<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Th30z - Coding on the Fly &#187; Apple</title>
	<atom:link href="http://th30z.netsons.org/category/apple/feed/" rel="self" type="application/rss+xml" />
	<link>http://th30z.netsons.org</link>
	<description>Matteo Bertozzi, Objective-C, Cocoa, C, C++, Qt4, iPhone, Mac OS X, Open Moko, Matteo Bertozzi Development</description>
	<lastBuildDate>Sun, 22 Nov 2009 09:47:19 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>[TIP] XCode Header Search Path</title>
		<link>http://th30z.netsons.org/2009/09/tip-xcode-header-search-path/</link>
		<comments>http://th30z.netsons.org/2009/09/tip-xcode-header-search-path/#comments</comments>
		<pubDate>Sat, 26 Sep 2009 10:26:08 +0000</pubDate>
		<dc:creator>Matteo Bertozzi</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[XCode]]></category>

		<guid isPermaLink="false">http://th30z.netsons.org/?p=1243</guid>
		<description><![CDATA[For many of you, this sounds like a stupid thing. But for those that just use gcc -I from command line, can be a pain find how to do it.
So, the problem is. How can I specify my Include path in XCode (gcc -I./mypath).

Tap on your project target, and click &#8220;Get Info&#8220;, tap on &#8220;Build&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p>For many of you, this sounds like a stupid thing. But for those that just use gcc -I from command line, can be a pain find how to do it.</p>
<p>So, the problem is. How can I specify my Include path in XCode (gcc -I./mypath).</p>
<p style="text-align: center;"><a href="http://th30z.netsons.org/wp-content/uploads/XCode-SearchHeaderPath1.png"><img class="aligncenter size-full wp-image-1245" title="XCode Search Header Path" src="http://th30z.netsons.org/wp-content/uploads/XCode-SearchHeaderPath1.png" alt="XCode Search Header Path" width="566" height="279" /></a></p>
<p>Tap on your project target, and click &#8220;<strong>Get Info</strong>&#8220;, tap on &#8220;<strong>Build</strong>&#8221; tab and search &#8220;Path&#8221; as showed in the figure above. Then click on the &#8220;<strong>Header Search Paths</strong>&#8221; options and add your favorite include paths for selected target.</p>
]]></content:encoded>
			<wfw:commentRss>http://th30z.netsons.org/2009/09/tip-xcode-header-search-path/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Grand Central Dispatch: First Look</title>
		<link>http://th30z.netsons.org/2009/09/grand-central-dispatch-first-look/</link>
		<comments>http://th30z.netsons.org/2009/09/grand-central-dispatch-first-look/#comments</comments>
		<pubDate>Sun, 06 Sep 2009 05:00:32 +0000</pubDate>
		<dc:creator>Matteo Bertozzi</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Grand Central Dispatch]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Threading]]></category>

		<guid isPermaLink="false">http://th30z.netsons.org/?p=1202</guid>
		<description><![CDATA[In the last years I&#8217;ve always used a &#8220;parallel task&#8221; approach foreach loops that I&#8217;ve in the code, not always to speedup but even to clean-up the code. How to do it? Wrapping threads and Thread Pool like in this C# Parallel Forech Code.
Snow Leopard has introduced a new BSD-level infrastructure, with simple and efficient [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://en.wikipedia.org/wiki/Grand_Central_Dispatch"><img src="http://th30z.netsons.org/wp-content/uploads/GDC-Logo.png" alt="Mac OS X Grand Central Dispatch" title="Mac OS X Grand Central Dispatch" width="118" height="106" class="alignright size-full wp-image-1207" /></a>In the last years I&#8217;ve always used a &#8220;parallel task&#8221; approach foreach loops that I&#8217;ve in the code, not always to speedup but even to clean-up the code. <em>How to do it? Wrapping threads and Thread Pool like in this <a href="http://th30z.netsons.org/2008/12/c-parallel-foreach-using-thread-pool/">C# Parallel Forech Code</a></em>.</p>
<p><strong>Snow Leopard</strong> has introduced a new BSD-level infrastructure, with simple and efficient API to do this job. Here a little usage preview.</p>
<p><strong>Block objects</strong> are a C-based language feature that you can use in your C, Objective-C, and C++ code. Blocks make it easy to define a self-contained unit of work. Blocks are something like Actions (delegate {}) in C#. <em>Very useful to embed function in loops.</em></p>
<p>Blocks looks like a &#8220;private&#8221; function pointer, but you can access to the &#8220;parent&#8221; vars. (<em>If you&#8217;re a Python coder, you&#8217;ve exactly the same thing</em>).<br />
<code></p>
<pre>
/* Blocks in Python...
 * def main():
 *    a = 10
 *    def test(k):
 *        print a, k
 *    test(128)
 */
int main (int argc, const char *argv[]) {
  int a = 12;

  void (^test_block) (int) = ^(int k) {
    printf("A Block: PARENT(%d) ARG(%d)\n", a, k);
  };

  test_block(128);

  return 0;
}
</pre>
<p></code></p>
<p>The <strong>GCD</strong> queue API provides <strong>dispatch queues</strong> from which threads take tasks to be executed. Because the threads are managed by GCD, Mac OS X can optimize the number of threads based upon available memory, number of currently active CPU cores, and so on. This shifts a great deal of the burden of power and resource management to the operating system itself, freeing your application to focus on the actual work to be accomplished.<br />
<code></p>
<pre>
#include &lt;dispatch/dispatch.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;stdio.h&gt;

#define ITEM_VMIN       (1)
#define ITEM_VMAX       (200)
#define NR_ITEMS        (100)

static void __fill_item (void *items, size_t n) {
  int *i_items = (int *)items;
  i_items[n] = (ITEM_VMIN + (int)(ITEM_VMAX * ((double)rand() / RAND_MAX)));
}

static void __work_on_item (void *items, size_t n) {
  int *i_items = (int *)items;
  i_items[n] *= 100;  /* Do some Computation on this Item */
}

int main (int argc, const char *argv[]) {
  dispatch_queue_t queue;
  int data[NR_ITEMS];

  /* Get Global Dispatch Queue */
  queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);

  /* Initialize data Elements, and run computation on each element */
  dispatch_apply_f(NR_ITEMS, queue, data, __fill_item);
  dispatch_apply_f(NR_ITEMS, queue, data, __work_on_item);

  /* Brief review of the items */
  dispatch_apply(NR_ITEMS, queue, ^(size_t n) {
    printf(&quot;Results: Item %lu = %d\n&quot;, n, data[n]);
  });

  return 0;
}
</pre>
<p></code></p>
]]></content:encoded>
			<wfw:commentRss>http://th30z.netsons.org/2009/09/grand-central-dispatch-first-look/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mac OS X 10.6 Snow Leopard</title>
		<link>http://th30z.netsons.org/2009/09/mac-os-x-10-6-snow-leopard/</link>
		<comments>http://th30z.netsons.org/2009/09/mac-os-x-10-6-snow-leopard/#comments</comments>
		<pubDate>Sat, 05 Sep 2009 09:59:49 +0000</pubDate>
		<dc:creator>Matteo Bertozzi</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Screenshots]]></category>

		<guid isPermaLink="false">http://th30z.netsons.org/?p=1195</guid>
		<description><![CDATA[It&#8217;s finally here.  Mac OS X Snow Leopard, The world&#8217;s most advanced operating system. Finely tuned.

Ok, It&#8217;s one week later&#8230; but I&#8217;ve installed it just right now. Maybe tomorrow morning an usage example of Grand Central Dispatch.
]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s finally here.  <a title="Apple Mac OS X Snow Leopard" href="http://www.apple.com/mac">Mac OS X Snow Leopard</a>, <em>The world&#8217;s most advanced operating system. Finely tuned.</em></p>
<p style="text-align: left;"><a href="http://th30z.netsons.org/wp-content/uploads/SnowLeopard-01.png"><img class="aligncenter size-large wp-image-1194" title="Mac OS X 10.6 Snow Leopard" src="http://th30z.netsons.org/wp-content/uploads/SnowLeopard-01-1024x640.png" alt="Mac OS X 10.6 Snow Leopard" width="553" height="346" /></a><br />
Ok, It&#8217;s one week later&#8230; but I&#8217;ve installed it just right now. Maybe tomorrow morning an usage example of <a title="Grand Central Dispatch" href="http://en.wikipedia.org/wiki/Grand_Central_Dispatch">Grand Central Dispatch</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://th30z.netsons.org/2009/09/mac-os-x-10-6-snow-leopard/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iPhone: Voice Mill</title>
		<link>http://th30z.netsons.org/2009/08/iphone-voice-mill/</link>
		<comments>http://th30z.netsons.org/2009/08/iphone-voice-mill/#comments</comments>
		<pubDate>Sun, 30 Aug 2009 04:30:13 +0000</pubDate>
		<dc:creator>Matteo Bertozzi</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Audio]]></category>

		<guid isPermaLink="false">http://th30z.netsons.org/?p=1175</guid>
		<description><![CDATA[Yesterday I&#8217;ve played a bit with AVAudioRecorder, and this is a very small and funny example.
The main Idea is to create something like a wind mill that works with voice instead of wind.

The code below shows you how to record something. Then with the updateMeters() and peakPowerForChannel() you can extract the audio &#8220;noise&#8221;.


NSURL *url = [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday I&#8217;ve played a bit with AVAudioRecorder, and this is a very small and funny example.<br />
The main Idea is to create something like a wind mill that works with voice instead of wind.</p>
<p style="text-align: center;"><object width="575" height="360" data="http://th30z.netsons.org/wp-content/uploads/VoiceMillVideo.swf" type="application/x-shockwave-flash"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://th30z.netsons.org/wp-content/uploads/VoiceMillVideo.swf" /><param name="allowfullscreen" value="true" /></object></p>
<p>The code below shows you how to record something. Then with the <em>updateMeters()</em> and <em>peakPowerForChannel()</em> you can extract the audio &#8220;noise&#8221;.<br />
<code></p>
<pre>
NSURL *url = [NSURL fileURLWithPath:@&quot;/dev/null&quot;];
NSDictionary *settings = [NSDictionary dictionaryWithObjectsAndKeys:
    [NSNumber numberWithFloat:44100.0], AVSampleRateKey,
    [NSNumber numberWithInt:kAudioFormatAppleLossless], AVFormatIDKey,
    [NSNumber numberWithInt:1], AVNumberOfChannelsKey,
    [NSNumber numberWithInt:AVAudioQualityLow], AVEncoderAudioQualityKey,
    nil];

NSError *error;
recorder = [[AVAudioRecorder alloc] initWithURL:url
            settings:settings error:&amp;error];
if (recorder) {
    [recorder prepareToRecord];
    recorder.meteringEnabled = YES;
    [recorder record];
    ...
}
</pre>
<p></code><br />
The SWF Video is available here <a href="http://th30z.netsons.org/wp-content/uploads/VoiceMillVideo.swf">Voice Mill Video</a>.<br />
The Source Code is available here <a href="http://th30z.netsons.org/wp-content/uploads/Cocoa-VoiceMill.zip">Cocoa Voice Mill Source Code</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://th30z.netsons.org/2009/08/iphone-voice-mill/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iPhone: Touch, Drag, Hit!</title>
		<link>http://th30z.netsons.org/2009/05/iphone-touch-drag-hit/</link>
		<comments>http://th30z.netsons.org/2009/05/iphone-touch-drag-hit/#comments</comments>
		<pubDate>Fri, 01 May 2009 07:46:27 +0000</pubDate>
		<dc:creator>Matteo Bertozzi</dc:creator>
				<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Cocoa Touch]]></category>
		<category><![CDATA[Drag & Drop]]></category>

		<guid isPermaLink="false">http://th30z.netsons.org/?p=803</guid>
		<description><![CDATA[Yesterday, Fredrik has asked me something like &#8220;Drag &#38; Drop with Hit Test&#8221; on the iPhone. Here&#8217;s a simple example.  There&#8217;s a simple UIView class that handles the touch events and a protocol that says that if the &#8220;DragMe View&#8221; has hit or not the &#8220;HitMe View&#8221;. Below you can see the result and the [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday, Fredrik has asked me something like &#8220;Drag &amp; Drop with Hit Test&#8221; on the iPhone. Here&#8217;s a simple example.  There&#8217;s a simple UIView class that handles the touch events and a protocol that says that if the &#8220;DragMe View&#8221; has hit or not the &#8220;HitMe View&#8221;. Below you can see the result and the Source Code Link.</p>
<p><a href="http://th30z.netsons.org/wp-content/uploads/iphonetouchdraghit.png"><img class="aligncenter size-medium wp-image-807" title="iPhone Touch Drag Hit" src="http://th30z.netsons.org/wp-content/uploads/iphonetouchdraghit-350x325.png" alt="iPhone Touch Drag Hit" width="350" height="325" /></a></p>
<p>The source code is available here: <a title="iPhone Touch Drag Hit Source Code" href="http://th30z.netsons.org/wp-content/uploads/iphone-touchdraghit.zip">Touch, Drag, Hit Source Code</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://th30z.netsons.org/2009/05/iphone-touch-drag-hit/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Qt/Cocoa DataStream (Binary Communication)</title>
		<link>http://th30z.netsons.org/2009/04/qtcocoa-datastream-binary-communication/</link>
		<comments>http://th30z.netsons.org/2009/04/qtcocoa-datastream-binary-communication/#comments</comments>
		<pubDate>Sat, 11 Apr 2009 17:55:47 +0000</pubDate>
		<dc:creator>Matteo Bertozzi</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Qt4]]></category>

		<guid isPermaLink="false">http://th30z.netsons.org/?p=732</guid>
		<description><![CDATA[In a time of REST protocols&#8230; I still love the Binary Communication. I don&#8217;t have much ideas this period, I need to find a different job (C# doesn&#8217;t fit my code necessity). The Example Source code, contains two Folder. One is the Qt4 TcpServer the second one is the ugly application that you can see [...]]]></description>
			<content:encoded><![CDATA[<p>In a time of REST protocols&#8230; I still love the Binary Communication. I don&#8217;t have much ideas this period, I need to find a different job (C# doesn&#8217;t fit my code necessity). The Example Source code, contains two Folder. One is the Qt4 TcpServer the second one is the ugly application that you can see below <img src='http://th30z.netsons.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><em>Note: This example doesn&#8217;t have anything related to the Qt 4.5 Cocoa Support.</em></p>
<p>Run the Qt4 Server, and the Cocoa Application (Remember to change the SERVER_HOST in AppController.m) and try to send some binary data. The Qt Server will receive this data it will resend you. Protocol is Very easy 1 byte of Data Type (Int8, Int16, ..) and Data. Remember that Intel arch is Little Endian.</p>
<p><a href="http://th30z.netsons.org/wp-content/uploads/qtcocoadatastream.png"><img class="aligncenter size-full wp-image-731" title="Qt Cocoa DataStream" src="http://th30z.netsons.org/wp-content/uploads/qtcocoadatastream.png" alt="Qt Cocoa DataStream" width="560" height="462" /></a></p>
<p>Note: This is just a &#8220;Draft&#8221; a &#8220;non complete&#8221; example only to give the idea on how it works.</p>
<p>The Source Code is available here: <a title="Qt/Cocoa DataStream Source Code" href="http://th30z.netsons.org/wp-content/uploads/qtcocoadatastream.zip">Qt/Cocoa DataStream Source Code</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://th30z.netsons.org/2009/04/qtcocoa-datastream-binary-communication/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iPhone: Download and Display Gravatar</title>
		<link>http://th30z.netsons.org/2009/03/iphone-download-and-display-gravatar/</link>
		<comments>http://th30z.netsons.org/2009/03/iphone-download-and-display-gravatar/#comments</comments>
		<pubDate>Sat, 28 Mar 2009 10:27:41 +0000</pubDate>
		<dc:creator>Matteo Bertozzi</dc:creator>
				<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://th30z.netsons.org/?p=662</guid>
		<description><![CDATA[Back to the real iPhone for a while&#8230; Gravatar, or globally recognized avatar, is an interesting free service. It can be integrated with AddressBook app or other apps that can have a picture related to email address. Here an Objective-C Example to retrive the Gravatar. It&#8217;s really simple!
The Source Code is Available Here: iPhone Gravatar [...]]]></description>
			<content:encoded><![CDATA[<p>Back to the real iPhone for a while&#8230; <a title="Gravatar" href="http://www.gravatar.com/">Gravatar</a>, or <strong>g</strong>lobally <strong>r</strong>ecognized <strong>avatar</strong>, is an interesting free service. It can be integrated with AddressBook app or other apps that can have a picture related to email address. Here an Objective-C Example to retrive the Gravatar. <em>It&#8217;s really simple!</em></p>
<p><a href="http://th30z.netsons.org/wp-content/uploads/iphonegravatar.png"><img class="aligncenter size-medium wp-image-666" title="iPhone Gravatar" src="http://th30z.netsons.org/wp-content/uploads/iphonegravatar-350x188.png" alt="iPhone Gravatar" width="350" height="188" /></a>The Source Code is Available Here: <a href="http://th30z.netsons.org/wp-content/uploads/iphonegravatar.zip">iPhone Gravatar Example</a>.<em></em></p>
<p><em>The Apple Worldwide Developers Conference (WWDC) takes place June 8-12, 2009 held at Moscone Center West in San Francisco. <a title="Apple WWDC" href="http://developer.apple.com/WWDC/">http://developer.apple.com/WWDC/</a>.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://th30z.netsons.org/2009/03/iphone-download-and-display-gravatar/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cocoa: Sidebar with Badges, Take 2</title>
		<link>http://th30z.netsons.org/2009/03/cocoa-sidebar-with-badges-take-2/</link>
		<comments>http://th30z.netsons.org/2009/03/cocoa-sidebar-with-badges-take-2/#comments</comments>
		<pubDate>Sun, 08 Mar 2009 15:13:42 +0000</pubDate>
		<dc:creator>Matteo Bertozzi</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Mac OS X]]></category>

		<guid isPermaLink="false">http://th30z.netsons.org/?p=588</guid>
		<description><![CDATA[Do you remember the Cocoa Sidebar? No, Take a Look at this post Cocoa Sidebar with Badges.
Joel asked me to revise the Sidebar, allowing to add/remove and do other operation at any time.
I&#8217;ve rewritten all the code of the Sidebar, and I&#8217;ve added a couple of new features, like the default action handler and obviously the ability [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://th30z.netsons.org/wp-content/uploads/cocoa-sidebar.png"><img class="size-medium wp-image-403 alignleft" title="Cocoa Sidebar" src="http://th30z.netsons.org/wp-content/uploads/cocoa-sidebar-237x350.png" alt="Cocoa Sidebar" width="166" height="245" /></a>Do you remember the Cocoa Sidebar? No, Take a Look at this post <a href="http://th30z.netsons.org/2008/12/cocoa-sidebar-with-badges/">Cocoa Sidebar with Badges</a><a>.</a></p>
<p>Joel asked me to revise the Sidebar, allowing to add/remove and do other operation at any time.</p>
<p>I&#8217;ve rewritten all the code of the Sidebar, and I&#8217;ve added a couple of new features, like the default action handler and obviously the ability to add, remove items and badges at any time.</p>
<p>All the past features, like Drag &amp; Drop are still present, but there&#8217;s something else to do to improve it. If You&#8217;ve suggestions, patches or something else post a comment or send me a mail!</p>
<p>The Source Code is Available Here: <a href="http://th30z.netsons.org/wp-content/uploads/cocoa-sidebar2.zip">Cocoa Sidebar 2 Source Code</a>.</p>
<p><em>Update 10 March 2008 &#8211; Source Updated with Fixes.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://th30z.netsons.org/2009/03/cocoa-sidebar-with-badges-take-2/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Cocoa: Drag &amp; Drop</title>
		<link>http://th30z.netsons.org/2009/02/cocoa-drag-drop/</link>
		<comments>http://th30z.netsons.org/2009/02/cocoa-drag-drop/#comments</comments>
		<pubDate>Sat, 28 Feb 2009 10:58:37 +0000</pubDate>
		<dc:creator>Matteo Bertozzi</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Drag & Drop]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[NSView]]></category>

		<guid isPermaLink="false">http://th30z.netsons.org/?p=554</guid>
		<description><![CDATA[Today a simple example of Drag &#38; Drop with Cocoa and NSView. The screenshot below shows two groups. In the first one, you can drop the photos on your filesystem, taken from Desktop or Finder. In the second group, you can only drop the first group image.

You can find the source code here: Drag &#38; [...]]]></description>
			<content:encoded><![CDATA[<p>Today a simple example of Drag &amp; Drop with Cocoa and NSView. The screenshot below shows two groups. In the first one, you can drop the photos on your filesystem, taken from Desktop or Finder. In the second group, you can only drop the first group image.</p>
<p><a href="http://th30z.netsons.org/wp-content/uploads/cocoa-draganddrop.png"><img class="aligncenter size-medium wp-image-555" title="Cocoa Drag &amp; Drop Test App" src="http://th30z.netsons.org/wp-content/uploads/cocoa-draganddrop-350x175.png" alt="Cocoa Drag &amp; Drop Test App" width="350" height="175" /></a></p>
<p>You can find the source code here: <a href="http://th30z.netsons.org/wp-content/uploads/cocoa-draganddroptest.zip">Drag &amp; Drop Test Source Code</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://th30z.netsons.org/2009/02/cocoa-drag-drop/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WebKit: Google Maps</title>
		<link>http://th30z.netsons.org/2009/02/webkit-google-maps/</link>
		<comments>http://th30z.netsons.org/2009/02/webkit-google-maps/#comments</comments>
		<pubDate>Sun, 01 Feb 2009 17:12:51 +0000</pubDate>
		<dc:creator>Matteo Bertozzi</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Google Maps]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[WebKit]]></category>

		<guid isPermaLink="false">http://th30z.netsons.org/?p=512</guid>
		<description><![CDATA[Following the Google StreetView post, another example on How Cocoa Application can Interact with Google. Today the WebKit shows Google Maps.

Like iPhoto &#8216;09 you can select you Map Type (Terrain, Satellite, Hybrid) and you can Zoom In or Zoom Out using controls of your Application.

You can Find the Source Code Here: Cocoa Google Maps.
]]></description>
			<content:encoded><![CDATA[<p>Following the <a href="http://th30z.netsons.org/2009/01/webkit-google-streetview/">Google StreetView</a> post, another example on How Cocoa Application can Interact with Google. Today the WebKit shows Google Maps.<br />
<a href="http://th30z.netsons.org/wp-content/uploads/cocoa-googlemaps-alisoviejo.png"><img src="http://th30z.netsons.org/wp-content/uploads/cocoa-googlemaps-alisoviejo-350x265.png" alt="Cocoa Google Maps - Aliso Viejo" title="Cocoa Google Maps - Aliso Viejo" width="350" height="265" class="aligncenter size-medium wp-image-513" /></a><br />
Like iPhoto &#8216;09 you can select you Map Type (Terrain, Satellite, Hybrid) and you can Zoom In or Zoom Out using controls of your Application.<br />
<a href="http://th30z.netsons.org/wp-content/uploads/cocoa-googlemaps-redwood.png"><img src="http://th30z.netsons.org/wp-content/uploads/cocoa-googlemaps-redwood-350x276.png" alt="Cocoa Google Maps - Red Wood" title="Cocoa Google Maps - Red Wood" width="350" height="276" class="aligncenter size-medium wp-image-514" /></a><br />
You can Find the Source Code Here: <a href='http://th30z.netsons.org/wp-content/uploads/cocoa-googlemaps.zip'>Cocoa Google Maps</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://th30z.netsons.org/2009/02/webkit-google-maps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WebKit: Google StreetView</title>
		<link>http://th30z.netsons.org/2009/01/webkit-google-streetview/</link>
		<comments>http://th30z.netsons.org/2009/01/webkit-google-streetview/#comments</comments>
		<pubDate>Sat, 17 Jan 2009 08:56:38 +0000</pubDate>
		<dc:creator>Matteo Bertozzi</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[StreetView]]></category>
		<category><![CDATA[WebKit]]></category>

		<guid isPermaLink="false">http://th30z.netsons.org/?p=469</guid>
		<description><![CDATA[Last iPhoto &#8216;09 presented at MacWorld contains a couple of interesting Features: Faces and Places. Today, I&#8217;ve a little bit of free time to play with my Mac, and the topic is How to embed Google StreetView into a Cocoa Application.

The Solution is using WebKit and Google Maps API. We&#8217;ve a simple HTML file that [...]]]></description>
			<content:encoded><![CDATA[<p>Last <a href="http://www.apple.com/ilife/iphoto/">iPhoto</a> &#8216;09 presented at MacWorld contains a couple of interesting Features: Faces and Places. Today, I&#8217;ve a little bit of free time to play with my Mac, and the topic is How to embed <a href="http://maps.google.com/help/maps/streetview/">Google StreetView</a> into a Cocoa Application.<br />
<a href="http://th30z.netsons.org/wp-content/uploads/cocoa-streetview-cuppertino.png"><img class="aligncenter size-medium wp-image-466" title="Cocoa Streetview Cuppertino" src="http://th30z.netsons.org/wp-content/uploads/cocoa-streetview-cuppertino-350x276.png" alt="Cocoa Streetview Cuppertino" width="350" height="276" /></a><br />
The Solution is using WebKit and <a href="http://code.google.com/apis/maps/">Google Maps API</a>. We&#8217;ve a simple HTML file that contains StreetView &#8220;Canvas&#8221; and a couple of javascript methods that interact with GStreetviewPanorama Object.<br />
<a href="http://th30z.netsons.org/wp-content/uploads/cocoa-streetview-sanfrancisco.png"><img class="aligncenter size-medium wp-image-467" title="Cocoa Streetview San Francisco" src="http://th30z.netsons.org/wp-content/uploads/cocoa-streetview-sanfrancisco-350x276.png" alt="Cocoa Streetview San Francisco" width="350" height="276" /></a><br />
The Source Code is Available Here: <a href='http://th30z.netsons.org/wp-content/uploads/googlestreetview.zip'>Cocoa StreetView Source</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://th30z.netsons.org/2009/01/webkit-google-streetview/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>WebKit: Dynamic Content</title>
		<link>http://th30z.netsons.org/2008/12/webkit-dynamic-content/</link>
		<comments>http://th30z.netsons.org/2008/12/webkit-dynamic-content/#comments</comments>
		<pubDate>Sat, 06 Dec 2008 10:42:57 +0000</pubDate>
		<dc:creator>Matteo Bertozzi</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[WebKit]]></category>

		<guid isPermaLink="false">http://th30z.netsons.org/?p=427</guid>
		<description><![CDATA[Today I&#8217;ve played a bit with WebKit. I Want do something like Cocoa VBox View and NSScrollView but with more flexibility. Below you can see the example result.

The interesting part of this example is How to manage WebKit content,  and how to add something dynamically.
I use webView:decidePolicyForNavigationAction:request:frame:decisionListener: of WebPolicyDelegate Protocol to handle my custom [...]]]></description>
			<content:encoded><![CDATA[<p>Today I&#8217;ve played a bit with <strong>WebKit</strong>. I Want do something like <a href="http://th30z.netsons.org/2008/11/cocoa-vbox-view-and-nsscrollview/">Cocoa VBox View and NSScrollView</a> but with more flexibility. Below you can see the example result.</p>
<p><a href="http://th30z.netsons.org/wp-content/uploads/webkitdynamiccontent.png"  title="WebKit Dynamic Content"><img src="http://th30z.netsons.org/wp-content/uploads/webkitdynamiccontent.png" alt="WebKit Dynamic Content" title="WebKit Dynamic Content" width="597" height="394" class="aligncenter size-full wp-image-424" /></a></p>
<p>The interesting part of this example is How to manage WebKit content,  and how to add something dynamically.</p>
<p>I use <em>webView:decidePolicyForNavigationAction:request:frame:decisionListener:</em> of <strong>WebPolicyDelegate Protocol</strong> to handle my custom requests, in this way&#8230;</p>
<pre>
- (void)webView:(WebView *)sender
    decidePolicyForNavigationAction:(NSDictionary *)actionInformation
   request:(NSURLRequest *)request frame:(WebFrame *)frame
   decisionListener:(id)listener
{
    if ([[[request URL] path] isEqualToString:@"PATH to Handle"]) {
        [listener ignore];
        // Handle Request
    } else {
         [listener use];
    }
}
</pre>
<p>&#8230;Then with a little bit of JavaScript I&#8217;ll set my dynamic content loaded from Database or somewhere else.</p>
<pre>
NSArray *args = [NSArray arrayWithObjects:@"Item1Content",
                                  @"Hi, I'm Test 1 Content", nil];
[[webKit windowScriptObject] callWebScriptMethod:@"fillElement"
                               withArguments:args];
</pre>
<p>The <strong>fillElement</strong> method is a simple JS function like this <em>document.getElementById(elem).innerHTML = data;</em></p>
<p>Here you can find the <a href="http://th30z.netsons.org/wp-content/uploads/testwebkit.zip">Source Code</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://th30z.netsons.org/2008/12/webkit-dynamic-content/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cocoa: Sidebar with Badges</title>
		<link>http://th30z.netsons.org/2008/12/cocoa-sidebar-with-badges/</link>
		<comments>http://th30z.netsons.org/2008/12/cocoa-sidebar-with-badges/#comments</comments>
		<pubDate>Tue, 02 Dec 2008 05:31:11 +0000</pubDate>
		<dc:creator>Matteo Bertozzi</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Mac OS X]]></category>

		<guid isPermaLink="false">http://th30z.netsons.org/?p=402</guid>
		<description><![CDATA[Yesterday, I&#8217;ve written a simple Sidebar controller that can saves you some time and trouble with Cocoa Source List. Nodes and Folders can be drag and dropped into other folders or near other items and you can easily set badges on nodes.
/p>
You can find the example Source Code Here.
And below you can see hot to [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday, I&#8217;ve written a simple Sidebar controller that can saves you some time and trouble with Cocoa Source List. Nodes and Folders can be drag and dropped into other folders or near other items and you can easily set badges on nodes.<br />
<div id="attachment_403" class="wp-caption aligncenter" style="width: 284px"><a href="http://th30z.netsons.org/wp-content/uploads/cocoa-sidebar.png"><img src="http://th30z.netsons.org/wp-content/uploads/cocoa-sidebar.png" alt="Cocoa Sidebar" title="Cocoa Sidebar" width="274" height="403" class="size-full wp-image-403" /></a><p class="wp-caption-text">Cocoa Sidebar</p></div></p>
<p>You can find the example <a href="http://th30z.netsons.org/wp-content/uploads/cocoa-sidebar.zip">Source Code</a> Here.</p>
<p>And below you can see hot to add folders, nodes and set badges.</p>
<pre>
- (void)populateOutlineContents:(id)inObject {
  NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

  [sidebar addRootFolder:@"1" name:@"DEVICES"];
  [sidebar addChild:@"1.1" name:@"Machintosh HD"
               icon:[NSImage imageNamed:NSImageNameComputer]
             action:@selector(buttonPres:) target:self];

  [sidebar addRootFolder:@"2" name:@"PLACES"];
  [sidebar addChild:@"2.1"
                url:NSHomeDirectory()
             action:@selector(buttonPres:) target:self];

  [sidebar addRootFolder:@"3" name:@"OTHER."];
  [sidebar addChild:@"3.1" name:@"Bonjour"
               icon:[NSImage imageNamed:NSImageNameBonjour]
             action:@selector(buttonPres:) target:self];
  [sidebar addChild:@"3.2" name:@"Users"
               icon:[NSImage imageNamed:NSImageNameUserGroup]
             action:@selector(buttonPres:) target:self];

  [sidebar clearSelection];

  // Add Badge to Node with Key
  [sidebar setBadge:@"2.1" count:5];
  [sidebar setBadge:@"3.2" count:7];

  [pool release];
}

- (void)buttonPres:(id)sender {
  NSLog(@"Button Press %@", [sender nodeTitle]);
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://th30z.netsons.org/2008/12/cocoa-sidebar-with-badges/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Objective-C: SQLite Wrapper</title>
		<link>http://th30z.netsons.org/2008/11/objective-c-sqlite-wrapper/</link>
		<comments>http://th30z.netsons.org/2008/11/objective-c-sqlite-wrapper/#comments</comments>
		<pubDate>Fri, 28 Nov 2008 06:41:15 +0000</pubDate>
		<dc:creator>Matteo Bertozzi</dc:creator>
				<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[SQLite]]></category>

		<guid isPermaLink="false">http://th30z.netsons.org/?p=317</guid>
		<description><![CDATA[I&#8217;ve written a simple SQLite Wrapper with two Examples one for Mac and one for the iPhone. The Wrapper class has the same source code for both platforms.
Here you can find the Mac Example Source Code and the iPhone Example Source Code.

This is a simple usage example:

Sqlite *sqlite = [[Sqlite alloc] init];

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
 [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve written a simple SQLite Wrapper with two Examples one for Mac and one for the iPhone. <em>The Wrapper class has the same source code for both platforms</em>.</p>
<p>Here you can find the <a href="http://th30z.netsons.org/wp-content/uploads/mac-testsqlite.zip">Mac Example Source Code</a> and the <a href="http://th30z.netsons.org/wp-content/uploads/iphone-testsqlite.zip">iPhone Example Source Code</a>.</p>
<div><a href="http://th30z.netsons.org/wp-content/uploads/iphonesqlitetest.png"><img src="http://th30z.netsons.org/wp-content/uploads/iphonesqlitetest-188x350.png" alt="iPhone Test SQLite App" title="iPhone Test SQLite App" width="188" height="350" class="aligncenter size-medium wp-image-318" /></a></div>
<p>This is a simple usage example:</p>
<pre>
Sqlite *sqlite = [[Sqlite alloc] init];

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
                             NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *writableDBPath = [documentsDirectory
                        stringByAppendingPathComponent:@"SQLiteTest.db"];
if (![sqlite open:writableDBPath])
  return;

[sqlite executeNonQuery:@"CREATE TABLE test (key TEXT NOT NULL, value TEXT);"];
[sqlite executeNonQuery:@"DELETE FROM test;"];
[sqlite executeNonQuery:@"INSERT INTO test VALUES (?, ?);",
                        [Sqlite createUuid], @"PROVA"];
[sqlite executeNonQuery:@"INSERT INTO test VALUES (?, ?);",
                         [Sqlite createUuid], @"PROVA 2"];
[sqlite executeNonQuery:@"INSERT INTO test VALUES (?, ?);",
                         [Sqlite createUuid], @"PROVA 3"];

NSArray *results = [sqlite executeQuery:@"SELECT * FROM test;"];
for (NSDictionary *dictionary in results) {
  NSLog(@"Row");
  for (NSString *key in [dictionary keyEnumerator])
      NSLog(@" - %@ %@", key, [dictionary objectForKey:key]);
}

[results release];
[sqlite release];
</pre>
]]></content:encoded>
			<wfw:commentRss>http://th30z.netsons.org/2008/11/objective-c-sqlite-wrapper/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Cocoa: VBox View and NSScrollView</title>
		<link>http://th30z.netsons.org/2008/11/cocoa-vbox-view-and-nsscrollview/</link>
		<comments>http://th30z.netsons.org/2008/11/cocoa-vbox-view-and-nsscrollview/#comments</comments>
		<pubDate>Sun, 16 Nov 2008 09:19:11 +0000</pubDate>
		<dc:creator>Matteo Bertozzi</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[NSScrollView]]></category>
		<category><![CDATA[NSView]]></category>

		<guid isPermaLink="false">http://th30z.netsons.org/?p=299</guid>
		<description><![CDATA[Following the post of yesterday, today I&#8217;ve implemented a simple VBoxView (Vertical Box Layout) that allow you to lines up NSViews vertically.
br />
Here you can find the example Source Code.
]]></description>
			<content:encoded><![CDATA[<p>Following the post of yesterday, today I&#8217;ve implemented a simple VBoxView (Vertical Box Layout) that allow you to lines up NSViews vertically.<br />
<div id="attachment_300" class="wp-caption aligncenter" style="width: 567px"><a href="http://th30z.netsons.org/wp-content/uploads/cocoascrollablensview.png"><img src="http://th30z.netsons.org/wp-content/uploads/cocoascrollablensview.png" alt="Cocoa Scrollable NSViews VBox" title="Cocoa Scrollable NSViews VBox" width="557" height="329" class="size-full wp-image-300" /></a><p class="wp-caption-text">Cocoa Scrollable NSViews VBox</p></div><br />
Here you can find the example <a href="http://th30z.netsons.org/wp-content/uploads/cocoavboxscrollview.zip">Source Code</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://th30z.netsons.org/2008/11/cocoa-vbox-view-and-nsscrollview/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
