Posterous theme by Cory Watilo

Australian Baby Colours

Baby-colours-icon-134

Click here to view Australian Baby Colours on the App Store

 

Teach your child the colours of the rainbow, with an Australian accent! 

  • No ads, never will be - i believe ads don't belong on kids games! 
  • No button to accidentally take your child to a developers website 
  • Settings button automatically hides after 5 seconds, so your child won't tap it accidentally 
  • Settings to mute the voice, use solid colours or coloured wallpapers, and to auto-hide the settings button.

Screenshots:

(download)

Attributions:

 

Megacomet with 1 million queued messages

TL;DR: Comet server with 1 million queued messages, uses ~5% cpu at 1000msgs/sec and 65m RAM, on the smallest EC2 instance.

I've just started the testing of Megacomet on a 64-bit Amazon EC2 micro instance. My first test is to get it running, and see how it goes when queuing up messages (mainly this is because I haven't yet written a test harness to pull the messages off the queue!). I'm very pleased with the results, so here's the summary:

  • Setup: 1 manager process, 8 worker processes. 64-bit Amazon linux.
  • 1 million messages queued, at 1000 messages per second (!)
  • CPU usage was tiny. Maybe 5%? And most of that was the test harness, which would in a real situation be on a different server from your comet server. Also, keep in mind this is the smallest EC2 server you can get.
  • Total memory usage was: 65m
  • Each worker averaged 8m

I'm really happy with that, both from the perspective of memory usage, and CPU usage. Keep in mind i plan to implement expiry of messages in the queue, so that in reality you'd never get a queue that large, but it's good to know that it'll queue up 1m messages without breaking a sweat.

You can find the code at: https://github.com/chrishulbert/megacomet

Here's the 'top' capture whilst running, to give you an idea of CPU usage. The 'ruby' process was the test harness:

 

top - 08:11:29 up 1 day,  2:15,  3 users,  load average: 0.00, 0.01, 0.05
Tasks:  70 total,   2 running,  68 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.7%us,  2.5%sy,  0.0%ni, 96.1%id,  0.0%wa,  0.0%hi,  0.2%si,  0.5%st
Mem:    611212k total,   603348k used,     7864k free,    23904k buffers
Swap:        0k total,        0k used,        0k free,   433696k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND           
30333 ec2-user  20   0 28028 2736 1424 R  4.7  0.4   0:02.51 ruby               
30202 ec2-user  20   0  8668  340  264 S  3.7  0.1   0:47.10 megamanager        
30219 ec2-user  20   0 34132  25m  484 S  1.0  4.2   0:09.63 megacomet          
30223 ec2-user  20   0 17104 9040  480 S  0.7  1.5   0:03.33 megacomet          
30213 ec2-user  20   0 17104 9044  480 S  0.3  1.5   0:03.39 megacomet          
30217 ec2-user  20   0 17104 9044  480 S  0.3  1.5   0:03.30 megacomet

 

And here's the top capture at the end of the 1 million queued messages, to show the memory usage:

 

top - 06:28:46 up 1 day, 33 min,  3 users,  load average: 0.01, 0.02, 0.05
Tasks:  69 total,   1 running,  68 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.0%us,  0.2%sy,  0.0%ni, 99.8%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:    611212k total,   600784k used,    10428k free,    23840k buffers
Swap:        0k total,        0k used,        0k free,   436568k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND           
30219 ec2-user  20   0 32548  23m  484 S  0.0  4.0   0:09.03 megacomet          
  942 root      39  19  324m  14m 1688 S  0.0  2.5   0:00.00 yum-updatesd       
30213 ec2-user  20   0 16576 8516  480 S  0.0  1.4   0:03.18 megacomet          
30217 ec2-user  20   0 16576 8516  480 S  0.0  1.4   0:03.09 megacomet          
30225 ec2-user  20   0 16576 8516  480 S  0.0  1.4   0:03.07 megacomet          
30227 ec2-user  20   0 16576 8516  480 S  0.0  1.4   0:03.16 megacomet          
30223 ec2-user  20   0 16576 8512  480 S  0.0  1.4   0:03.11 megacomet

 

Painted the inside of the boat

I've just painted the inside of the boat black, so that it won't stand out so much and contrast against the dark stain of the hull. Also last night i installed the rudder and strut, but no photos of that.

(download)

Fuzzy iphone graphics when using an UIImageView set to UIViewContentModeCenter

Say you've got a 15px image, inside a 20px imageview, with contentmode set to UIViewContentModeCenter. Well, you'd expect it to be centered at 1:1 (eg no scaling). But it appears fuzzy, because its origin won't be at a rounded pixel boundary, it'll be at a fraction. If you look at the maths it makes sense:

  • The image is 15px, centered inside a 20px view
  • The image will be drawn at: 20/2 - 15/2 = 2.5px
Hence it'll be fuzzy, because the offset is at a 1/2 pixel boundary, and images (in ios) are drawn using subpixel precision in much the same was as fonts are. So the solution is to make it centered inside a 21px (or 19px) view:
  • The image is 15px, centered inside a 21px view
  • The image will be drawn at: 21/2 - 15/2 = 3px, hence will be drawn sharply.
Other reasons for fuzzy graphics can be seen here:

My 3 Data and Calls Usage

3usageicon

My 3 Data and Calls Usage makes it easier for you to keep tabs on your 3 post-paid iPhone plan usage. This app will save you money from unexpectedly going over your calls or data usage. To do this, it queries the My 3 website and summarises the information for you in one quick and easy to read page.

(download)

You can get this information already if you have a My 3 login, however it is time consuming as you have to log in every time, and click around to several pages to find the information you want. With this app, the process is simplified to the point that you are much more likely to keep a regular eye on your usage - after all, your up-to-date usage will only be one quick tap of the 'refresh' button away.

This app is a thick client which communicates with the My 3 website only. Your information will never be sent to us! Your pin and password details are stored securely in your iPhone's keychain, and are only transmitted to the My 3 website via encrypted SSL, for your safety.

To use this app, you will need a My 3 account, and the details as per the second screen shot. The returned information is:

  • Refreshed: This is when the app last queried 3's servers.
  • Effective date: This is the time the data is accurate as of.
  • Final date: This is the last day of your billing cycle.
  • Calls usage: The dollar amount of calls you have made
  • Calls quota: Entered by you, this is your cap call quota.
  • Data usage: The megabytes of data you have used
  • Data quota: Entered by you, this is your data quota in MB.

To configure your details, tap the 'i' icon at the bottom right of the screen.

Please be aware that 3's servers are not always available, and if they are down then this app will not work. When that happens, please try the My 3 website before emailing me to report an issue. This app is only as accurate and up-to-date as the data it receives from the My 3 website, and as such I cannot be held responsible for the accuracy of data. This app is only a means of convenience, if you need accurate information you need to talk to 3 directly, DO NOT critically rely on it.

If you notice this app seems to be inaccurate, please get in touch and I'll do my best to fix it in the next version.

Chris

 

Trim whitespaces on all text fields in a view controller

Often, after the user has edited a bunch of text fields, just before saving i want to trim the whitespace, because its all too common for the user to leave a space at the start or end of a 'username' or other important field.

So here's a chunk of code, put it in your view controller, and it'll trim all your text fields. Its worth looking at just to see how verbose the obj-c equivalent of .Trim() is!