<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Seaside</title>
	
	<link>http://blog.blackwhale.at</link>
	<description>A weblog by Blackwhale about design, code and random stuff we care about.</description>
	<lastBuildDate>Mon, 04 Jan 2010 17:28:09 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Seaside" /><feedburner:info uri="seaside" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Hide iPhone status bar</title>
		<link>http://feedproxy.google.com/~r/Seaside/~3/zUz_Ta9wLjw/</link>
		<comments>http://blog.blackwhale.at/2009/12/hide-iphone-status-bar/#comments</comments>
		<pubDate>Mon, 28 Dec 2009 17:25:56 +0000</pubDate>
		<dc:creator>Andreas</dc:creator>
				<category><![CDATA[I talk code]]></category>
		<category><![CDATA[iPhone OS]]></category>
		<category><![CDATA[hide status bar]]></category>
		<category><![CDATA[plist settings]]></category>
		<category><![CDATA[status bar]]></category>

		<guid isPermaLink="false">http://blog.blackwhale.at/?p=467</guid>
		<description><![CDATA[Hi folks,
today something very short and simple. There are two ways to hide your status bar within your iPhone app:

Programmatically

...
//use this whereever you want
&#91;&#91;UIApplication sharedApplication&#93; setStatusBarHidden:YES
                              [...]]]></description>
			<content:encoded><![CDATA[<p>Hi folks,</p>
<p>today something very short and simple. There are two ways to hide your status bar within your iPhone app:</p>
<ol>
<li>Programmatically

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;">...
<span style="color: #11740a; font-style: italic;">//use this whereever you want</span>
<span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIApplication sharedApplication<span style="color: #002200;">&#93;</span> setStatusBarHidden<span style="color: #002200;">:</span><span style="color: #a61390;">YES</span>
                                   animated<span style="color: #002200;">:</span><span style="color: #a61390;">NO</span><span style="color: #002200;">&#93;</span>;
...</pre></div></div>

</li>
<li>Configuration of your Info.plist (seen in SDK 3.1.2)<br />
Just add a new line to your <code>"your project name"-Info.plist</code> file and select <code>"Status bar is initially hidden"</code> like in the picture below.<br />
<img class="aligncenter size-full wp-image-468" title="Configuration to hide status bar" src="http://blog.blackwhale.at/wp-content/uploads/2010/01/Bildschirmfoto-2010-01-04-um-18.17.26.png" alt="" width="451" height="229" /></li>
</ol>
<p>Thats pretty all! Have fun,<br />
Andreas</p>

<p><a href="http://feedads.g.doubleclick.net/~a/ae2vy8J6dkUv6qrDspC1gBmSjlA/0/da"><img src="http://feedads.g.doubleclick.net/~a/ae2vy8J6dkUv6qrDspC1gBmSjlA/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/ae2vy8J6dkUv6qrDspC1gBmSjlA/1/da"><img src="http://feedads.g.doubleclick.net/~a/ae2vy8J6dkUv6qrDspC1gBmSjlA/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Seaside?a=zUz_Ta9wLjw:ude3o0GltZY:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Seaside?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Seaside?a=zUz_Ta9wLjw:ude3o0GltZY:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Seaside?i=zUz_Ta9wLjw:ude3o0GltZY:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Seaside?a=zUz_Ta9wLjw:ude3o0GltZY:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/Seaside?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Seaside/~4/zUz_Ta9wLjw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.blackwhale.at/2009/12/hide-iphone-status-bar/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://blog.blackwhale.at/2009/12/hide-iphone-status-bar/</feedburner:origLink></item>
		<item>
		<title>Custom video/camera overlay view on the iPhone</title>
		<link>http://feedproxy.google.com/~r/Seaside/~3/xXR9x5XMow8/</link>
		<comments>http://blog.blackwhale.at/2009/10/custom-video-overlay-view-on-the-iphone/#comments</comments>
		<pubDate>Sat, 24 Oct 2009 16:42:03 +0000</pubDate>
		<dc:creator>Andreas</dc:creator>
				<category><![CDATA[I talk code]]></category>
		<category><![CDATA[iPhone OS]]></category>
		<category><![CDATA[camera overlay]]></category>
		<category><![CDATA[UIImagePicker]]></category>
		<category><![CDATA[UIImagePickerController]]></category>
		<category><![CDATA[video capturing]]></category>
		<category><![CDATA[video overlay]]></category>

		<guid isPermaLink="false">http://blog.blackwhale.at/?p=443</guid>
		<description><![CDATA[Today I am going to show how we can add a custom overlay view to the standard iPhone video capturing functionality. First of all I have to say, that since the iPhone OS 3.1 is published, a custom overlay is really simple to achive. There are only a few steps you have to do:


Create a [...]]]></description>
			<content:encoded><![CDATA[<p>Today I am going to show how we can add a custom overlay view to the standard iPhone video capturing functionality. First of all I have to say, that since the iPhone OS 3.1 is published, a custom overlay is really simple to achive. There are only a few steps you have to do:<br />
<span id="more-443"></span></p>
<ol>
<li>Create a custom view with a transparent background.</li>
<li>Add controls and/or images to the custom view as you like.</li>
<li>Get a new instance of the UIImagePickerController (picker).</li>
<li>Set the source type of the picker to video source.</li>
<li>Hide unneccesary controls of the picker.</li>
<li>Make the video image full-size (if you wish to).</li>
<li>Set your custom overlay and present the picker.</li>
</ol>
<p>To prove that it is really so simple, I worked out an example for you, which adds a small image and a button to the custom overlay and shows this overlay on the image picker. In my example I didn&#8217;t add any functionality to keep it simple and straightforward.</p>
<p>First of all I subclassed UIView for my own custom Overlay view called OverlayView. In this custom overlay I simply added a small image and a button which will sketch the possibility of scanning a marked region within the video preview.</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #a61390;">@implementation</span> OverlayView
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span>initWithFrame<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>CGRect<span style="color: #002200;">&#41;</span>frame <span style="color: #002200;">&#123;</span>
    <span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span>self <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>super initWithFrame<span style="color: #002200;">:</span>frame<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
        <span style="color: #11740a; font-style: italic;">//clear the background color of the overlay</span>
        self.opaque <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;
        self.backgroundColor <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>UIColor clearColor<span style="color: #002200;">&#93;</span>;
&nbsp;
        <span style="color: #11740a; font-style: italic;">//load an image to show in the overlay</span>
        UIImage <span style="color: #002200;">*</span>searcher <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>UIImage imageNamed<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;searcher.png&quot;</span><span style="color: #002200;">&#93;</span>;
        UIImageView <span style="color: #002200;">*</span>searcherView <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIImageView alloc<span style="color: #002200;">&#93;</span> 
                            initWithImage<span style="color: #002200;">:</span>searcher<span style="color: #002200;">&#93;</span>;
        searcherView.frame <span style="color: #002200;">=</span> CGRectMake<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">30</span>, <span style="color: #2400d9;">100</span>, <span style="color: #2400d9;">260</span>, <span style="color: #2400d9;">200</span><span style="color: #002200;">&#41;</span>;
        <span style="color: #002200;">&#91;</span>self addSubview<span style="color: #002200;">:</span>searcherView<span style="color: #002200;">&#93;</span>;
        <span style="color: #002200;">&#91;</span>searcherView release<span style="color: #002200;">&#93;</span>;
&nbsp;
        <span style="color: #11740a; font-style: italic;">//add a simple button to the overview</span>
        <span style="color: #11740a; font-style: italic;">//with no functionality at the moment</span>
        UIButton <span style="color: #002200;">*</span>button <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>UIButton 
                            buttonWithType<span style="color: #002200;">:</span>UIButtonTypeRoundedRect<span style="color: #002200;">&#93;</span>;
        <span style="color: #002200;">&#91;</span>button setTitle<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Scan Now&quot;</span> forState<span style="color: #002200;">:</span>UIControlStateNormal<span style="color: #002200;">&#93;</span>;
        button.frame <span style="color: #002200;">=</span> CGRectMake<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">0</span>, <span style="color: #2400d9;">430</span>, <span style="color: #2400d9;">320</span>, <span style="color: #2400d9;">40</span><span style="color: #002200;">&#41;</span>;
        <span style="color: #002200;">&#91;</span>self addSubview<span style="color: #002200;">:</span>button<span style="color: #002200;">&#93;</span>;
    <span style="color: #002200;">&#125;</span>
    <span style="color: #a61390;">return</span> self;
<span style="color: #002200;">&#125;</span>
...
<span style="color: #a61390;">@end</span></pre></div></div>

<p>All I have to do now is to create a UIImagePickerController instance and customize all specific properties of it to show the overlay view on the video preview. This is very simple and the following code should be very easy to understand.</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">//create an overlay view instance</span>
OverlayView <span style="color: #002200;">*</span>overlay <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>OverlayView alloc<span style="color: #002200;">&#93;</span>
        initWithFrame<span style="color: #002200;">:</span>CGRectMake<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">0</span>, <span style="color: #2400d9;">0</span>, SCREEN_WIDTH, SCREEN_HEIGTH<span style="color: #002200;">&#41;</span><span style="color: #002200;">&#93;</span>;
&nbsp;
<span style="color: #11740a; font-style: italic;">//create a new image picker instance</span>
UIImagePickerController <span style="color: #002200;">*</span>picker <span style="color: #002200;">=</span> 
                <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIImagePickerController alloc<span style="color: #002200;">&#93;</span> init<span style="color: #002200;">&#93;</span>;
<span style="color: #11740a; font-style: italic;">//set source to video!</span>
picker.sourceType <span style="color: #002200;">=</span> UIImagePickerControllerSourceTypeCamera;
<span style="color: #11740a; font-style: italic;">//hide all controls</span>
picker.showsCameraControls <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;
picker.navigationBarHidden <span style="color: #002200;">=</span> <span style="color: #a61390;">YES</span>;
picker.toolbarHidden <span style="color: #002200;">=</span> <span style="color: #a61390;">YES</span>;
<span style="color: #11740a; font-style: italic;">//make the video preview full size</span>
picker.wantsFullScreenLayout <span style="color: #002200;">=</span> <span style="color: #a61390;">YES</span>;
picker.cameraViewTransform <span style="color: #002200;">=</span>
CGAffineTransformScale<span style="color: #002200;">&#40;</span>picker.cameraViewTransform,
            CAMERA_TRANSFORM_X,
            CAMERA_TRANSFORM_Y<span style="color: #002200;">&#41;</span>;
<span style="color: #11740a; font-style: italic;">//set our custom overlay view</span>
picker.cameraOverlayView <span style="color: #002200;">=</span> overlay;
&nbsp;
<span style="color: #11740a; font-style: italic;">//show picker</span>
<span style="color: #002200;">&#91;</span>self presentModalViewController<span style="color: #002200;">:</span>picker animated<span style="color: #002200;">:</span><span style="color: #a61390;">YES</span><span style="color: #002200;">&#93;</span>;</pre></div></div>

<p>The only things missing are my defines for the constants I am using, but I don&#8217;t wanna keep them away from you:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">//transform values for full screen support</span>
<span style="color: #6e371a;">#define CAMERA_TRANSFORM_X 1</span>
<span style="color: #6e371a;">#define CAMERA_TRANSFORM_Y 1.12412</span>
<span style="color: #11740a; font-style: italic;">//iphone screen dimensions</span>
<span style="color: #6e371a;">#define SCREEN_WIDTH  320</span>
<span style="color: #6e371a;">#define SCREEN_HEIGTH 480</span></pre></div></div>

<p>After all we get something like this:</p>
<p><img class="aligncenter size-full wp-image-451" title="video scanner" src="http://blog.blackwhale.at/wp-content/uploads/2009/10/IMG_0228.PNG" alt="video scanner" width="320" height="480" /></p>
<p>So, thats pretty all. Of course you have to add much more to get some functionality within your overlay, but this example was just a demonstration how easy it is to create your custom video preview overlay view.</p>
<p>Cheers,<br />
Andreas</p>

<p><a href="http://feedads.g.doubleclick.net/~a/PZl0T4zeJV4IIfnGaEfPbFfp1WI/0/da"><img src="http://feedads.g.doubleclick.net/~a/PZl0T4zeJV4IIfnGaEfPbFfp1WI/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/PZl0T4zeJV4IIfnGaEfPbFfp1WI/1/da"><img src="http://feedads.g.doubleclick.net/~a/PZl0T4zeJV4IIfnGaEfPbFfp1WI/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Seaside?a=xXR9x5XMow8:dWLou2kYpLg:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Seaside?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Seaside?a=xXR9x5XMow8:dWLou2kYpLg:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Seaside?i=xXR9x5XMow8:dWLou2kYpLg:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Seaside?a=xXR9x5XMow8:dWLou2kYpLg:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/Seaside?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Seaside/~4/xXR9x5XMow8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.blackwhale.at/2009/10/custom-video-overlay-view-on-the-iphone/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		<feedburner:origLink>http://blog.blackwhale.at/2009/10/custom-video-overlay-view-on-the-iphone/</feedburner:origLink></item>
		<item>
		<title>How to set up your Mac for Rails Development</title>
		<link>http://feedproxy.google.com/~r/Seaside/~3/QLzn71fKJmo/</link>
		<comments>http://blog.blackwhale.at/2009/09/set-up-your-mac-for-rails-development/#comments</comments>
		<pubDate>Tue, 15 Sep 2009 15:18:37 +0000</pubDate>
		<dc:creator>Christian</dc:creator>
				<category><![CDATA[Infrastructure]]></category>
		<category><![CDATA[ImageMagick]]></category>
		<category><![CDATA[Leopard]]></category>
		<category><![CDATA[Mac OS]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[MacPorts]]></category>
		<category><![CDATA[pg]]></category>
		<category><![CDATA[Phusion Passenger]]></category>
		<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[rubygems]]></category>
		<category><![CDATA[Snow Leopard]]></category>
		<category><![CDATA[SQLite3]]></category>
		<category><![CDATA[SSH Keys]]></category>
		<category><![CDATA[TextMate]]></category>

		<guid isPermaLink="false">http://blog.blackwhale.at/?p=175</guid>
		<description><![CDATA[<p>In this post I will guide you through everything necessary to get your freshly set up Mac ready for Ruby on Rails Development.</p>
<p>Things we'll install:</p>
  <ul>
    <li><a href="#Xcode">Xcode</a></li>
    <li><a href="#MacPorts">MacPorts</a>
      <ul>
        <li>Git</li>
        <li>Ruby</li>
        <li>SQLite3</li>
        <li>ImageMagick</li>
      </ul>
    </li>
    <li><a href="#TextMate">TextMate</a></li>
    <li><a href="#Passenger">Phusion Passenger</a></li>
    <li><a href="#SSH-Keys">SSH Keys</a></li>
  </ul>]]></description>
			<content:encoded><![CDATA[<p>In this post I will guide you through everything necessary to get your freshly set up Mac &#8212; using Leopard or Snow Leopard &#8212; ready for Ruby on Rails Development.</p>
<p>Things we&#8217;ll install:</p>
<ul>
<li><a href="#Xcode">Xcode</a></li>
<li><a href="#MacPorts">MacPorts</a>
<ul>
<li>Git</li>
<li>Ruby</li>
<li>SQLite3</li>
<li>ImageMagick</li>
</ul>
</li>
<li><a href="#PostgreSQL">PostgreSQL</a></li>
<li><a href="#TextMate">TextMate</a></li>
<li><a href="#Passenger">Phusion Passenger</a></li>
<li><a href="#SSH-Keys">SSH Keys</a></li>
</ul>
<p><span id="more-175"></span></p>
<h3><a name="Xcode">Xcode Tools</a></h3>
<p>Install XCode Tools from your MacOS Install Disc&#8217;s &#8220;Optional Installs&#8221; Folder:</p>
<p><img src="http://blog.blackwhale.at/wp-content/uploads/2009/07/Optional-Installs.png" alt="Install Xcode from your Mac OS X Install disc&#039;s &#039;Optional Installs&#039; folder" title="optional installs" width="512" height="156" class="size-full wp-image-410" /></p>
<p>Or, if you don&#8217;t have your Mac OS Install disc handy, you can download the latest version of Xcode Tools from <a href="http://developer.apple.com/technology/Xcode.html">Apple Developer Connection</a> (free Registration required). </p>
<h3><a name="MacPorts">MacPorts</a></h3>
<p>Get the latest version from the <a href="http://www.macports.org/install.php">MacPorts</a> site. Download the disk image for your version of Mac OS X and install MacPorts.</p>
<p>After the installation is complete, open a Terminal and make sure that the <code>port</code> command is available by reloading <code>/etc/profile</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">. <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>profile</pre></div></div>

<p>Update your ports database using</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> port selfupdate</pre></div></div>

<p>Then, install all the necessary ports:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> port <span style="color: #c20cb9; font-weight: bold;">install</span> git-core +<span style="color: #c20cb9; font-weight: bold;">svn</span> ruby rb-rubygems sqlite3 ImageMagick</pre></div></div>

<h3><a name="PostgreSQL">PostgreSQL</a></h3>
<p>While MacPorts is building and installing packages, download <a href="http://postgresqlformac.com/lists/downloads/unified_installer_disk_imag/">PostgreSQL for Mac</a> and start the &#8216;PostgreSQL for Mac&#8217; installer in the &#8216;Server&#8217; directory.</p>
<p><img src="http://blog.blackwhale.at/wp-content/uploads/2009/07/Server.png" alt="Install PostgreSQL Server" title="Install PostgreSQL Server" width="515" height="416" class="alignnone size-full wp-image-402" /></p>
<p>After installing PostgreSQL Server, add a database role for your user account:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #660033;">-u</span> postgres <span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>PostgreSQL8<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>createuser</pre></div></div>

<p>Enter your Mac OS X system user name as role name, and make it a superuser.</p>
<p><img src="http://blog.blackwhale.at/wp-content/uploads/2009/07/Terminal-—-zsh-—-⌘3.png" alt="Add postgres user role" title="Add postgres user role" width="471" height="84" class="alignnone size-full wp-image-403" /></p>
<h3><a name="TextMate">TextMate</a></h3>
<p>Download and install the latest version from the <a href="http://macromates.com">TextMate</a> site.</p>
<h4>TextMate Bundles</h4>
<p>To make sure that the bundle installation runs smoothly, make sure that the <code>Bundles</code> directory exists on your machine:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> ~<span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>Application\ Support<span style="color: #000000; font-weight: bold;">/</span>TextMate<span style="color: #000000; font-weight: bold;">/</span>Bundles</pre></div></div>

<p>Install Bundles for Git, Ruby on Rails, RSpec, Cucmber, Webrat, Sass and Haml:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">git clone git:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>timcharper<span style="color: #000000; font-weight: bold;">/</span>git-tmbundle.git ~<span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>Application\ Support<span style="color: #000000; font-weight: bold;">/</span>TextMate<span style="color: #000000; font-weight: bold;">/</span>Bundles<span style="color: #000000; font-weight: bold;">/</span>Git.tmbundle
git clone git:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>drnic<span style="color: #000000; font-weight: bold;">/</span>ruby-on-rails-tmbundle.git ~<span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>Application\ Support<span style="color: #000000; font-weight: bold;">/</span>TextMate<span style="color: #000000; font-weight: bold;">/</span>Bundles<span style="color: #000000; font-weight: bold;">/</span>Ruby\ on\ Rails.tmbundle
git clone git:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>dchelimsky<span style="color: #000000; font-weight: bold;">/</span>rspec-tmbundle.git ~<span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>Application\ Support<span style="color: #000000; font-weight: bold;">/</span>TextMate<span style="color: #000000; font-weight: bold;">/</span>Bundles<span style="color: #000000; font-weight: bold;">/</span>RSpec.tmbundle
git clone git:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>bmabey<span style="color: #000000; font-weight: bold;">/</span>cucumber-tmbundle.git ~<span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>Application\ Support<span style="color: #000000; font-weight: bold;">/</span>TextMate<span style="color: #000000; font-weight: bold;">/</span>Bundles<span style="color: #000000; font-weight: bold;">/</span>Cucumber.tmbundle
git clone git:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>bmabey<span style="color: #000000; font-weight: bold;">/</span>webrat-tmbundle.git ~<span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>Application\ Support<span style="color: #000000; font-weight: bold;">/</span>TextMate<span style="color: #000000; font-weight: bold;">/</span>Bundles<span style="color: #000000; font-weight: bold;">/</span>Webrat.tmbundle
git clone git:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>aussiegeek<span style="color: #000000; font-weight: bold;">/</span>ruby-sass-tmbundle.git ~<span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>Application\ Support<span style="color: #000000; font-weight: bold;">/</span>TextMate<span style="color: #000000; font-weight: bold;">/</span>Bundles<span style="color: #000000; font-weight: bold;">/</span>Ruby\ Sass.tmbundle
git clone git:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>canadadrugs<span style="color: #000000; font-weight: bold;">/</span>ruby-haml-tmbundle.git ~<span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>Application\ Support<span style="color: #000000; font-weight: bold;">/</span>TextMate<span style="color: #000000; font-weight: bold;">/</span>Bundles<span style="color: #000000; font-weight: bold;">/</span>Ruby\ Haml.tmbundle</pre></div></div>

<p>You can also install my TextMate bundle containing commands to restart Passenger, reformat Ruby code and update all your bundles via Git:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">git clone git:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>inz<span style="color: #000000; font-weight: bold;">/</span>inz-tmbundle.git ~<span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>Application\ Support<span style="color: #000000; font-weight: bold;">/</span>TextMate<span style="color: #000000; font-weight: bold;">/</span>Bundles<span style="color: #000000; font-weight: bold;">/</span>inz.tmbundle</pre></div></div>

<p>Finally, tell TextMate to reload all bundles:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">osascript <span style="color: #660033;">-e</span> <span style="color: #ff0000;">'tell app &quot;TextMate&quot; to reload bundles'</span></pre></div></div>

<h3>Rubygems</h3>
<p>Make sure you have the latest version of Rubygems:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> gem update <span style="color: #660033;">--system</span></pre></div></div>

<h4>SQLite3</h4>
<p>SQLite3 needs some special attention to install properly.</p>
<p>To install SQLite3 on <em>Mac OS X 10.5 Leopard</em>:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">env</span> <span style="color: #007800;">ARCHFLAGS</span>=<span style="color: #ff0000;">&quot;-arch i386&quot;</span> gem <span style="color: #c20cb9; font-weight: bold;">install</span> sqlite3-ruby <span style="color: #660033;">--</span> <span style="color: #660033;">--with-sqlite3-dir</span>=<span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">local</span></pre></div></div>

<p>If you are using <em>Mac OS X 10.6 Snow Leopard</em>, install like so:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> gem <span style="color: #c20cb9; font-weight: bold;">install</span> sqlite3-ruby <span style="color: #660033;">--</span> <span style="color: #660033;">--with-sqlite3-dir</span>=<span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">local</span></pre></div></div>

<h4>PostgreSQL</h4>
<p>The PostgreSQL gem will also not install without special treatment, install it using this command:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">env</span> <span style="color: #007800;">PATH</span>=<span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>PostgreSQL8<span style="color: #000000; font-weight: bold;">/</span>bin:<span style="color: #007800;">$PATH</span> gem <span style="color: #c20cb9; font-weight: bold;">install</span> pg</pre></div></div>

<h4>Rails and all the Rest</h4>
<p>The other gems necessary for your development setup will happily install without any further issues:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> gem <span style="color: #c20cb9; font-weight: bold;">install</span> rails haml rspec rspec-rails cucumber capistrano capistrano-ext</pre></div></div>

<h3><a name="Passenger">Phusion Passenger and Passenger PrefPane</a></h3>
<p>To keep your development environment one step closer to your deployment setup, you can use <a href="http://modrails.com">Phusion Passenger</a> for development. And with the <a href="http://www.fngtps.com/passenger-preference-pane">Passenger PrefPane</a> you even get a pretty interface for that!</p>
<p>Install passenger:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> gem <span style="color: #c20cb9; font-weight: bold;">install</span> passenger</pre></div></div>

<p>Then, install the Apache module using</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> passenger-install-apache2-module</pre></div></div>

<p>After the installation of the module, follow the directions and load the passenger module in your <code>/etc/apache2/httpd.conf</code>.</p>
<p>To make future updates a little easier you can create a config file in <code>/etc/apache2/other</code>, and it will be loaded automatically.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">mate <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>apache2<span style="color: #000000; font-weight: bold;">/</span>other<span style="color: #000000; font-weight: bold;">/</span>passenger.conf</pre></div></div>

<p>and copy the directives from the Passenger installation into the file.</p>
<p>Or, if you like the command line, you can also add the file like so:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">sh</span> <span style="color: #660033;">-c</span> <span style="color: #ff0000;">&quot;cat &gt;/etc/apache2/other/passenger.conf &lt;&lt;EOT
LoadModule passenger_module /opt/local/lib/ruby/gems/1.8/gems/passenger-2.2.5/ext/apache2/mod_passenger.so
PassengerRoot /opt/local/lib/ruby/gems/1.8/gems/passenger-2.2.5
PassengerRuby /opt/local/bin/ruby
EOT&quot;</span></pre></div></div>

<p><!-- " --></p>
<p>The command above can then be reused whenever you update the passenger gem, replacing the updated version number.</p>
<h4>Passenger PrefPane</h4>
<p>To simplify development using passenger you can download and install the <a href="http://www.fngtps.com/passenger-preference-pane">Passenger PrefPane</a>. It will automatically add the necessary directives to the Apache configuration, so you should be able to use Passenger right away.</p>
<h3><a name="SSH-Keys">SSH Keys</a></h3>
<p>If you&#8217;re developing and/or deploying web applications, chances are you need a pair of SSH keys for public key-based login to your servers.</p>
<p>Generate a pair of keys using:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ssh-keygen</span></pre></div></div>

<p>Install the keys into the default location and follow the instructions.</p>
<p>To use the key to log in to your servers, copy it to the clipboard using:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">cat</span> ~<span style="color: #000000; font-weight: bold;">/</span>.ssh<span style="color: #000000; font-weight: bold;">/</span>id_rsa.pub <span style="color: #000000; font-weight: bold;">|</span> pbcopy</pre></div></div>

<p>Then, log in to your servers and append the key to <code>~/.ssh/authorized_keys</code> for every account you want to log in with.</p>
<p>If you have a set of SSH keys backed up from previous installations, you can of course use these as well. Just be sure to set the correct permissions on the copied files (be sure to use your Mac OS username in the command below):</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">chown</span> <span style="color: #660033;">-R</span> inz:staff ~<span style="color: #000000; font-weight: bold;">/</span>.ssh
<span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">600</span> ~<span style="color: #000000; font-weight: bold;">/</span>.ssh<span style="color: #000000; font-weight: bold;">/</span>id_rsa
<span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">644</span> ~<span style="color: #000000; font-weight: bold;">/</span>.ssh<span style="color: #000000; font-weight: bold;">/</span>id_rsa.pub</pre></div></div>

<p>If you&#8217;ve followed the instructions you should now have a Mac fully set up for all your Rails development needs.</p>
<p>Let me know in the comments what worked for you what did not, so I can keep this guide up to date.</p>
<p>Thanks, have fun<br />
  C.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/87Ar0fSusuOWgKvLBNwjNYtnyfk/0/da"><img src="http://feedads.g.doubleclick.net/~a/87Ar0fSusuOWgKvLBNwjNYtnyfk/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/87Ar0fSusuOWgKvLBNwjNYtnyfk/1/da"><img src="http://feedads.g.doubleclick.net/~a/87Ar0fSusuOWgKvLBNwjNYtnyfk/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Seaside?a=QLzn71fKJmo:z_1GhJsmFhE:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Seaside?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Seaside?a=QLzn71fKJmo:z_1GhJsmFhE:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Seaside?i=QLzn71fKJmo:z_1GhJsmFhE:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Seaside?a=QLzn71fKJmo:z_1GhJsmFhE:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/Seaside?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Seaside/~4/QLzn71fKJmo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.blackwhale.at/2009/09/set-up-your-mac-for-rails-development/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://blog.blackwhale.at/2009/09/set-up-your-mac-for-rails-development/</feedburner:origLink></item>
		<item>
		<title>Set background image of UITableView</title>
		<link>http://feedproxy.google.com/~r/Seaside/~3/bvZ6mdjbMxo/</link>
		<comments>http://blog.blackwhale.at/2009/09/set-background-image-of-uitableview/#comments</comments>
		<pubDate>Mon, 14 Sep 2009 21:15:27 +0000</pubDate>
		<dc:creator>Andreas</dc:creator>
				<category><![CDATA[I talk code]]></category>
		<category><![CDATA[iPhone OS]]></category>
		<category><![CDATA[background]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[UITableView]]></category>

		<guid isPermaLink="false">http://blog.blackwhale.at/?p=368</guid>
		<description><![CDATA[How to set a background image of a UITableView is a very often and common question. Today we will try to answer this.
There are two ways to solve this problem:

Create a new UIView &#8211; lets call the view V &#8211; set the background image of V and embed a UITableView &#8211; lets call it TV [...]]]></description>
			<content:encoded><![CDATA[<p>How to set a background image of a UITableView is a very often and common question. Today we will try to answer this.</p>
<p>There are two ways to solve this problem:</p>
<ol>
<li>Create a new UIView &ndash; lets call the view V &ndash; set the background image of V and embed a UITableView &#8211; lets call it TV &#8211; within V. Now set the background color of TV to <code>[UIColor clearColor]</code> and do so for all UITableViewCells. Everything seems to work well but you have to handle some tasks (regarding the UITableView) on your own now like deselcting the currently selected UITableViewCell when returning from a prior pushed view.</li>
<li>The second approach requires less effort but creates a not so pretty side-effect. You can simply create a new UIView, set its background image and send this view to the back of the UITableView. If you do so the background image scrolls with the UITableView. So this solution should only be used if you do not have to many cells, i.e. to create a simple menu screen in a grouped style within your app.</li>
</ol>
<p>For those guys, implementing the second solution, the following code would be helpful. Put it i.e. in your <code>- (void) viewDidLoad;</code> method or further initialization of your view controller.</p>
<p><span id="more-368"></span></p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">//clear background color of uitableview</span>
self.view.backgroundColor <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>UIColor blackColor<span style="color: #002200;">&#93;</span>;
&nbsp;
<span style="color: #11740a; font-style: italic;">//create new uiview with a background image</span>
UIImage <span style="color: #002200;">*</span>backgroundImage <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>UIImage imageWithContentsOfFile<span style="color: #002200;">:</span>
				<span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSBundle</span> mainBundle<span style="color: #002200;">&#93;</span> 
				pathForResource<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;your_background&quot;</span> 
				ofType<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;png&quot;</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;
UIImageView <span style="color: #002200;">*</span>backgroundView <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIImageView alloc<span style="color: #002200;">&#93;</span> 
				initWithImage<span style="color: #002200;">:</span>backgroundImage<span style="color: #002200;">&#93;</span>;
&nbsp;
<span style="color: #11740a; font-style: italic;">//adjust the frame for the case of navigation or tabbars</span>
backgroundView.frame <span style="color: #002200;">=</span> CGRectMake<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">0</span>, <span style="color: #2400d9;">0</span>, <span style="color: #2400d9;">320</span>, <span style="color: #2400d9;">460</span><span style="color: #002200;">&#41;</span>;
&nbsp;
<span style="color: #11740a; font-style: italic;">//add background view and send it to the back</span>
<span style="color: #002200;">&#91;</span>self.view addSubview<span style="color: #002200;">:</span>backgroundView<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#91;</span>self.view sendSubviewToBack<span style="color: #002200;">:</span>backgroundView<span style="color: #002200;">&#93;</span>;
&nbsp;
<span style="color: #002200;">&#91;</span>backgroundView release<span style="color: #002200;">&#93;</span>;</pre></div></div>

<p>One more thing I should not forget to mention is that iPhone SDK Documentation recommends not to use transparent images, table views or cells. This kind of stuff consumes a lot of resources, so use it wisely and only when necessary (I know, for a pretty user interface it is often indispensable <img src='http://blog.blackwhale.at/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  ).</p>
<p>That&#8217;s all folks,<br />
Andreas</p>

<p><a href="http://feedads.g.doubleclick.net/~a/dN0SHNpDoRHwmxYsFKRVjC3BLhM/0/da"><img src="http://feedads.g.doubleclick.net/~a/dN0SHNpDoRHwmxYsFKRVjC3BLhM/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/dN0SHNpDoRHwmxYsFKRVjC3BLhM/1/da"><img src="http://feedads.g.doubleclick.net/~a/dN0SHNpDoRHwmxYsFKRVjC3BLhM/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Seaside?a=bvZ6mdjbMxo:i3gEYqmvqtg:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Seaside?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Seaside?a=bvZ6mdjbMxo:i3gEYqmvqtg:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Seaside?i=bvZ6mdjbMxo:i3gEYqmvqtg:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Seaside?a=bvZ6mdjbMxo:i3gEYqmvqtg:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/Seaside?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Seaside/~4/bvZ6mdjbMxo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.blackwhale.at/2009/09/set-background-image-of-uitableview/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://blog.blackwhale.at/2009/09/set-background-image-of-uitableview/</feedburner:origLink></item>
		<item>
		<title>Create custom activity indicator for your iPhone App</title>
		<link>http://feedproxy.google.com/~r/Seaside/~3/KG9e23TjrEE/</link>
		<comments>http://blog.blackwhale.at/2009/09/create-custom-activity-indicator-for-your-iphone-app/#comments</comments>
		<pubDate>Tue, 01 Sep 2009 18:56:29 +0000</pubDate>
		<dc:creator>Andreas</dc:creator>
				<category><![CDATA[I talk code]]></category>
		<category><![CDATA[iPhone OS]]></category>
		<category><![CDATA[status indicator]]></category>
		<category><![CDATA[uiimage animation]]></category>

		<guid isPermaLink="false">http://blog.blackwhale.at/?p=336</guid>
		<description><![CDATA[Have you ever dreamed of your own custom activity indicator within your iPhone App? The class UIImageView provides a very useful and simple way to implement such a thing. The only thing you have to do is to:

 Provide a number of images that reflect your indicator animation.
Create a new UIImageView instance and set images [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever dreamed of your own custom activity indicator within your iPhone App? The class UIImageView provides a very useful and simple way to implement such a thing. The only thing you have to do is to:</p>
<ul>
<li> Provide a number of images that reflect your indicator animation.</li>
<li>Create a new UIImageView instance and set images and animation duration.</li>
<li>Position your custom activity indicator within your current view.</li>
</ul>
<p>To demonstrate the whole process I quickly created some images (I am sure you will style them better than me) which will serve for our animation.</p>
<p><span id="more-336"></span></p>
<p><img class="alignnone size-full wp-image-341" title="status1" src="http://blog.blackwhale.at/wp-content/uploads/2009/09/status1.png" alt="status1" width="50" height="50" /><img class="alignnone size-full wp-image-342" title="status2" src="http://blog.blackwhale.at/wp-content/uploads/2009/09/status2.png" alt="status2" width="50" height="50" /><img class="alignnone size-full wp-image-343" title="status3" src="http://blog.blackwhale.at/wp-content/uploads/2009/09/status3.png" alt="status3" width="50" height="50" />.. I think you got it &#8230; <img class="alignnone size-full wp-image-348" title="status8" src="http://blog.blackwhale.at/wp-content/uploads/2009/09/status8.png" alt="status8" width="50" height="50" /> creates<img class="alignnone size-full wp-image-337" title="custom status indicator" src="http://blog.blackwhale.at/wp-content/uploads/2009/09/status_finish.gif" alt="custom status indicator" width="50" height="50" /></p>
<p>So the images are prepared and now we can go to the next step and create the animation of our custom activity indicator somewhere i.e. in your current view controller. The code you need should look like the following.</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">//Create the first status image and the indicator view</span>
UIImage <span style="color: #002200;">*</span>statusImage <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>UIImage imageNamed<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;status1.png&quot;</span><span style="color: #002200;">&#93;</span>;
UIImageView <span style="color: #002200;">*</span>activityImageView <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIImageView alloc<span style="color: #002200;">&#93;</span> 
				initWithImage<span style="color: #002200;">:</span>statusImage<span style="color: #002200;">&#93;</span>;
&nbsp;
&nbsp;
<span style="color: #11740a; font-style: italic;">//Add more images which will be used for the animation</span>
activityImageView.animationImages <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSArray</span> arrayWithObjects<span style="color: #002200;">:</span>
			<span style="color: #002200;">&#91;</span>UIImage imageNamed<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;status1.png&quot;</span><span style="color: #002200;">&#93;</span>,
			<span style="color: #002200;">&#91;</span>UIImage imageNamed<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;status2.png&quot;</span><span style="color: #002200;">&#93;</span>,
			<span style="color: #002200;">&#91;</span>UIImage imageNamed<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;status3.png&quot;</span><span style="color: #002200;">&#93;</span>,
			<span style="color: #002200;">&#91;</span>UIImage imageNamed<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;status4.png&quot;</span><span style="color: #002200;">&#93;</span>,
			<span style="color: #002200;">&#91;</span>UIImage imageNamed<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;status5.png&quot;</span><span style="color: #002200;">&#93;</span>,
			<span style="color: #002200;">&#91;</span>UIImage imageNamed<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;status6.png&quot;</span><span style="color: #002200;">&#93;</span>,
			<span style="color: #002200;">&#91;</span>UIImage imageNamed<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;status7.png&quot;</span><span style="color: #002200;">&#93;</span>,
			<span style="color: #002200;">&#91;</span>UIImage imageNamed<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;status8.png&quot;</span><span style="color: #002200;">&#93;</span>,
			<span style="color: #a61390;">nil</span><span style="color: #002200;">&#93;</span>;
&nbsp;
&nbsp;
<span style="color: #11740a; font-style: italic;">//Set the duration of the animation (play with it</span>
<span style="color: #11740a; font-style: italic;">//until it looks nice for you)</span>
activityImageView.animationDuration <span style="color: #002200;">=</span> <span style="color: #2400d9;">0.8</span>;
&nbsp;
&nbsp;
<span style="color: #11740a; font-style: italic;">//Position the activity image view somewhere in </span>
<span style="color: #11740a; font-style: italic;">//the middle of your current view</span>
activityImageView.frame <span style="color: #002200;">=</span> CGRectMake<span style="color: #002200;">&#40;</span>
			self.view.frame.size.width<span style="color: #002200;">/</span><span style="color: #2400d9;">2</span>
				<span style="color: #002200;">-</span>statusImage.size.width<span style="color: #002200;">/</span><span style="color: #2400d9;">2</span>, 
			self.view.frame.size.height<span style="color: #002200;">/</span><span style="color: #2400d9;">2</span>
				<span style="color: #002200;">-</span>statusImage.size.height<span style="color: #002200;">/</span><span style="color: #2400d9;">2</span>, 
			statusImage.size.width, 
			statusImage.size.height<span style="color: #002200;">&#41;</span>;
&nbsp;
<span style="color: #11740a; font-style: italic;">//Start the animation</span>
<span style="color: #002200;">&#91;</span>activityImageView startAnimating<span style="color: #002200;">&#93;</span>;
&nbsp;
&nbsp;
<span style="color: #11740a; font-style: italic;">//Add your custom activity indicator to your current view</span>
<span style="color: #002200;">&#91;</span>self.view addSubview<span style="color: #002200;">:</span>activityImageView<span style="color: #002200;">&#93;</span>;</pre></div></div>

<p>As I mentioned within a code annotation, try to play arround with the duration of the animation so it fits for you. Basically thats all you have to do. For more information look at the documentation of <a href="http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIImageView_Class/Reference/Reference.html#//apple_ref/occ/instp/UIImageView">UIImageView</a>. There you will find some more useful methods like <code>stopAnimating</code> or <code>isAnimating</code> and you are also able to add images for an animation if the view is highlighted with the property <code>highlightedAnimationImages</code>. </p>
<p>So far thats all I wanna say and I hope it will help you somehow or other,<br />
Andreas</p>

<p><a href="http://feedads.g.doubleclick.net/~a/mQTKyVtzFBf6QWQ8_8Ut_Z5OMwA/0/da"><img src="http://feedads.g.doubleclick.net/~a/mQTKyVtzFBf6QWQ8_8Ut_Z5OMwA/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/mQTKyVtzFBf6QWQ8_8Ut_Z5OMwA/1/da"><img src="http://feedads.g.doubleclick.net/~a/mQTKyVtzFBf6QWQ8_8Ut_Z5OMwA/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Seaside?a=KG9e23TjrEE:i1acY_qSadA:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Seaside?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Seaside?a=KG9e23TjrEE:i1acY_qSadA:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Seaside?i=KG9e23TjrEE:i1acY_qSadA:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Seaside?a=KG9e23TjrEE:i1acY_qSadA:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/Seaside?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Seaside/~4/KG9e23TjrEE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.blackwhale.at/2009/09/create-custom-activity-indicator-for-your-iphone-app/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		<feedburner:origLink>http://blog.blackwhale.at/2009/09/create-custom-activity-indicator-for-your-iphone-app/</feedburner:origLink></item>
		<item>
		<title>UIImageView Fade-In and Fade-Out (pulsating) Animation</title>
		<link>http://feedproxy.google.com/~r/Seaside/~3/9MWigp5iDWw/</link>
		<comments>http://blog.blackwhale.at/2009/09/uiimageview-fade-in-and-fade-out/#comments</comments>
		<pubDate>Tue, 01 Sep 2009 17:17:00 +0000</pubDate>
		<dc:creator>Andreas</dc:creator>
				<category><![CDATA[I talk code]]></category>
		<category><![CDATA[iPhone OS]]></category>
		<category><![CDATA[core animation]]></category>
		<category><![CDATA[opacity]]></category>
		<category><![CDATA[UIImageView]]></category>

		<guid isPermaLink="false">http://blog.blackwhale.at/?p=325</guid>
		<description><![CDATA[Today just a small code snippet to create a nice fade-in-fade-out (or call it pulsating) effect on a given UIImage. To accomplish this within a UIView you have to do only a few steps:

Create a UIImageView containing your image.
Create the animation with its properties.
Set the animation for the specific layer containing your image.

In words of [...]]]></description>
			<content:encoded><![CDATA[<p>Today just a small code snippet to create a nice fade-in-fade-out (or call it pulsating) effect on a given UIImage. To accomplish this within a UIView you have to do only a few steps:</p>
<ul>
<li>Create a UIImageView containing your image.</li>
<li>Create the animation with its properties.</li>
<li>Set the animation for the specific layer containing your image.</li>
</ul>
<p>In words of code you will have to do something like the following:</p>
<p><span id="more-325"></span></p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">//Get the image and create the image view</span>
<span style="color: #11740a; font-style: italic;">//You also can use an image view created with Interface Builder</span>
UIImage <span style="color: #002200;">*</span>image <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>UIImage imageNamed<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;yourfavouriteimage.png&quot;</span><span style="color: #002200;">&#93;</span>;
UIImageView <span style="color: #002200;">*</span>imageView <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIImageView alloc<span style="color: #002200;">&#93;</span> initWithImage<span style="color: #002200;">:</span>image<span style="color: #002200;">&#93;</span>;
&nbsp;
&nbsp;
<span style="color: #11740a; font-style: italic;">//Add the image view to your main view</span>
<span style="color: #11740a; font-style: italic;">//(This is optional if it was created with Interface Builder)</span>
...
&nbsp;
&nbsp;
<span style="color: #11740a; font-style: italic;">//Create an animation with pulsating effect</span>
CABasicAnimation <span style="color: #002200;">*</span>theAnimation;
&nbsp;
<span style="color: #11740a; font-style: italic;">//within the animation we will adjust the &quot;opacity&quot; </span>
<span style="color: #11740a; font-style: italic;">//value of the layer</span>
theAnimation<span style="color: #002200;">=</span><span style="color: #002200;">&#91;</span>CABasicAnimation animationWithKeyPath<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;opacity&quot;</span><span style="color: #002200;">&#93;</span>;
<span style="color: #11740a; font-style: italic;">//animation lasts 0.4 seconds</span>
theAnimation.duration<span style="color: #002200;">=</span><span style="color: #2400d9;">0.4</span>;	
<span style="color: #11740a; font-style: italic;">//and it repeats forever</span>
theAnimation.repeatCount<span style="color: #002200;">=</span> 1e100f;
<span style="color: #11740a; font-style: italic;">//we want a reverse animation</span>
theAnimation.autoreverses<span style="color: #002200;">=</span><span style="color: #a61390;">YES</span>;	
<span style="color: #11740a; font-style: italic;">//justify the opacity as you like (1=fully visible, 0=unvisible)</span>
theAnimation.fromValue<span style="color: #002200;">=</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSNumber</span> numberWithFloat<span style="color: #002200;">:</span><span style="color: #2400d9;">1.0</span><span style="color: #002200;">&#93;</span>; 
theAnimation.toValue<span style="color: #002200;">=</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSNumber</span> numberWithFloat<span style="color: #002200;">:</span><span style="color: #2400d9;">0.1</span><span style="color: #002200;">&#93;</span>;
&nbsp;
<span style="color: #11740a; font-style: italic;">//Assign the animation to your UIImage layer and the </span>
<span style="color: #11740a; font-style: italic;">//animation will start immediately</span>
<span style="color: #002200;">&#91;</span>imageView.layer addAnimation<span style="color: #002200;">:</span>theAnimation 
                 forKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;animateOpacity&quot;</span><span style="color: #002200;">&#93;</span>;</pre></div></div>

<p>Thats all folks and have fun,</p>
<p>Andreas</p>

<p><a href="http://feedads.g.doubleclick.net/~a/Vc8AggZvqcYWZeyeH2ilRh1-O6U/0/da"><img src="http://feedads.g.doubleclick.net/~a/Vc8AggZvqcYWZeyeH2ilRh1-O6U/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/Vc8AggZvqcYWZeyeH2ilRh1-O6U/1/da"><img src="http://feedads.g.doubleclick.net/~a/Vc8AggZvqcYWZeyeH2ilRh1-O6U/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Seaside?a=9MWigp5iDWw:JIAxzClqUR4:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Seaside?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Seaside?a=9MWigp5iDWw:JIAxzClqUR4:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Seaside?i=9MWigp5iDWw:JIAxzClqUR4:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Seaside?a=9MWigp5iDWw:JIAxzClqUR4:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/Seaside?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Seaside/~4/9MWigp5iDWw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.blackwhale.at/2009/09/uiimageview-fade-in-and-fade-out/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.blackwhale.at/2009/09/uiimageview-fade-in-and-fade-out/</feedburner:origLink></item>
		<item>
		<title>Jolein iPhone App published</title>
		<link>http://feedproxy.google.com/~r/Seaside/~3/RSGmI5X8cz4/</link>
		<comments>http://blog.blackwhale.at/2009/08/jolein-iphone-app-published/#comments</comments>
		<pubDate>Wed, 12 Aug 2009 08:12:00 +0000</pubDate>
		<dc:creator>Andreas</dc:creator>
				<category><![CDATA[Jolein]]></category>
		<category><![CDATA[iPhone OS]]></category>
		<category><![CDATA[app store]]></category>
		<category><![CDATA[iphone app]]></category>

		<guid isPermaLink="false">http://blog.blackwhale.at/?p=147</guid>
		<description><![CDATA[Its done! On 21st, July 2009 we submitted the first iPhone App to the Apple App Store and today it was approved! Our App is called Jolein and is used as a basic management frontend for the stunning Jolein platform.




Currently the Jolein App is only available in german language but further language support is planned. [...]]]></description>
			<content:encoded><![CDATA[<p>Its done! On 21st, July 2009 we submitted the first iPhone App to the Apple App Store and today it was approved! Our App is called <strong>Jolein</strong> and is used as a basic management frontend for the stunning <a href="http://www.jolein.at" target="_blank">Jolein</a> platform.</p>
<table border="0">
<tbody>
<tr>
<td><img class="size-full wp-image-261" title="Jolein Main Menu" src="http://blog.blackwhale.at/wp-content/uploads/2009/08/iphone_jolein_menu.png" alt="Jolein Main Menu" width="290" height="542" /></td>
<td>Currently the Jolein App is only available in german language but further language support is planned. While the Jolein platform is used for efficient staff coordination, resource and qualification managment and service scheduling the associated Jolein App supports following tasks:</p>
<ul>
<li>Overview of staff and easy communication with them</li>
<li>Task managment</li>
<li>Messaging service</li>
<li>Overview of own companies</li>
<li>Easy staff coordination and service planning</li>
<li>Conflict managment</li>
<li>&#8230;</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>Over here are some more pictures of the App to get a better imagination for the user interface and the App&#8217;s capabilities. On the first screen you can see how a new task for a given employee is created and on the second screen a duty roaster is illustrated for a given company and day.</p>
<p style="text-align: center;"><img class="size-medium wp-image-266" title="Jolein Add Task" src="http://blog.blackwhale.at/wp-content/uploads/2009/08/jolein_screen_3-208x300.jpg" alt="Jolein Add Task" width="208" height="300" /> <img class="size-medium wp-image-267" title="Jolein Duty Roaster" src="http://blog.blackwhale.at/wp-content/uploads/2009/08/jolein_screen_4-208x300.jpg" alt="Jolein Duty Roaster" width="208" height="300" /></p>
<table border="0">
<tbody>
<tr>
<td>For more information visit the <a href="http://www.jolein.at" target="_blank">Jolein</a> platform or view the App description within the <a href="itms://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=324690572&amp;mt=8&amp;s=143441">Apple App Store</a>.</td>
<td><a href="itms://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=324690572&amp;mt=8&amp;s=143441"><img class="alignnone size-full wp-image-308" title="Jolein im App Store" src="http://blog.blackwhale.at/wp-content/uploads/2009/08/available_in_app_store.png" alt="Jolein im App Store" width="160" height="69" /></a></td>
</tr>
</tbody>
</table>

<p><a href="http://feedads.g.doubleclick.net/~a/BxYIxz8iCmNzkGk2Fx4GMW82wDw/0/da"><img src="http://feedads.g.doubleclick.net/~a/BxYIxz8iCmNzkGk2Fx4GMW82wDw/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/BxYIxz8iCmNzkGk2Fx4GMW82wDw/1/da"><img src="http://feedads.g.doubleclick.net/~a/BxYIxz8iCmNzkGk2Fx4GMW82wDw/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Seaside?a=RSGmI5X8cz4:oEqOsWouq5A:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Seaside?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Seaside?a=RSGmI5X8cz4:oEqOsWouq5A:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Seaside?i=RSGmI5X8cz4:oEqOsWouq5A:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Seaside?a=RSGmI5X8cz4:oEqOsWouq5A:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/Seaside?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Seaside/~4/RSGmI5X8cz4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.blackwhale.at/2009/08/jolein-iphone-app-published/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.blackwhale.at/2009/08/jolein-iphone-app-published/</feedburner:origLink></item>
		<item>
		<title>Android Bluetooth on steroids with the NDK and bluez</title>
		<link>http://feedproxy.google.com/~r/Seaside/~3/jSAX0EGvUyo/</link>
		<comments>http://blog.blackwhale.at/2009/08/android-bluetooth-on-steroids-with-the-ndk-and-bluez/#comments</comments>
		<pubDate>Thu, 06 Aug 2009 09:24:37 +0000</pubDate>
		<dc:creator>Johannes</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[I talk code]]></category>
		<category><![CDATA[Bluetooth]]></category>
		<category><![CDATA[Bluez]]></category>
		<category><![CDATA[NDK]]></category>
		<category><![CDATA[Serial]]></category>
		<category><![CDATA[SPP]]></category>

		<guid isPermaLink="false">http://blog.blackwhale.at/?p=216</guid>
		<description><![CDATA[NOTE: this is not a general solution and might not work on every phone or future version of the DKs, but it is still a great way for any prototyping purposes 

Unfortunately the SDK currently only supports a small set of the Bluetooth stack. As we wanted to integrate some of our hardware gadgets (over [...]]]></description>
			<content:encoded><![CDATA[<p><em>NOTE: this is not a general solution and might not work on every phone or future version of the DKs, but it is still a great way for any prototyping purposes <img src='http://blog.blackwhale.at/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
</em></p>
<p>Unfortunately the SDK currently only supports a small set of the Bluetooth stack. As we wanted to integrate some of our hardware gadgets (over SPP/RFCOMM) with our Dev Phone 1, we needed to digg a little deeper. So here is what you want to do to get it working.</p>
<p><span id="more-216"></span></p>
<p>1) Follow the great article by <a href="http://blog.bruary.net/2009/07/android-bluetooth-hacking-using-ndk.html">Stephan</a>, to get all the necessary libraries in place. His Bluescan app also provides a good starting point both for SDK and NDK integration.</p>
<p>2) Adapt the NDK specific code to talk to your device.</p>
<p>First allocate a socket</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;">s <span style="color: #000080;">=</span> socket<span style="color: #008000;">&#40;</span>PF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span></pre></div></div>

<p>Next you need to set who to connect to</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #0000ff;">struct</span> sockaddr_rc addr1 <span style="color: #000080;">=</span> <span style="color: #008000;">&#123;</span> <span style="color: #0000dd;">0</span> <span style="color: #008000;">&#125;</span><span style="color: #008080;">;</span>
<span style="color: #0000ff;">char</span> dest<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">18</span><span style="color: #008000;">&#93;</span> <span style="color: #000080;">=</span> <span style="color: #FF0000;">&quot;00:06:66:02:9D:39&quot;</span><span style="color: #008080;">;</span> <span style="color: #666666;">//Device ID of your Bluetooth device</span>
addr1.<span style="color: #007788;">rc_family</span> <span style="color: #000080;">=</span> AF_BLUETOOTH<span style="color: #008080;">;</span>
addr1.<span style="color: #007788;">rc_channel</span> <span style="color: #000080;">=</span> <span style="color: #008000;">&#40;</span>uint8_t<span style="color: #008000;">&#41;</span> <span style="color: #0000dd;">1</span><span style="color: #008080;">;</span>
str2ba<span style="color: #008000;">&#40;</span> dest, <span style="color: #000040;">&amp;</span>amp<span style="color: #008080;">;</span>addr1.<span style="color: #007788;">rc_bdaddr</span> <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span></pre></div></div>

<p>Now you can connect to the device</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;">status <span style="color: #000080;">=</span> connect<span style="color: #008000;">&#40;</span>s, <span style="color: #008000;">&#40;</span><span style="color: #0000ff;">struct</span> sockaddr <span style="color: #000040;">*</span><span style="color: #008000;">&#41;</span><span style="color: #000040;">&amp;</span>addr1, <span style="color: #0000dd;">sizeof</span><span style="color: #008000;">&#40;</span>addr1<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span></pre></div></div>

<p>Thats pretty much it, you can start sending and receiving stuff with</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span> status <span style="color: #000080;">&gt;=</span> <span style="color: #0000dd;">0</span> <span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
  __android_log_write<span style="color: #008000;">&#40;</span>ANDROID_LOG_INFO,<span style="color: #FF0000;">&quot;SPP_COMM&quot;</span>,<span style="color: #FF0000;">&quot;Successfully connected&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
&nbsp;
  status <span style="color: #000080;">=</span> write<span style="color: #008000;">&#40;</span>s, <span style="color: #FF0000;">&quot;L1<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>, <span style="color: #0000dd;">4</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
&nbsp;
  sleep<span style="color: #008000;">&#40;</span><span style="color: #0000dd;">1</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
&nbsp;
  len1 <span style="color: #000080;">=</span> recv<span style="color: #008000;">&#40;</span>s,buf,<span style="color: #0000dd;">sizeof</span><span style="color: #008000;">&#40;</span>buf<span style="color: #008000;">&#41;</span>,<span style="color: #0000dd;">0</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
  <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span>len1 <span style="color: #000080;">&gt;</span> <span style="color: #0000dd;">0</span><span style="color: #008000;">&#41;</span> 
    __android_log_write<span style="color: #008000;">&#40;</span>ANDROID_LOG_INFO,<span style="color: #FF0000;">&quot;SPP_COMM&quot;</span>,buf<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
  <span style="color: #0000ff;">else</span>
    __android_log_write<span style="color: #008000;">&#40;</span>ANDROID_LOG_ERROR,<span style="color: #FF0000;">&quot;SPP_COMM&quot;</span>,<span style="color: #FF0000;">&quot;Nothing was received from the device&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p>HTH<br />
Enjoy<br />
J.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/rKjxgER3frTVSBa47rbTaxaR5tk/0/da"><img src="http://feedads.g.doubleclick.net/~a/rKjxgER3frTVSBa47rbTaxaR5tk/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/rKjxgER3frTVSBa47rbTaxaR5tk/1/da"><img src="http://feedads.g.doubleclick.net/~a/rKjxgER3frTVSBa47rbTaxaR5tk/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Seaside?a=jSAX0EGvUyo:uEezdmbG4OA:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Seaside?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Seaside?a=jSAX0EGvUyo:uEezdmbG4OA:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Seaside?i=jSAX0EGvUyo:uEezdmbG4OA:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Seaside?a=jSAX0EGvUyo:uEezdmbG4OA:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/Seaside?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Seaside/~4/jSAX0EGvUyo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.blackwhale.at/2009/08/android-bluetooth-on-steroids-with-the-ndk-and-bluez/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.blackwhale.at/2009/08/android-bluetooth-on-steroids-with-the-ndk-and-bluez/</feedburner:origLink></item>
		<item>
		<title>Android NDK logging</title>
		<link>http://feedproxy.google.com/~r/Seaside/~3/FiZsSw325oM/</link>
		<comments>http://blog.blackwhale.at/2009/08/android-ndk-logging/#comments</comments>
		<pubDate>Wed, 05 Aug 2009 14:38:58 +0000</pubDate>
		<dc:creator>Johannes</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[I talk code]]></category>
		<category><![CDATA[logcat]]></category>
		<category><![CDATA[Logging]]></category>
		<category><![CDATA[NDK]]></category>

		<guid isPermaLink="false">http://blog.blackwhale.at/?p=218</guid>
		<description><![CDATA[So after the first few mini steps into the NDK the first thing you will probably notice missing, is a way to retrieve log messages through logcat. To be able to do this you need to do two things:

1. Include log.h in your source files

#include &#60;android/log.h&#62;

2. Be sure to add llog to your LOCAL_LDLIBS in [...]]]></description>
			<content:encoded><![CDATA[<p>So after the first few mini steps into the NDK the first thing you will probably notice missing, is a way to retrieve log messages through logcat. To be able to do this you need to do two things:</p>
<p><span id="more-218"></span></p>
<p>1. Include log.h in your source files</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #339900;">#include &lt;android/log.h&gt;</span></pre></div></div>

<p>2. Be sure to add llog to your LOCAL_LDLIBS in the Android.mk file of your NDK code</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">LOCAL_LDLIBS := <span style="color: #660033;">-llog</span></pre></div></div>

<p>Now you are ready to log to logcat from you NDK code, simply via</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;">__android_log_write<span style="color: #008000;">&#40;</span>ANDROID_LOG_ERROR,<span style="color: #FF0000;">&quot;Tag&quot;</span>,<span style="color: #FF0000;">&quot;Message&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span></pre></div></div>

<p>Further loglevels are</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #0000ff;">typedef</span> <span style="color: #0000ff;">enum</span> android_LogPriority <span style="color: #008000;">&#123;</span>
    ANDROID_LOG_UNKNOWN <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span>,
    ANDROID_LOG_DEFAULT,    <span style="color: #ff0000; font-style: italic;">/* only for SetMinPriority() */</span>
    ANDROID_LOG_VERBOSE,
    ANDROID_LOG_DEBUG,
    ANDROID_LOG_INFO,
    ANDROID_LOG_WARN,
    ANDROID_LOG_ERROR,
    ANDROID_LOG_FATAL,
    ANDROID_LOG_SILENT,     <span style="color: #ff0000; font-style: italic;">/* only for SetMinPriority(); must be last */</span>
<span style="color: #008000;">&#125;</span> android_LogPriority<span style="color: #008080;">;</span></pre></div></div>

<p>all the other stuff you can look up under</p>
<pre> build/platforms/android-1.5/common/include/android/log.h</pre>
<p>HTH</p>
<p>Enjoy<br />
J.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/WIbM3MRinPhZ2YVnc-jV3zwA2DU/0/da"><img src="http://feedads.g.doubleclick.net/~a/WIbM3MRinPhZ2YVnc-jV3zwA2DU/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/WIbM3MRinPhZ2YVnc-jV3zwA2DU/1/da"><img src="http://feedads.g.doubleclick.net/~a/WIbM3MRinPhZ2YVnc-jV3zwA2DU/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Seaside?a=FiZsSw325oM:_ymOG0JL1qw:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Seaside?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Seaside?a=FiZsSw325oM:_ymOG0JL1qw:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Seaside?i=FiZsSw325oM:_ymOG0JL1qw:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Seaside?a=FiZsSw325oM:_ymOG0JL1qw:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/Seaside?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Seaside/~4/FiZsSw325oM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.blackwhale.at/2009/08/android-ndk-logging/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://blog.blackwhale.at/2009/08/android-ndk-logging/</feedburner:origLink></item>
		<item>
		<title>Check internet connection on iPhone</title>
		<link>http://feedproxy.google.com/~r/Seaside/~3/OHQL0AISKn8/</link>
		<comments>http://blog.blackwhale.at/2009/07/check-internet-connection-on-iphone/#comments</comments>
		<pubDate>Thu, 30 Jul 2009 11:41:49 +0000</pubDate>
		<dc:creator>Andreas</dc:creator>
				<category><![CDATA[I talk code]]></category>
		<category><![CDATA[iPhone OS]]></category>
		<category><![CDATA[network reachability]]></category>

		<guid isPermaLink="false">http://blog.blackwhale.at/?p=204</guid>
		<description><![CDATA[People (especially iPhone developers) watch out! If your iPhone app relies on any kind of internet back-end-service, don&#8217;t forget to check if the service is available and even more to check if a internet connection is currently possible (for instance there is no network or the iPhone is in flight mode).
If you don&#8217;t provide enough [...]]]></description>
			<content:encoded><![CDATA[<p>People (especially iPhone developers) watch out! If your iPhone app relies on any kind of internet back-end-service, don&#8217;t forget to check if the service is available and even more to check if a internet connection is currently possible (for instance there is no network or the iPhone is in flight mode).</p>
<p>If you don&#8217;t provide enough information to your users, that your iPhone app needs a valid internet connection or your back-end-service is currently not available, Apple may reject your iPhone App.</p>
<p>You will find several examples how to achieve that at the web. The following code I found several times at stackoverflow.com could be very useful for you:</p>
<p><span id="more-204"></span></p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;">&nbsp;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span> someMethod <span style="color: #002200;">&#123;</span>
    <span style="color: #a61390;">const</span> <span style="color: #a61390;">char</span> <span style="color: #002200;">*</span>host_name <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">&quot;blackwhale.at&quot;</span>;
    <span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span> <span style="color: #002200;">&#91;</span>self checkConnection<span style="color: #002200;">:</span>host_name<span style="color: #002200;">&#93;</span> <span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
        <span style="color: #11740a; font-style: italic;">//everything is ok</span>
    <span style="color: #002200;">&#125;</span>
    <span style="color: #a61390;">else</span> <span style="color: #002200;">&#123;</span>
        <span style="color: #11740a; font-style: italic;">//notify your users</span>
    <span style="color: #002200;">&#125;</span>
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #11740a; font-style: italic;">/**
 * checkConnection:
 * Check if the given host is reachable with the 
 * current network settings
 */</span>
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">BOOL</span><span style="color: #002200;">&#41;</span> checkConnection<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">const</span> <span style="color: #a61390;">char</span><span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span> host_name <span style="color: #002200;">&#123;</span>
    <span style="color: #a61390;">BOOL</span> _isDataSourceAvailable <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;
    Boolean success;    
&nbsp;
    <span style="color: #11740a; font-style: italic;">//Creates a reachability reference to the specified </span>
    <span style="color: #11740a; font-style: italic;">//network host or node name.</span>
    SCNetworkReachabilityRef reachability <span style="color: #002200;">=</span> 
            SCNetworkReachabilityCreateWithName<span style="color: #002200;">&#40;</span><span style="color: #a61390;">NULL</span>, host_name<span style="color: #002200;">&#41;</span>;
&nbsp;
    <span style="color: #11740a; font-style: italic;">//Determines if the specified network target is reachable </span>
    <span style="color: #11740a; font-style: italic;">//using the current network configuration.</span>
    SCNetworkReachabilityFlags flags;
    success <span style="color: #002200;">=</span> SCNetworkReachabilityGetFlags<span style="color: #002200;">&#40;</span>reachability, <span style="color: #002200;">&amp;</span>flags<span style="color: #002200;">&#41;</span>;
    _isDataSourceAvailable <span style="color: #002200;">=</span> success <span style="color: #002200;">&amp;&amp;</span> 
                <span style="color: #002200;">&#40;</span>flags <span style="color: #002200;">&amp;</span> kSCNetworkFlagsReachable<span style="color: #002200;">&#41;</span> <span style="color: #002200;">&amp;&amp;</span>
                <span style="color: #002200;">!</span><span style="color: #002200;">&#40;</span>flags <span style="color: #002200;">&amp;</span> kSCNetworkFlagsConnectionRequired<span style="color: #002200;">&#41;</span>;
&nbsp;
    CFRelease<span style="color: #002200;">&#40;</span>reachability<span style="color: #002200;">&#41;</span>;
&nbsp;
    <span style="color: #a61390;">return</span> _isDataSourceAvailable;
<span style="color: #002200;">&#125;</span></pre></div></div>


<p><a href="http://feedads.g.doubleclick.net/~a/qQ-muk_n-RzwQeCNrQ2-ZSODkeU/0/da"><img src="http://feedads.g.doubleclick.net/~a/qQ-muk_n-RzwQeCNrQ2-ZSODkeU/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/qQ-muk_n-RzwQeCNrQ2-ZSODkeU/1/da"><img src="http://feedads.g.doubleclick.net/~a/qQ-muk_n-RzwQeCNrQ2-ZSODkeU/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Seaside?a=OHQL0AISKn8:4Td8yNjlKsc:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Seaside?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Seaside?a=OHQL0AISKn8:4Td8yNjlKsc:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Seaside?i=OHQL0AISKn8:4Td8yNjlKsc:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Seaside?a=OHQL0AISKn8:4Td8yNjlKsc:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/Seaside?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Seaside/~4/OHQL0AISKn8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.blackwhale.at/2009/07/check-internet-connection-on-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.blackwhale.at/2009/07/check-internet-connection-on-iphone/</feedburner:origLink></item>
	</channel>
</rss><!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
