Aug
12
2010
There are some features that most ppl hasnt noticed in google Chrome. For my opinion Google Chrome will be the no1 choise of all net freaks.
Incognito mode (private browsing)

For times when you want to browse in stealth mode, for example, to plan surprises like gifts or birthdays, Google Chrome offers the incognito browsing mode. Here’s how the incognito mode works:
Webpages that you open and files downloaded while you are incognito aren’t recorded in your browsing and download histories.
All new cookies are deleted after you close all incognito windows that you’ve opened.
Changes made to your Google Chrome bookmarks and general settings while in incognito mode are always saved.
Keyboard shortcut: Ctrl+Shift+N
Advanced Search in Address Bar
Chrome uses a search engine as your type a url. So the address bar can be used for search and for inserting a url. Autocomplete is very helpful even in very specific searches.

Also Check out this screen. In options

There are default Search options but also Other search engines from Sites you use mostly (this is done for you automatically)

Quick Search
Type your search. As you type you can see the number of occurrences (current occurrences is highlighted in orange).
Check out that the search string is highlighted in the scrollbar also.

Keyboard shortcut: CTRL + F
Speed
see some past test i did with tracemonkey here
no comments | posted in Tips
Jul
20
2010
First make sure you have ssh and bsd subsystem installed from installer. If you cant find the source reboot or turn off wifi and back on.
Next get WinSCP and find your iPhone’s ip by going to (on your iphone) settings > Wi-Fi > “Your selected WiFi” > Look under IP Address- Connect to your iPhone using WinSCP (user: root password: alpine) Change File Protocol to SCP.

Once OpenSSH is installed your phone will be vunerable to all users in a specific wifi subnet. Make sure to Use the WinSCP terminal window an use this command to change password:
passwd root
type in password, press return
type it in again, press return
To avoid frequent logouts remember to change the Setting -> General -> Auto-Lock (5 minutes or Never)
no comments | tags: alpine, iphone, openssh, root, winscp | posted in iPhone
Jul
8
2010
NSFileManager offers a convenient way to write images to and load them from the documents directory.
If you’re frequently doing that in your project, I suggest to wrap up NSFileManager support in three simple methods:
Save/Load/Remove Image Methods
//saving an image
- (void)saveImage:(UIImage*)image:(NSString*)imageName {
NSData *imageData = UIImagePNGRepresentation(image); //convert image into .png format.
NSFileManager *fileManager = [NSFileManager defaultManager];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *fullPath = [documentsDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.png", imageName]];
[fileManager createFileAtPath:fullPath contents:imageData attributes:nil];
NSLog(@"image saved");
}
//removing an image
- (void)removeImage:(NSString*)fileName {
NSFileManager *fileManager = [NSFileManager defaultManager];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *fullPath = [documentsDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.png", fileName]];
[fileManager removeItemAtPath: fullPath error:NULL];
NSLog(@"image removed");
}
//loading an image
- (UIImage*)loadImage:(NSString*)imageName {
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *fullPath = [documentsDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.png", imageName]];
return [UIImage imageWithContentsOfFile:fullPath];
}
Now, you can easily save an image like:
[self saveImage: myUIImage: @"myUIImageName"];
or load it like:
myUIImage = [self loadImage: @"myUIImageName"];
or remove it like:
[self removeImage: @"myUIImageName"];
Capture an image
- (UIImage*) getGLScreenshot {
NSInteger myDataLength = 320 * 480 * 4;
// allocate array and read pixels into it.
GLubyte *buffer = (GLubyte *) malloc(myDataLength);
glReadPixels(0, 0, 320, 480, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
// gl renders "upside down" so swap top to bottom into new array.
// there's gotta be a better way, but this works.
GLubyte *buffer2 = (GLubyte *) malloc(myDataLength);
for(int y = 0; y <480; y++)
{
for(int x = 0; x <320 * 4; x++)
{
buffer2[(479 - y) * 320 * 4 + x] = buffer[y * 4 * 320 + x];
}
}
// make data provider with data.
CGDataProviderRef provider = CGDataProviderCreateWithData(NULL, buffer2, myDataLength, NULL);
// prep the ingredients
int bitsPerComponent = 8;
int bitsPerPixel = 32;
int bytesPerRow = 4 * 320;
CGColorSpaceRef colorSpaceRef = CGColorSpaceCreateDeviceRGB();
CGBitmapInfo bitmapInfo = kCGBitmapByteOrderDefault;
CGColorRenderingIntent renderingIntent = kCGRenderingIntentDefault;
// make the cgimage
CGImageRef imageRef = CGImageCreate(320, 480, bitsPerComponent, bitsPerPixel, bytesPerRow, colorSpaceRef, bitmapInfo, provider, NULL, NO, renderingIntent);
// then make the uiimage from that
UIImage *myImage = [UIImage imageWithCGImage:imageRef];
return myImage;
}
- (void)saveGLScreenshotToPhotosAlbum {
UIImageWriteToSavedPhotosAlbum([self getGLScreenshot], nil, nil, nil);
}
no comments | tags: capture, image, iphone, load, objective-c, remove, save | posted in Uncategorized, objective c
Jul
8
2010

Weird bug-easy solution.
I did have this weird issue also when updating to SDK4.0. I couldn’t get CLLocationManager to work on simulator. This problem also existed in iPhone Simulator 3.1.3.
The solution is quite weird. Open the Airport (wifi) in your mac and the CLLocationManager will work as before fetching the Cupertino, or in my case fetching a wide area of my country.
I guess the Location is estimated by the internet ip address of your connection.
Continue reading
2 comments | tags: bug, CLLocation, CLLocationManager, didupdatetolocation, iOS4, iphone, simulator, tips | posted in Tips, objective c
Jul
3
2010

Yet another small useful collection of small code snippets for NSString.
Continue reading
no comments | tags: iphone, NSString, obective c, programmming, tip, xcode | posted in objective c
Jun
30
2010
This is a small collection of my personal preference of color themes for xcode programming environment. For those who are looking for a dark theme. You can chose from one of the following color themes. I’m currently using teliaz theme, it has been tested and works very smoothly.
To get
teliaz theme
run the following code in Terminal:
mkdir -p ~/Library/Application\ Support/Xcode/Color\ Themes; cd ~/Library/Application\ Support/Xcode/Color\ Themes; curl http://teliaz.com/files/apple/TeliazTheme.xccolortheme &> TeliazTheme.xccolortheme
To get
Ego theme
run the following code in Terminal:
mkdir -p ~/Library/Application\ Support/Xcode/Color\ Themes; cd ~/Library/Application\ Support/Xcode/Color\ Themes; curl http://teliaz.com/files/apple/XCodeColorTheme.xccolortheme &> EgoTheme.xccolortheme
“EGO” uses the font “DejaVu Sans Mono” at 12pt. Some of you may know it as “Panic Sans” from Panic’s Coda (which is a repackaged version of it). You can grab the font over at dejavu-fonts.org. If you already have Code installed, feel free to swap in Panic Sans in place of DejaVu Sans Mono.
To get
Humane Theme
run the following code in Terminal:
mkdir -p ~/Library/Application\ Support/Xcode/Color\ Themes; cd ~/Library/Application\ Support/Xcode/Color\ Themes; curl http://teliaz.com/files/apple/Humane.xccolortheme &> Humane.xccolortheme
Now just restart Xcode, go to Preferences > Fonts & Colors, and select “one of these themes” from the color theme drop down. Hope you like it!! Happy coding…
1 comment | tags: apple, color, interface, theme, xcode | posted in fonts, objective c
Jun
28
2010
Have you been frustrated sometimes trying to debug an application and really making it worse, the output of your logs are not as desired. Complete chaos and nonsense.
Some of the concepts here will be familiar in c coding language, as objective c is just an extended c with object oriented approach. Take a quick look at this table that will surely clear things up.
| Type |
Constants |
NSLog |
Short Explanation |
| char |
"a", "\n" |
%c |
– |
| short int |
– |
%hi, %hx, %ho |
%hi, %hx, %ho |
| unsigned short int |
– |
%hi, %hx, %ho |
%hi, %hx (hex notation), %ho (octa notation) |
| int |
12, -97, 0xFFE0, 0177 |
%i, %x, %o |
also %d can be used in objective-c |
| unsigned int |
12u, 100U, 0xFFU |
%u, %x, %o |
as above |
| long int |
12L, -200l, 0xfffL |
%lu, %lx, %lo |
as above |
| long long int |
0xe5e5e5e5LL, 500LL |
%lli, %llx, %llo |
as above |
| long long unsigned int |
0xe5e5e5e5ULL, 120ULL |
%llu, %llx, %llo |
as above |
| float |
12.34f, 3.1e-5f |
%f, %e, %g |
%f (with 6 decimal place by default), %e (with scientific notation), %g (personal preference most readable) |
| double |
12.34, 3.1e-5 |
%f, %e, %g |
as above |
| long double |
12.34l, 3.1e-5l |
%Lf, %Le, %Lg |
as above |
| id |
– |
%p |
|
no comments | posted in objective c
Jun
27
2010

(Somehow this project seems to me so simple, that I’m sure someone has done this before. Anyway). This is my feeble attempt to bring an answer to the eternal dichotomy between those arguing about the relative benefits of creating user interfaces via Interface Builder or via pure Objective-C code: let me introduce nib2objc.
Continue reading
no comments | tags: iphone, nib2obj, objective-c, xcode | posted in objective c
Jun
27
2010

It is very important that iPhone and iPad applications use visual styles in a coherent way. This helps users learn how to use your application faster, it helps them scan your UI for important information as quickly as possible, and it also can convey a strong marketing message; companies who want iPhone or iPad applications often have complex visual identities, including predefined fonts and colors, and they will want their applications to match those choices.
Continue reading
no comments | posted in objective c
Jun
24
2010

Check this informative comparison sheets….
Continue reading
no comments | tags: iphone, iphone 4, news, specs, tech | posted in Hardware, iPhone, tech news