Sencha Touch seems like a great idea, but I was totally not able to fall in love with it. It feels like I’m writing JSON code, lots and lots of configuration. And really difficult to figure out why things do not work. The official tutorials are buggy and miss key pieces of information that are required to get the samples to work.
So I will be keeping with maintaining three separate code versions for Hotelplanner: IOS, Android, and the Web App. We are using Sencha Ext for the real-time downloading of hotel offers. To do the entire search before presenting a web page takes over 10 seconds! Ouch. With Sencha, we can start downloading immediately, and replace existing entries in the DOM with better offers since we check about half a dozen sites for these offers. Owen is working on doing the same for the mobile web version with Sencha Touch. I will happily leave the Sencha code in his talented hands.
I just finished reading Brain Rules by John Medina. This is a very well written and fun to read book full of things we know about the brain, primarily from psychological studies. What affects our ability to learn and memorize things? What happens to our brains when we sleep? How the brain processes vision and smell. Fascinating stuff that is written in a style that evokes the wonder that it deserves!
Unlike “How to Create a Brain,” which I love but mainly appeals to computer scientists. And unlike “Connectome,” which would appeal to anyone who loves science. I think “Brain Rules” would be fun to read for just about anybody. But then my brain is wired completely differently from yours, so what do I know?
IBM just made a movie by moving atoms around. Seriously. Atoms.
A Boy and his Atom
I have been using png gradient background image for my buttons. But these images don’t scale well and the corners always look off. So today I changed them all to custom buttons using the QuartzCore framework.
The code below creates a blue gradient button with rounded corners that can be any size.
First, create a new objective-c class and make it a subclass of UIButton. Here is my .h file:
#import < uikit /UIKit.h >
#import < quartzcore /QuartzCore.h >
@interface CustomButton : UIButton
And here is my .m code:
@interface CustomButton ()
@property (strong,nonatomic) CAGradientLayer *backgroundLayer, *highlightBackgroundLayer;
@property (strong,nonatomic) CALayer *innerGlow;
- (id)initWithCoder:(NSCoder *)coder
self = [super initWithCoder:coder];
_highlightBackgroundLayer.hidden = YES;
CALayer *layer = self.layer;
layer.cornerRadius = 10.0f;
self.clipsToBounds = YES;
layer.borderWidth = 1;
layer.borderColor = [UIColor colorWithRed:48.0f/255.0f green:107.0f/255.0f blue:189.0f/255.0f alpha:1.0f].CGColor;
NSArray *colors = (@[(id)[UIColor colorWithRed:129.0f/255.0f green:165.0f/255.0f blue:215.0f/255.0f alpha:1.0f].CGColor,
(id)[UIColor colorWithRed:48.0f/255.0f green:107.0f/255.0f blue:189.0f/255.0f alpha:1.0f].CGColor ]);
NSArray *colors = (@[(id)[UIColor colorWithRed:90.0/255.0f green:137.0f/255.0f blue:203.0f/255.0f alpha:1.0f].CGColor,
(id)[UIColor colorWithRed:30.0/255.0f green:48.0f/255.0f blue:69.0f/255.0f alpha:1.0f].CGColor ]);
_backgroundLayer = [CAGradientLayer layer];
_backgroundLayer.colors = colors;
_backgroundLayer.locations = (@[ @0.0f, @1.0f ]);
[self.layer insertSublayer:_backgroundLayer atIndex:0];
_highlightBackgroundLayer = [CAGradientLayer layer];
_highlightBackgroundLayer.colors = colors;
_highlightBackgroundLayer.locations = (@[ @0.0f, @1.0f ]);
[self.layer insertSublayer:_highlightBackgroundLayer atIndex:0];
_innerGlow = [CALayer layer];
_innerGlow.borderWidth = 1;
_innerGlow.borderColor = [[UIColor whiteColor] CGColor];
_innerGlow.opacity = 0.5;
[self.layer insertSublayer:_innerGlow atIndex:2];
// Set inner glow frame (1pt inset)
_innerGlow.frame = CGRectInset(self.bounds, 1, 1);
// Set gradient frame (fill the whole button))
_backgroundLayer.frame = self.bounds;
// Set inverted gradient frame
_highlightBackgroundLayer.frame = self.bounds;
// Disable implicit animations
// Hide/show inverted gradient
_highlightBackgroundLayer.hidden = !highlighted;
_backgroundLayer.hidden = highlighted;
+ (CustomButton *)buttonWithType:(UIButtonType)type
return [super buttonWithType:UIButtonTypeCustom];
Then all you have to do is create a button in Interface Builder like you normally would, and change its class to CustomButton (third tab in the utilities panel). Voila! Pretty gradient buttons. Obviously, you can change all kinds of things in this code snippet to make the button look how you wish.
More pages are going live every day! John and Owen are doing a bunch of responsive design and asynchronous performance boosts, but I get to do all the mobile design! Check these out! Should work on iPhone and Android…
http://www.hotelplanner.com (use the first search button… most others go to full site)
If you have posted a comment, I apologize for not responding to it or approving it. I have gotten 2500+ comments this last month, the vast majority of which are spam. I guess my next task is to figure out how to block these. I would really enjoy having interaction with what I am sure will soon be my enormous fan base!
Editing this post to say that I have activated a plug-in called Akismet, and did a bulk removal of my “pending approval” comments. So lets see how effective this Akismet plug-in is. I’ll keep you posted.
My second app just went live today! This one is a children’s app so I’m selling it and not using ads at all. It’s using a lot of core animation and sound effects to interact with the little ones.
Puppy Dogs and Santa Claus and Peanut Butter Sandwiches
An auspicious start to the new year for me. My first personal app was released to the itunes app store this morning! It’s called Rhythm ID and is designed to help recognize middle-eastern bellydance rhythms.
Rhythm ID for Middle-Eastern Bellydance Rhythms
This first version has a quiz to test and reinforce your identification skills, and a list to play the rhythm and show you what the musical notation is that goes along with it. It also lets you add your own rhythms by recording them on the phone.
My next update will enable uploading your rhythms so that everyone can download them, and let users vote the rhythms up and down. And some better graphics, especially on the iPad. Eventually, once there’s a good sized database, I have big plans for this app.
Today Rhythm ID, tomorrow the world!
I finally submitted my first app, Rhythm ID, to the app store for approval. The sound problem turned out to be unrelated to sessions after all. It turns out I could hear them fine with earphones, but 75% of them were garbled without headphones, only on the iphone device. On the ipad and the simulator, all files played fine with or without earphones. After pulling my hair out for weeks trying to find the issue, I finally just got the sound files from a different source and they play fine now. It is disturbing that I was never able to determine the problem. But a work-around is better than nothing. And today, I am excited to finally have reached an important milestone in my app development career.
I have finally figured out how to configure ColdFusion Builder 2 to use the remote development server. I had been using HomeSite, which is what the founder of my company uses. But it is horribly slow for learning. Searches take forever. The files really stay remote. Plus it runs in Windows in Parallels which has annoying features. The beauty of CFBuilder is it mirrors the files so I can search and grep and study to my heart’s content without forgetting why I was searching before the results come back.
To add the server in CFBuilder, right click your project namem in the navigator, go to synchronize -> create new synchronize connection –> enter all your info. You do not have to install the extensions… that’s for extending CFBuilder itself. Then, right-click, go to synchronize –> synchronize to show a list of the differences in the files on the server and the files on your computer. Initially, this will be all of them, and you can synch them now. I chose the upload on save option when creating the connection, or else you’d do the same thing to upload a file, except instead of choosing synchronize–> synchronize, you choose synchronize–>upload, and your selected file or folder will get uploaded to the server. I’m glad I got this figured out because there are lots of advantages to mirroring and CFBuilder seems to have an active community, while HomeSite was discontinued.