Blog Archives

How to find the soil type in your area.

I was looking for an information about soil type in my area and come across the online GIST system Web Soil Survey, which give me all information I need to know.

You will need select an area of interest using Soil Survey area section and pressing on “Set AOI”.

Navigate to soil map and navigate the map to see your area.

A Guide to Mac Diagnostic and Repair Utilities

Back in the very old days almost every Mac user owned a copy of Norton Utilities, a name synonymous with fixing any Mac problem. “Have you run Norton on it?” was the first step in any repair routine. Today, no single program dominates the market. There are several different maintenance applications to choose from, and the one you end up using will depend on both the specific problem you’re encountering and your level of comfort and experience with Mac troubleshooting.

Apple Utilities: Your First Step

Regardless of what problem you’re having, your first step should be to try one of Apple’s own utilities. Apple provides several free Mac utilities in the OS. Apple Hardware Test (AHT) is included with every new Mac. The AHT boot CD bypasses your operating system and tests basic hardware such as your hard drive, memory, processing, and video. The tests are very basic and a passing  grade doesn’t always mean all is well. Apple sees AHT as a quick test to rule out obvious problems. If your Mac is just acting weird, AHT is a quick and easy place to start your troubleshooting journey.

Another Apple utility is Apple’s Disk Utility which can be found inside the Utilities folder (which is in your Mac’s Applications folder). The app is also on your OS X installation disc. Disk Utility’s is primarily for screening drives for serious problems like disk file structure errors (things are out of place), SMART failures (early warning signs of a problem), or permissions issues. For some repairs, you’ll need to boot from your installation disc. Apple’s provides extensive instructions on how to use Disk Utility on its support website.

General Disk Maintenance and Basic Repair

For basic hard drive checks and repair, the closest equivalent today to the power and simplicity of the original Norton Disk Doctor is Alsoft’s Disk Warrior ($99.95). Disk Warrior primarily does one thing and does it very well: it repairs disk directories.

All the cryptic and confusing errors Apple’s Disk Utility has problems with, Disk Warrior fixes with flying colors. Your disk’s directory is similar to a table of contents crossed with an index, and when it gets confused (usually due to program crashes or improper machine shutdowns), Disk Warrior rebuilds (instead of repairs) the directory, allowing the computer to operate normally.

Disk Warrior can’t repair the drive it’s installed on, so you’ll have to run it off of the installation DVD or another volume if you want to repair your boot drive.

Disk Warrior should be a part of any basic troubleshooting routine and I always run it before any system updates. It’s my most trusted and relied upon Mac Utility.

Data Recovery


At the first sign of disk failure, you need to consider whether or not you’ll be sending the drive off for forensic-style data recovery from a company like DriveSavers.  If you think you’ll be using professionals, then stop all recovery efforts and call them right away. Although these services often cost thousands of dollars, sometimes it could be covered by insurance.

If you want to go the do-it-yourself route, my first choice is Stellar Phoenix 4.1 ($79). The program is extremely powerful and deals best with volumes that won’t mount on your Mac. It pushes right through read errors and recovers data that other programs can’t find. Some recovery applications may give up if they encounter excessive read errors, which are common on dying hard drives, but Stellar Phoenix will keep trying until it recovers whatever data it can. Unfortunately, the interface is confusing and unintuitive like. In spite of the bad UI, however, the program itself is very reliable.

Hard Drive Optimization


Drive Genius 3($99) by Prosoft Engineering, has a comprehensive suite of hard drive utilities attractively packaged with a easy-to-use interface that lets you tweak every possible byte of performance from your storage device.

Drive Genius includes not only those functions covered by Disk Utility such as secure erasure, initialization and partitioning, but also adds a slew of maintenance and optimization routines. For those using a smaller hard drive, their proprietary DriveSlim algorithms removes unnecessary files to add space.

Although not necessary for the average user, Drive Genius also includes a defragmentation option, along with advanced functions for sector editing, benchmarking, cloning and an early warning system for potential problems called “Drive Pulse.” Drive Genius is used by Apple’s own Genius staff for yearly checkups. I recommend Drive Genius for more experienced users and geeks who want to really explore their hard drive.

Hardware Problems

TechTool Pro 5 ($99) by Micromat goes way beyond the AHT, doing more extensive testing of your memory, hard drive, audio and video. Apple includes a limited version of TechTool called TechTool Deluxe with the purchase of AppleCare that provides a limited subset of the full version’s hardware tests.

A unique part of TechTool is the “eDrive” feature, which creates a bootable partition on your current hard drive in order to run its utilities in case of emergency. More technical users probably would be more comfortable using an external hard drive, but rest of us will find this eDrive very useful for basic maintenance and testing. eDrive and most of TechTool’s other hard drive tools aren’t included with TechTool Deluxe, representing the major difference between it and the full Pro product.

Which should you buy?

Overall, every Mac user would benefit from owning a copy of DiskWarrior for periodic maintenance. If you aren’t fastidious about backing up (or work with others who aren’t), Stellar Phoenix can really save your data and I suggest it as your primary recovery tool, but you might be able to wait until something actually goes wrong. For the more technically inclined, I’d recommend TechTool Pro over Drive Genius because it includes both optimization and hardware testing. If all you want to do is occasionally optimize your hard drive and save space, owning just Drive Genius is a great choice.

While one program doesn’t do it all like in the days of good ol’ Norton, this list of programs will provide you the key to solving some of your own computer problems.

Related content from GigaOM Pro (sub req’d):

Getting Around Apple’s AirPrint Restrictions

New iPad ads show users effortlessly printing with the tap of a finger. Unfortunately, the reality doesn’t match the ads: AirPrint, introduced in iOS 4.2, only works with 16 printers, all from HP. If you don’t have one of these higher-end printers, you’re out of luck. Or you would be, if it weren’t for third-party solutions.

Enabling More Printers for AirPrint With Printopia

For those user who’ve upgraded to iOS 4.2, Ecamm Network provides an effective and reliable solution with Printopia. For $9.95, Printopia enables AirPrint on any printer your Mac can connect to and works with both Leopard and Snow Leopard (great for those still using PowerPC-based Macs). Not only does it allow printing, but it will also convert files to PDF or JPG for storage on your local Mac or on Dropbox.

Printopia has three key requirements: your iPad must be on the same network as your Mac, you must be running iOS 4.2 or higher, and the application you’re using must support AirPrint. If you don’t meet all those requirements, other options exist and I detail them below.

Pinnacle of Printing: Print Bureau

Eurosmartz has nine different printing apps ranging in price from $2.99 to $12.99. Print Bureau ($12.99) encompasses the features of all each in a single app and can print emails, contacts, calendars, pictures, clipboards and both local and cloud-based files. If it’s on your iPad or accessible via your iPad, Print Bureau should be able to print it. I was able to directly access iDisk, Google Docs, Dropbox, box.net, FTP, and WebDav with the app.

Printing directly from Print Bureau can produce inconsistent results, since it communicates directly with printers. Fortunately, Eurosmartz also offers an alternative method using a companion application called “WePrint.”

WePrint works on Macs running OS X Tiger and above, as well as on XP, Vista, and Windows 7. Instead of having Print Bureau (and any other Eurosmartz apps) print directly to the printer, WePrint intercepts the file and routes it through the desktop’s native printer software, ensuring near-perfect compatibility.

Moreover, WePrint will monitor an email address for you and print any files you send it via the iOS app, thereby enabling printing from outside your local area network. They call it “Printing Over 3G”, but you can be on any type of network to use it.

Other Alternatives

For basic photo printing, a majority of manufacturers have their own printing apps, which are usually free. I’ve tried both HP iPrint Photo 3 and Epson’s iPrint. Both print pictures very well (including screen shots from other iOS apps). Considering these manufacturer-based apps are free, having them all in case you happen to need them is probably a good idea.

Other apps I tested such as Wella’s Print MagicAvatron’s Air Sharing Pro, and Microtech’s ePrint weren’t always compatible with every printer in every situation. The key advantage of these apps is that they don’t require a “helper” application to be installed on a separate computer. In public environments like a computer lab or hotel, Wella’s ePrint was the most reliable. I was able to walk into a Wi-Fi network and simply print to an available printer. Great for printing a boarding pass at the last minute!

Developers Picking Up Where Apple Left Off

While we’ve come to expect the ability to print from any program on our Mac, it’s sadly still not fully baked in to the iPad, iPhone and iPod touch. Fortunately, programs like Printopia and Print Bureau are helping users bridge the gap between Apple’s printing hype and the iOS reality.

Any other solutions you’ve found that aren’t listed here?

Related content from GigaOM Pro (sub req’d):

First Impression of Mac App Store: Try it, It’s Good.

The Mac App Store is here, and is now up and running on all three of my Snow Leopard-sporting machines. As you might expect, the experience is very much like what you get from the iOS App Store. But the Mac version has its differences, too.

First, let’s talk about the similarities. The Mac App Store looks a lot like the iOS version, especially the one you find on the iPad. Like the iOS App Store, the Mac store requires you to have and sign-in with an active Apple ID. You’ll need this to purchase and download free apps from the store, though your account doesn’t have to be associated with a credit card if you want to just download free apps or use iTunes gift cards. Promotional codes appear to also work, if you can get your hands on some.

Purchasing apps works much the same as on an iOS device, too. You click the item’s price and it will ask you for your Apple ID credentials, or begin downloading immediately if you’ve recently provided them, triggering an animation of the app’s icon jumping to your dock. Every app you download from the App Store will appear in the dock by default, though it actually resides in your Applications folder. There’s no way to turn this off, since the App Store lacks a preferences menu, but you can always just drag icons out of the dock after the fact. The app’s icon will show a loading bar as it downloads and installs, and will appear as normal once the operation is complete and you’re free to use it.

The fact that there is so little you can customize or change about the Mac App Store is indicative of the direction Apple seems to want to go with software. As with iOS, the goal is probably to provide a surface-level simplicity that reduces potentially confusing menu items to the absolute minimum.  Many third-party apps that launched with the App Store seem to share this design philosophy, too.

Since the Mac App Store lacks its own dedicated preference menu, I initially thought users couldn’t limit access to it in the way they could the iTunes and iOS App Stores. Not so, since Mac App Store restrictions can be set using Parental Controls, found in OS X’s System Preferences, as shown in the screenshot below.

One of the best carry-overs from the iOS version of the App Store is the ability to install software on multiple machines. Software purchases on my iMac can easily be installed on my MacBook Pro or Mac mini just by “purchasing” it again on each of those machines with the same Apple ID. Alternatively, you can hit the “Purchased” icon at the top of the App Store interface to check what you’ve bought, and an install option will appear if you don’t yet have it on the machine you’re using. Unfortunately, you can’t transfer purchases from your iOS device to your Mac, so if you bought Angry Birds on your iPhone and your iPad, you still have to buy it again for OS X.

Note that only apps you purchased through the Mac App Store have this ability. While the App Store will recognize that you have iWork or iLife apps installed from before, for instance, trying to purchase these on other computers will actually result in a charge to your account, not just a free re-download.

One big difference many iOS users will notice is in pricing. Mac App Store prices tend to vary much more than those for iPhone and iPad apps, and tend not to reside around the $0.99 mark. Around $20 to $30 seems to be fairly common, and some software climbs as high as $80 or even $150. For now, at least, the introduction of the iOS model of software distribution hasn’t led to a similar pricing model.

I’ve yet to experience updating an app, since everything I’ve purchased so far is already up-to-date, but I suspect it won’t differ all that much from updating apps on the iPhone or iPad. And while it’s early days yet, I think the Mac App Store will be a success for Apple, considering I’ve already bought around three times more OS X software than I have during the past three months combined. How about you?

Related content from GigaOM Pro (sub req’d):

Mac 101: Creating Secure Disk Image Files

If you have files on your Mac you don’t want others to have access to, the simplest way to secure them is to create an encrypted Apple disk image. An Apple disk image is a single file that can be mounted by OS X as a drive. You can create new blank disk images, which bear the familiar .dmg file extension, on a Mac using Disk Utility.

  1. Open Disk Utility (located in Applications>Utilities) and select File>New>Blank Disk Image from the menu bar.
  2. Under “Save As,” enter the desired filename for your .dmg. Enter a name for the disk image (this is what will appear in your source menu when it’s mounted) and choose the size of the disk you want to create.
  3. Keep the format set to the default: Mac OS Extended (Journaled)
  4. Go ahead and set the encryption to 256-bit AES
  5. Set Partitions to Single partition – Apple Partition Map
  6. For Image Format, choose read/write disk image

When you click Create, you’ll be prompted to set a password for the file you’ve created. If you click on the key image next to the password field, a Password Assistant will pop up to help you create a strong password. Choose Memorable and a long length (the max length of 31 characters is most secure), and the Password Assistant’s autogenerated password will be very hard to guess using a software program (the level of security is similar to that of a Captcha, the word-generating fields used to determine whether a visitor is human or not).

Dragging data to your disk image when it’s mounted will copy it to the .dmg. Once you eject the disk image, you’ll need to enter your password to mount the image again and access your files. If the .dmg file is unmounted (ejected), people who don’t have access to your password won’t be able to get the data within. You can securely mount the resulting .dmg file from any Mac. If you decide to remember the password in your Mac’s Keychain (the password prompt will ask you if you want to do this), keep in mind that anyone else who has access to the user account that keychain is associated with will also have access to the files within.

This technique is particularly useful when preparing taxes or hiding the electronic trail of receipts and correspondences related to a special gift you want to keep secret from tech-savvy nosy kids this holiday season.

Related content from GigaOM Pro (sub req’d):

Hands-On With Apple’s AirPlay in iOS 4.2

Apple today released iOS 4.2 for the iPod touch, iPhone and iPad, and iOS 4.1 for Apple TV. Together, the updates allow you to use the new AirPlay feature to stream audio and video content from your device to your television. It sounds like a killer feature, but does it live up to the hype? NewTeeVee certainly doesn’t think so, but AirPlay does have its good points.

It will depend largely on what you want to be able to do with AirPlay. Right now, it does two basic things pretty well: It streams photos from your on-device camera roll or Photos app to the Apple TV; and it streams audio and video from both the built-in YouTube app and the on-device iPhone or iPad-formatted video library. What it doesn’t do is transmit any video and audio content you come across to an Apple TV-connected display.

No third-party (downloadable) apps I tried had support for streaming video to the Apple TV yet (I tried the HGTV app, CityTV’s iPad app and Air Video). Audio streaming, on the other hand, seems built-in everywhere (works on HGTV, TuneIn radio, and with web-based content). Whether that means that audio streaming works without developer intervention, while video streaming must be programmed in, or whether third-party software will only have very limited access to video streaming isn’t yet clear.

Even if Apple does allow third-party programs to stream video, there will be some limitations. The video being streamed must be in a format the Apple TV can recognize, for example, since AirPlay just pushes the content from the iOS device to Apple’s set-top box, and there’s no processing involved. So .MKV files, a common format for HD video, won’t likely ever be able to be streamed from the VLC app, for instance. It also doesn’t work with home video recorded on your device, which seems like something I’d probably do most with the feature, were it available.

As for what it does provide, there are some limitations that show it’s early yet for the AirPlay tech. First, YouTube videos take quite a while to load before playing, at least in my experience. I thought it wasn’t working properly, in fact. Second, when streaming photos, there’s quite a delay, and no indicator there’s any kind of loading in progress before the image shows up on your screen. I was swiping through my library thinking photos didn’t stream when all of a sudden the first one I’d viewed showed up. The experience of many others on Twitter confirms that I’m not alone in this.

Devices using iOS can still run other apps while streaming content to the Apple TV, so that’s a huge benefit. You can check your email or play games while a movie broadcasts in the background, for instance, and you can control playback on either your portable or using the Apple Remote with your Apple TV. Also, content will display a TV as the AirPlay icon when it can stream video, and a speaker icon when it can only transmit sound, so you know at a glance what you’ll be getting.

For now, AirPlay remains a nice feature, but one that’s in its infancy. To truly have a wide appeal, I think it needs to be extended to third-party applications, and work better and faster while keeping user surprises to a minimum by telling users exactly when it’s loading. Apple also needs to seriously consider making this a two-way street, since being able to stream from iTunes libraries to an iOS device without having to install additional, unofficial software would be fantastic. Of course, it would also limit the appeal of larger on-device storage sizes, which is likely why it’s being ignored by Cupertino.

If AirPlay was the reason you were waiting to make an Apple TV purchase, I’d wait a little longer to see how the tech matures in future iOS iterations. What do you think? Is AirPlay in its current form grounds enough to justify buying the new Apple TV?

Related content from GigaOM Pro (sub req’d):

Controlling my growbox with a mobile phone

 

image

How many times have you been riding the bus and have been curious what temperature your computer growbox was running and if the plants needed to be watered?  Ok maybe never, but I decided to solve this problem anyway.  There is also no point in identifying that you may have a problem without having a way to do something about so I also implemented the ability to override the controls on the growbox by using a Windows Phone 7 application.

Design

image

I made the design for this pretty simple, unfortunately I could not connect with my growbox directly using a mobile device because the computer is behind a firewall (which is a good thing) so I used machine that both the mobile phone and growbox can contact…cheapvegetablegardener.com.  After creating a quick web service with the following methods the growbox and mobile device could now talk to each other:

  • SetStatus(StatusInfo) – GrowBox sets this status every minute
  • SetOverride(OverrideInfo) – Mobile sets override to default functionality
  • GetStatus() – Mobile Phone gets status
  • GetOverride() – GrowBox checks for potential overrides requested by Mobile device

Mobile UI

Now I have the two devices talking here is the basic UI.  The top half of the screen shows the growbox temperature, cpu temperature, and the moisture content. All of these statues change color (to yellow and red) as their values get to critical levels (too hot, too cold, too dry)

The middle section shows the current state of the growbox letting me know if the lights, heater, exhaust fan, and/or water pump are on or off.  If a situation occurs where you want to override this state you can do this by simply clicking the status indicator.

The bottom part of the screen shows temperature and moisture levels over the past 24 hours.  The graphs are rendered using Google Charts for simplicity though am thinking about creating my own custom solution to get the graphs just right.  It also displays a current screenshot inside the grow box and you can transition between views with a finger swipe.

Screenshots

Temperature history graph Moisture saturation history graph
image image

Overriding the heater setting

Status screen following heater override
image image

 

Though this covers most of my required functionality, I still need to add some cool transition animations and some additional analytics, but thought I would share my current version.

Add to Del.icio.us
Add to digg
Add to Facebook
Add to reddit
Add to Stumble Upon
Add to Technorati
Add to Twitter


Dealing with the Twitter Oauth-Apocalypse

As many of you may have seen in recent weeks, Twitter changed its access policies and now requires OAuth from all third party applications that access Twitter user accounts. This is a large change from how many iPhone developers having been incorporating Twitter into their applications. What is OAuth exactly? How can iPhone developers get their apps up to date so they don’t break their Twitter incorporation? Well we have all the info you need to know about the OAuth-Apocalypse.

What is Oauth?

Twitter has a brief explanation of the difference between Basic Authentication and OAuth. They use the example of a letter and how it is addressed as their metaphor, and I think this gets the idea across clearly. You can see their entire explanation along with pros and cons here.

TL;DR With Basic Auth you would make every request and would include a username and password with each. This method is very insecure because it allows applications to actively hold user’s credentials and does not have any accountability for which application is performing what action on who’s account. If you imagine your Twitter account as a room, this is like having access to the room be granted based on a single key that many people have copies of. OAuth makes access to your room be granted by a key pad. And everyone that has access to the room has a different code they input into the keypad. You can see who came in and when and revoke anyone’s code at any time.

Twitter is evolving and now requiring that applications register. As a result, user’s gain more control over what services have access to their account. Additionally, Twitter can be more effective at targeting malicious applications, and developers can get more accurate feedback on the frequency of their app’s use throughout Twitter. With all this said, OAuth is tough to implement from scratch. So today we are going to go through the installation and use of a collection of classes that takes care of the dirty work for us, and let developers update the Twitter functionality of their application easily.

Required Classes

Today we are going to be building off a collection of classes that were created by several different people. The main portion of the class is the MGTwitterEngine which was created by Matt Legend Gemmell who’s website can be found here. From here, Ben Gottlieb took the classes and added his own drop in view controller to them. With all this together we have a simple view controller that will perform login and OAuth, and from there an engine that will perform any type of Twitter request we are looking to do. You can get a zip file of the root folder that contains all of these files here.

Installation

We are going to start out with a blank, view based iPhone project called iCodeOAuth. Once the project has come up, take the folder you downloaded called “Twitter+OAuth” and drag it into the “Other Sources” folder within Xcode. Make sure you check the box to copy the sources into the project folder. If we do a build now, you will get a ton of errors. That is because these classes require that libXML be a target of the project build as well. This can be accomplished by clicking the arrow next to Targets in the left column of the Xcode project. Here there will be an application called iCodeOAuth. If we right click on this and select Get Info we will see the info about our target. From here we click the build tab and search for the field “Header Search Paths”. You need to add the following into the Header Search Paths:

$(SDKROOT)/usr/include/libxml2

EDIT: I forgot to include here that you must also include a special XML library for the build to be successful. The Framework is called libxml2.dylib. You can find it at

/Macintosh HD/Developer/Platforms/iPhoneOS.platform/Developer/SDK/iPhoneOS4.1SDK/usr/lib

If you build again, you should see no errors and we can move forward with using this awesome set of classes.

Getting your Creds from Twitter

Now that we have these classes properly installed, it is time to take care of some registration requirements for OAuth. In order to use OAuth you must identify your app to Twitter. Once you do so, Twitter will provide you with an OAuthConsumerKey and an OAuthConsumerSecretKey. These are going to need to be provided to the classes we have just added into our project in order to talk with Twitter’s OAuth system. To register your application and get these creds go to dev.twitter.com/apps/new. I have created a application called the iCodeBlog OAuth Demo, whose credentials are included in the sample app which I have provided. For your own personal app you will need to go create your own Twitter Application and get your own keys.

Using SA_OAuthTwitter Engine

Ben Gottlieb used a great design pattern to create a very easy to use access point for the more complex MGTwitterEngine which lies underneath. In order to use these classes we will go into out view controller and add the following code to the header:

#import "SA_OAuthTwitterEngine.h"
#import "SA_OAuthTwitterController.h"
 
@interface iCodeOauthViewController : UIViewController  {
 
	IBOutlet UITableView *tableView;
	IBOutlet UITextField *textfield;
 
	SA_OAuthTwitterEngine *_engine;
	NSMutableArray *tweets;
}
 
@property (nonatomic, retain) IBOutlet UITableView *tableView;
@property (nonatomic, retain) IBOutlet UITextField *textfield;
 
-(IBAction)updateStream:(id)sender;
-(IBAction)tweet:(id)sender;
 
@end

And add the following into the Main

- (void)viewDidAppear:(BOOL)animated {
 
	if(_engine) return;
 
	_engine = [[SA_OAuthTwitterEngine alloc] initOAuthWithDelegate:self];
	_engine.consumerKey = @"PzkZj9g57ah2bcB58mD4Q";
	_engine.consumerSecret = @"OvogWpara8xybjMUDGcLklOeZSF12xnYHLE37rel2g";
 
	UIViewController *controller = [SA_OAuthTwitterController controllerToEnterCredentialsWithTwitterEngine: _engine delegate: self];
 
	if (controller)
		[self presentModalViewController: controller animated: YES];
	else {
		tweets = [[NSMutableArray alloc] init];
		[self updateStream:nil];
	}
}

This will instantiate our engine with the appropriate consumer and consumer secret keys. With this done we will create a controller. If you run the app now you will see a modal web view come up and lead to a sign in page for Twitter. This is a web view, but the great classes written by Ben are set up to programmatically handle the progression of these web views as the user signs in.

Scrolling to the bottom of this page there will be a username and password field to fill out. Don’t put in your Twitter credentials yet. We need to fill out a few delegate methods to handle the callback from SA_OAuthTwitterEngine.

Handling Login Callbacks

Insert the following into your main class.

 
-(IBAction)updateStream:(id)sender {
 
}
 
-(IBAction)tweet:(id)sender {
 
}
 
#pragma mark SA_OAuthTwitterEngineDelegate
 
- (void) storeCachedTwitterOAuthData: (NSString *) data forUsername: (NSString *) username {
 
	NSUserDefaults	*defaults = [NSUserDefaults standardUserDefaults];
 
	[defaults setObject: data forKey: @"authData"];
	[defaults synchronize];
}
 
- (NSString *) cachedTwitterOAuthDataForUsername: (NSString *) username {
 
	return [[NSUserDefaults standardUserDefaults] objectForKey: @"authData"];
}
 
#pragma mark SA_OAuthTwitterController Delegate
 
- (void) OAuthTwitterController: (SA_OAuthTwitterController *) controller authenticatedWithUsername: (NSString *) username {
 
	NSLog(@"Authenticated with user %@", username);
 
	tweets = [[NSMutableArray alloc] init];
	[self updateStream:nil];
}
 
- (void) OAuthTwitterControllerFailed: (SA_OAuthTwitterController *) controller {
 
	NSLog(@"Authentication Failure");
}
 
- (void) OAuthTwitterControllerCanceled: (SA_OAuthTwitterController *) controller {
 
	NSLog(@"Authentication Canceled");
}

We just implemented the SA_OAuthTwitterControllerDelegate and the SA_OAuthTwitterEngineDelegate. The SA_OAuthTwitterEngineDelegate methods take care of storing the OAuth data string in a plist so that when the app is launched again the user will not have to sign in. SA_OAuthTwitterControllerDelegate methods are callbacks depending on what happens upon sign in. In this case when sign in is successful another method in our class called updateTweets will fire. For now we have those methods defined but we don’t have them filled in. We will get to that in a few steps. If you run the application and login using some Twitter credentials, you should see a successful authentication message appear in your debug screen. With this done, let’s add some interface elements to our view controller XIB so that we can start interacting with Twitter. Our final product is going to look like this:

Building the Interface

To Build the interface open up the XIB for your view controller. We are going to be putting in 2 buttons, a UITextField and a UITableView. Lay the elements out like so.

Make sure to connect the delegate and data source of the table view to the file owner. Also connect the “Tweet This” button to the tweet method and the Update Tweets method to the updateStream method. Finally, make sure the IBOutlets for the UITextField and the UITableView are set. With these in place we can fill in the final methods to take advantage of our Twitter engine.

Filling in our IBActions

Put the following code in for the IBActions which we defied before.

#pragma mark IBActions
 
-(IBAction)updateStream:(id)sender {
 
	[_engine getFollowedTimelineSinceID:1 startingAtPage:1 count:100];
}
 
-(IBAction)tweet:(id)sender {
 
	[textfield resignFirstResponder];
	[_engine sendUpdate:[textfield text]];
	[self updateStream:nil];
}

The update stream method will ask our engine to get the Twitter timeline of the people you follow. It will retrieve the first page of the first 100 tweets. There is a delegate method that fires off on this request completing that we will fill out in a moment. The tweet method dismisses the keyboard and then uses our engine to send an update. Once the update is send we update the tweet view below.

Making a really simple Tweet Object

To help us with displaying tweets we are going to make a very quick Tweet object. This will be a simple NSObject subclass. Use this code for the header:

@interface Tweet : NSObject {
 
	NSDictionary *contents;
}
 
-(NSString*)tweet;
-(NSString*)author;
 
@end

And this code for the main

@implementation Tweet
 
-(id)initWithTweetDictionary:(NSDictionary*)_contents {
 
	if(self = [super init]) {
 
		contents = _contents;
		[contents retain];
	}
 
	return self;
}
 
-(NSString*)tweet {
 
	return [contents objectForKey:@"text"];
}
 
-(NSString*)author {
 
	return [[contents objectForKey:@"user"] objectForKey:@"screen_name"];
}
@end

Finally make sure to import the class within the main of your view controller class. These will simply give easy methods to get the info we want out of each tweet dictionary that the MGTwitterEngine will return to us.

Filling in our MGTwitterEngineDelegate Methods

The MGTwitterEngine is doing most of the heavy lifting here when it comes to interacting with Twitter. The methods we are using to get tweets and to send tweets are all defined within the MGTwitterEngine. There is also a defined MGTwtterEngineDelegate which defines the callback methods that fire upon these requests finishing. For the sake of completeness, I have filled out all the methods, although only a few of them will be called in the case of our application working properly. Insert the following code into your main.

#pragma mark MGTwitterEngineDelegate Methods
 
- (void)requestSucceeded:(NSString *)connectionIdentifier {
 
	NSLog(@"Request Suceeded: %@", connectionIdentifier);
}
 
- (void)statusesReceived:(NSArray *)statuses forRequest:(NSString *)connectionIdentifier {
 
	tweets = [[NSMutableArray alloc] init];
 
	for(NSDictionary *d in statuses) {
 
		NSLog(@"See dictionary: %@", d);
 
		Tweet *tweet = [[Tweet alloc] initWithTweetDictionary:d];
		[tweets addObject:tweet];
		[tweet release];
	}
 
	[self.tableView reloadData];
}
 
- (void)receivedObject:(NSDictionary *)dictionary forRequest:(NSString *)connectionIdentifier {
 
	NSLog(@"Recieved Object: %@", dictionary);
}
 
- (void)directMessagesReceived:(NSArray *)messages forRequest:(NSString *)connectionIdentifier {
 
	NSLog(@"Direct Messages Received: %@", messages);
}
 
- (void)userInfoReceived:(NSArray *)userInfo forRequest:(NSString *)connectionIdentifier {
 
	NSLog(@"User Info Received: %@", userInfo);
}
 
- (void)miscInfoReceived:(NSArray *)miscInfo forRequest:(NSString *)connectionIdentifier {
 
	NSLog(@"Misc Info Received: %@", miscInfo);
}

These methods are all very straightforward in their naming. The only one we fill out significantly is the statusesReceived:forRequest method. Here is where tweets will be returned to us, each as a separate dictionary when we request the timeline for a user. We will clear the tweets array that we have defined for our class and create a Tweet object for each of the dictionaries we have representing a tweet. From there we will ask our table view to reload. The only task we have left to perform is to fill in our table view data source methods to show all the tweets.

Table View Data Source and Delegate Methods

Now we have everything in place. We just need to create a UITableViewCell for every tweet we have. We will also do some tweaking of the size of each cell and the number of lines of each UITextField within each table view cell. These methods are very common so I wont go into much detail on them. Here are the necessary Data Source and Delegate Methods.

#pragma mark UITableViewDataSource Methods 
 
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
 
	return [tweets count];
}
 
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
 
	NSString *identifier = @"cell";
	UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
 
	if(!cell) {
 
		cell = [[UITableViewCell alloc] initWithStyle:UITableViewStyleGrouped reuseIdentifier:identifier];
		//[cell setBackgroundColor:[UIColor clearColor]];
	}
 
	[cell.textLabel setNumberOfLines:7];
	[cell.textLabel setText:[(Tweet*)[tweets objectAtIndex:indexPath.row] tweet]];
 
	return cell;
}
 
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
 
	return 150;
}

With this in place you will have an OAuth twitter client that is capable of doing any type of interaction with Twitter. You can find the source for the project here. Please post any questions you have and happy coding!

Follow me on Twitter at @cruffenach

Setting up IIS 6 for HTTPS

In order to set IIS 6 to respond HTTPS requests the server must be configured with Certificate.
The certificate can be requested from Certificate Authorities, or you can simply self certificate the server.
For the second option you need to follow these simple steps:
1) Download and Install IIS 6.0 Resource Kit Tools from:

http://www.microsoft.com/downloads/details.aspx?FamilyID=56fc92ee-a71a-4c73-b628-ade629c89499&displaylang=en

2) Once IIS Resource Kit installed, open IIS Metabase Explorer (Start menu->Programs->IIS Resources->Metabase Explorer). Go to LM->W3SVC and select the items on the left to see on the right a description of them and find your virtual site (the default Web Site usually has ID 1). At this point, suppose the site has ID=123 you have to issue run from command prompt (you might need to change current directory to ‘Program FilesIIS ResourcesSelfSSL’):

SelfSSL /N:CN=yoursite.yourdomain.com /V:365 /S:123

where:

/N:CN is the name of your site on the internet (or LAN)
/V: sets the number of days before the new certify expires
/S: is the ID we found

After this command line is completed, the site is ready to go.

ZumoCast Streams Media to iPad, iPhone From a Home Computer

The ZumoDrive folks are at it again, but this time, they’re taking the cloud storage to your home computer so you can stream media files right to an Apple iPad using ZumoCast. The new ZumoCast service is a take on my “personal cloud” thought — instead of storing data on a third-party web server, ZumoCast shares the files already on your PC or Mac. You just tell ZumoCast which files or folders you want remote access to and the software does the rest. The company is wise to go after the iPad market since the device makes for a great mobile media player.

DRM-protected files won’t play on an iPad or iPhone using ZumoCast, but that’s about the only major limitation aside from requiring your home computer to be powered on. However, you can sync media files with ZumoCast for offline playback on a mobile device — in that case, the home computer can be sleeping peacefully. The ZumoCast desktop software handles all file-sharing aspects and it supports adaptive transcoding. That means the audio and video quality will adjust on the fly to offer the best experience based on your web connection.

Initially for iPad and iPhone, ZumoCast is planned for additional mobile platforms. That makes sense as ZumoDrive, the cloud storage service, is also supported on Google Android and Palm webOS handsets. The company also says that “video sharing and enhanced music and photo interfaces” are in the works. ZumoCast is in an open beta, so you can sign up to try it. At this time, no pricing has been announced for the media streaming service.

Related research on GigaOM Pro (sub req’d):




Alcatel-Lucent NextGen Communications Spotlight — Learn More »

WP Like Button Plugin by Free WordPress Templates