<?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>Steili.com &#187; Coding</title>
	<atom:link href="http://www.steili.com/wordpress/category/coding/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.steili.com/wordpress</link>
	<description>My life ... My blog</description>
	<lastBuildDate>Thu, 20 May 2010 21:57: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>mySlate for iPad 1.03 Approved</title>
		<link>http://www.steili.com/wordpress/2010/05/20/myslate-for-ipad-1-03-approved/</link>
		<comments>http://www.steili.com/wordpress/2010/05/20/myslate-for-ipad-1-03-approved/#comments</comments>
		<pubDate>Thu, 20 May 2010 21:57:57 +0000</pubDate>
		<dc:creator>brandon</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://www.steili.com/wordpress/?p=214</guid>
		<description><![CDATA[
Just a heads up for anyone who has it &#8230; 1.03 of mySlate for iPad was just approved by Apple and should be propagating its way through the app store now. Here&#8217;s the changelog:
 
#WebView:
Added Bookmark Folders
Save Images with 2 finger tap on image
2 finger swipe left/right to go back/forward
#Photos:
Option to randomize the slideshow
#Videos
New display layout
#General
Change [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.steili.com/wordpress/wp-content/uploads/2010/05/Screen-shot-2010-05-20-at-3.56.12-PM.png" border="0" alt="Screen shot 2010-05-20 at 3.56.12 PM.png" width="199" height="191" /></p>
<p>Just a heads up for anyone who has it &#8230; 1.03 of mySlate for iPad was just approved by Apple and should be propagating its way through the app store now. Here&#8217;s the changelog:</p>
<p> </p>
<p><strong>#WebView:</strong></p>
<p>Added Bookmark Folders</p>
<p>Save Images with 2 finger tap on image</p>
<p>2 finger swipe left/right to go back/forward</p>
<p><strong>#Photos:</strong></p>
<p>Option to randomize the slideshow</p>
<p><strong>#Videos</strong></p>
<p>New display layout</p>
<p><strong>#General</strong></p>
<p>Change password</p>
<p>Contact Support﻿ from the app</p>
<p> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.steili.com/wordpress/2010/05/20/myslate-for-ipad-1-03-approved/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Limiting UITableview Cell Moves Between Sections</title>
		<link>http://www.steili.com/wordpress/2010/05/01/limiting-uitableview-cell-moves-between-sections/</link>
		<comments>http://www.steili.com/wordpress/2010/05/01/limiting-uitableview-cell-moves-between-sections/#comments</comments>
		<pubDate>Sat, 01 May 2010 17:25:13 +0000</pubDate>
		<dc:creator>brandon</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://www.steili.com/wordpress/?p=206</guid>
		<description><![CDATA[
Problem: You want to limit if a tableview cell is ABLE to move to a new section, or is limited to ONLY moving to a new section. For example in mySlate I&#8217;m supporting moving bookmarks to a new section/folder. However the bookmarks are laid out in alphabetical order inside a section/folder, so re-ordering them would [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.steili.com/wordpress/wp-content/uploads/2010/05/CBD4D958-0624-4B0E-9D08-022F7C6C8CDE.jpg" alt="CBD4D958-0624-4B0E-9D08-022F7C6C8CDE.jpg" border="0" width="160" height="90" /></p>
<p>Problem: You want to limit if a tableview cell is ABLE to move to a new section, or is limited to ONLY moving to a new section. For example in mySlate I&#8217;m supporting moving bookmarks to a new section/folder. However the bookmarks are laid out in alphabetical order inside a section/folder, so re-ordering them would do no good. Each time you open the bookmarks view they are returned alphabetically from the data store.</p>
<p>Solution:</p>
<pre>
- (NSIndexPath *)tableView:(UITableView *)tableView targetIndexPathForMoveFromRowAtIndexPath:(NSIndexPath *)sourceIndexPath toProposedIndexPath:(NSIndexPath *)proposedDestinationIndexPath
{
    if( sourceIndexPath.section != proposedDestinationIndexPath.section )
    {
        return proposedDestinationIndexPath;
    }
    else
    {
        return sourceIndexPath;
    }
//Reverse those to support only moving inside a section
}
</pre>
<p>Of course supporting movement in the tableview is yours to implement.</p>
<p>Source: <a href="http://stackoverflow.com/questions/849926/how-to-limit-uitableview-row-reordering-to-a-section">stackoverflow</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.steili.com/wordpress/2010/05/01/limiting-uitableview-cell-moves-between-sections/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Saving an Image from UIWebView</title>
		<link>http://www.steili.com/wordpress/2010/04/30/saving-an-image-from-uiwebview/</link>
		<comments>http://www.steili.com/wordpress/2010/04/30/saving-an-image-from-uiwebview/#comments</comments>
		<pubDate>Sat, 01 May 2010 02:59:47 +0000</pubDate>
		<dc:creator>brandon</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://www.steili.com/wordpress/?p=196</guid>
		<description><![CDATA[
I spent the last few days trying to wrap my head around how to save a user selected image in a UIWebView. The concept itself would seem really simple, and if you&#8217;re using Safari on the iPad or iPhone it is really simple. You just tap and hold on an image. Simple. Problem is, when [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.steili.com/wordpress/wp-content/uploads/2010/04/IMG_0049.jpg" alt="IMG_0049.jpg" border="0" width="540" height="264" /></p>
<p>I spent the last few days trying to wrap my head around how to save a user selected image in a UIWebView. The concept itself would seem really simple, and if you&#8217;re using Safari on the iPad or iPhone it is really simple. You just tap and hold on an image. Simple. Problem is, when you&#8217;re developing you&#8217;re own application, this functionality doesn&#8217;t exist in UIWebView. Don&#8217;t believe me? Try it out for yourself. Go ahead&#8230; I&#8217;ll wait.</p>
<p>Ok, so if you&#8217;re still here you must have found out I&#8217;m right. The worst part of all this is I found out the hard way&#8230; from a user. I rarely save images from the web, so it never occurred to me to try it in my own app (and honestly I thought this was built in freebie functionality). Well, I got an email the other day from a user who was shocked that this didn&#8217;t work. He was not nearly as shocked as I was. I was even more shocked to find out that there&#8217;s pretty much nobody on the web who has discussed how to do this. Much time was spent searching for a solution, a couple tweets sent with only crickets responding, time was spent filling out a bug report with Apple (<a href="http://openradar.appspot.com/radar?id=303401">radar</a>) only to have it closed without a work around as a duplicate. So, I basically hit a brick wall.</p>
<p>Alright, let&#8217;s get down to it. My complaining is done. Well not really. Did you also know its a huge PITA to handle touches in a UIWebView? Like to the point where you&#8217;re either having to <a href="http://mithin.in/2009/08/26/detecting-taps-and-events-on-uiwebview-the-right-way/">sub-class UIWindow</a> to trap touches or you&#8217;re having to add a view <a href="http://codepimpsdotorg.blogspot.com/2009/10/capturing-uiwebview-touches.html">above the UIWebView</a>. I&#8217;m going to leave it up to you as to how you want to implement what we&#8217;re talking about. I personally decided to not bother with any of it. Why? Well, I&#8217;ve already started building in a bunch of gestures, so it just made sense use a gesture recognizer instead of adding in a bunch of code which may or may not end up breaking sooner than later. My hope is that Apple fixes the problem, but I&#8217;m not holding my breath. Anyway, choose for yourself. For this example we&#8217;ll just follow the KISS method.</p>
<p>Ok, here come the code. First things first, you need to have some kind of way to collect touches. For simplicity we&#8217;ll use a UITapGestureRecognizer:</p>
<pre>
UITapGestureRecognizer *doubleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(doubleTap:)];
doubleTap.numberOfTouchesRequired = 2;
[self.webView addGestureRecognizer:doubleTap];
[doubleTap release];</pre>
<p>What we&#8217;ve done is simply define a gesture (two fingers on tap the screen at the same time) and add that to the webview. When the webview detects two fingers on the screen (tap) it&#8217;ll fire the doubleTap method which is where we&#8217;ll figure out what image has been selected (if any at all).</p>
<pre>
- (void) doubleTap:(UITapGestureRecognizer *)sender {
	int scrollPosition = [[self.webView stringByEvaluatingJavaScriptFromString:@"window.pageYOffset"] intValue];
	CGPoint startPoint = [sender locationInView:self.webView];
	NSString *js = [NSString stringWithFormat:@"document.elementFromPoint(%f, %f).tagName", startPoint.x, startPoint.y+scrollPosition];
	NSString *value = [self.webView stringByEvaluatingJavaScriptFromString:js];
	if ([value isEqualToString:@"IMG"]) {
		NSString *imgURL = [NSString stringWithFormat:@"document.elementFromPoint(%f, %f).src", startPoint.x, startPoint.y+scrollPosition];
		NSString *urlToSave = [self.webView stringByEvaluatingJavaScriptFromString:imgURL];
		}

//Do whatever you want - like a UIAlertView or UIPopover to let the user chose what to do with the image
}
</pre>
<p>So, let&#8217;s walk through the code. The first thing we need to get is where we are on the page. Without this vital chunk of information we end up sending the same coordinates to the document so even if we&#8217;re at the bottom of the web page, when we tap the top of the screen it sends the coordinates for the header image. Not good. Next we get the location of the tap in the webView itself. After that we determine which element is at the location where the user tapped. Notice we added the scroll position to the y coordinate so again we don&#8217;t end up with the same x,y all the time. &#8216;tagName&#8217; returns back the element type &#8211; &#8216;A&#8217;, &#8216;IMG&#8217;, &#8216;IFRAME&#8217; etc. We only want images right now (you could always grab the a ref if you wanted to do other fun stuff) so we throw an if statement in to check if the element is an image. If it is, we grab the URL of the element and do stuff with it.</p>
<p>When that code is all said and done you&#8217;ll end up with an NSString like so:<br />
http://justanotheripadblog.com/wp-content/uploads/2010/04/3GiPad_thumb.jpg<br />
Nice right?</p>
<p>So, that&#8217;s how I ended up saving images from a UIWebView without resorting to private API calls or other wacky business.</p>
<p><b>Sound Off:</b> Did this work for you? Am I crazy and there was a much easier way? Please let me know in the comments. Thanks!</p>
<p>Credits: <a href="http://www.icab.de/blog/2009/07/27/webkit-on-the-iphone-part-1/#comment-212">iCab Blog</a> for the elementFromPoint idea &#8211; see Alexander&#8217;s comment on 9/1 11:55am, and the <a href="http://www.perfectbrowser.com/">support folks at perfectbrowser.com</a> who got me started looking at doing this through javascript.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.steili.com/wordpress/2010/04/30/saving-an-image-from-uiwebview/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>gCalWall Updates</title>
		<link>http://www.steili.com/wordpress/2009/04/23/gcalwall-updates/</link>
		<comments>http://www.steili.com/wordpress/2009/04/23/gcalwall-updates/#comments</comments>
		<pubDate>Thu, 23 Apr 2009 16:11:43 +0000</pubDate>
		<dc:creator>brandon</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[gCalWall]]></category>

		<guid isPermaLink="false">http://www.steili.com/wordpress/?p=166</guid>
		<description><![CDATA[
I just wanted to throw up a quick post on the current state of gCalWall. I know there&#8217;s some things that are a little &#8220;wonky&#8221;. Some (minor number) of folks have seen issues with all day events, and some other stuff like blurry images. I have every intention of doing everything I can to fix [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.steili.com/wordpress/wp-content/uploads/2009/04/gcalwall-128.png" alt="gCalWall_128.png" border="0" width="128" height="128" /></p>
<p>I just wanted to throw up a quick post on the current state of gCalWall. I know there&#8217;s some things that are a little &#8220;wonky&#8221;. Some (minor number) of folks have seen issues with all day events, and some other stuff like blurry images. I have every intention of doing everything I can to fix these issues. I also have every intention of working in some requested improvements. But at the same time, I haven&#8217;t made much of anything off of gCalWall wall &#8211; so while its a product I intend to continue working on, it&#8217;s not a &#8220;top&#8221; priority.</p>
<p>So, long story short &#8211; I&#8217;m working on it, but I wouldn&#8217;t expect to release anything (aside from a major affects everybody emergency bugfix) until the iPhone 3.0 software is released. Why? Well, there&#8217;s some things I have to change for gCalWall in 3.0 to work properly and I&#8217;ve already got a development build started. So, rather than try and maintain separate builds, I&#8217;m jumping ship from 2.x and moving on to 3.x&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.steili.com/wordpress/2009/04/23/gcalwall-updates/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building an iPhone App Without Interface Builder</title>
		<link>http://www.steili.com/wordpress/2009/02/25/building-an-iphone-app-without-interface-builder/</link>
		<comments>http://www.steili.com/wordpress/2009/02/25/building-an-iphone-app-without-interface-builder/#comments</comments>
		<pubDate>Thu, 26 Feb 2009 05:13:08 +0000</pubDate>
		<dc:creator>brandon</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[iphone developement]]></category>

		<guid isPermaLink="false">http://www.steili.com/wordpress/?p=140</guid>
		<description><![CDATA[Building iPhone Applications without Interface Builder from Troy Mcilvena on Vimeo
Adding this one for my own future reference. The important things to note was really how to remove the references to the NIB files when first building the project.
In the Resouces like locate the info.plist file and right click then go to source view and [...]]]></description>
			<content:encoded><![CDATA[<p><object width="400" height="300"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=3363949&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=3363949&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"></embed></object><br /><a href="http://vimeo.com/3363949">Building iPhone Applications without Interface Builder</a> from <a href="http://vimeo.com/mcilvena">Troy Mcilvena</a> on <a href="http://vimeo.com">Vimeo</a></p>
<p>Adding this one for my own future reference. The important things to note was really how to remove the references to the NIB files when first building the project.</p>
<p>In the Resouces like locate the info.plist file and right click then go to source view and delete:</p>
<pre>key - NSMainNibFile
string - MainWindow</pre>
<p>While you&#8217;re in he resources list also delete the mainWindow.xib file. Finally open &#8220;Other Sources&#8221; main.m and you&#8217;re going to edit this line:</p>
<pre>
int retVal = UIApplicationMain(argc, argv, nil, nil);
</pre>
<p> and make it look like this:</p>
<pre>
    int retVal = UIApplicationMain(argc, argv, nil, @"Your_App_Delegate_Class");</pre>
<p>That pretty well sums up the key points. There&#8217;s some good information about UIWindow and UIView in the video as well if you&#8217;re not familiar with building your base view without IB. <a href="http://www.steili.com/wordpress/gcalwall/">gCalWall</a> was built largely without using Interface Builder at all so I was pretty familiar with most of it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.steili.com/wordpress/2009/02/25/building-an-iphone-app-without-interface-builder/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Excellent iPhone Email App Tutorial</title>
		<link>http://www.steili.com/wordpress/2009/02/25/excellent-iphone-email-app-tutorial/</link>
		<comments>http://www.steili.com/wordpress/2009/02/25/excellent-iphone-email-app-tutorial/#comments</comments>
		<pubDate>Thu, 26 Feb 2009 03:52:52 +0000</pubDate>
		<dc:creator>brandon</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://www.steili.com/wordpress/?p=138</guid>
		<description><![CDATA[iphone programming from Joe on Vimeo
Definitely worth the time to watch. Make sure you click on through and say thanks to Joe!
]]></description>
			<content:encoded><![CDATA[<p><object width="400" height="300"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=3331338&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=3331338&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"></embed></object><br /><a href="http://vimeo.com/3331338">iphone programming</a> from <a href="http://vimeo.com/user1341598">Joe</a> on <a href="http://vimeo.com">Vimeo</a></p>
<p>Definitely worth the time to watch. Make sure you click on through and say <a href="http://vimeo.com/3331338">thanks to Joe</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.steili.com/wordpress/2009/02/25/excellent-iphone-email-app-tutorial/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>NSCFArray append string errors, distinct Objective-C types</title>
		<link>http://www.steili.com/wordpress/2009/01/22/nscfarray-append-string-errors-distinct-objective-c-types/</link>
		<comments>http://www.steili.com/wordpress/2009/01/22/nscfarray-append-string-errors-distinct-objective-c-types/#comments</comments>
		<pubDate>Fri, 23 Jan 2009 01:49:51 +0000</pubDate>
		<dc:creator>brandon</dc:creator>
				<category><![CDATA[Coding]]></category>

		<guid isPermaLink="false">http://www.steili.com/wordpress/?p=69</guid>
		<description><![CDATA[
Ran into some weirdness earlier which was absolutely killing me. I&#8217;m building a project using SQLite Persistent Objects, and this:
NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
	dict = [Commands sortedFieldValuesWithKeysForProperty:@"commandname"];
	self.keyLookup = [dict mutableDeepCopy];

	NSMutableArray *array = [[NSMutableArray alloc] init];
	array = [[[self.keyLookup allValues] sortedArrayUsingSelector:@selector(compare:)] retain];
was throwing an error about assigning the values from a distinct Objective-C type. I was [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.steili.com/wordpress/wp-content/uploads/2009/01/picture-11.png" border="0" alt="Picture 1.png" width="278" height="154" /></p>
<p>Ran into some weirdness earlier which was absolutely killing me. I&#8217;m building a project using SQLite Persistent Objects, and this:</p>
<pre>NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
	dict = [Commands sortedFieldValuesWithKeysForProperty:@"commandname"];
	self.keyLookup = [dict mutableDeepCopy];

	NSMutableArray *array = [[NSMutableArray alloc] init];
	array = [[[self.keyLookup allValues] sortedArrayUsingSelector:@selector(compare:)] retain];</pre>
<p>was throwing an error about assigning the values from a distinct Objective-C type. I was able to fake my way around it in another viewController I had a similar issue with, but this time it was a show stopper because when I tried to work with the resulting array later (by adding/removing some stuff from it) I would get another error:</p>
<pre>exception: *** -[NSCFArray addObject:]: mutating method sent to immutable object</pre>
<p>Well, I was pretty dammed sure I hadn&#8217;t asked for my array to be immutable, but I&#8217;m guessing somewhere in the code for the persistent object (which I&#8217;ll be checking into) there&#8217;s a copy happening (or something similar) and its turning the returned data into an NSCFArray. To fix it&#8230; I needed to make it a mutable array again:</p>
<pre>if (self.commandArray != array){
		[self.commandArray release];
		self.commandArray = [array mutableCopy];</pre>
<p>Of course this may be simple if you&#8217;re the programming type&#8230; but it drove me nuts for a while!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.steili.com/wordpress/2009/01/22/nscfarray-append-string-errors-distinct-objective-c-types/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>UISearchBar to be the top item in the view</title>
		<link>http://www.steili.com/wordpress/2009/01/22/searchbar-to-be-the-top-item-in-the-view/</link>
		<comments>http://www.steili.com/wordpress/2009/01/22/searchbar-to-be-the-top-item-in-the-view/#comments</comments>
		<pubDate>Thu, 22 Jan 2009 19:54:21 +0000</pubDate>
		<dc:creator>brandon</dc:creator>
				<category><![CDATA[Coding]]></category>

		<guid isPermaLink="false">http://www.steili.com/wordpress/?p=59</guid>
		<description><![CDATA[
So what to do if you&#8217;re building a view and you have a navigationBar at the top of the view but you want a searchbar at the top instead?
Try this in your viewDidLoad:
 self.navigationController.navigationBar.topItem.titleView = searchBar;
Of course you&#8217;ll need to define searchBar in the header file too&#8230;
IBOutlet UISearchBar *searchbar;
Along with doing all the NIB file [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.steili.com/wordpress/wp-content/uploads/2009/01/picture-1.png" alt="Picture 1.png" border="0" width="301" height="80" /></p>
<p>So what to do if you&#8217;re building a view and you have a navigationBar at the top of the view but you want a searchbar at the top instead?</p>
<p>Try this in your viewDidLoad:</p>
<pre> self.navigationController.navigationBar.topItem.titleView = searchBar;</pre>
<p>Of course you&#8217;ll need to define searchBar in the header file too&#8230;</p>
<pre>IBOutlet UISearchBar *searchbar;</pre>
<p>Along with doing all the NIB file stuff, property declarations, blah blah blah&#8230; but you get the idea.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.steili.com/wordpress/2009/01/22/searchbar-to-be-the-top-item-in-the-view/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Had to write a VBScript today</title>
		<link>http://www.steili.com/wordpress/2009/01/13/43/</link>
		<comments>http://www.steili.com/wordpress/2009/01/13/43/#comments</comments>
		<pubDate>Tue, 13 Jan 2009 21:25:14 +0000</pubDate>
		<dc:creator>brandon</dc:creator>
				<category><![CDATA[Coding]]></category>

		<guid isPermaLink="false">http://www.steili.com/wordpress/?p=43</guid>
		<description><![CDATA[
 photo credit: wisof
Had to write a VBScript today to do some funky stuff. Basically we needed to copy in a string of text and then output that text so it would be formatted to go into an email.
Input text looked something like:
x.x.x.0/x Company  How Assigned    Location
The big issue I had with all of this [...]]]></description>
			<content:encoded><![CDATA[<p><a title="003_p5_det_c" href="http://www.flickr.com/photos/84952594@N00/2501818300/" target="_blank"><img src="http://farm4.static.flickr.com/3201/2501818300_fe9c4d68e9_m.jpg" border="0" alt="003_p5_det_c" /></a><br />
<small><a title="Attribution-ShareAlike License" href="http://creativecommons.org/licenses/by-sa/2.0/" target="_blank"><img src="http://www.steili.com/wordpress/wp-content/plugins/photo-dropper/images/cc.png" border="0" alt="Creative Commons License" width="16" height="16" align="absmiddle" /></a> <a href="http://www.photodropper.com/photos/" target="_blank">photo</a> credit: <a title="wisof" href="http://www.flickr.com/photos/84952594@N00/2501818300/" target="_blank">wisof</a></small></p>
<p>Had to write a VBScript today to do some funky stuff. Basically we needed to copy in a string of text and then output that text so it would be formatted to go into an email.</p>
<p>Input text looked something like:</p>
<p>x.x.x.0/x Company  How Assigned    Location</p>
<p>The big issue I had with all of this is that there&#8217;s spaces in the company names, spaces in the location, spaces in how assigned&#8230; so I couldn&#8217;t use a space as the delimter. Well, the code is UGLY&#8230; but the general concept is I knew I had certain points where I would have more than one space in a row. After the company name I had 2 spaces. After the How assigned I had 4 spaces. So I could create a couple arrays and delimit using those known values. The only other problem I had was how to get rid of the IP address before the company name&#8230; well I solved that by getting rid of all the numbers from the section of the array where the company should be. Again this isn&#8217;t pretty &#8211; but it got the job done.</p>
<pre>
window.resizeTo 450,500</code>

dim arrHeaders(3), strIP, strCompany, strStatus, strNewContent
arrHeaders(0) = "IP Block:"
arrHeaders(1) = "Customer:"
arrHeaders(2) = "Status:"
arrHeaders(3) = "IDC:"

Sub SetCopyPaste

strPortal = "From the site:"

strline = CopyPaste.value
arrFields = Split(strLine)
arrFields2 = Split(strline, "  ")
cutString = arrFields2(0)
arrFields3 = Split(strline, "    ")

strAlphaNumeric = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ "
For i = 1 to len(cutString)
strChar = mid(cutString,i,1)
If instr(strAlphaNumeric,strChar) Then
CleanedString = CleanedString &amp; strChar
End If
next

strIP = arrFields(0)
strCompany = CleanedString
strStatus = arrFields2(1)
strIDC = arrFields3(1)
strNewContent = strPortal &amp; vbCrLf &amp; vbCrLf &amp; arrheaders(0) &amp; " " &amp; strIP &amp; " - " &amp; strStatus &amp; vbCrLf _
&amp; arrHeaders(1) &amp; " " &amp; strCompany &amp; vbCrLf &amp; arrheaders(3) &amp; " " &amp; strIDC

CombinedText.Value = strNewContent

End Sub
</pre>
<p>Obviously there&#8217;s VBSCRIPT tags at the top and the bottom&#8230; and some HTML to format the page.</p>
<p>The attached file you can grab and see the whole thing with the code and whatnot.</p>
<p>Output text looked like this:<br />
<code>From the site:</code></p>
<p>IP Block: x.x.x.0/x &#8211; How Assigned<br />
Customer: Company<br />
IDC: Location</p>
<p>spam-email</p>
]]></content:encoded>
			<wfw:commentRss>http://www.steili.com/wordpress/2009/01/13/43/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TabBarViewController with TableViews</title>
		<link>http://www.steili.com/wordpress/2009/01/10/tabbarviewcontroller-with-tableviews/</link>
		<comments>http://www.steili.com/wordpress/2009/01/10/tabbarviewcontroller-with-tableviews/#comments</comments>
		<pubDate>Sun, 11 Jan 2009 04:13:41 +0000</pubDate>
		<dc:creator>brandon</dc:creator>
				<category><![CDATA[Coding]]></category>

		<guid isPermaLink="false">http://www.steili.com/wordpress/?p=37</guid>
		<description><![CDATA[
 photo credit: databhi ♪♫
Here&#8217;s the solution to that generic problem of creating a tabBarController that has Navigation Controllers / tableViews under each tab.
(SOURCE LINK &#8211; See posts 5 &#38; 8 )
Here's the code. Reposted for my future reference in case the source disappears. 

@interface AppDelegate : NSObject  {
    UIWindow *window;
 [...]]]></description>
			<content:encoded><![CDATA[<p><a title="Coding can kill" href="http://www.flickr.com/photos/53222432@N00/398077393/" target="_blank"><img src="http://farm1.static.flickr.com/147/398077393_873acbecaa_m.jpg" border="0" alt="Coding can kill" /></a><br />
<small><a title="Attribution-NonCommercial-NoDerivs License" href="http://creativecommons.org/licenses/by-nc-nd/2.0/" target="_blank"><img src="http://www.steili.com/wordpress/wp-content/plugins/photo-dropper/images/cc.png" border="0" alt="Creative Commons License" width="16" height="16" align="absmiddle" /></a> <a href="http://www.photodropper.com/photos/" target="_blank">photo</a> credit: <a title="databhi ♪♫" href="http://www.flickr.com/photos/53222432@N00/398077393/" target="_blank">databhi ♪♫</a></small></p>
<p>Here&#8217;s the solution to that generic problem of creating a tabBarController that has Navigation Controllers / tableViews under each tab.</p>
<p>(<a href="http://www.iphonedevsdk.com/forum/iphone-sdk-development/2447-tab-bar-controller-navigation-controller-tableview.html">SOURCE LINK</a> &#8211; See posts 5 &amp; 8 )</p>
<pre>Here's the code. Reposted for my future reference in case the source disappears. 

@interface AppDelegate : NSObject  {
    UIWindow *window;
    UITabBarController *tabBarController;
    MyTableViewController *myTableViewController;
    MySecondTableViewController *mySecondTableViewController;
}

@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) UITabBarController *tabBarController;
@property (nonatomic, retain) MyTableViewController *myTableViewController;
@property (nonatomic, retain) MySecondTableViewController *mySecondTableViewController;

@end

@implementation AppDelegate

@synthesize window, myTableViewController, mySecondTableViewController, tabBarController;

- (void)applicationDidFinishLaunching:(UIApplication *)application {

       tabBarController = [[UITabBarController alloc] init];          // creates your tab bar so you can add everything else to it

       myTableViewController = [[MyTableViewController alloc] init];               // creates your table view - this should be a UIViewController with a table view in it, or UITableViewController
       UINavigationController *tableNavController = [[[UINavigationController alloc] initWithRootViewController:myTableViewController] autorelease];
       [myTableViewController release];                                                              // creates your table view's navigation controller, then adds the view controller you made. Note I then let go of the view controller as the navigation controller now holds onto it for me. This saves memory.

       mySecondTableViewController = [[MySecondTableViewController alloc] init];
       UINavigationController *table2NavController = [[[UINavigationController alloc] initWithRootViewController:mySecondTableViewController] autorelease];
       [mySecondTableViewController release];                                                    // does exactly the same as the first round, but for your second tab at the bottom of the bar.

       tabBarController.viewControllers = [NSArray arrayWithObjects:tableNavController, table2NavController, nil]; add both of your navigation controllers to the tab bar. You can put as many controllers on as you like, but they will turn into the more button like in the iPod program.

       [window addSubview:tabBarController.view];                                              // adds the tab bar's view property to the window
       [window makeKeyAndVisible];                                                                  // makes the window visible
}

- (void)dealloc {
       [tabBarController release];
       [window release];
       [super dealloc];
}                                           // lets go of everything else, thats so your program doesn't create any leaks of memory.

@end</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.steili.com/wordpress/2009/01/10/tabbarviewcontroller-with-tableviews/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
