Monday, July 11, 2011
node.js links
Here are a few of the links I have found in doing a preliminary investigating of node.js
Thursday, May 19, 2011
UIImage and UIColor
I just got asked a question about setting the background of a UISearchBar to an image. Something like this:
When using an image as a repeating pattern, for a background on a view, for instance, check out
+ (UIColor *)colorWithPatternImage:(UIImage *)image
The resulting UIColor is similar to a graphics engine or Photoshop brush loaded with an image.
For the UISearchBar, we found that setting the tint color property to our image brush did not cause the desired effect. So we painted a normal view and slipped it in just above the default view. Here's a snippet of the code. I'll leave it to you to make your own Xcode project, build the NIB and use your own image. I grabbed an outrageous polka dot image from Google image search.
tintyViewController.h
fixed it to not use colorWithPatternImage, profiled it again and got this result(956.82KB). Sure enough, he's right.
Here's the fixed code:tintyViewController.m (try two)

When using an image as a repeating pattern, for a background on a view, for instance, check out
+ (UIColor *)colorWithPatternImage:(UIImage *)image
The resulting UIColor is similar to a graphics engine or Photoshop brush loaded with an image.
For the UISearchBar, we found that setting the tint color property to our image brush did not cause the desired effect. So we painted a normal view and slipped it in just above the default view. Here's a snippet of the code. I'll leave it to you to make your own Xcode project, build the NIB and use your own image. I grabbed an outrageous polka dot image from Google image search.
tintyViewController.h
@interface tintyViewController : UIViewControllertintyViewController.m
@property (nonatomic, retain) IBOutlet UISearchBar *searchBar;
@end
#import "tintyViewController.h">@implementation tintyViewControllerUPDATE: According to this guy using colorWithPatternImage is dangerous. I profiled the sample in Instruments, got this result (1.65MB):
@synthesize searchBar;
#pragma mark -
#pragma mark NSObject
- (void)dealloc {
[searchBar release];
[super dealloc];
}
#pragma UIViewController
- (void)viewDidLoad {
UIImage *image = [UIImage imageNamed:@"Polka_dots"];
UIColor *col = [UIColor colorWithPatternImage:image];
[searchBar setTintColor:[UIColor purpleColor]];
UIView *searchBack = (UIView *)[searchBar.subviews objectAtIndex:0];
CGRect backFrame = searchBack.frame;
UIView *newBack = [[UIView alloc] initWithFrame:backFrame];
[newBack setBackgroundColor:col];
[searchBar insertSubview:newBack aboveSubview:searchBack];
[newBack release];
}
@end
fixed it to not use colorWithPatternImage, profiled it again and got this result(956.82KB). Sure enough, he's right.
Here's the fixed code:tintyViewController.m (try two)
- (void)viewDidLoad {
UIImage *image = [UIImage imageNamed:@"Polka_dots"];
[searchBar setTintColor:[UIColor purpleColor]];
UIView *searchBack = (UIView *)[searchBar.subviews objectAtIndex:0];
CGRect backFrame = searchBack.frame;
UIView *newBack = [[UIView alloc] initWithFrame:backFrame];
UIImageView *imageBack = [[UIImageView alloc] initWithImage:image];
[newBack addSubview:imageBack];
[newBack setClipsToBounds:YES];
[searchBar insertSubview:newBack aboveSubview:searchBack];
[imageBack release];
[newBack release];
}
Sunday, February 13, 2011
iOS encryption and export law
I may need to store passwords on a device for an upcoming iOS app. I would like to encrypt the passwords. I know from previous iTunes Connect submissions that there are questions about government export compliance when using encryption. I intend to sell (free app, actually) the app internationally. I did some research and found the following links. By the sound of it, I _think_ there are exceptions to an intimidating government review process when using encryption for authentication. I hope so.
Export Administration Regulations Database
http://www.access.gpo.gov/bis/ear/ear_data.html
Commerce Control List Supplement No. 1 to Part 774 Category 5 - Info. Security
http://www.gpo.gov/bis/ear/pdf/ccl5-pt2.pdf
Checklist on Encryption and Other “Information Security” Functions
http://www.bis.doc.gov/encryption/checklistinstr.htm
-- "encryption review or notification is NOT required ... for ... limited forms of cryptography, such as authentication ...
Export Administration Regulations Database
http://www.access.gpo.gov/bis/ear/ear_data.html
Commerce Control List Supplement No. 1 to Part 774 Category 5 - Info. Security
http://www.gpo.gov/bis/ear/pdf/ccl5-pt2.pdf
Checklist on Encryption and Other “Information Security” Functions
http://www.bis.doc.gov/encryption/checklistinstr.htm
-- "encryption review or notification is NOT required ... for ... limited forms of cryptography, such as authentication ...
Thursday, November 4, 2010
Spirit of Nashville iPhone app
The Spirit of Nashville iPhone app is in the App Store here. It's a mobile representation of some of Nashville's most talented artists and video producers. It's also a fun way to get a little Nashville history. Long before we met the design company, Mary and I fell in love with their work and bough two of their posters for our kitchen. When the project started to gel, I was a bit star struck. It's kind of like stringing guitars for one of your favorite bands. I am very honored to have worked with them to build the app.
Sunday, October 17, 2010
Moving Media
I just bought two external USB drives to serve as a mirrored set. Setting up the RAID was easy using Disk Utility. Now I'm copying over iTunes, iPhoto, etc. Here's some handy instructions for iTunes: http://support.apple.com/kb/ht1449
Wednesday, September 22, 2010
WP7 Emulator on Parallels 6 for Mac
I just upgraded to Parallels 6 and thought I would attempt to run the Windows Phone 7 emulator. Simply building and running did not work. However, I ran the emulator from the Start menu. It took a long time for it to start up. The emulator rebooted a few times, then it arrived at the phone home screen. From there, I could launch the debugger from Visual Studio.
While re-testing for this post, I would occasionally see the following error when attempting to attach the debugger:
a specified communication resource (port) is already in use by another application.
I did a Build -> Clean and retried. Success!
The app that I built does nothing. It was simply the Visual Studio template. So I can’t yet attest to performance while debugging, or the availability of features.
The virtual machine is Windows 7 Ultimate. With the first few tests, it had 1 processor and 1GB of ram, which was an error in configuration. I changed it to 2 processors and 4GB of ram. That didn't seem to increase the speed of the emulator startup by very much.
Please give it a try! I am curious if others can reproduce the success.
Saturday, August 7, 2010
Subscribe to:
Posts (Atom)
