Thursday, March 17, 2011

iOS Linebreak Fun

Learned something the hard way today.  You'd think that the order in which properties are set shouldn't matter even in weirdo Objective-C land, but things are different over there.

The following will wrap long button text, but limit it to two lines.

button.titleLabel.lineBreakMode = UILineBreakModeWordWrap;
button.titleLabel.numberOfLines = 2;

The following will wrap long button text all over your image and outside the bounds of your button.  You'll be scratching your head for a while wondering why the numberOfLines property doesn't have any effect.

button.
titleLabel.numberOfLines = 2;
button.titleLabel.lineBreakMode = UILineBreakModeWordWrap;



Monday, February 28, 2011

Shop Stats open for business!

Shop Stats is out of closed beta and now ready for open signups!

After I made a couple of paid Android apps available on Market, I quickly found out how painful it is to keep track of my sales through Google Checkout.  I was spending more time refreshing and counting than coding.  Thus, Shop Stats was born.

With this web service, you can:

  • leave the overview page open and it'll auto-refresh with the latest numbers throughout the day
  • see your sales broken out by state in case your state makes you pay sales tax for digital goods
  • sanity check your numbers when you fill out your tax forms
  • see the effect of app update timing
  • lots more coming...

Saturday, November 6, 2010

Adding a single static file

To add a single static file to your App Engine application, let's say your robots.txt file, add the following to the handlers section of your app.yaml:


- url: /robots.txt
  static_files: static/robots.txt
  upload: static/robots.txt

This assumes your robots.txt file lives in the directory static and that you want to access it from http:///robots.txt

My first try after looking at the docs missed the upload parameter.  Totally zoomed in on static_files and figured I was good to go.

Mac helpers

Some Mac-related things that have helped with the day-to-day:

  • UTC clock widget - detailed instructions here.  UTC is way easier to work with as a base for date/time normalization, but it's a pain to constantly have to convert in your head (especially if you travel).  Modifying the World Clock widget was simple.  Remember to look in /Library not /Library and make a backup just in case...
  • iTunes control - you control: tunes.  I use all of my Spaces and with this free utility I get iTunes music control no matter which Space I'm in (adds controls to your menu bar).

Tuesday, November 2, 2010

Google App Engine and Cron

  1. Stagger your cron tasks such that they don't resonate
  2. Limit cron time limits to 2 digits
Looking at the requests/second graph on my GAE dashboard recently, I noticed a pattern of medium peaks at one frequency and a pattern of large peaks at about half that frequency.  These were the result of the way I had set up my cron tasks.

Self-inflicted usage spikes have to be avoided when you need to live within per minute quotas.  Because of a natural inclination towards time anchors like whole and half hours, multiple cron tasks were often starting up at the same time even though they all had different intervals.  The large spikes were from when they would all start up at the same time.  Oops.

Changed the intervals to ones that didn't overlap so frequently and ran in the the error below: 

Error parsing yaml file:
Unable to assign value 'every 157 minutes' to attribute 'schedule':
schedule 'every 157 minutes' failed to parse: line 1:8 mismatched input u'7' expecting set None

Turns out that 'every n ...' is ok and 'every nn ...' is ok, but 'every nnn ...' is not.