Posterous theme by Cory Watilo

Hacker News Reader

I'm creating this app as a learning exercise for me, and to 'scratch my own itch' so to speak - to have a nice simple way to read HN from my iphone while pushing my daughter on the swing: Available in the app store

Hn134

Available in the app store here

I also intended from the start open-sourcing this so that people can have a look and learn with a nontrivial demo app. The more people that know obj-c/UIKit, the merrier! https://github.com/chrishulbert/HackerNewsReader

Shot
Attributions:

* Icons by app-bits: http://app-bits.com/free-icons.html

* FMDB sqlite wrapper: https://github.com/ccgus/fmdb

* ConciseKit: https://github.com/petejkim/ConciseKit

* ASIHttp: https://github.com/pokeb/asi-http-request

 

How to programmatically resize elements for landscape vs portrait in your iphone interface

In a view controller, it's a bit harder to programmatically resize your UI elements, so that eg in landscape things are radically rearranged, and anything that can't be handled by the normal anchoring configurations.

If you subclass your view, it's easy: simply put the code in your 'layoutSubviews' method. But usually you don't have that, rather you've got your view controller class. Well the answer is to make a single method that does your resizing, and call it from three places, to ensure that it always gets called, otherwise you'll get strange edge cases where it doesn't get called. So put code like the following in your view controller:

MegaComet testing part 2

I've been busy testing megacomet on an EC2 micro instance. Keep in mind this testing is pretty crummy, given the instance only has 600M memory and i'm running the fake-client-flooding app on the same box as the server. Anyway, i was able to get up to 50k connections open before things started getting slow. I'm not sure if i hit a configuration limit, or a memory limit, or what. Testing continues...

Anyway, here's the 'top' results, showing that 50k connections roughly means 16M memory usage:

 

top - 08:52:17 up 58 min,  2 users,  load average: 0.13, 0.16, 0.22
Tasks:  68 total,   1 running,  67 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:    611212k total,   581608k used,    29604k free,     3760k buffers
Swap:        0k total,        0k used,        0k free,    25356k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND          
22542 root      20   0 10392 2020  116 S  0.0  0.3   0:01.47 megacomet         
22548 root      20   0 10400 2016  116 S  0.0  0.3   0:01.48 megacomet         
22544 root      20   0 10452 2004  108 S  0.0  0.3   0:01.49 megacomet         
22546 root      20   0 10392 1968  108 S  0.0  0.3   0:01.49 megacomet         
22543 root      20   0 10388 1908   60 S  0.0  0.3   0:01.48 megacomet         
22549 root      20   0 10396 1860   20 S  0.0  0.3   0:01.47 megacomet         
22545 root      20   0 10396 1840    0 S  0.0  0.3   0:01.47 megacomet         
22547 root      20   0 10392 1840    0 S  0.0  0.3   0:01.50 megacomet

 

And here's where i got the kernel tuning tips from:

http://www.metabrew.com/article/a-million-user-comet-application-with-mochiwe...

http://www.cs.wisc.edu/condor/condorg/linux_scalability.html