<?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>Mozketo &#187; Apple</title>
	<atom:link href="http://mozketo.com/category/apple/feed/" rel="self" type="application/rss+xml" />
	<link>http://mozketo.com</link>
	<description>Now a dev diary</description>
	<lastBuildDate>Thu, 25 Mar 2010 09:17:59 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Barebones CAEmitterLayer aka Particle Effects</title>
		<link>http://mozketo.com/barebones-caemitterlayer-aka-particle-effects/</link>
		<comments>http://mozketo.com/barebones-caemitterlayer-aka-particle-effects/#comments</comments>
		<pubDate>Wed, 24 Feb 2010 12:18:55 +0000</pubDate>
		<dc:creator>Mozketo</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[CAEmitterLayer]]></category>
		<category><![CDATA[Core Animation]]></category>

		<guid isPermaLink="false">http://mozketo.com/?p=360</guid>
		<description><![CDATA[CAEmitterLayer: use to create particle effects. Each particle is an instance of CAEmitterCell. (10.6) &#8211; cocoadevcentral
How could you not be intrigued? Particle Effects! Well I&#8217;ve always been interested in Particle Generators, and there&#8217;s one right here in Snow Leopard. How exciting. /claps.
I recently took a look at the Fire and Fireworks sample code that Apple [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>CAEmitterLayer: use to create particle effects. Each particle is an instance of CAEmitterCell. (10.6) &#8211; <a href="http://twitter.com/cocoadevcentral/status/3607680055">cocoadevcentral</a></p></blockquote>
<p>How could you not be intrigued? Particle Effects! Well I&#8217;ve always been interested in Particle Generators, and there&#8217;s one right here in Snow Leopard. How exciting. /claps.</p>
<p>I recently took a look at the Fire and Fireworks sample code that Apple and was duly impressed by what Core Animation provides for so little cost both code-wise and CPU resources. So I decided to write the simplest &#8211; barebones &#8211; <a href="http://developer.apple.com/mac/library/documentation/GraphicsImaging/Reference/CAEmitterLayer_class/Reference/Reference.html">CAEmitterLayer</a> code where I was only dependant on the NSView it draws on.</p>
<p>There&#8217;s no fancy-pants stuff going on here, just a raw, simple, single particle effect. But it gives you a great perspective on how it works and the minimal code required to have a great particle animation.</p>
<p><a href="http://mozketo.com/wp-content/uploads/2010/02/particle_01_01.png"><img src="http://mozketo.com/wp-content/uploads/2010/02/particle_01_01.png" alt="Screenshot of this project" title="particle_01_01" width="531" height="519" class="alignnone size-full wp-image-362" /></a></p>
<p>If you&#8217;re starting afresh you&#8217;re going to need to tell your project that we want to use Core Animation so:</p>
<ul>
<li>Right click the Frameworks > Linked Frameworks on the left,</li>
<li>Add > Existing Frameworks&#8230;</li>
<li>Scroll to QuartzCore.framework > Add,</li>
<li>And make sure your ParticleController header file contains <code>#import &lt;QuartzCore/QuartzCore.h&gt;</code>.</li>
</ul>
<p>Looking at CAEmitterLayer briefly (and ignoring setting up Interface Builder &#038; the Nib) in our header file we simply need a CAEmitterLayer:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p360code3'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p3603"><td class="code" id="p360code3"><pre class="objc" style="font-family:monospace;">IBOutlet <a href="http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSView_Class/"><span style="color: #400080;">NSView</span></a> <span style="color: #002200;">*</span>view;
CALayer <span style="color: #002200;">*</span>rootLayer;
CAEmitterLayer <span style="color: #002200;">*</span>emitter;</pre></td></tr></table></div>

<p>Where as the implementation file is going to need a whole lot of data for the Emitter plus we need to create a CAEmitterCell for the particle itself.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p360code4'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p3604"><td class="code" id="p360code4"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">//Create the emitter layer</span>
emitter <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>CAEmitterLayer layer<span style="color: #002200;">&#93;</span>;
emitter.emitterPosition <span style="color: #002200;">=</span> CGPointMake<span style="color: #002200;">&#40;</span>CGRectGetMidX<span style="color: #002200;">&#40;</span>rootLayer.bounds<span style="color: #002200;">&#41;</span>, CGRectGetMidY<span style="color: #002200;">&#40;</span>rootLayer.bounds<span style="color: #002200;">&#41;</span><span style="color: #002200;">&#41;</span>;
emitter.emitterMode <span style="color: #002200;">=</span> kCAEmitterLayerOutline;
emitter.emitterShape <span style="color: #002200;">=</span> kCAEmitterLayerCircle;
emitter.renderMode <span style="color: #002200;">=</span> kCAEmitterLayerAdditive;
emitter.emitterSize <span style="color: #002200;">=</span> CGSizeMake<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">50</span> <span style="color: #002200;">*</span> multiplier, <span style="color: #2400d9;">0</span><span style="color: #002200;">&#41;</span>;
&nbsp;
<span style="color: #11740a; font-style: italic;">//Create the emitter cell</span>
CAEmitterCell<span style="color: #002200;">*</span> particle <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>CAEmitterCell emitterCell<span style="color: #002200;">&#93;</span>;
particle.emissionLongitude <span style="color: #002200;">=</span> M_PI;
particle.birthRate <span style="color: #002200;">=</span> multiplier <span style="color: #002200;">*</span> <span style="color: #2400d9;">1000.0</span>;
particle.lifetime <span style="color: #002200;">=</span> multiplier;
particle.lifetimeRange <span style="color: #002200;">=</span> multiplier <span style="color: #002200;">*</span> <span style="color: #2400d9;">0.35</span>;
particle.velocity <span style="color: #002200;">=</span> <span style="color: #2400d9;">180</span>;
particle.velocityRange <span style="color: #002200;">=</span> <span style="color: #2400d9;">130</span>;
particle.emissionRange <span style="color: #002200;">=</span> <span style="color: #2400d9;">1.1</span>;
particle.scaleSpeed <span style="color: #002200;">=</span> <span style="color: #2400d9;">0.3</span>;
CGColorRef color <span style="color: #002200;">=</span> CGColorCreateGenericRGB<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">0.3</span>, <span style="color: #2400d9;">0.4</span>, <span style="color: #2400d9;">0.9</span>, <span style="color: #2400d9;">0.10</span><span style="color: #002200;">&#41;</span>;
particle.color <span style="color: #002200;">=</span> color;
CGColorRelease<span style="color: #002200;">&#40;</span>color<span style="color: #002200;">&#41;</span>;
particle.contents <span style="color: #002200;">=</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#91;</span>self CGImageNamed<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;spark.png&quot;</span><span style="color: #002200;">&#93;</span>;</pre></td></tr></table></div>

<p>For the complete implementation file or the complete project please <a href="http://bitbucket.org/Mozketo/barebones-ca-particles-01">feel free to grab the source code from the bitbucket project</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://mozketo.com/barebones-caemitterlayer-aka-particle-effects/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Font Smoothing in Snow Leopard with a 3rd Party LCD</title>
		<link>http://mozketo.com/font-smoothing-in-snow-leopard/</link>
		<comments>http://mozketo.com/font-smoothing-in-snow-leopard/#comments</comments>
		<pubDate>Thu, 14 Jan 2010 00:11:16 +0000</pubDate>
		<dc:creator>Mozketo</dc:creator>
				<category><![CDATA[Apple]]></category>

		<guid isPermaLink="false">http://mozketo.com/?p=282</guid>
		<description><![CDATA[Having connected a 3rd party (Polyview) 19&#8243; LCD into the work MacBook Pro I was struck by how poor any on screen text rendered. Trying to use Terminal.app was just aweful, all jaggy and hard to read.
It turns out that font smoothing (aka sub-pixel antialiasing) on the 3rd party screen wasn&#8217;t happening and OS X [...]]]></description>
			<content:encoded><![CDATA[<p>Having connected a 3rd party (Polyview) 19&#8243; LCD into the work MacBook Pro I was struck by how poor any on screen text rendered. Trying to use Terminal.app was just aweful, all jaggy and hard to read.</p>
<p>It turns out that font smoothing (aka sub-pixel antialiasing) on the 3rd party screen wasn&#8217;t happening and OS X was defaulting the font smoothing to CRT. Take a look at the screenshots below, bad eh?</p>
<div id="attachment_283" class="wp-caption alignnone" style="width: 648px"><a href="http://mozketo.com/wp-content/uploads/2010/01/Screen-shot-2010-01-14-at-9.41.38-AM.png"><img src="http://mozketo.com/wp-content/uploads/2010/01/Screen-shot-2010-01-14-at-9.41.38-AM.png" alt="" title="Screen shot 2010-01-14 at 9.41.38 AM" width="638" height="61" class="size-full wp-image-283" /></a><p class="wp-caption-text">Antialiasing for CRTs, ewwwww.</p></div>
<div id="attachment_284" class="wp-caption alignnone" style="width: 647px"><a href="http://mozketo.com/wp-content/uploads/2010/01/Screen-shot-2010-01-14-at-9.42.53-AM.png"><img src="http://mozketo.com/wp-content/uploads/2010/01/Screen-shot-2010-01-14-at-9.42.53-AM.png" alt="" title="Screen shot 2010-01-14 at 9.42.53 AM" width="637" height="56" class="size-full wp-image-284" /></a><p class="wp-caption-text">Antialiasing fixed!</p></div>
<h3>How to fix the problem?</h3>
<p>Open up terminal and paste in the following:</p>
<p><code>defaults -currentHost write -globalDomain AppleFontSmoothing -int 2</code></p>
<p>or if you find the text a little large/blurry you can try:</p>
<p><code>defaults -currentHost write -globalDomain AppleFontSmoothing -int 1</code></p>
<p>Now logout > login.</p>
<h3>So what&#8217;s up?</h3>
<p>The whole Snow Leopard font smoothing issue seems strange and why Apple changed the font smooth dialog is beyond me. But you can read more about it here<br />
<a href="http://blog.jjgod.org/2009/08/18/snow-leopard-vs-dell-lcd-displays/">jjgod / blog > Snow Leopard vs. 3rd Party LCD Displays</a> if you&#8217;d like to know a little more about the problem.</p>
]]></content:encoded>
			<wfw:commentRss>http://mozketo.com/font-smoothing-in-snow-leopard/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Resize UIView/UITableView when Keyboard displays</title>
		<link>http://mozketo.com/resize-uiviewuitableview-when-keyboard-displays/</link>
		<comments>http://mozketo.com/resize-uiviewuitableview-when-keyboard-displays/#comments</comments>
		<pubDate>Tue, 02 Jun 2009 00:33:43 +0000</pubDate>
		<dc:creator>Mozketo</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Cocoa]]></category>

		<guid isPermaLink="false">http://mozketo.com/?p=213</guid>
		<description><![CDATA[I was having a hell of a time trying to get my UITableView to resize itself after the iPhone keyboard displayed itself. After being just a little surprised that the iPhone doesn&#8217;t resize the underlying UIView for free I figured it was up to me to do resize.
Firstly add a few variables and method declares [...]]]></description>
			<content:encoded><![CDATA[<p>I was having a hell of a time trying to get my UITableView to resize itself after the iPhone keyboard displayed itself. After being just a little surprised that the iPhone doesn&#8217;t resize the underlying UIView for free I figured it was up to me to do resize.</p>
<p>Firstly add a few variables and method declares into your ViewController.h header file:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p213code10'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p21310"><td class="code" id="p213code10"><pre class="objc" style="font-family:monospace;">Boolean keyboardIsShowing;
CGRect keyboardBounds;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>resizeViewControllerToFitScreen;</pre></td></tr></table></div>

<p>Now we need to register for the UIKeyboardWillShowNotification and the UIKeyboardWillHideNotification:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p213code11'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p21311"><td class="code" id="p213code11"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSNotificationCenter_Class/"><span style="color: #400080;">NSNotificationCenter</span></a> defaultCenter<span style="color: #002200;">&#93;</span> addObserver<span style="color: #002200;">:</span>self selector<span style="color: #002200;">:</span><span style="color: #a61390;">@selector</span><span style="color: #002200;">&#40;</span>keyboardWillShow<span style="color: #002200;">:</span><span style="color: #002200;">&#41;</span> name<span style="color: #002200;">:</span>UIKeyboardWillShowNotification object<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span><span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSNotificationCenter_Class/"><span style="color: #400080;">NSNotificationCenter</span></a> defaultCenter<span style="color: #002200;">&#93;</span> addObserver<span style="color: #002200;">:</span>self selector<span style="color: #002200;">:</span><span style="color: #a61390;">@selector</span><span style="color: #002200;">&#40;</span>keyboardWillHide<span style="color: #002200;">:</span><span style="color: #002200;">&#41;</span> name<span style="color: #002200;">:</span>UIKeyboardWillHideNotification object<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span><span style="color: #002200;">&#93;</span>;</pre></td></tr></table></div>

<p>And these notifications need somewhere to go:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p213code12'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p21312"><td class="code" id="p213code12"><pre class="objc" style="font-family:monospace;"><span style="color: #6e371a;">#pragma mark -</span>
<span style="color: #6e371a;">#pragma mark Keyboard Handling</span>
&nbsp;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>keyboardWillShow<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSNotification_Class/"><span style="color: #400080;">NSNotification</span></a> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>notification <span style="color: #002200;">&#123;</span>
	<a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSDictionary_Class/"><span style="color: #400080;">NSDictionary</span></a> <span style="color: #002200;">*</span>userInfo <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>notification userInfo<span style="color: #002200;">&#93;</span>;
	<a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSValue_Class/"><span style="color: #400080;">NSValue</span></a> <span style="color: #002200;">*</span>keyboardBoundsValue <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>userInfo objectForKey<span style="color: #002200;">:</span>UIKeyboardBoundsUserInfoKey<span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>keyboardBoundsValue getValue<span style="color: #002200;">:&amp;</span>keyboardBounds<span style="color: #002200;">&#93;</span>;
	keyboardIsShowing <span style="color: #002200;">=</span> <span style="color: #a61390;">YES</span>;
	<span style="color: #002200;">&#91;</span>self resizeViewControllerToFitScreen<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>keyboardWillHide<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSNotification_Class/"><span style="color: #400080;">NSNotification</span></a> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>note <span style="color: #002200;">&#123;</span>
	keyboardIsShowing <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;
	keyboardBounds <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;">0</span>, <span style="color: #2400d9;">0</span><span style="color: #002200;">&#41;</span>;
	<span style="color: #002200;">&#91;</span>self resizeViewControllerToFitScreen<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span></pre></td></tr></table></div>

<p>And now add the magic method to resize the view:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p213code13'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p21313"><td class="code" id="p213code13"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>resizeViewControllerToFitScreen <span style="color: #002200;">&#123;</span>
	<span style="color: #11740a; font-style: italic;">// Needs adjustment for portrait orientation!</span>
	CGRect applicationFrame <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIScreen mainScreen<span style="color: #002200;">&#93;</span> applicationFrame<span style="color: #002200;">&#93;</span>;
	CGRect frame <span style="color: #002200;">=</span> self.view.frame;
	frame.size.height <span style="color: #002200;">=</span> applicationFrame.size.height;
&nbsp;
	<span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span>keyboardIsShowing<span style="color: #002200;">&#41;</span>
		frame.size.height <span style="color: #002200;">-=</span> keyboardBounds.size.height;
&nbsp;
	<span style="color: #002200;">&#91;</span>UIView beginAnimations<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span> context<span style="color: #002200;">:</span><span style="color: #a61390;">NULL</span><span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>UIView setAnimationBeginsFromCurrentState<span style="color: #002200;">:</span><span style="color: #a61390;">YES</span><span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>UIView setAnimationDuration<span style="color: #002200;">:</span>0.3f<span style="color: #002200;">&#93;</span>;
	self.view.frame <span style="color: #002200;">=</span> frame;
	<span style="color: #002200;">&#91;</span>UIView commitAnimations<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span></pre></td></tr></table></div>

<p>And super importantly de-register the ViewController from those notifications.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p213code14'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p21314"><td class="code" id="p213code14"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>viewWillDisappear<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">BOOL</span><span style="color: #002200;">&#41;</span>animated <span style="color: #002200;">&#123;</span>
	<span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSNotificationCenter_Class/"><span style="color: #400080;">NSNotificationCenter</span></a> defaultCenter<span style="color: #002200;">&#93;</span> removeObserver<span style="color: #002200;">:</span>self name<span style="color: #002200;">:</span>UIKeyboardWillShowNotification object<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span><span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSNotificationCenter_Class/"><span style="color: #400080;">NSNotificationCenter</span></a> defaultCenter<span style="color: #002200;">&#93;</span> removeObserver<span style="color: #002200;">:</span>self name<span style="color: #002200;">:</span>UIKeyboardWillHideNotification object<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span><span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span></pre></td></tr></table></div>

<p>See how this all comes together?</p>
<p>1. We register for Notifications when the Keyboard shows/hides,<br />
2. We react when the keyboard is shown/hidden,<br />
3. The resizeViewControllerToFitScreen method handles our resize, including animating the underlying view so it looks pretty.</p>
<p>There&#8217;s a few caveats:</p>
<p>1. I&#8217;ve not tested on Landscape mode, I&#8217;m pretty sure this will fail.<br />
2. UIKeyboardWillShowNotification can get fired every time you enter a textbox (as I&#8217;ve only one textbox it&#8217;s not a problem for me). So you might need to look at using &#8230;TextDidBeginEditing/&#8230;TextDidEndEditing or maintaining state differently so that the view isn&#8217;t jumping all over the place.</p>
]]></content:encoded>
			<wfw:commentRss>http://mozketo.com/resize-uiviewuitableview-when-keyboard-displays/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Geektool: Use that wasted space beside the Dock</title>
		<link>http://mozketo.com/geektool-use-that-wasted-space-beside-the-dock/</link>
		<comments>http://mozketo.com/geektool-use-that-wasted-space-beside-the-dock/#comments</comments>
		<pubDate>Fri, 22 May 2009 06:01:32 +0000</pubDate>
		<dc:creator>Mozketo</dc:creator>
				<category><![CDATA[Apple]]></category>

		<guid isPermaLink="false">http://mozketo.com/?p=164</guid>
		<description><![CDATA[One little gripe I&#8217;ve always had about in OS X is the apparent waste of space either side of the Dock (assuming you have it centred at the bottom of the screen).
Geektool to the rescue!

Here&#8217;s the little scripts that I use to get the weather (just change the region code ASXX0016 to your region from [...]]]></description>
			<content:encoded><![CDATA[<p>One little gripe I&#8217;ve always had about in OS X is the apparent waste of space either side of the Dock (assuming you have it centred at the bottom of the screen).</p>
<p><a href="http://projects.tynsoe.org/en/geektool/">Geektool</a> to the rescue!</p>
<p><a href='http://www.quicksnapper.com/Mozketo/image/-dock-w-weather-and-stats'><img src='http://www.quicksnapper.com/files/4932/14717678234A163D4C55EA8_m.png' alt='View the image at QuickSnapper.com' title='Hosted by QuickSnapper.com' width="505" /></a></p>
<p>Here&#8217;s the little scripts that I use to get the weather (just change the region code ASXX0016 to your region from <a href="http://weather.yahoo.com">weather.yahoo.com</a>. Your region code will be found in the yahoo URL):</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p164code18'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p16418"><td class="code" id="p164code18"><pre class="bash" style="font-family:monospace;">curl <span style="color: #660033;">--silent</span> <span style="color: #ff0000;">&quot;http://xml.weather.yahoo.com/forecastrss?p=ASXX0016&amp;u=c&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-E</span> <span style="color: #ff0000;">'(Current Conditions:|C&lt;BR)'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">'s/Current Conditions://'</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">'s/&lt;br \/&gt;//'</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">'s/&lt;b&gt;//'</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">'s/&lt;\/b&gt;//'</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">'s/&lt;BR \/&gt;//'</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">'s/&lt;description&gt;//'</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">'s/&lt;\/description&gt;//'</span></pre></td></tr></table></div>


<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p164code19'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p16419"><td class="code" id="p164code19"><pre class="bash" style="font-family:monospace;">curl <span style="color: #660033;">--silent</span> <span style="color: #ff0000;">&quot;http://xml.weather.yahoo.com/forecastrss?p=ASXX0016&amp;u=c&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-E</span> <span style="color: #ff0000;">'(High:)'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">'s/&lt;BR \/&gt;//'</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">'s/&lt;b&gt;//'</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">'s/&lt;\/b&gt;//'</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">'s/&lt;BR \/&gt;//'</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">'s/&lt;br \/&gt;//'</span></pre></td></tr></table></div>

<p>And the script for Memory usage, HDD space and Uptime:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p164code20'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p16420"><td class="code" id="p164code20"><pre class="bash" style="font-family:monospace;">top <span style="color: #660033;">-l</span> <span style="color: #000000;">1</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'/PhysMem/ {print $10}'</span> 
<span style="color: #c20cb9; font-weight: bold;">df</span> <span style="color: #660033;">-hl</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">'disk0s2'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $4}'</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Uptime: &quot;</span><span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">uptime</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print &quot;&quot; $3 &quot; &quot; $4 &quot; &quot; $5 }'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">'s/.$//g'</span>;<span style="color: #000000; font-weight: bold;">`</span></pre></td></tr></table></div>

<p>You might also be interested to check out other uses of Geektool on <a href="http://www.flickr.com/photos/tags/geektool/">Flickr</a></p>
<p>To Apple: Let us put Widgets on the Desktop too please (without having to use a hack).</p>
]]></content:encoded>
			<wfw:commentRss>http://mozketo.com/geektool-use-that-wasted-space-beside-the-dock/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>sudo in OS X with non-admin account</title>
		<link>http://mozketo.com/sudo-in-os-x-with-non-admin-account/</link>
		<comments>http://mozketo.com/sudo-in-os-x-with-non-admin-account/#comments</comments>
		<pubDate>Tue, 25 Nov 2008 01:45:33 +0000</pubDate>
		<dc:creator>Mozketo</dc:creator>
				<category><![CDATA[Apple]]></category>

		<guid isPermaLink="false">http://mozketo.com/blog/?p=10</guid>
		<description><![CDATA[I try to keep my Mac nice and secure so I run my everyday account ben with non-administrator privileges and keep an admin account so when I install Apps or use Software Update I will be asked for the admin user and password. This works just fine, but when I attempt to
sudo
from the command-line: Fail.
For example I [...]]]></description>
			<content:encoded><![CDATA[<p>I try to keep my Mac nice and secure so I run my everyday account <em>ben</em> with non-administrator privileges and keep an <em>admin</em> account so when I install Apps or use Software Update I will be asked for the admin user and password. This works just fine, but when I attempt to</p>
<pre>sudo</pre>
<p>from the command-line: Fail.</p>
<p>For example I was attempting to update Rails to version 2.2;</p>
<pre>gem update rails</pre>
<p>this of course failed, so I tried;</p>
<pre>sudo gem update rails</pre>
<p>When asked for my password, the <em>admin</em> password would fail, and my <em>ben</em> password would fail too with the error &#8220;ben is not in the sudoers file&#8221;. I expected the <em>ben</em> everyday-user to fail, but how to get my <em>admin</em> user to step up to the plate and take over?</p>
<p>Well I found the secret from <a href="#mce_temp_url#">here</a> and it worked beautifully. Simply type</p>
<pre>su &lt;admin username&gt;
sudo &lt;command&gt;
password: &lt;admin password&gt;</pre>
<p>Yipee, sudo from OS X terminal, finally.</p>
<p>And type </p>
<pre>exit</pre>
<p>to restore to your previous account prior to running su.</p>
]]></content:encoded>
			<wfw:commentRss>http://mozketo.com/sudo-in-os-x-with-non-admin-account/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
