Archive October, 2009

Objective-C: NSLog () of C struct

o CGPoint , ad esempio. The syntax NSLog(@"%@", ... ); works and is used to obtain information about objects, but does not work on C data types such as struct CGRect or CGPoint , for example. o NSStringFromCGPoint : To take advantage of NSLog(@"%@", ... ); even on C-style structs can rely on conversion functions like NSStringFromCGRect() or NSStringFromCGPoint :

1
2
3
4
5
CGRect ) { 10 , 20 , 30 , 40 } ; CGRect mioRect = (CGRect) {10, 20, 30, 40};
CGPoint ) { 32 , 64 } ; CGPoint mioPoint = (CGPoint) {32, 64};
/ /
"Info rettangolo: %@" , NSStringFromCGRect ( mioRect ) ) ; NSLog (@ "Info rectangle:% @", NSStringFromCGRect (mioRect));
"Info point: %@" , NSStringFromCGPoint ( mioPoint ) ) ; NSLog (@ "Info point:% @", NSStringFromCGPoint (mioPoint));

Specifically, it is possible to improve this procedure writes of small useful macros like:

1
# Define NSLogRect (rect) NSLog (@ "% s (% 0.0f,% 0.0f)% 0.0f% 0.0fx", # rect, rect.origin.x, rect.origin.y, rect.size.width , rect.size.height)

Or:

1
2
3
4
# Define NSLogCGPoint (point) NSLog (@ "% s (% 0.0f,% 0.0f)", # point.x point, Point.y)

CGPoint ) { 32 , 64 } ; CGPoint mioPoint = (CGPoint) {32, 64};
; NSLogCGPoint (mioPoint);

That will give as output:

1
32 , 64 ) mioPoint: (32, 64)

Continued ...

Very short trick: 3 tricks for developers Apple iPhone

Application Icon

57 × 57 pixel icon that will represent our application is "impaired" by the Apple iPhone automatically: you add a rounded edge, a bright and 3D effects. This setting can be changed by selecting the file [nome applicazione]-Info.plist and adding the property "Icon includes gloss and bevel effects Already":

Continued ...

XCode Objective-C: Useful keyboard shortcuts

XCode is a very powerful development environment and reserves some surprises. It allows a function similar to "snippets" of the famous editor TextMate . In practice it is possible to insert blocks of code using the sequence ESC + a combination of one or more sequences of characters. e otterrete: For example, if you want to insert a block if try pressing ESC+if and you'll get:

Immagine 3

. As shown in the figure, a menu appears (the same auto-completion) where you can choose between a simple block if or if/else . Clicking "send" you get:

Immagine 4

Here are two links for the complete list of keyboard shortcuts:

Continued ...

Web Analytics

More about Web analytics The analysis of access to a Web site is an argument vast and interesting. The majority of the time the analysis is carried out by tools such as Google Analitycs , Woopra , Reinvigorate , etc ... However, for the most savvy, you may be planning to build their own personal analysis tool, or just to look at the "mysterious" log file of our Web Server. Council, then, to read Web Analytics David Vasta, text very useful to understand in detail all the processes that lie behind the tracking of access.

The guide is very comprehensive as it analyzes each aspect revolves around the topic of Web Analitycs. Also useful advice addressed to the coders, those who develop Web pages, how to use "correctly" tag and attribute. List below the major topics covered in the text by highlighting, in my opinion, the most interesting and useful to the "coder", ie those that do not directly affect SEO analysis:

  • Basics of Web Analytics: log file and metrics
  • Analysis tools
  • First analysis: visits, bounce rate, page views, navigation paths, an output link
  • Analysis of historical, geographical and seasonal
  • Analysis of the relevant pages and keywords
  • Analysis by referrers and KPIs
  • Conversion Analysis
  • Real-time analysis
  • Serach engine marketing (SEM) and Web Analytics
  • Analysis Tools for logs
  • Increase the visibility of a site
  • Legal Aspects of Web Analytics

Continued ...

Topics in JavaScript variables: two alternatives

In Javascript you can write functions with variable arguments, that is, functions that do not necessarily accept a fixed number of inputs. For example, you can write functions like this:

Continued ...

Very short snippet: iPhone, random numbers

If you need to generate random numbers in an application must set aside Apple iPhone Objective-C, because it does not propose any class order. The solution is proposed that the C: rand(), srand(), random(), srandom() e arc4random() .

Continued ...

Adobe Flash CS5 Professional for Apple iPhone

Adobe Flash Professiona 5 per Apple iPhone

Continued ...