Pages

Saturday, September 4, 2010

Simplest project for iPhone: no xib-file.

Probably, I do know the way to create "empty" iPhone project. Is it useful? I have no idea.
In the Windows world, in Visual Studio, the best way to create new project was to check "Empty project" checkbox in the Win32 application wizard.
In Xcode, for an iPhone project, the IDE generates for me a lot of files, makes folders. If I'm just learning, if I'm just testing all these files and folders just fulfill my hard disk.
So I found a way to create such "empty" project in Xcode:
1. Create new project in Xcode: Window-based template, any name,... everything's as usual.
2. In Xcode sidebar, select "Classes" and delete them. In the alert window choose "Also move to Trash".
3. Delete xib-file.
4. Modify *-info.plist file: delete the line about MainWindow - probably, the last one.
5. Open main.m file and add a simple application delegate. Then set the name of the delegate in the main() function.
Here is my main.m file:
#import <UIKit/UIKit.h>

// Application delegate
@interface Simple : NSObject <UIApplicationDelegate>
{
}

@end

@implementation Simple

- (void)applicationDidFinishLaunching: (UIApplication*)application
{
UIWindow* window = [[UIWindow alloc] initWithFrame: [[UIScreen mainScreen] bounds]];
[window setBackgroundColor: [UIColor yellowColor]];

[window makeKeyAndVisible];
}

@end


int main(int argc, char *argv[]) {

NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, @"Simple");
[pool release];
return retVal;
}
6. Compile and Run:

Thursday, September 2, 2010

iOS 4.1. High Dynamic Range photos

Gigaom. iOS 4.1 Update Next Week, 4.2 in November
I'm not the first to update OS on my iPhone. But this announce looks very interesting. iOS 4.1 is supposed to fix the performance problems and will bring new feature - High Dynamic Range photos:
Using High Dynamic Range (HDR), the iPhone takes three photos: one at normal exposure, one under exposed, and one over exposed. iOS 4 then combines the three photos using “advanced algorithms” to create a single high-definition photograph. Both the normal exposure picture and the HDR picture are kept in the photos app on the iPhone, making it easy to choose one or the other. The demos look amazing; the HDR photos bring out features in the background that you couldn’t see in the normal exposure

Worldwide OS Market Share

Just an information:
iOS Over Linux Today, Android Over iOS Tomorrow

Windows Phone Team is very excited to say

Windows Phone Blog. Windows Phone 7 – Released To Manufacturing
Windows Phone 7 released to manufacturing. Seems like the developers are really proud and believe that this is really a great OS.

Sunday, August 22, 2010

Big-O Notation

Big-O Notation is a kind of a strange foreign language. Interviewers use it in order to show that they are smarter than you, the development managers mention it to demonstrate own IQ to the programmers. :)
In case you have to know what is this Big-O notation read these articles in the following order:
1. A Beginners’ Guide to Big O Notation.
2. An Intro to Big Oh Notation with Java.
3. Complexity and Big-O Notation
4. An informal introduction to O(N) notation
5. Algorithmic Efficiency -- Analyzing Algorithms
6. Algorithmic Efficiency -- Various Orders and Examples
From my point of view it's a bureaucracy that comes to the real programming. Yes, it says something about the algorithm performance. But it can be a real mistake to write a fundamental algorithms yourself in complex commercial projects. It's important to see in the source code the bottle necks, but if I see a nested loop, I do know that it is better to "open" it and the fact that now I know that is O(N^2) does not help me at all.

Sunday, August 15, 2010

Mac OS X. Terminal curl

Today morning I found this blog post:
See Share Quotes In Terminal / Geek Tool

I'm from the Windows world and didn't know about curl in Terminal, so I tested:
Looks interesting? For me too. So I found how to work with the ftp via curl:
http://www.hyperorg.com/blogger/2008/01/01/beginner-to-beginner-ftp-via-curl/
One more nice example: how to detect my IP address with curl:
curl ifconfig.me