GhostWire Studios - Flash/Flex UI Components Development And Consulting Services
Quality User Interface Controls For Flash Application DevelopmentAspireUI Components

Archive for August, 2010

Aug 28 2010

On Permutations, Probabilities and Psychology

Published by under Others

Shuffling an array of items is a common topic in programming, especially as an academic exercise. In my previous post, I wrote about a different approach towards cards shuffling in programming – which is to not do it. Instead, you can randomly select and remove an item from the array whenever you need to retrieve an item. As far as distribution of probabilities goes, there is no difference between the two methods.

The seemingly controversial topic received some interesting comments. Due to certain fallacies introduced by a commenter, I thought I should clarify those points for the benefit of any reader who might become confused after reading his comments. My reply got a little too long, so I am posting it here.

Continue Reading »

One response so far

Aug 21 2010

[Game Programming] Consider A Different Approach To Cards Shuffling

Published by under Flash,Flash AS3,Tips

Very commonly, computer programs (usually games) that have the need to simulate a shuffling of a deck of cards (or drawing a tile from a bag, etc.) will go the obvious way of putting the items in an array, and then randomize the order of the elements of the array. A common algorithm for doing that is the Fisher–Yates shuffle (you can find a suitable implementation easily by googling).

The purpose of this post, however, is not to discuss “how” to shuffle arrays. Rather, I would like to bring up the question of “why” (do it) in the first place.

Continue Reading »

13 responses so far

Aug 19 2010

FlashDevelop: Getting trace() Statements To Show In Output Panel

Published by under Flash,Flash AS3,Tips

This is quite an obscure, little known, hidden-by-default feature, but the FlashDevelop IDE actually has a built-in Flash tracer. The plug-in is unfortunately not enabled by default, and new users of FlashDevelop often get frustrated wondering where to look for the output of their trace statements.

To get the tracer to work:

1) Go to Tools -> Program Settings (F10).

2) In the Plugins list on the left of the dialog box, look for FlashLogViewer and click on it.

3) On the right panel, look for the “Start Tracking” property, click on the drop down box and select “OnBuildComplete” (it is set to “Manually” by default).

The output of your trace statements are now shown in the Output Panel after you build your project.

2 responses so far

Aug 04 2010

Mac OSX Keeps Restarting On Its Own?

Published by under Others

Ever since I first started using Mac OSX, I have been haunted by this strange behavior. On Windows, if I leave the machine to take a much needed break, or to take a phone call, go for a run, take a shower, etc. I can return to the machine later, with my work-in-progress intact, safe and sound. Or downloads in Firefox completed. Or whatever tasks that were left running, either still running or completed.

On the Mac, I have lost much work and time due to the Mac OSX intrusively restarting on its own. Drafts not saved? Say farewell – lost forever. Downloads disrupted – start over (unless resume miraculously works). This is especially exasperating, considering that Apple requires you to update the iPhone SDK/Xcode by re-downloading the whole package. Not patching, but re-downloading a 2GB+ file.

So, why exactly is the Mac restarting on its own, even when it is not idle such as having a download-in-progress?

Turns out that this is due to a rather useless Security feature. Ridiculously, the “Log out after 30 minutes of inactivity” setting is the culprit. So, to save yourself some agony, make sure you turn it off:

If your Mac has been suffering from this problem, hope the above helps!

Seriously, I have no idea what purpose this Security feature serves, other than to make you lose progress in your work. By comparison, on Windows, if the OS logs you out due to inactivity, it actually restores your session with your work-in-progress intact the next time you log in. You can even safely switch between user accounts on Windows, and log back into an account with its last session intact.

P/S: As far as security goes, you should just check the “Require password” option.

2 responses so far