Pages

Sunday, November 3, 2013

How to install Windows 8.1 on mid-2009 Macbook pro

How to install Windows on Macs?

The simplest answer is - use "Bootcamp"

Well if its so simple then... Why this tutorial?

Because as it stands today, the latest version (5.0.5033) of Bootcamp does not support mid-2009 macbooks, which in my opinion is a shame esp. when you see a lot of machines in the market with much lower specs are running Win8. And as I soon found out, I was not the only one looking to get this done and found this amazing link on Apple support communities page: How to install Windows 8 on Mid 09 Macbook Pro (10.8.3). A big thanks to 'projectRelentless' and others on this thread, your comments were extremely helpful!

So let me lay down my machine specs and will then go through the to-do's and not to-do's for installation process.
I'm running Mountain Lion 10.8.5 on a mid-2009 13" macbook pro. core2duo, 2.26GHz, 160GB HDD, 4GB RAM with NVIDIA 9400M

And I installed Windows8.1 64bit edition - partitioned OSX using USB installer, but installation needs a DVD - USB install will not work if you are planning to install using bootcamp support. You DO NOT need Windows7. The process should apply for Windows 8, if you have a compelling reason to install that, though I'd say 8.1 is better, esp. the windows/start icon is back :D

Note: having a USB mouse during installation could be handy. Else you'll have to click / select either using your keyboard or by pressing your trackpad at bottom left because tap-to-click won't work.

And here are the steps!

Once again, they are largely derived from the discussion I linked above and I'm going to refer mainly the changes

  1. Firstly, unlike the main instruction... you do not require a Windows7 DVD. So relax if you don't have one! But then, how do you partition the disk? (I think you can use Win8 DVD, but since I was initially trying to use USB install mode, I did not check it)
    The trick is to fool bootcamp to believe that the current device can burn a USB. How?
    • Go to Applications->Utilities, Right click on Bootcamp and select "Show Package Content"
    • Open Info.plist using Xcode, TextEdit or from terminal using vi, etc. You may be required to add yourself to users with edit permission.
    • Find the line which says - USBBootSupportedModels and add your model to the list of supported models by adding the line: <string>MacbookPro5,5</string>
      • Alternately, in some machines you may find the following key <key>Win7OnlyModels</key> . In this case, delete the line <string>MacbookPro5,5</string> which you'll find somewhere below this.  
      • Note: replace the value with your model number.
    • The next time you launch Bootcamp Assitant, you'll see an option to burn USB disk. Do this and then partition your disk. Give Windows (takes about 15-20GB) at least 40GB esp. if you are planning to install Visual Studio (10GB+) after that.
  2. Once you are done partitioning, your system will restart and boot using the USB (if you have left it plugged in). And here is the catch
    • With USB installer, you'll be able to start the installation process. Provide the key, etc. etc. but will get stuck on the screen for choosing partition.
    • You'll read in the linked discussion about "cannot install to the partition" error and the workaround of formatting the partition to use NTFS, etc. But...
      • With USB install this won't budge. You'll not be able to move any bit forward from here. Why? Apparently, the USB installer only supports Windows 8.1 or for that matter Win8 in EFI mode something that will not go hand-in-hand with this bootcamp created partition.
      • So whats the alternative? the other option is to install in CSM mode. Google to read more about UEFI vs CSM / Legacy / BIOS boot
      • What does not having EFI cost to us? Nothing much except for a little longish booting time.
  3. And this is where you'll need your DVD (Win8 or Win8.1).
    • After bootcamp assistant is done partitioning, simply remove the USB and insert your DVD.
    • Go through the installation steps.
    • You'll again find the partition screen, which will show the same error (unless you have formatted the partition when you reached this screen with your USB installation).
    • This time formatting the partition will let you pass through.
    • Let Windows do its bits, restart a couple of time and so on.
    • Create your account and choose your settings when asked.
  4. Finally, you'll find yourself staring at the shiny new tiles of Win8.1. but with a few glitches. You'll still be missing the tap-to-click feature for trackpad as well as the function keys like volume, display brightness, etc.
  5. Download the bootcamp drivers. NOTE: you do not need to install the 4.xx drivers mentioned in the discussion I referred above.
    • Go to folder: Bootcamp->Drivers->Apple and run the Bootcamp.msi. It will throw an error and won't run. This is where you'll need the registry file from http://www.theprojectdev.com/public/pub.html specified the original post. Create your own or download from the link (I simply downloaded it) and install it.
    • Now right click on the "BootCamp.msi" and run it as Administrator and it will go through.
    • This will install the bootcamp drivers and support for your trackpad and function keys and a few other features. 
    • Finally your system will ask for a restart, do it!
  6. And you are done... Now pat your back to have successfully installed it and share your happiness plus these instructions with your friends.
Enjoy!

Wednesday, September 18, 2013

Crunched Bytes: July - August 2013

This is what I believe will be the last of the series for sharing on Twitter (@aniruddha_loya) seems more instant and timely.  Nevertheless, enjoy this big collection with some really good reads from Jesse Schell, F2P, Player's IPU, Pixar (breadcrumbs spread over the movies), A productivity secret from Harvard, the "Un"-Consoles / microconsoles and more...

The Shame Game: An Interview With Jesse Schell

An interview with Jesse Schell on using humiliation (-ve reinforcement) techniques used in games and how that affects the game play. Also there is some discussion on hard-core gamers frustration with F2P and how things might evolve with due course of time.

Mind Games: Offloading Cycles to the Player’s IPU (Imagination Processing Unit)

A very interesting article emphasising on using player's Imagination as an integral part of game design. And links to the related article below. Leaving certain things to be imagined, helps in creating the sense of immersion and the bond between the game and the player, which can play an important role in success or failure of the game as a whole.

The Simulation Dream

Related to the IPU article, this article also talks about the mental model of the players which is termed as "Player Model Principle" which states that the entire value of game is in the mental model.

Why do we play video games, when they cause us such pain? On Jesper Juul’s “The Art of Failure”

The author refers to Jesper Juul's book and draws attention to the paradox of failure in games, that "players dislike failing in games, but they dislike more not failing even more". 
However, what strikes out is the explanation provided why "gamification" fails in corporations, that failures are acceptable (even strived after) in games but not at the job.

Why Candy Crush Saga is so Engaging - An Audio Breakdown

If you haven't played this game, first go and play and then you'll understand why this game deserve an analysis for its Audio. I just love its background music and was interesting to read an analysis for the music elements of the game. 

Dopamine and games – Liking, learning, or wanting to play?

A very interesting article on the use and abuse of the reference to Dopamine in gaming context and some scientific insights to the facts (or what is known until now).

Designing local multiplayer games for microconsoles

A local multiplayer game has taken hold of parts of my imagination since I made one myself during the Global Game Jam in January 2013 (Check out our game Heart Racer). And the above article provides some interesting insights to this genre.

The Pixar Theory

Love Pixar Movies? Ever wondered if all these movies are inter-related or made with a common underlying theme?? 
No! Read this blog and you are going to find it interesting to the point of believing!
Yes! Still read it and enjoy!!!
The blog article a working narrative that ties all of the Pixar movies into one cohesive timeline with a main theme.

Today's game industry through the lens of human history

The Author maps the wold of video games and its inhabitants (players & developrs) with the human history and looking into human evolution, predicts how the scenario would shape in the world of video games.

Accessibility & the Folly of Exclusivism

A highly controversial topic in gaming world (as the author himself notes) but in my opinion a very valid point (suggestion). I'm in favour of an easy mode (or very easy or what author sometimes refer to as God mode) to help the beginners or casual players latch on with games. I do not understand how this affects the so-called "hard-core" gamers… on the contrary it may give rise to some new members for their community and more incentives for companies to continue working on those titles rather allocate more budget to casual games. EA recently announced their largest income source was from Apple's AppStore and in my view that doesn't bode well for the hard-core unless they have now turned into "casual hard-core" :D

Chasing the Whale: Examining the ethics of free-to-play games

An insight to lives of a few gamers, often termed as "Whales" for the amount they spend on F2P games. Lots of arguments and counter-arguments in the article as well as the following discussion.
My take: If gambling is legal and ethical, then so is the F2P model. Every one has a compulsive desire and addiction to one thing or the other and it is up to us to draw the line. If someone calls it wrong to design games to make money, then there are 2 questions: 1. How are these game companies going to survive, remember nothing comes "free" in this world. and 2. Aren't gambling machines/ games/ etc. designed the same way? What may be done is to raise awareness among people and may be some conscientious game makers putting a cap onto daily/monthly spending, just like how Steam blocked the account (though the reasons in the said example might be different).

And while we are at it, read this as well with another argument of why to hate F2P but also a potential way out to solve the shortcomings of method which is here to stay.

F2P Gaming - Removing the Stigma


Game Over: Parting thoughts from the Game Developer team

http://www.gamasutra.com/view/feature/194856/game_over_parting_thoughts_from_.php
A brief recap and an outlook for the future of consoles, Indies, mobiles, and Game Dev in general, GameDev teams write their last and fitting finale to a great journey of 19years.

5 Things to Ask Your Interviewer

Nice little blog with advice for interviews with 5 actual Qs that you can ask unlike just the suggestion to ask question given by many blogs/articles on interview tips!

The Five Basics of Being a Game Design Problem Solver

Listen, reason, think and master -- the key essentials for problem solving… not limited to Game Design.

Fewer Options, More Meaningful Choices

Though presented in the context of gameplay design, this applies to creativity in general. I have seen my GameLab professor demonstrate it in the class and then we, students, do it. And the same was experienced in the Global Game Jam 2013. Restricting the projects on a particular theme can give rise to interesting interpretations, ideas, gameplay and mechanics.

A Harvard Economist's Surprisingly Simple Productivity Secret

I have always been avoiding internet on my mobile, though it has some problems, but more benefits. I get some time to think over without constantly checking for emails and importantly, since am not connected I'm not required to answer any of them. And as Chip Cutter found out, its a sub-optimum use of time: "All those times that I thought I was using my time well-- … -- I was using my bandwidth badly"

The Android Microconsole Reference Guide for Game Developers

A list of current and upcoming micro consoles with an evaluation of their pros & cons.

Friday, July 12, 2013

Crunched Bytes: June 2013

And as always, here is the compilation of June reading. Not many given the exams and move to Zurich for internship!
 

How Pixar made Monsters University, its latest technological marvel

http://venturebeat.com/2013/04/24/the-making-of-pixars-latest-technological-marvel-monsters-university/

Well, for a animation fan like me… its always fascinating to read more about what goes behind the scenes and this article is just the kind of dose I like to have, full of details both from technical and creative point of views. #ILovePixarMovies

Practical examples for marrying theme and meaning

http://www.gamasutra.com/view/news/193342/Practical_examples_for_marrying_theme_and_meaning.php
This reprint of an old article is still every bit valid. Taking examples from real life means its not simply a message / advice in the darkness but ensures concrete understanding.

Google Zombie: The Glass Wearers of Tomorrow

The best metaphor for Google Glass? Not jerks or junkies, but the living dead.

http://www.bogost.com/writing/google_zombie_the_glass_wearer.shtml
I'm not a big fan of this upcoming tech from Google and to a large extent I'm really turned off with the prospect of always connected/always-online mode we now constantly live in. Despite being a computer science student, I still am very happy not to have a data-connection on my mobile and enjoy that disconnected moment of peace to catch up some reading or just to look around the world while I travel.
And the article says everything else that I missed out in the paragraph above ;)

The Guide to Implementing 2d Platformers

www.gamedev.net/page/resources/_/technical/game-programming/the-guide-to-implementing-2d-platformers-r2936
A very detailed and informative article on the old and friendly 2-d platformers we all loved and played at some point in time.

The tendencies of the mobile art on the example of top-grossing games

http://www.gamasutra.com/blogs/OlgaCherkashina/20130624/194889/The_tendencies_of_the_mobile_art_on_the_example_of_topgrossing_games.php
Read this to see how the interface, artwork and gameplay fares in taking the mobile games to top grossers. Also, see for the important differences when designing your game for the asian markets.

Bogost: Let's make 'earnest' games, not 'serious games'

http://www.gamasutra.com/view/news/194490/Bogost_Lets_make_earnest_games_not_serious_games.php
With all the hoopla around making serious games, Bogost takes a dig at the reality and the whole propaganda about them. And seriously, what is required is an "earnest" effort for 'ernest' games.
"The dirty truth about most of these serious games, the one that nobody wants to talk about in public, is they're not really that concerned about being games," Bogost adds. "This is mostly because games are hip, they make appealing peaks in your grant application, they offer new terrain, undiscovered country, they give us new reasons to pursue existing programs in order to keep them running."

Making games as a hobby with Locomalito

http://www.gamasutra.com/view/news/195022/Making_games_as_a_hobby_with_Locomalito.php
An interview with Locomalito about his work and creating arcade like free-to-play games as a hobby. Nice read!

Sunday, June 23, 2013

Crunched Bytes: May 2013

Alright, so here is a compilation of interesting articles read for the month of May

Starting this month's reading is with the big question - "Why are you making games?" followed by a look at the problem affecting the Game Reviews and much more!

Why Are You Making Games?

http://gamasutra.com/blogs/BenServiss/20130425/191183/Why_Are_You_Making_Games.php
A very thought provoking article forcing the reader (read game developers) to re-evaluate why they are actually making games?? What's the motivation?

“Surely there is some reason you are going through all the trouble of trying to design great games.” –Jesse Schell, The Art of Game Design

So have you figured out your reason yet?? May be this article is just meant for you!

The Problem with Game Reviews (And Why Games Are Like Restaurants)

http://www.gamasutra.com/blogs/BenServiss/20130502/191616/The_Problem_with_Game_Reviews_And_Why_Games_Are_Like_Restaurants.php
Author Ben Serviss indicates how we have simply copied the rating systems from a linear comparable domain of movies and mapped it to use for rating the interactive and immersive experience of games, and why such a system is incomplete and broken.

Cognitive Overhead, Or Why Your Product Isn’t As Simple As You Think

http://techcrunch.com/2013/04/20/cognitive-overhead/
Does any of these sounds familiar -
  • Make your product simpler, 
  • Minimize the number of steps, 
  • minimize time required, 
  • minimize the features, etc. etc.
David Lieb, co-founder and CEO of Bump has something different to say... Making simple is all about reducing the cognitive overhead and this may even mean adding an additional step i.e. make users do more rather less!!!

Google Introduces Portable Native Client, Makes It Easier For Developers To Add C And C++ Code To Their Web Apps

http://techcrunch.com/2013/05/17/google-introduces-portable-native-client-makes-it-easier-for-developers-to-add-c-and-c-code-to-their-web-apps
After Mozilla's asm.js now we have PNaCl… its soon going to be c/c++ on web as well… way to go!

Ten classic games you can actually beat, but probably won’t

http://arstechnica.com/gaming/2013/04/ten-classic-games-that-are-surprisingly-technically-beatable/
A fun read on games that you weren't supposed to win and what happens if you win

Anatomy of a hack: How crackers ransack passwords like “qeadzcwrsfxv1331”

http://arstechnica.com/security/2013/05/how-crackers-make-minced-meat-out-of-your-passwords/
With hackers decoding upto 90% of leaked passwords (in the form of md5 hashes) within
a day… are your passwords really secure?

Why you should move that button 3px to the left

https://medium.com/adventures-in-consumer-technology/c012e5ad32f7
How to bring together design and engineering. As an engineer, its a nice read into a designer's mind.

Designing Game Logos

http://gamasutra.com/blogs/SimonDean/20130425/191184/Designing_Game_Logos.php
A quick writeup based on the experience of designing their game logo. Few good tips to keep in mind though

Euler vs Verlet

http://kahrstrom.com/gamephysics/2011/08/03/euler-vs-verlet/
A small primer to help you decide how to integrate the laws of motion in your game/simulation. If you have ever wondered how to model the movement (velocity, distance, etc.) of your scene objects and wrote a code to model the Laws of motion, this article will help you name the method you used or better, provide you with a better alternative.

Friday, May 17, 2013

Crunched Bytes: April 2013

I love reading, novels, stories, articles...
There are many articles I read, few I find interesting and retweet, and this gave an inspiration to make a monthly compilation of these article with a short summary. As my professor from "How People Learn" would say, repetition is one strategy for effective learning and summarizing your learning is another... so this is a mix of both :).

This new monthly post series will be the compilation of these interesting articles. Most of them will be technology oriented but some can be general blogs or viewpoints as well!

So here goes my first collection drawn from April 2013 readings. Enjoy! 
(*Ordering of articles is not arbitrary)

How Pixar Used Moore’s Law to Predict the Future

http://www.wired.com/opinion/2013/04/how-pixar-used-moores-law-to-predict-the-future/
A very very interesting article from Alvy Ray Smith, co-Founder Pixar, reflecting on why Moore's Law exists and how it brought about the creation of Pixar and all those lovely movies along with it!!! And importantly the belief that "the law" still has life to live and imagine what all it can do…
"Moore’s Law reflects the top rate at which humans can innovate. If we could proceed faster, we would."
"That’s the reason for expressing Moore’s Law in orders of magnitude rather than factors of 10. The latter form is merely arithmetic, but the former implies an intellectual challenge. We use “order of magnitude” to imply a change so great that it requires new thought processes, new conceptualizations: It’s not simply more, it’s different."

Pixar's Senior Scientist explains how math makes the movies and games we love

http://www.theverge.com/2013/3/7/4074956/pixar-senior-scientist-derose-explains-how-math-makes-movies-games
A look into what goes behind those beautiful curly hairs or those cheering crowd in the car race - the mathematics and the chief person behind it.

There are no smartphones

http://bergie.iki.fi/blog/no-smartphones/
An article that puts into words, something that has been there in the back of my mind for some time now, especially after moving to Switzerland. I've been hardly using my mobile (smart)phone. Come to think of it, even back in India, the most used aspect of that device was to read novels (yes on a small 3 inch screen) while I travelled or to play games... and lately, I've been thinking to get a regular old-style Nokia (I still love those sturdy keypad devices) and rather buy a tablet for these purposes, a view recently pushed further by another professor of mine who is doing the same :)

The technique LucasArts used to design its classic adventure games

 http://www.gamasutra.com/view/news/189266/The_technique_LucasArts_used_to_design_its_classic_adventure_games.php
Using puzzle dependency chart for narrative-driven games.
Provide alternate paths for players to avoid getting stuck. Work it backwards from end to start (a matter of choice but does look easier to do). Makes it simpler to identify too easy and too hard, and align story with gameplay.
All this and more...

A Plain English Guide to JavaScript Prototypes

 http://sporto.github.io/blog/2013/02/22/a-plain-english-guide-to-javascript-prototypes/
Confused about __proto__ and prototype in JavaScript? This article explains it well along with some background on inheritance and object model in JavaScript

Design Tips When Porting Mobile to Console

 http://gamasutra.com/blogs/NathanFouts/20130405/189905/Design_Tips_When_Porting_Mobile_to_Console.php
Planning to port your android games from mobile to upcoming OUYA console, here are some tips that are worth keeping in mind while porting!

INFOGRAPHIC: How Interviewers Know When to Hire You in 90 Seconds

http://theundercoverrecruiter.com/infographic-how-interviewers-know-when-hire-you-90-seconds/
Some quantification of the aspects you might generally know about, or do you??
E.g. 33% of bosses know within the first 90 seconds of an interview whether they will hire someone, The number one most common mistake at a job interview is: failing to ask for the job and much more

I follow the tech industry news, thanks to Twitter @Techcrunch, @GamesBeat, @IGN and many more, plus a few email subscriptions.

Wednesday, April 3, 2013

Box2D & Javascript: Part 3

In part 2: I covered a basic setup for box2d based simulations and in this long promised final installment  of the tutorial series, I will cover the integration with KineticJS library. The most important aspect of this part is how to use a framework like KineticJS and use their features for image rendering and manipulation in physics based simulations without having to write your own physics engine for it.



Press 'd' to toggle debugDraw mode
Box2d Demo - by Aniruddha Loya

Now let's break up the code and see how it works

Sunday, November 11, 2012

Box2D & Javascript: Part 2

In part 1: I covered what Box2d is along with some of its application and a number of links to possible box2d resource. Now in this blog, I'm going to demonstrate a basic setup for box2d based simulations and the next one will cover the integration with KineticJS library.



Press 'd' to toggle debugDraw mode
Box2d Demo - by Aniruddha Loya

This example was adapted from the Box2dWeb example.

Now let's break up the code and see how it works

Saturday, October 6, 2012

Box2D & Javascript

After a long break which saw me completing my semester, developing a number of HTML5 mobile games (including the one in which I'm using Box2D), planning for a new website to host all of them and finally selecting courses for the new semester, I finally manage to take out time to write this series of posts on Box2D and its use in HTML5 games along with KineticJS.

This post is an introduction to Box2D (for those who do not know) and the next in the series would cover details on how to build a game using Box2D and combining it with KineticJS library.

So what is Box2D?

Box2D started as an open source C++ library, a 2-d physics engine to be precise, to simulate 2-dimensional rigid bodies. More details can be looked up on their website. It has been used in many applications and games, and have been ported to be used in various other platforms. I came to know about it with the success of Rovio's Angry Birds franchise. Box2DFlash, the flash port of the library has been extensively used and there has been multiple ports for javascript of which the following 3 appears to be the major ones - box2d-js,  box2dweb, box2d.js.

Box2d-js was converted from Box2DFlashAS3_1.4.3.1 in an automatic manner and is very old and not up-to-date. It requires a big amount of imports to get it to work and I couldn't find much support/ samples for this.

Box2d.js is a Javascript version of Box2DFlash 2.1a and Heiko Behrens, who maintains the git repository, has mentioned that this has become a part of cocos2d-javascript. There are a number of samples available in the git repository, and here is a link to one of the useful tutorials I found using this library.

Box2dweb is also a port from Box2DFlash 2.1a generated using a ActionScript - to - Javascript compiler. Its is available as one single file and is promoted by Seth Ladd on his blog along with many examples. Here is a compilation of the posts.

Box2D Resources:

  • Box2D V2.2.0 Manual - Gives details about the various objects, parameters, functions in Box2D, and their uses.
  • Box2DFlash documentation - More of an API and works well with box2dweb as the later being a direct conversion from the actively maintained flash port.

In the coming posts, I'll talk about how to use box2dweb in HTML5 games in conjunction with KineticJS library.
Box2D & Javascript : Part 2

Tuesday, May 15, 2012

Google: Annoying and not so annoying recent changes

The new "Social" search!

Google has long become a synonym for search... "Google it!" is something we often say and do a number of times every day/hour. And I've been doing the same for last 8 years and was able to find useful result with ease. But recently something went wrong, terribly wrong... there was no relevant result on Google even while looking to as much as "Page 3"... I'm convinced that in normal use, no one ever has to go beyond "Page 1" and I believe what I was searching was a normal query (tried all sorts of permutations and combinations of keywords and their synonyms). A normal question on php related stuff... but all I got was frustation with results displaying how to do those things in Android or Javascript or dont know what. The question then arise is why it was showing such results?

Well, the answer to that is trivial. Because, for last couple of months I have been doing search for results related to Android and Javascript while I was working on couple of projects. And now even when I'm searching with keyword "php"... results shows up Android and Javascript fixes... all thanks to tracking my search history and intelligent guessing made on my queries.

Secondly, if you are frequently selecting a couple of sites from search results the next time you search, these sites get higher preference even though they may not have relevant information for the search you made. What was the problem with the plain old search that provided the results irrespective of my interaction but depending upon the content? Why so much emphasis on making everything social? And if the same site (for example Stack Overflow) has more than one relevant result, why not show them at the first place rather than a small hyperlink saying "Get more discussion results"?

And call it a coincidence, I just happened to find this article (Introducing the New Bing: Spend Less Time Searching, More Time Doing) via codeproject newsletter which made me seriously think considering a change to Bing! (at least they are keeping social separate from normal search).

Location specific customization... grrr....

Another annoying thing happening lately is Google tracking my location and changing my default from Google.com to Google.ch even after I made Google.com as default search engine in Chrome (yes, a Google product). Even my Blog preview is in German (I suppose) though my blog interface where I'm composing this is in English. Com'on Google, if I'm in Switzerland does not mean I can read German or French. So why change to something else from what I had been using for so-so long? Why?

The missing simplicity of old Google interfaces!

Change some Settings:

A couple of days back, the time-zone settings for my GMail changed by itself and then I had to "Google It" to find how to restore it. The simple interface of Google that made me like it so much (over Yahoo & Hotmail) is getting cluttered day-by-day. For simple setting like timezone for my email, I had to do about 10 clicks on 4 or 5 different screens (for the actual process, ignoring the wrong ones I made).

New GMail Interface:

Anyone with comments on new GMail interface? Sorry to say, the old one was much better without requiring me to scroll separately in each sub frames or do a tradeoff between seeing more options for mail (labels) or making my chat list longer.

New Blogger Interface:

I tried the new blogger interface and within minutes was back to the older version... and praying that it stays longer and am not forced to change to new one!

But not all is BAD... There are a couple of welcome changes/ updates

Google Play!

Finally, better late than never! Now its much easier to browse and choose apps for effortless installation not only for my Android, but more importantly for my father's android sitting miles away from him  (all I need is to log-in through his account). Just loved it! Not to say, a fairly neat and intuitive interface as well.
Do I expect Chrome store to merge with this, well it sounds like a possibility to me!

Google +

Well I would simply say Google has got this one way better compared to the new timeline interface on Facebook (where again I'm sticking with the old profile page and hoping they dont force me to change anytime soon, scare about people getting access to all the old posts with one click unless I spend some hours choosing what to keep public and what private and hate those ugly name labels on friends' display pics).
Sadly, Google+ is not catching up... people not willing to migrate from Facebook or are simply too tired to make yet another social network profile or have made it (like myself) but do not actively maintain it like the old Orkut profile.

Thursday, March 1, 2012

HTML5: How to ensure images are loaded before rendering them

Okay, so I have been busy developing HTML5 games for a company so cannot share it here... but what I can share is a small trick that helps to make sure that my images are loaded before I go about rendering them

Why and where do you need it?
Well, "why" is just to put things in context but "where you need it is more important".
It is a good idea to ensure the images are uploaded before rendering them because unless you have scoped all your code with a try catch block, it is difficult to find where the error is, esp. when you have tens of images being displayed and only a couple of them missing.

Although the technique is useful for all the browsers, its requirement is more pronounced in the case of mobile browsers which are the primary targets if your are building mobile games that run across the platforms with same code base.

And finally, the main thing - "HOW"
The basic idea is this:
  • Make a list of all the images you want to upload
  • Create image objects for all the images listed above
  • Add "onLoad" event listener to each one of them such that the listener calls the same function, lets call it onImgLoad
  • Now comes our onImgLoad function which will be fired every time an image gets loaded enough that it can be rendered or at least that when trying to render the image all the basic image data will be available so that no error is thrown.
    • Every time this function is called we increment a variable i.e. imgLoaded by 1
    • If the imgLoaded becomes equal to total number of images to be loaded i.e. imgToLoad, we can now safely draw them.
Here is the code snippet where I'm loading 10 images 1.png to 10.png from images folder

var imgLoaded = 0;
var imgToLoad = 10;
var onImgLoad = function()
{
   imgLoaded++;
   if(imgLoaded == imgToLoad)
   {
      drawImage()             //Call to our draw function
   }
}
 
for(var i = 0; i < 10; i++)
{
  images[i] = new Image();
  images[i].onload = onImgLoad;
  images[i].src = 'images/'+i+'.png';
}

Also a key point to note here is that
 images[i].onload = onImgLoad;
is assigned before providing the image source.

This is done as a hack for IE (That's something I read in some post while I was hunting to solve this problem of mine)

Saturday, November 5, 2011

Zip/Unzip using Windows Shell

Okay, so here I was suppose to write a module for compressing / decompressing files in windows. I went through a lot of stuff over the net and found some open source libraries to do it. Out of those I narrowed down to the one provided by Info-Zip. Although no longer actively maintained, this is in existence for a long time and is known to be stable. This is used in various forms in a number of programs including Mac OS X.

However, on Windows there is another way to zip files free of cost. I found this article - Easily zip / unzip files using Windows Shell32 on which provides a neat way to use windows routines to zip and unzip files programmatically. The code provided is in VB but since my requirement was in c++, I wrote a small c++ module which is shared here. I found the discussion and code snippets provided here to be very useful.

Zip
To compress and zip files first we need to create the required zip file. The code below creates “test.zip” in "C:"

Code Snippet
------------------------------------------------------------------------------------------------------------------------
// Create Zip file
BYTE startBuffer[] = {80, 75, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
FILE *f = fopen("C:\\test.zip", "wb");
fwrite(startBuffer,sizeof(startBuffer),1,f);
fclose(f);
------------------------------------------------------------------------------------------------------------------------

Now that our zip file is created, lets add the files to be compressed inside this zip.
For this we use the CopyHere function wherein we treat our newly created zip file as a folder.

Code Snippet
------------------------------------------------------------------------------------------------------------------------
BSTR source = L"C:\\test.txt\0\0";
BSTR dest = L"C:\\test.zip\\\0\0";

HRESULT hResult;
IShellDispatch *pISD;
Folder *pToFolder = NULL;
VARIANT vDir, vFile, vOpt;

CoInitialize(NULL);

hResult = CoCreateInstance(CLSID_Shell, NULL, CLSCTX_INPROC_SERVER, IID_IShellDispatch, (void **)&pISD);

if (SUCCEEDED(hResult))
{

VariantInit(&vDir);
vDir.vt = VT_BSTR;
vDir.bstrVal = dest;
// Destination is our zip file
hResult = pISD->NameSpace(vDir, &pToFolder);
if (SUCCEEDED(hResult))
{
// Now copy source file(s) to the zip
VariantInit(&vFile);
vFile.vt = VT_BSTR;
vFile.bstrVal = source;
// ****NOTE**** To copy multiple files into the zip, need to create a FolderItems object (see unzip implementation below for more details)
VariantInit(&vOpt);
vOpt.vt = VT_I4;
vOpt.lVal = FOF_NO_UI;//Do not display a progress dialog box, not useful in compression

// Copying and compressing the source files to our zip

hResult = pToFolder->CopyHere(vFile, vOpt);
// CopyHere() creates a separate thread to copy files and it may happen that the main thread exits before the copy thread is initialized. So we put the main thread to sleep for a second to give time for the copy thread to start.
Sleep(1000);
pToFolder->Release();
}
pISD->Release();
}
CoUninitialize();
------------------------------------------------------------------------------------------------------------------------

Unzip is similar to zip except that we now have zip (treated as source folder) and destination which anyways is a folder. The code below currently assumes that there already exist the destination folder, however adding a code to check for a folder or create a new folder on the fly should not be difficult.
The minor change (compared to above code) in unzip comes only in identifying the source files. Here we use the folderItems, which is essentially a list of all files/folders inside the given folder, instead of a single source file.

Code Snippet
------------------------------------------------------------------------------------------------------------------------
if (SUCCEEDED(hResult))
{

Folder *pFromFolder = NULL;


VariantInit(&vFile);
vFile.vt = VT_BSTR;
vFile.bstrVal = source;


pISD->NameSpace(vFile, &pFromFolder);
FolderItems *fi = NULL;
pFromFolder->Items(&fi);


VariantInit(&vOpt);
vOpt.vt = VT_I4;
vOpt.lVal = FOF_NO_UI; // Do not display a progress dialog box

// Creating a new Variant with pointer to FolderItems to be copied

VARIANT newV;
VariantInit(&newV);
newV.vt = VT_DISPATCH;
newV.pdispVal = fi;


hResult = pToFolder->CopyHere(newV, vOpt);
Sleep(1000);
pFromFolder->Release();
pToFolder->Release();
}
------------------------------------------------------------------------------------------------------------------------

Complete project (in VS2010) is available here via CodeProject.

Saturday, August 20, 2011

Configure apache localhost to use secure HTTP (HTTPS) using mod_ssl

For all those who want to test their website on localhost using the secure HTTP protocol, here is how you can configure apache for testing purpose. I did this on Mac OSX 10.6 using apache 2.2

Guidelines provided at apple are for older version. We'll use them to generate the certificate and then configure apache for newer version.

> mkdir ~/keys
> cd ~/keys
> openssl genrsa -des3 -out server.key 1024
Remember the passphrase you provide here. It will be required in next steps.

> openssl req -new -key server.key -out server.csr
Answers to all questions are straight-forward, except for Common Name: you need to provide 127.0.0.1 (i.e. server name)

> openssl genrsa -des3 -out ca.key 1024
For simplicity, keep the passphrase same as used above

> openssl req -new -x509 -days 365 -key ca.key -out ca.crt
This again asks same Questions as in step 4, but this time for Common Name you can provide any dummy name

Find sign.sh file if you have mod_ssl package downloaded, or else retrieve it from pkg.contrib folder from latest version of package. Copy the sign.sh to "keys" folder and make it executable

>chmod +x sign.sh
>./sign.sh server.csr

Say yes ("y") to the 2 questions

>sudo mkdir /etc/apache2/ssl.key
>sudo cp -r * /etc/apache2/ssl.key/

>cd /etc/apache2/ssl.key/
>sudo cp server.key server.key.original

>sudo openssl rsa -in server.key.original -out server.key

>sudo apachectl stop

>sudo vim /etc/apache2/httpd.conf

* You may want to make a backup before editing this

- Locate and comment out Port directive to listening on 80
*Note - Commenting this line will force to use only https, leave it as is if you want to use both.

- Locate and uncomment the LoadModule ssl_module libexec/apache2/mod_ssl.so

- sudo vim /etc/apache2/extra/httpd-ssl.conf
* Again make a backup before editing

- Change ServerName from www.example.com to 127.0.0.1
- Provide your email id for ServerAdmin

- Under SSLCertification, provide path to our own ssl certificate i.e. SSLCertificateFile "/private/etc/apache2/ssl.key/server.crt"

- Also, set ServerKey with: SSLCertificateKeyFile "/private/etc/apache2/ssl.key/server.key"
- You may also set the other paths as per requirement

> sudo httpd -D SSL
> sudo apachectl start

And you now have https://127.0.0.1 running

Monday, July 25, 2011

HTML5 Games 101 - An introductory tutorial to HTML5 Games

In my last blog, I had posted the game of Snake that I developed as my first attempt in HTML5 programming and all I can say is... it was fun!

In this tutorial, I will show you how to use the basic features of HTML5 and get the simple game of Snake up and ready within a couple of hours, even if you are a beginner. All you require is some basic logic and any experience with programming is a huge plus. However, I must also admit here that this is more of a JavaScript work than HTML5, as it just uses the canvas and a couple more elements.

Okay, so lets begin!

Saturday, July 16, 2011

Snake: A beginner's attempt on HTML5 Games


HTML5 is the new buzz in the web technologies. The technology is in its infancy but with its variety of new features, it has captured everyone's attention with interesting applications and experiments across the globe. To list some check out the - interactive presentation by Seth Ladd @ Google IO 2011, use of WebGL to present geographic data or a cool way to show news, experiments like The Wilderness Downtown,  and Games like Angry Birds and those from Gopherwood Studios on Chrome web store. HTML5 is supported by all the new browsers including those on smartphones, and therefore, it has become a hot platform to develop games which developers can serve directly to the consumers bypassing the App stores. HTML5 is also expected to have enormous potential in online advertisement market (click for more details)

I decided to take a dig into this and thanks to some wonderful tutorials at html5rocks, html5games, tutsplus, links on Seth's presentation, and many more resources available, my first attempt is now on display.

I plan to put my experience in a tutorial (HTML5 Games 101) very soon. Meanwhile, share your comments and feel free to use the code and kindly acknowledge the source.

Score: 0      Level: 1


HTML5 Games 101 - by Aniruddha Loya

Sunday, July 10, 2011

Google+: Limited Invites - Actual constraints or A Marketing Gimmick?

Google+: Google's yet another attempt to socialize the users. Launched ever so silently in end of June, 2011... Google+ has caught the attention of both - techies as well as non-techies alike.

Google has previously used the limited invites strategy for its mail service to a great effect but will it work this time? All of us can speculate and only time shall provide the answer!

Here is my first take on Google+
+ves

  1. The BUZZ - Creating excitement and curiosity among people is important for the success of a product or service. It provides with the initial user base who are generally the early adapters and more often than not are also the trend setters. Thereafter, it is the usefulness of the offering which becomes important. Google has managed to create a BUZZ around its latest offering. Despite a silent launch, well placed demo, technology blogs and limited invites has done the trick to generate curiosity among the huge base social networkers (facebookers, orkuters, and others). But how long will it limit users in its trial launch?
  2. (Facebook & Twitter)+ - Google+ combines the major feature of Twitter (aka following people) and Facebook (broadcast updates) in one single platform which is a natural extension but how crucial it is for the users remains to be seen. It is worth mentioning that both the features i.e. following people and broadcasting updates were initially launched with not so successful Google Buzz. However, I did like the feature of being able to control who can follow you.
  3. The Google Power - "Powered by Google" in my opinion counts as a major factor. The simplicity of GMail was something that inspired me to move on it and still use it as my primary id and so was the case with Orkut. This was precisely the reason for not liking Facebook initially, but it has come a long way since then in terms of its user interface and offering, it has moved from just being a platform to pass time on the crazy apps and quizzes to a platform for sharing almost everything. The huge GMail userbase provides with captive clients.

-ves

  1. Limited Invites may hurt - YES! I mentioned limited invites as a good strategy in creating the BUZZ but here we are talking about a social network and people form the essence of it. The larger the user base bigger the network, so why the limited invites?
  2. Now your friends can further share your picasa albums - Till now I used picasa for sharing pics with selected people but Google+ force you to link your picasa albums with your profile enabling your connections to further share it... some users may not like it!
  3. Circle, Spark, Huddles, Hangouts, etc. Are they really very different from existing options? Can the existing players not provide such features? Doesn't feel so! Facebook has already started video chat and you can group your friends under various lists, create groups and do a group chat, plan a group event, etc. etc.
  4. Effect on your GMail account - How does creating and customizing your Google+ profile affects your GMail contacts remains to be seen. When my HTC Hero running on Android synced all my GMail contacts and mixed with my existing phone contacts from my previous Nokia phones, I wasn't particularly happy and I'm still using phone with hidden GMail contacts as it makes difficult to search the contacts with phone numbers among a list of email contacts.

Having said all this, I should also state that I haven't used Google+ till now and like many others waiting eagerly to try it out. Will post another update from a user perspective after playing around with it.