Integrating Cocos2d V1 and Storyboards

May 30th, 2012

I have read quite a few tutorials on integrating Cocos2d and UIKit, unfortunately when you rotated the  iPhone they would not display correctly.  I needed to have portrait UIKit views for settings and  landscape Cocos2d views for the “game”. While trying to figure out how to fix this issue I ended up finding my own solution.  You can read about it here.

CCPickerView

May 22nd, 2012
CCpickerView Screenshot

CCpickerView

I have had a few weeks of being able to work on my Math Explosion App, which is in serious need of an update. It was the first app that wrote way back in 2009 and has not been updated since then.  I always keep expecting it to break when Apple releases a new version of iOS.  I am doing more than an update, I am doing a complete rewrite. The original app was written using UIKit and Core Animation but I have felt for a very long time that the app needs to be more gamey to get the kids more interested in playing. As a result I am doing a complete rewrite using Cocos2d. I have dabbled with Cocos2d in the past but have never been able to spend much time using it until now. One of the first things I missed from UIKit was the UIPickerView. I also noticed quite a few other people out there also looking for a UIPickerView equivalent but with no success. In the end I wrote my own CCPickerView with the desire to make it as similar as UIPickerView, but for Cocos2d.  If you know how to use UIPickerView you will have no problem finding your way around setting up CCPickerView.

I want to mention some of the differences.  Firstly CCPickerView does not create a picker like UIPickerView. It simply creates the components, you have to supply your own “overlay”. I did this deliberately for two reasons. Firstly it was way simpler for me to code and secondly I figured everyone would want to have their own picker image that matched their app.  The CCPickerView can be as big or as small as you like, which is not true for UIPickerView unless you incorporate some tricks.

I also added some extras like continuous components.  With UIPickerView you add your rows, but if you want the last row to appear to be next to the first row as if the component has been rotated through 360 degrees you had to do the extra coding yourself.  I also needed the components to spin.  This was a bit tricky for me as I wanted something that was flexible as I could see many possible uses.  As a result you can configure settings like the speed of the spin, how many times the components spin and if the components ease in and out when starting and stopping.  You also get to control the stop row.  How else are you going to have a winner.

You can find the code on GitHub  https://github.com/fidgetware/CCPickerView

 

360iDev 2011

November 6th, 2011

This is a late post on 360 iDev, which was held September 11-14. Once again it was a great conference and a highlight for me this year especially as I missed out on WWDC. I have always thought that 360iDev is better value for money than WWDC. You will meet many excellent developers from around the world and as it is a smaller event you will get a chance to meet them.

The sessions were great. I started on Sunday with Photoshop for devs. This was an excellent session by Mike Berg. I find very often that I want to manipulate an image, something that seems relatively simple, but do not know how to go about it. Mike lead us through various techniques on how to create awesome graphics. (Ok awesome graphics for a developer)

While I can always learn more on the coding front I always look out for the sessions on business and UI design to round out my skills. Being an independent iOS developer I need to be able to do all aspects, soups to nuts to run my business. I went to two informative business sessions. The first one was by Kyle Richter who focused on the people side of getting clients and keeping them happy. The second session was by Andria Jensen who did an excellent job of explaining the in and outs of running a contracting business, all very useful information.

My favorite session had to be from Mike Lee who lives in Appsterdam. (Amsterdam Netherlands) Mike is a larger than life developer who came dressed as a Mariachi Cowboy, along with margaritas and a Mariachi band. Mike took us through the technology steps of man kind all the way to shipping a product. This was a laugh a minute presentation.

I still have hopes of creating a game with cocos2d so Ray and Rod’s intro to cocos2d was another motivator to get going on learning cocos2d. They made it look so easy to create a workable game.

A big part of 360iDev is meeting other developers and there was ample opportunity to do that at the parties scheduled in the evening by the sponsors. So if you have been sitting in the fence I hope I have persuaded you to attend next year.

You can find more information on the 360iDev website http://360iDev.com

Twelve South Compass

March 5th, 2011

I have had my iPad precariously balanced against books on my cluttered desk ever since I bought it. This arrangement sort of worked but was never satisfactory. The iPad would often slide off the book it was balanced against, so I finally decided to buy a stand. I had a few requirements for a stand that would work for me. It needed to be small, due to the lack of space on my cluttered desk. It also had to work with an iPad cover on. I was not going to be taking the cover off and on just to use the stand. I searched amazon.com as I have a prime membership and two day shipping is free. I ended up settling on the Twelve South Compass, which looks just like the compass you use to draw a circle. I was concerned that the stand would “fold” or tip over when tapped, but based off the other user reviews I decided to purchase it.
The Twelve South Compass came in a nice looking box that Twelve South suggests you reuse. I could have reused the box if it had had a lid. The stand also came with a snug fitting black carry bag. The stand is well made out of solid metal that is covered in a silver powder coat that will match your iPad and other Apple devices. Some parts, like the feet are covered in rubber to stop the stand from slipping or scratching. The Twelve South Compass stand has two positions, one for display and one for typing. Open the three compass legs and flip open two small levers for the upright position. The iPad can fit on the stand in both the portrait and landscape positions. The stand felt solid and it was no problem tapping the screen without feeling that the stand would fall over. The extra bonus that I had not thought of, was the fact that I could attach the 30 pin cable to the iPad while it was on the stand. I find that I use the iPad even more now as I have been able to position it better for my needs. For the typing position you close the back leg and open a smaller leg that is embedded in the main third leg. This gives you a slightly angled position that is great for typing. the stand is small enough to take with you when you take your iPad. It is not the cheapest stand out there. But then, if you have an iPad you are what we shall call a discerning buyer who will pay a premium for good quality. The Twelve South Compass stand can be purchased for $39.99 at amazon.com or apple.com

A Great Backup Solution

January 11th, 2011

I have always loved TimeMachine ever since I bought an external hard drive. The interface is pretty cool. One day however, I could not recover a file from Time Machine. For some reason it had decided that there were no recent backup copies. After a bit of frantic nail chewing and a reboot TimeMachine found all it’s backup versions. But it did get me thinking that a single backup solution was not enough. After a few days research I decided to try CrashPlan as it looked like a perfect fit for my needs, where I have multiple computers and multiple OS’s (Mac, Linux and Windows). What initially drew me to CrashPlan was the ability to backup to different locations. CrashPlan is very flexible in this regard, you can backup to multiple external drives, backup to another computer you own, in addition you can backup to a friends computer or to CrashPlan’s cloud service. All of these services are free except for the cloud service.

The setup was extremely easy and the default setting for each OS seemed to be perfect for the average user. CrashPlan by default will only backup your home directory. Within no time CrashPlan was backing up my laptop as well as the other computers in my house. The interface allows me to easy see the backup state of all the computers. Some of the computers are dual boot, so I installed CrashPlan for both operating systems. Once installed CrashPlan will run automatically once per day. You can choose to get reports on the backup status of the computers or you can choose to get alerts for when a computer is not being backed up. CrashPlan simply runs in the background and you can configure how much CPU or network resources it can use. I do not notice it running at all.

As my laptop is for work I bought CrashPlan+, which does realtime backups and also now allows for data sets. Having all my backups under one roof did not give me a sense of security. I was thinking of the worst case scenario where I lose my home office and my backups. While the cloud service looks great I did not like the time that it takes to retrieve all your data assuming you had a catastrophic event that resulted in the loss of all local data. (CrashPlan will ship a disk to you, but takes a few days) As a result I persuaded a friend who lives 30 minutes away to get CrashPlan with the idea that we will be remote backup sites for each other. This way if I were to lose all my data locally I will still have a backup just 30 minutes away. The remote setup is straight forward, but I decided to seed a drive with my backup before attaching it to her laptop. As her laptop runs Windows and as I run a Mac I had to attach the external drive to a Windows machine in order to keep the NTFS file system on the external drive. I added the drive as a new backup destination and initiated the backup. By the next morning I had a new backup ready to be located remotely. At the remote site I helped my friend sign up for a CrashPlan account and had her invite me. When I attached the external hard drive to her computer I had to enter my CrashPlan user name and password and it immediately became available as a backup destination for my laptop. Within a few minutes it had competed a scan to compare my laptop to the new backup destination. I also added her as a person that could backup to my system. She had about 15GB of data and it took about 5 days for her data to be completely backed up to my system. I now have a secure remote backup solution. All the data encrypted as it is sent over the Internet and the remote backup is also encrypted for my account only. I did a few tests to confirm that backups were running to the remote destination and recovered a few files to confirm the backup.

I have been very please with CrashPlan. Since I started using the backup application they have had an update which was installed automatically. CrashPlan has now added a long awaited feature, data sets. The data sets option is only available in CrashPlan+. You can now have different sets of files that can get backed up to different locations at different time intervals. I find this very useful as I do not feel that I need to get a realtime backup of my files remotely. This saves on the amount of data that is sent over the Internet and some people have capped data plans.

I was even more impressed with CrashPlan when I offered to a do rebuild of my friends computer. Her laptop had been bought 6 years earlier and had had no maintenance . In addition she had many old applications cluttering the PC that she no longer used. I brought the laptop home and did a new install of the OS and then installed CrashPlan with her username and password. CrashPlan immediately recognized my laptop as a backup set and I was able to restore her files. I did tweak the data limits in CrashPlan to be unlimited while doing this to make the restore process faster. Once the laptop was rebuilt the final step was to start the backup process again. Here we were allowed to assume the name of another computer, which is really useful when doing a rebuild and you want to pickup where you left off with the backup process. This way CrashPlan only had to sync the differences between the old backup and the files I had restored. As all the files were already in the backup set this step went quickly. I returned her laptop, plugged in her external drive and my remote backups picked up where they had left off.

My only complaint I have with CrashPlan is the interface for recovering files and I have a feeling that it is a Mac only issue. When you try to recover a Mac application like any other file you are presented with a small drop down arrow which then shows you the different versions based off date that you can recover. Being an application it will most likely only have a single date. If you choose to recover the file by checking the checkbox next to the date the application will not be recovered correctly. I have a feeling that is due the fact on the Mac Applications are really special directories. If choose the application itself by checking the checkbox next to the application name it will be recovered correctly. The more I think of this it must be a bug. Any other file is recovered as expected. An alternative way to restore files is to choose a date by clicking a link below the file selector.

CrashPlan is great and is free for no commercial use. You can also get a 30 day trial of CrashPlan+ after which is simply reverts back to a regular CrashPlan install. You can find more details on their website.

Goodbye GoDaddy

January 6th, 2011

I have been with GoDaddy for a number of years. It all started with the need to buy SSL certificates. You cannot beat their prices, (at least a few years ago you could not). Their interface was terrible but I put up with it for a bargain. Never mind the fact that they would make it so hard to make changes between all the ads. Plus things they did not want you change like auto renew are hidden deep down. Auto renew is great, but I had used my personal credit card to buy a business SSL certificate so I did not want this feature. I ended up buying my own personal domain through GoDaddy and finally purchased a hosting plan for fidgetware. I was never happy with the management interface and config changes that should have gone quickly always took a long time. GoDaddy shows the same data on multiple pages but somehow the key data is on another page. What finally prompted me to move was the poor performance of this blog. It was taking 20-30 seconds to serve up a WordPress page. The static pages were fast. GoDaddy tech support said there were no issues and suggested I install Super Cache, which I finally did with no performance improvement. A few days later performance improved miraculously back to the performance when I started with them. Recently though the performance slowed down again. I could put up with the horrible interface but I need website that is accessible.

Switching was not too hard thanks to the ubiquitous of WordPress and MySQL. I did a data dump of MySQL and copied it to my local machine and copied the wp-content directory locally too.

Signing up with NetworkSolutions was a breeze and I transfered my domains over. While that was happening I setup WordPress and using the PhPAdmin interface did a restore of the exported file from GoDaddy. Finally I copied up the content for the website. Everything is now working about 97% I have few more images to sort out as I changed the location of WordPress.

I had signed up with GoDaddy all the way through to 2012 but have chosen to go month to month with NetworkSolutions just incase performance degrades.

On a closing note Kudos to GoDaddy, I did complain on twitter and they tracked me down and gave me a call. I have moved on, but maybe they heard my complaints.

Play Pandora From Your iPhone Through Remote Speakers

December 15th, 2010

I love listening to Pandora but don’t like the way Pandora sucks up the CPU on my laptop especially when I am using Google Chrome. I often use my iPhone to listen even when sitting at my desk, but I also don’t always want to use my headphones. A dock is nice but then I cannot use my iPhone. I want it all! Lucky for me and you there is a simple and relatively inexpensive solution. Buy an AirPort Express for $99. An AirPort Express is a device sold by Apple for playing iTunes through a remote stereo and some other neat features like setting up a remote printer or to extend your wifi network. The setup is pretty easy if you choose the right options. You have to install the AirPort Utility software to connect to the AirPort Express in order to configure it. The software found the AirPort Express without any problem and I answered the questions to extend my wifi. I figured why not extend the wifi, it could help boost the signal in other parts of the house. Unfortunately after the reboot the AirPort Express it did not restart and the AirPort Utility software could not detect it. I tried a reset of the AirPort Express and that did not work. The instructions say to press the reset button for 1 second, but later on on I figured out it was more like 30 seconds to do a reset. I am not sure if a reboot of my laptop was required or if the AirPort Express just took a long time to sort itself out with the bad settings. But the utility software does make temporary changes the AirPort on your laptop to get things going. A reboot of my laptop and the AirPort Express was discoverable again. A second attempt also failed and I was convinced I had a dud device. On the third attempt I decided to do a manual setup to see diagnostic information. When I selected the “extend the wifi network” option it said that my router was not compatible. This was the main issue and why the express setup did not work. It should have given an error during the express setup and told me do a manual install. I did do a manual install and chose “join the network” instead . The manual install does require a few more steps, but soon enough the AirPort Express had a nice green glowing led which indicated all was well. (After the working manual install I did reset the AirPort Express to the default settings and ran the express setup and chose the “join a network” option and had no problems setting the device up in under 5 minutes.) The next step was to test from my laptop. I fired up iTunes and selected the remote speaker. The AirPlay icon for the remote speakers is on the bottom right of the iTunes status bar. Sweet music!

The final test was playing Pandora from the iPhone. You do need to have iOS 4.2.1 for AirPlay from your iPhone or iPad for this to work. Start Pandora and once again on the bottom right of the interface is the same AirPlay icon. Select the remote speaker and away you go. I can now play Pandora through the remote speaker and still have my iPhone in my hand. As an added bonus you can also control the volume from your iPhone.

To play Pandora from your Mac or Windows machine you will need to buy some more software from Rogue Amoeba called AirFoil $25. AirFoil will allow you to play any sounds from you laptop onto the remote speaker. Another option is buy PandoraJam $15 which is a small interface for playing Pandora but also allows you to direct the music through the remote speakers.

When using AirPlay from your laptop you can choose multiple speakers, so you could have multiple devices throughout your home and play music through all of them simultaneously. Unfortunately from iOS devices you can only play through a single device at a time. Maybe this will change later.

Been busy!!

November 10th, 2010

I find it hard to believe that so much time has gone by since my last post. All I can say is that I have been BUSY!!! In the intervening months I have been on many projects and even flew to Boston for one project that will finish at the end of the year. I really enjoyed my Boston trip, and wish that I had had more time to explore the city. But I did manage to eat out at some fine old establishments and had some great food. One reason for no updates, is because I ran out disk space and had to drop a new drive into my MacBook. As a result I only re-installed my development software. But I am back in action and ready to do more updates, with useful information for developers.

More Interface Builder Woes

September 14th, 2010

Sometimes I find when I am using Interface Builder the view I want to edit disappears.  You open the xib file click on the view you want to modify and nothing happens.  I have tried multiple clicking, clicking really HARD but I always get the same result. The view will not appear.  The issue appears most often when using a second screen, the view you want edit is on the second monitor, but you are semi unplugged at a coffee shop.

The easiest way to fix this is to click (gently) on the view you want to appear.  Now hit Cmd W to close the window.  Now click (normally) on the view and it will magically appear on your screen.

This has happened to me pretty often so I thought I would share the solution.

Flash a Flashlight

July 15th, 2010

One of the things I noticed with the iPhone 4 was that the flash could be turned on like a “torch” when you were shooting a video.  I immediately thought of using it like a flashlight.  But being busy, and thinking that all the flashlight apps would be updated to use this new feature I initially left.  A few days later I decided that I may as well try my hand at a flashlight app seeing as there were none in the iTunes store.  A short big of coding later, I had a basic version working.  I was not 100% happy with it as you could see the “camera” aperture image open.  But it worked.  I wanted to get iAds built in as it is pretty easy to do that, but did not have time and want to be one of the first apps available to use the flash.  I submitted the app and the following day the first led flashlight app appeared.  7 days later my app was approved along with about 10 other flashlight apps.  I had some traction on day one, and six reviews, so I was quite happy.  Unfortunately on day two the app basically disappeared from review and was now with all the other flashlight apps.  There are few flashlight apps that are now in the top 25 of utility apps that get all the attention and so now will be downloaded more, and hence will get more attention.

I have still not managed to figure out that magic formula to get an app noticed.  I decided to go ahead anyway and build in the iAds as planned and submitted the update to Apple.  I changed the icon too, hope that will make it more noticeable.

You can download the “Flash a Flashlight” app here.