Category 'D'


Very short snippet: Apple iPhone file system

Both the Mac OS X and iPhone OS, we can access easily and directly to the directory - most important - the system which are:

1
2
3
NSHomeDirectory Returns the path to the current user's home directory.
Returns the path to NSHomeDirectoryForUser Given a user's home directory.
NSTemporaryDirectory Returns the path of the temporary directory for the current user.

Continued ...

10 Useful tricks and snippets for Apple iPhone and Xcode

1. Strings on multiple lines

In Xcode, you can "break" a string across multiple lines by inserting at the end with a backslash "\". This feature can be useful when, for example, we want to insert the HTML text in a control UIWebView :

Continued ...

Very short snippet: a data format of a control UIDatePicker

The control UIDatePicker is perhaps the most beautiful present graphical control on the Apple iPhone. Besides the beauty of it is also easy to use, extremely versatile and used in many situations.

Continued ...

Adobe Flash CS4: Create an Ajax Loader or Activity Indicator

Create an Ajax Loader (or Activity indicator for those who are already accustomed to using the Apple iPhone) for the Web is not a difficult thing: there are services that generate animated gif images of all types. However, the GIF format has the big drawback of not supporting transparent as it should. Transparency in GIF current plan involves only one bit with the consequence that if we do not have a background color uniform, the edges of the image are noticeably grainy and fragmented.

Continued ...

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 ...