Category: Uncategorized

Play a short sound in your iPhone application the RIGHT WAY

There are LOTS of answers to this question out there on the internet, many of them old and no longer applicable.  LOTS of them use CF instead of NS libraries and many of them are LEAKY!  So after some research, and some help from the guys at #iphonedev (Thanks august, millenomi, sgtblue52) I think I finally landed on the right way to do it.

Note 1:  Works for AIF or WAV files, make sure they are properly added to your project.

Note 2:  Retain the SystemSoundID as an instance if you plan on using it multiple times

Note 3: In my example, I added the file “bell.wav” to my project (and made sure it added it to the folder as well)

SystemSoundID bell;
AudioServicesCreateSystemSoundID((CFURLRef)[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"bell" ofType:@"wav"]], &bell);
AudioServicesPlaySystemSound (bell);
  • Share/Bookmark

Fix a string in PHP for use in Unix Filenames

Language: PHP

Problem: You are trying to use a string as or in a UNIX filename (for instance, passing a filename to a command within the exec() function) and addslashes() falls short because it doesn’t include spaces or ampersands.
Solution: It’s rough but it works fine.  Run your strings through this function first, and don’t use surrounding quotation marks (no need).  If you’ve got a better one or have questions, leave a comment :)

function makeUnixFilename($string)
 {
 return str_replace("&",'\&',str_replace(" ",'\ ',addslashes($string)));
 }
 
  • Share/Bookmark

Gamers Assistant 1.1 awaiting review

Version 1.0 application blues got you down? Well cry no more, because here comes Gamers Assistant v1.1!

Changes!

* You can now change the label of the modules in the main menu
* Set counter to number function added so that you can instantly and variably change the count on any counter to any keyboard entered number
* You can now change the label of the modules in the main menu
* Change display name to GA (Gamers Assistant)
* Dice roll now icon prettified with top glare
* More responsive
* If you use the wand to place the roll dice function onto the main menu that button will now roll all dice instead of just the module you took it from.
* BUG SQUASHED: Should not be able to delete the settings module
* BUG SQUASHED: Add module should not be a placable function using the wand tool
* BUG SQUASHED: Add Counter function – no icon

And now with new shiny icon!

Coming soon to an App Store near you!

  • Share/Bookmark

WordPress Themes