<?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>Doga Berntas &#187; english</title>
	<atom:link href="http://doganberktas.com/category/english/feed/" rel="self" type="application/rss+xml" />
	<link>http://doganberktas.com</link>
	<description>is actually from a small planet somewhere in the vicinity of Betelgeuse</description>
	<lastBuildDate>Sat, 21 Apr 2012 21:48:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Passing Data with TTNavigator</title>
		<link>http://doganberktas.com/2012/04/21/passing-data-with-ttnavigator/</link>
		<comments>http://doganberktas.com/2012/04/21/passing-data-with-ttnavigator/#comments</comments>
		<pubDate>Fri, 20 Apr 2012 21:22:57 +0000</pubDate>
		<dc:creator>dkberktas</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[ipad]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[320]]></category>
		<category><![CDATA[initWithNavigatorURL]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[three20]]></category>
		<category><![CDATA[ttnavigator]]></category>

		<guid isPermaLink="false">http://doganberktas.com/?p=808</guid>
		<description><![CDATA[Three20 has a nice way of handling navigation between controllers. One thing that is not immediately obvious is passing data to the controller. From the sample code and the extremely short wiki page, we can see how to pass data with a query parameter when there is another parameter. NSArray*arr =[...load up with data...]; [[TTNavigator [...]]]></description>
			<content:encoded><![CDATA[<p>Three20 has a nice way of handling navigation between controllers. One thing that is not immediately obvious is passing data to the controller. From the <a href="https://github.com/facebook/three20/tree/master/samples/TTNavigatorDemo">sample code</a> and the extremely <a href="http://three20.info/article/2010-10-06-URL-Based-Navigation">short wiki page</a>, we can see how to pass data with a query parameter when there is another parameter.</p>
<pre>NSArray*arr =[...load up with data...];
[[TTNavigator navigator] openURLAction:[[TTURLAction actionWithURLPath:@"tt://restaurant/Chotchkie's"]
applyQuery:[NSDictionary dictionaryWithObject:arr forKey:@"arrayData"]]];
-(id) initWithName:(NSString*)name query:(NSDictionary*)query 
{
  for(MyObject* item in[query objectForKey:@"arrayData"])
  //... do something with item ...
}

// ...

}</pre>
<p>But, what happens when you only want to pass the query parameter?</p>
<pre> - (id)initWithNavigatorURL:(NSURL*)URL query:(NSDictionary*)query</pre>
<p><strong>Obvious right!</strong></p>
<p>Thanks <a href="http://stackoverflow.com/questions/6678012/three20-passing-of-object">StackOverflow</a></p>
]]></content:encoded>
			<wfw:commentRss>http://doganberktas.com/2012/04/21/passing-data-with-ttnavigator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iOS and Custom Fonts</title>
		<link>http://doganberktas.com/2012/01/26/ios-and-custom-fonts/</link>
		<comments>http://doganberktas.com/2012/01/26/ios-and-custom-fonts/#comments</comments>
		<pubDate>Wed, 25 Jan 2012 22:52:51 +0000</pubDate>
		<dc:creator>dkberktas</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[ipad]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[custom fonts]]></category>
		<category><![CDATA[font]]></category>
		<category><![CDATA[HelveticaNeue]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[iPad]]></category>

		<guid isPermaLink="false">http://doganberktas.com/?p=793</guid>
		<description><![CDATA[Recently, I was working on a game with Cocos2d and keep getting this weird iOS version problem. On iOS 5, all my labels were shown as expected but on iOS 4 labels somehow kept disappearing. First I thought this is because of the retina display and point/pixels stuff. However, it was because of the fonts I was [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a title="Crazy quilt collage, is this Cubism (Hockney anyone?) or is this a Fauvist mess?" href="http://flickr.com/photos/23642817@N00/2478897091"><br />
</a></p>
<p>Recently, I was working on a game with Cocos2d and keep getting this weird iOS version problem. On iOS 5, all my labels were shown as expected but on iOS 4 labels somehow kept disappearing. First I thought this is because of the retina display and point/pixels stuff. However, it was because of the fonts I was using. HelveticaNeue-CondensedBold and HelveticaNeue-CondensedBlack are available on iOS 5, but not on iOS 4 (<a href="http://iosfonts.com/" target="_blank">http://iosfonts.com/</a>).</p>
<p><a title="Crazy quilt collage, is this Cubism (Hockney anyone?) or is this a Fauvist mess?" href="http://flickr.com/photos/23642817@N00/2478897091"><img class="aligncenter" src="http://farm4.static.flickr.com/3086/2478897091_02ac5a97fb.jpg" alt="" width="309" height="500" /></a></p>
<p>I googled to see how easy to add custom fonts and it turned out, it is super easy.</p>
<p>These are the links I found helpful:</p>
<ul>
<li>Adding custom fonts by Dave Allanson (<a href="http://www.daveallanson.com/index.php?option=com_content&amp;view=article&amp;id=56:adding-custom-fonts-ios-4&amp;catid=38:blog&amp;Itemid=56" target="_blank">link</a>)</li>
<li>Using Custom Fonts by M. Arsalan Anwar (<a href="http://arsalananwar.blogspot.com/2010/10/using-custom-fonts-on-iphoneipad.html" target="_blank">link</a>)</li>
</ul>
<div><strong>Steps to Add Custom Font:</strong></div>
<div>1. Add font files to project</div>
<div>2. Open your Info.plist file</div>
<div>3. Create the key &#8220;UIAppFonts&#8221;  as Array (it will be shown as &#8220;Fonts provided by application&#8221;  if you are not on Ras Key/Value state, right click and you will see what I mean)</div>
<div>4. Add the fonts to the array</div>
<div><a href="http://doganberktas.com/wp-content/uploads/2012/01/Screen-Shot-2012-01-25-at-2.43.30-PM.png"><img class="alignnone size-medium wp-image-796" title="Screen Shot 2012-01-25 at 2.43.30 PM" src="http://doganberktas.com/wp-content/uploads/2012/01/Screen-Shot-2012-01-25-at-2.43.30-PM-300x34.png" alt="" width="300" height="34" /></a></div>
<div>5. In your code, you can use these fonts as if you are using the regular ones (without the file extension).</div>
<div><strong>Drawing Problems:</strong></div>
<div>If you get the fonts from Adobe, we will get a drawing problem like mentioned <a href="http://stackoverflow.com/questions/5414730/custom-installed-font-not-displayed-correctly-in-uilabel">here</a>. You need to follow the steps <a href="http://stackoverflow.com/questions/7535498/uibutton-custom-font-vertical-alignment/8314197#8314197">here</a>, change the font file&#8217;s ascender property. Don&#8217;t worry it is not that scary as it seems <img src='http://doganberktas.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  Don&#8217;t forget to install Apple Font Tool Suite from <a href="http://developer.apple.com/fonts/">here</a>.</div>
]]></content:encoded>
			<wfw:commentRss>http://doganberktas.com/2012/01/26/ios-and-custom-fonts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Animating Views with iPhone Keyboard</title>
		<link>http://doganberktas.com/2011/02/21/animating-views-with-iphone-keyboard/</link>
		<comments>http://doganberktas.com/2011/02/21/animating-views-with-iphone-keyboard/#comments</comments>
		<pubDate>Mon, 21 Feb 2011 11:29:48 +0000</pubDate>
		<dc:creator>dkberktas</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[NSNotificationCenter]]></category>
		<category><![CDATA[UIKeyboardWillHideNotification]]></category>
		<category><![CDATA[UIKeyboardWillShowNotification]]></category>

		<guid isPermaLink="false">http://doganberktas.com/?p=765</guid>
		<description><![CDATA[Keyboards on iPhone can be a headache with their half screen size, especially when you have many input fields on a single view. Animating the view in an elegant way so that the input fields are always visible to the user  requires to slide up or down with the keyboard synchronously. Following is a very simple view [...]]]></description>
			<content:encoded><![CDATA[<p><a title="Swimming In The iPool" href="http://flickr.com/photos/83346641@N00/3420540107"><img src="http://farm4.static.flickr.com/3378/3420540107_f71054f41f.jpg" alt="" /></a>Keyboards on iPhone can be a headache with their half screen size, especially when you have many input fields on a single view. Animating the view in an elegant way so that the input fields are always visible to the user  requires to slide up or down with the keyboard synchronously.</p>
<p>Following is a very simple view based project, that will demonstrate animating view with keyboard slide up/down.<br />
But first, let&#8217;s see the problem. If you don&#8217;t change your view positioning when the keyboard becomes visible, basically you are likely to get something like this:</p>
<p style="text-align: center;"><a href="http://doganberktas.com/wp-content/uploads/2011/02/Screen-shot-2011-02-21-at-2.06.19-AM.png"><img class="size-full wp-image-768  aligncenter" title="Screen shot 2011-02-21 at 2.06.19 AM" src="http://doganberktas.com/wp-content/uploads/2011/02/Screen-shot-2011-02-21-at-2.06.19-AM.png" alt="" width="396" height="744" /></a><a href="http://doganberktas.com/wp-content/uploads/2011/02/Screen-shot-2011-02-21-at-2.06.27-AM.png"><img class="size-full wp-image-767  aligncenter" title="Screen shot 2011-02-21 at 2.06.27 AM" src="http://doganberktas.com/wp-content/uploads/2011/02/Screen-shot-2011-02-21-at-2.06.27-AM.png" alt="" width="396" height="744" /></a></p>
<p>To fix that, what should be done is to listen the keyboard slide up/down notifications through the NSNotificationCenter, which viewWillAppear is a good place to start listening these two notifications.</p>
<pre>-(void)viewWillAppear:(BOOL)animated
{
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(slideUpView:) name:UIKeyboardWillShowNotification object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(slideDownView:) name:UIKeyboardWillHideNotification object:nil];
}</pre>
<p>Second step is to change the positioning of the components according to the animation of the keyboard. The following methods are called when there is a notification from the keyboard:</p>
<pre>-(void)slideDownView:(NSNotification*)notification
{
	[[[notification userInfo] objectForKey:UIKeyboardAnimationCurveUserInfoKey] getValue:&amp;animationCurve];
    [[[notification userInfo] objectForKey:UIKeyboardAnimationDurationUserInfoKey] getValue:&amp;animationDuration];
    [[[notification userInfo] objectForKey:UIKeyboardBoundsUserInfoKey] getValue:&amp;keyboardFrame];

	[UIView animateWithDuration:animationDuration
				delay:0.0
				options:animationCurve
				animations:^{
					self.view.frame = CGRectMake(0, 0, 320, 480);
				}
				completion:^(BOOL finished){
					NSLog(@"Slide down Done..!");
				}];
}

-(void)slideUpView:(NSNotification*)notification
{
    [[[notification userInfo] objectForKey:UIKeyboardAnimationCurveUserInfoKey] getValue:&amp;animationCurve];
    [[[notification userInfo] objectForKey:UIKeyboardAnimationDurationUserInfoKey] getValue:&amp;animationDuration];
    [[[notification userInfo] objectForKey:UIKeyboardBoundsUserInfoKey] getValue:&amp;keyboardFrame];
	//
	[UIView animateWithDuration:animationDuration
				delay:0.0
				options:animationCurve
				animations:^{
					self.view.frame = CGRectMake(0, -keyboardFrame.size.height + 70, 320, 416);
				}
				completion:^(BOOL finished){
					NSLog(@"Slide up Done..!");
				}];
}</pre>
<p>Don&#8217;t forget to add .h file the following declarations:</p>
<pre>// in controller's .h file
NSTimeInterval animationDuration;
UIViewAnimationCurve animationCurve;
CGRect keyboardFrame;</pre>
<p>The final result is something like this</p>
<p style="text-align: center;"><a href="http://doganberktas.com/wp-content/uploads/2011/02/Screen-shot-2011-02-21-at-3.22.16-AM.png"><img class="aligncenter" title="Screen shot 2011-02-21 at 3.22.16 AM" src="http://doganberktas.com/wp-content/uploads/2011/02/Screen-shot-2011-02-21-at-3.22.16-AM.png" alt="" width="396" height="744" /></a></p>
<p>note 1: Feel free to download the source code (<a href="http://doganberktas.com/code/SlideUpWithKeyboard.zip">link</a>). It also includes the slide down via the button.<br />
note 2: The licence to this peace of code is <a href="http://en.wikipedia.org/wiki/Beerware">Beerware</a>, In short, &#8220;Should the user of the product meet the author and consider the software useful, he is encouraged to buy the author a <a href="http://en.wikipedia.org/wiki/Beer">beer</a> &#8216;in return&#8217; (or, in some variations, drink a beer in the author&#8217;s honor).&#8221;</p>
]]></content:encoded>
			<wfw:commentRss>http://doganberktas.com/2011/02/21/animating-views-with-iphone-keyboard/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Signing Up to AWS and Creating your First EC2 Instance &#8212; A Step by Step Guide</title>
		<link>http://doganberktas.com/2010/11/23/signing-up-to-aws-and-creating-your-first-instance-a-step-by-step-guide/</link>
		<comments>http://doganberktas.com/2010/11/23/signing-up-to-aws-and-creating-your-first-instance-a-step-by-step-guide/#comments</comments>
		<pubDate>Tue, 23 Nov 2010 21:11:46 +0000</pubDate>
		<dc:creator>dkberktas</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[Amazon Elastic Compute Cloud]]></category>
		<category><![CDATA[amazon web services]]></category>
		<category><![CDATA[Amazon.com]]></category>
		<category><![CDATA[aws]]></category>
		<category><![CDATA[ec2]]></category>
		<category><![CDATA[monkey]]></category>
		<category><![CDATA[private key]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[Web services]]></category>

		<guid isPermaLink="false">http://doganberktas.com/?p=747</guid>
		<description><![CDATA[There are lots of sources about  how to start AWS EC2, but this abundance can be intimidating and confusing. During the last summer, when I tried to find a hosting solution for Remotespots, I briefly tried AWS EC2, but then switched to Eapps since they speed things up. What you need to do in three steps is that Sign [...]]]></description>
			<content:encoded><![CDATA[<p>There are lots of sources about  how to start AWS EC2, but this abundance can be intimidating and confusing. During the last summer, when I tried to find a hosting solution for Remotespots, I briefly tried AWS EC2, but then switched to Eapps since they speed things up.</p>
<p><a title="Alone" href="http://flickr.com/photos/36855333@N05/3396582319"><img src="http://farm4.static.flickr.com/3427/3396582319_f11b04f724.jpg" alt="" /></a></p>
<p>What you need to do in three steps is that</p>
<ul>
<li>Sign up to AWS, connect to AWS (preferable with Amazon EC2 API Tools)</li>
<li>Create an instance (via API tools or the web console)</li>
<li>Connect to that instance via SSH.</li>
</ul>
<p>These are the steps that works for me,</p>
<p>1. Sign up AWS &#8212; <a href="http://aws.amazon.com/">http://aws.amazon.com/</a></p>
<p>2. Follow the steps at that <a href="http://www.robertsosinski.com/2008/01/26/starting-amazon-ec2-with-mac-os-x/">link</a>, and create X.509 certificate (also download private key when doing that)</p>
<p>3. Create an instance from the <a href="https://console.aws.amazon.com/ec2/">https://console.aws.amazon.com/ec2/</a> (Don&#8217;t forget to save the private key .pem file while creating the instance)</p>
<p>5. Follow the steps here <a href="http://paulstamatiou.com/how-to-getting-started-with-amazon-ec2">http://paulstamatiou.com/how-to-getting-started-with-amazon-ec2</a> for connecting to the instance via SSH.</p>
<p>Links that helps <img src='http://doganberktas.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>- AWS console &#8211; <a href="https://console.aws.amazon.com/ec2/">https://console.aws.amazon.com/ec2/</a></p>
<p>- AWS portal &#8212; <a href="https://aws-portal.amazon.com/">https://aws-portal.amazon.com/</a></p>
<p>- Starting Amazon EC2 with Mac OS X &#8212; <a href="http://www.robertsosinski.com/2008/01/26/starting-amazon-ec2-with-mac-os-x/">http://www.robertsosinski.com/2008/01/26/starting-amazon-ec2-with-mac-os-x/</a></p>
<p>- How To: Getting Started with Amazon EC2 &#8212; <a href="http://paulstamatiou.com/how-to-getting-started-with-amazon-ec2">http://paulstamatiou.com/how-to-getting-started-with-amazon-ec2</a></p>
<p>- Connect to Your Linux/UNIX Instance &#8212; <a href="http://docs.amazonwebservices.com/AWSEC2/latest/GettingStartedGuide/">http://docs.amazonwebservices.com/AWSEC2/latest/GettingStartedGuide/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://doganberktas.com/2010/11/23/signing-up-to-aws-and-creating-your-first-instance-a-step-by-step-guide/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Data Storage Alternatives on iOS (in a Nutshell)</title>
		<link>http://doganberktas.com/2010/10/16/data-storage-alternatives-on-ios-in-a-nutshell/</link>
		<comments>http://doganberktas.com/2010/10/16/data-storage-alternatives-on-ios-in-a-nutshell/#comments</comments>
		<pubDate>Sat, 16 Oct 2010 20:27:00 +0000</pubDate>
		<dc:creator>dkberktas</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[ipad]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[data managements]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[iPad]]></category>

		<guid isPermaLink="false">http://doganberktas.com/?p=687</guid>
		<description><![CDATA[Below you can find the summary of available alternatives for storing data on iOS based machines. Mainly, which one to use depends on your needs like size of data, need of concurrency, access speed, etc. NSUserDefaults Based on plists Store lightweight app state Tutorial (link) Plist &#8212; Writing everything out as a plist Not suitable [...]]]></description>
			<content:encoded><![CDATA[<p><a title="The Sheep, and we Twitter Sheep can follow these 10 great photographers!" href="http://flickr.com/photos/95572727@N00/3440978820"><img class="alignnone" src="http://farm4.static.flickr.com/3414/3440978820_cf8c782674.jpg" alt="" width="500" height="332" /></a></p>
<p><a title="The Sheep, and we Twitter Sheep can follow these 10 great photographers!" href="http://flickr.com/photos/95572727@N00/3440978820"></a>Below you can find the summary of available alternatives for storing data on iOS based machines. Mainly, which one to use depends on your needs like size of data, need of concurrency, access speed, etc.</p>
<ul>
<li>NSUserDefaults
<ul>
<li>Based on plists</li>
<li>Store lightweight app state</li>
<li>Tutorial (<a href="http://icodeblog.com/2008/10/03/iphone-programming-tutorial-savingretrieving-data-using-nsuserdefaults/">link</a>)</li>
</ul>
</li>
<li>Plist &#8212; Writing everything out as a plist
<ul>
<li>Not suitable for complex model objects</li>
<li>Faster than NSUserDefaults</li>
<li>How to load a plist (<a href="http://code.davidjanes.com/blog/2009/03/23/how-to-load-a-plist-in-an-iphone-application/">link</a>)</li>
<li>Write &amp; Read data to .plist (<a href="http://ipgames.wordpress.com/tutorials/writeread-data-to-plist-file/">link</a>)</li>
</ul>
</li>
<li>Archived Objects
<ul>
<li>Conteptual guide (<a title="http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Archiving/Archiving.html%23//apple_ref/doc/uid/10000047-SW1" href="http://">link</a>)</li>
<li>Archives provide a means to convert objects and values into an architecture-independent stream of bytes that preserves the identity of and the relationships between the objects and values.</li>
<li>Serialization converts Objective-C types to and from an architecture-independent byte stream. In contrast to archiving, basic serialization does not record the data type of the values nor the relationships between them; only the values themselves are recorded. Arbitrary objects cannot be serialized. Only instances of NSArray, NSDictionary, NSString, NSDate, NSNumber, and NSData (and some of their subclasses) can be serialized. (<a href="http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Archiving/Articles/objectgraphs.html">link</a>)</li>
<li>Forum post about how to use archiver (<a href="http://www.iphonedevsdk.com/forum/iphone-sdk-development/3369-archiving-object-nskeyedarchiver-sqlite-coredata.html">link</a>)</li>
</ul>
</li>
<li>The joy of SQLite
<ul>
<li>Basically a local file act like a database server</li>
<li>Not very good for extreme concurrent access</li>
<li>A step by step tutorial (<a href="http://dblog.com.au/iphone-development-tutorials/iphone-sdk-tutorial-reading-data-from-a-sqlite-database/">link</a>)</li>
</ul>
</li>
<li>Core Data
<ul>
<li>Higher abstraction layer than SQLite</li>
<li>Save&amp;load model objects</li>
<li>ORM (Rails ActiveRecord, Java Hibernate)</li>
<li>Use NSPredicate for in memory filtering</li>
<li>Apple Dev Center Article (<a href="http://developer.apple.com/macosx/coredata.html">link</a>)</li>
</ul>
</li>
<li>Web Services
<ul>
<li>Store &amp; access remote data</li>
<li>XML and Json parsers</li>
</ul>
</li>
</ul>
<p>ps. Related Stackoverflow <a href="http://stackoverflow.com/questions/934878/iphone-plist-or-sqlite-for-static-data">entry</a></p>
]]></content:encoded>
			<wfw:commentRss>http://doganberktas.com/2010/10/16/data-storage-alternatives-on-ios-in-a-nutshell/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Amazon S3 and Paperclip on Rails 3</title>
		<link>http://doganberktas.com/2010/09/14/amazon-s3-and-paperclip-rails-3/</link>
		<comments>http://doganberktas.com/2010/09/14/amazon-s3-and-paperclip-rails-3/#comments</comments>
		<pubDate>Tue, 14 Sep 2010 16:53:43 +0000</pubDate>
		<dc:creator>dkberktas</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[paperclip]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[rails 3]]></category>
		<category><![CDATA[rails3]]></category>
		<category><![CDATA[RoR]]></category>

		<guid isPermaLink="false">http://doganberktas.com/?p=662</guid>
		<description><![CDATA[I previously posted about Using Amazon S3 with Paperclip. This post will talk about same topic. But this time for Rails 3. Install aws-s3 by adding Gemfile gem 'aws-s3' and run bundle install Create s3.yml file under config directory and enter your Amazon S3 credentials (also I assume you created the buckets for development and [...]]]></description>
			<content:encoded><![CDATA[<p>I previously posted about <a href="http://doganberktas.com/tag/amazon-s3/">Using Amazon S3 with Paperclip</a>. This post will talk about same topic. But this time for Rails 3.</p>
<li>Install aws-s3 by adding Gemfile
<pre>gem 'aws-s3'</pre>
<p>and run</p>
<pre>bundle install</pre>
</li>
<li>Create s3.yml file under config directory and enter your Amazon S3 credentials (also I assume you created the buckets for development and production)
<pre>development:
  bucket: bucket-dev
  access_key_id: xxx
  secret_access_key: xxx
test:
  bucket: bucket-test
  access_key_id: xxx
  secret_access_key: xxx
production:
  bucket: bucket-pro
  access_key_id: xxx
  secret_access_key: xxx</pre>
</li>
<li> Open your model file that will hold the attachment and modify it as follows:
<pre>  #paperclip
  has_attached_file :photo,
       :styles =&gt; {
       :thumb=&gt; "100x100#",
       :small  =&gt; "400x400&gt;" },
     :storage =&gt; :s3,
     :s3_credentials =&gt; "#{RAILS_ROOT}/config/s3.yml",
     :path =&gt; "/:style/:id/:filename"</pre>
</li>
<p>That&#8217;s it! Simple isn&#8217;t it.</p>
<p>links that might help</p>
<li><a href="http://docs.heroku.com/s3">http://docs.heroku.com/s3</a></li>
<li><a href="http://stackoverflow.com/questions/3055105/establishing-connection-w-amazon-s3-from-heroku">http://stackoverflow.com/questions/3055105/establishing-connection-w-amazon-s3-from-heroku</a></li>
]]></content:encoded>
			<wfw:commentRss>http://doganberktas.com/2010/09/14/amazon-s3-and-paperclip-rails-3/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Paperclip on Rails 3 &#8212; damn easy!</title>
		<link>http://doganberktas.com/2010/09/12/paperclip-on-rails-3-damn-easy/</link>
		<comments>http://doganberktas.com/2010/09/12/paperclip-on-rails-3-damn-easy/#comments</comments>
		<pubDate>Sun, 12 Sep 2010 12:03:29 +0000</pubDate>
		<dc:creator>dkberktas</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[amazon s3]]></category>
		<category><![CDATA[file attachment]]></category>
		<category><![CDATA[paperclip]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[rails 3]]></category>
		<category><![CDATA[RoR]]></category>

		<guid isPermaLink="false">http://doganberktas.com/?p=640</guid>
		<description><![CDATA[Paperclip is a Rails plug-in for attaching files to models. Using Paperclip is also very easy to use, it can thumbnail your images and also send the files to Amazon S3. From this link, you can find the steps for creating a Rails project from scratch with paperclip. http://jameswilding.net/2010/07/24/paperclip-rails-3/ As I have already had a [...]]]></description>
			<content:encoded><![CDATA[<p>Paperclip is a Rails plug-in for attaching files to models. Using Paperclip is also very easy to use, it can thumbnail your images and also send the files to Amazon S3.</p>
<p>From this link, you can find the steps for creating a Rails project from scratch with paperclip.<br />
<a href="http://jameswilding.net/2010/07/24/paperclip-rails-3/"> http://jameswilding.net/2010/07/24/paperclip-rails-3/</a></p>
<p style="text-align: left;">As I have already had a project that needs file attachments, I follow a slightly different path.</p>
<p><a title="Milan Train Station at Midnight" href="http://flickr.com/photos/95572727@N00/211239773"><img class="aligncenter" src="http://farm1.static.flickr.com/83/211239773_940d75fc4d.jpg" alt="" width="450" height="298" /></a></p>
<p>The steps for adding a file attachment is as follows:</p>
<ol>
<li>Install Paperclip</li>
<pre>$ rails plugin install git://github.com/thoughtbot/paperclip.git</pre>
<li>Add image attribute to your model</li>
<pre>  #paperclip
  has_attached_file :photo,
     :styles =&gt; {
       :thumb=&gt; "100x100#",
       :small  =&gt; "400x400&gt;" }</pre>
<li>Create migration file and add the necessary columns to your database</li>
<pre>$ rails generate migration add_photo_to_microposts photo_file_name:string photo_content_type:string photo_file_size:integer</pre>
<pre>rake db:migrate</pre>
<li>Change you form</li>
<pre>
<div id="_mcePaste">&lt;%= form_for @micropost  , :html =&gt; { :multipart =&gt; true } do |f| %&gt;</div>
<div id="_mcePaste">  &lt;%= f.file_field :photo %&gt;</div>
<div id="_mcePaste">  ...</div>
</pre>
<li>Change view that will show the uploaded image (optional)</li>
<pre>&lt;% if micropost.photo.exists? then %&gt;
	&lt;%= image_tag micropost.photo.url(:small) %&gt;
&lt;% end %&gt;</pre>
</ol>
<p>That&#8217;s it. It is done.</p>
]]></content:encoded>
			<wfw:commentRss>http://doganberktas.com/2010/09/12/paperclip-on-rails-3-damn-easy/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>So How Do You Convince Google App Engine to Create Your Datastore Indexes</title>
		<link>http://doganberktas.com/2010/09/03/so-how-do-you-convience-google-app-engine-to-create-your-datastore-indexes/</link>
		<comments>http://doganberktas.com/2010/09/03/so-how-do-you-convience-google-app-engine-to-create-your-datastore-indexes/#comments</comments>
		<pubDate>Fri, 03 Sep 2010 14:11:47 +0000</pubDate>
		<dc:creator>dkberktas</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[e-tohum]]></category>
		<category><![CDATA[etohum]]></category>
		<category><![CDATA[gae]]></category>
		<category><![CDATA[gae/j]]></category>
		<category><![CDATA[index]]></category>

		<guid isPermaLink="false">http://doganberktas.com/?p=606</guid>
		<description><![CDATA[Creating indexes on Google App Engine / Java (gae/j) is an easy job. You don&#8217;t even have to think about it (well, for some time) For etohum admin application we used gae/j and it has been almost two years and gae/j has been improved a lot, but still, it has some really annoying features (bugs [...]]]></description>
			<content:encoded><![CDATA[<p>Creating indexes on Google App Engine / Java (gae/j) is an easy job. You don&#8217;t even have to think about it (well, for some time)</p>
<p>For <a href="http://doganberktas.com/tag/e-tohum/">etohum</a> admin application we used gae/j and it has been almost two years and gae/j has been improved a lot, but still, it has some really annoying features (bugs &#8212; I am not sure how to named them).</p>
<p>This time, it is the <strong>Datastore Indexes</strong>. Some of the pages requires indexes like</p>
<p><img style="margin-top: 5px; margin-bottom: 5px;" src="http://doganberktas.com/wp-content/uploads/2010/09/Screen-shot-2010-09-03-at-4.48.10-PM.png" alt="" width="500" height="21" /></p>
<p>which turns out to be confusing for the auto generation tool. If, let&#8217;s say, you change the order of the last two fields,</p>
<p>like this</p>
<p><img style="margin-top: 5px; margin-bottom: 5px;" src="http://doganberktas.com/wp-content/uploads/2010/09/Screen-shot-2010-09-03-at-4.48.02-PM.png" alt="" width="500" height="21" /></p>
<p>you will not get it automatically.</p>
<p>Even if you explicitly define it in your  <strong>datastore-indexes.xml</strong> file</p>
<pre>&lt;datastore-index kind="Application" ancestor="false" source="manual"&gt;
 &lt;property name="applciationIsFinished" direction="asc"/&gt;
 &lt;property name="isSpam" direction="asc"/&gt;
 &lt;property name="sezonId" direction="asc"/&gt;
 &lt;property name="bitisTarihi" direction="desc"/&gt;
 &lt;property name="basvuruTarihi" direction="desc"/&gt;
 &lt;/datastore-index&gt;
</pre>
<p>And the workaround for the problem is stated in the last paragraph of <a href="http://code.google.com/appengine/docs/java/config/indexconfig.html#Using_Automatic_Index_Configuration">Using Automatic Index Configuration documentation</a></p>
<blockquote><p>It&#8217;s a good idea to occasionally move index configuration from <code>datastore-indexes-auto.xml</code> to <code>datastore-indexes.xml</code>,  then disable automatic index configuration and test your app in the  development server.  This makes it easy to maintain indexes without  having to manage two files, and ensures that your testing will reproduce  errors caused by missing index configuration.</p></blockquote>
<p>So change the <strong>datastore-indexes.xml</strong> file and add manually the all required indexes and upload the application.</p>
<pre>&lt;datastore-indexes autoGenerate="false"&gt;</pre>
<p>You can change it back to auto generate after make sure the desired indexes are created.</p>
<p>ps. A tip about gae/j is that it is considerable faster when it is 4AM-7AM at the west coast of North America.</p>
]]></content:encoded>
			<wfw:commentRss>http://doganberktas.com/2010/09/03/so-how-do-you-convience-google-app-engine-to-create-your-datastore-indexes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iOS Shouldn&#8217;t Have 6 Device Orientations</title>
		<link>http://doganberktas.com/2010/08/30/ios-shouldnt-have-6-device-orientations/</link>
		<comments>http://doganberktas.com/2010/08/30/ios-shouldnt-have-6-device-orientations/#comments</comments>
		<pubDate>Mon, 30 Aug 2010 19:47:51 +0000</pubDate>
		<dc:creator>dkberktas</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[ipad]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[device orientation]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[view controller]]></category>

		<guid isPermaLink="false">http://doganberktas.com/?p=592</guid>
		<description><![CDATA[For a small iPad project, I happened to use iPad&#8217;s orientation stuff. As it turns out, there is always a catch. In UIDevice class , you see the following orientations: typedef enum { UIDeviceOrientationUnknown, UIDeviceOrientationPortrait, // Device oriented vertically, home button on the bottom UIDeviceOrientationPortraitUpsideDown, // Device oriented vertically, home button on the top UIDeviceOrientationLandscapeLeft, [...]]]></description>
			<content:encoded><![CDATA[<p>For a small iPad project, I happened to use iPad&#8217;s orientation stuff. As it turns out, there is always a catch.</p>
<p>In UIDevice class , you see the following orientations:</p>
<pre>
typedef enum
{
    UIDeviceOrientationUnknown,
    UIDeviceOrientationPortrait,            // Device oriented vertically, home button on the bottom
    UIDeviceOrientationPortraitUpsideDown,  // Device oriented vertically, home button on the top
    UIDeviceOrientationLandscapeLeft,       // Device oriented horizontally, home button on the right
    UIDeviceOrientationLandscapeRight,      // Device oriented horizontally, home button on the left
    UIDeviceOrientationFaceUp,              // Device oriented flat, face up
    UIDeviceOrientationFaceDown             // Device oriented flat, face down
} UIDeviceOrientation;
</pre>
<p>But for a view controller&#8217;s parent, there are only four</p>
<p>self.parentViewController.interfaceOrientation only has</p>
<pre>typedef enum
{
    UIInterfaceOrientationPortrait           = UIDeviceOrientationPortrait,
    UIInterfaceOrientationPortraitUpsideDown = UIDeviceOrientationPortraitUpsideDown,
    UIInterfaceOrientationLandscapeLeft      = UIDeviceOrientationLandscapeRight,
    UIInterfaceOrientationLandscapeRight     = UIDeviceOrientationLandscapeLeft
} UIInterfaceOrientation;</pre>
<p>So the problem arises when you try to layout according to</p>
<pre>  [UIDevice currentDevice].orientation</pre>
<p>When the device orientation is UIDeviceOrientationFaceUp or UIDeviceOrientationFaceDown, you get 3 orientation changed calls. One is the up and down, than a landscape, than again up or down.</p>
<p>This is, to be honest, completely broken. It is clear that, since the status bar can be located to four locations on the screen, there should be 4 device orientations, not 6. The FaceUp and FaceDown should be a different property I guess (gravityOrientation or sth like that)</p>
<p>ps. Some links that can help if you have issues with this up&amp;down thing</p>
<ul>
<li><a href="http://blogs.remobjects.com/blogs/mh/2010/06/29/p1685">Handling UIDeviceOrientationFaceUp &amp; UIDeviceOrientationFaceDown </a></li>
<li><a href="http://www.cocos2d-iphone.org/forum/topic/6413">http://www.cocos2d-iphone.org/forum/topic/6413</a></li>
<li><a href="http://www.iphonedevsdk.com/forum/iphone-sdk-development/45799-ipad-device-orientation-face-up.html">http://www.iphonedevsdk.com/forum/iphone-sdk-development/45799-ipad-device-orientation-face-up.html</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://doganberktas.com/2010/08/30/ios-shouldnt-have-6-device-orientations/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Adding Short Sound Clips to iPhone/iPad Apps</title>
		<link>http://doganberktas.com/2010/08/24/adding-short-sound-clips-to-iphoneipad-apps/</link>
		<comments>http://doganberktas.com/2010/08/24/adding-short-sound-clips-to-iphoneipad-apps/#comments</comments>
		<pubDate>Tue, 24 Aug 2010 15:20:24 +0000</pubDate>
		<dc:creator>dkberktas</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[ipad]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[ios4]]></category>
		<category><![CDATA[iPad]]></category>
		<category><![CDATA[system audio API]]></category>

		<guid isPermaLink="false">http://doganberktas.com/?p=579</guid>
		<description><![CDATA[There are lots of ways of playing/recording audio in your iPhone/iPad app, and probably this is why it took me a while to decide which one to chose, Here are the alternatives (List of Audio APIs) &#8211; System Sound API &#8212; very short &#8211; limited file type &#8211; no control AVAudioPlayer class &#8212; objC Audio [...]]]></description>
			<content:encoded><![CDATA[<p>There are lots of ways of playing/recording audio in your iPhone/iPad app, and probably this is why it took me a while to decide which one to chose,</p>
<p>Here are the alternatives (List of Audio APIs) &#8211;</p>
<ul>
<li><strong>System Sound API &#8212; very short &#8211; limited file type &#8211; no control</strong></li>
<li>AVAudioPlayer class &#8212; objC</li>
<li>Audio Toolbox &#8212; recording &#8211; streaming &#8211; controls</li>
<li>Audio Units &#8212; audio processing</li>
<li>OpenAL &#8212; 3D positional sound (Yes, just like OpenGL)</li>
</ul>
<p>Since what I need is just to play a short audio clip w/out any looping or any other control, I choose System Audio API.</p>
<p>As always, Google is the first address to ask howto use System Audio AP, <a title="Permanent Link to How To Play Audio With The iPhone SDK" rel="bookmark" href="http://iphoneincubator.com/blog/tutorial/how-to-play-audio-with-the-iphone-sdk">How To Play Audio With The iPhone SDK</a> is a step by step guide, but it takes the starting point from a sample code project from Apple, which is no longer available.</p>
<p>Another one is the sample code project <a href="https://developer.apple.com/iphone/library/samplecode/SysSound/Introduction/Intro.html">SysSound</a> which contains an iOS4 specific feature so that it will not work on iPad.</p>
<p>So how to play an audio clip w/out hassling that much?</p>
<p>Here is the code snippet : (don&#8217;t forget to add the AudioToolbox framework)<br />
#include<br />
&#8230;.</p>
<pre>-(void)playSound
{
	SystemSoundID shortSound;
	NSURL* audioFile = [NSURL fileURLWithPath:[[NSBundle mainBundle]
				pathForResource:[NSString stringWithFormat:@"filename"] ofType:@"wav"]];
	AudioServicesCreateSystemSoundID((CFURLRef)audioFile, &amp;shortSound); 

	//playing it
	AudioServicesPlaySystemSound(shortSound);

	//cleanup
	AudioServicesDisposeSystemSoundID(shortSound);

}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://doganberktas.com/2010/08/24/adding-short-sound-clips-to-iphoneipad-apps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

