Hugoware

The product of a web developer with a little too much caffeine

Posts Tagged ‘iPhone

Testing ASP.NET Sites for iPhone

with one comment

Writing a iPhone version of a website it can be a slight pain. After writing some code you have to upload it to a public location so you can browse to it with your phone. Even though you can browse the site you are still somewhat limited in your debugging options once your site is on a remote server.

You might have read before how impressed I am with the Mono project. You can fire up a Mac, import and existing .NET project and more than likely it is going to run just fine.

So here is the cool thing – You have a pretty good .NET IDE (MonoDevelop) on the Mac and you also have a built-in iPhone simulator. Browse to the local test server and…

Cool!

I’m not sure all the options available for debugging in MonoDevelop (or mostly for the ASP.NET side) but since you are running the test server then you have more options available to you than if it ran on another website (for example writing debugging messages)

Naturally, this will work for regular ASP.NET sites as well as MVC. In fact, anything that runs a local server for testing should be able to do this without a problem.

Anyways, certainly not the greatest thing ever but something fun to mess around with and another example of just how useful Mono can be.

Written by hugoware

February 4, 2010 at 10:58 pm

Outlook Web Access via iPhone

with 14 comments

You may have seen my post a little while back about how I was starting to do some iPhone development for my job. For the most part the app is nothing more than a nice pretty front end to a handful of Web Services (hint: last blog post was along the same lines)

In any case, I’d rather my first attempt at iPhone development be a throw away project since I’m going to probably going to have to start over several times.

Learning Through Development

Whenever I offer up advice to a new programmer on what is the best way to learn programming I always say – “write a program that does something you want — you’ll learn a lot along the way and have motivation to finish it.”. Learning Objective-C was no exception for me.

Even though we use Exchange for our e-mail server at work, we don’t have the “Active Sync” enabled so you can’t link up with the iPhone through the built in e-mail application. So, instead, I decided to go a different route — use the existing Outlook Web Access and parse the HTML.


Picture 1

So with a couple of nice Regular Expressions and some HTTP calls we have a nice clean display of all the e-mails in my mailbox. Yep, that’s right — screen scraping via HTML… a little cheesy, but not bad since it works even if Exchange isn’t configured to allow it!

This was a perfect example of writing an application that met my need and allowed me to learn a new language at the same time… of course I’m not suggesting that I’m an Objective C expert or anything but at least now I can ditch my BlackBerry! 🙂

Hey, Who Puked On My Screen… Oh Wait, That’s Objective C

I’m definitely a spoiled programmer. Using .NET and C#/VB has definitely shielded me from some ugly languages out there. Objective-C is the kind of stuff that makes babies cry.

Developing iPhone is WAY different that anything that you have ever done in .NET. You’re adding all sorts of weird things like IBOutlet and IBAction so you can link them around all over the place — it is definitely a new experience. I’m going to have to write a ‘C# Developers Guide To iPhone Development’ to maybe save some other poor guy a lot of grief.

Still a .NET Guy

Getting into new languages and technologies on different platforms is always a good idea. You gain added perspective while increasing your skill sets (not to mention you look better on paper for your next job). Even if you don’t want to buy a Mac and play with the iPhone you can always tinker with a myriad of other languages on any number of free operating systems — Go do it!!

Don’t think that I’m converting – If anything using a Mac this much has solidified why I’m still die-hard Windows/ASP.NET/PC…

…But then again… MonoDevelop for Mac is looking kinda slick…

Written by hugoware

October 1, 2009 at 7:54 pm

iPhone vs BlackBerry – A Developer’s Tale – Part 1

with 9 comments

Here is the plan: Develop two mobile apps, one for BlackBerry and one for iPhone at the same time to see what is easier for a .NET guy to whip out — then blog the whole thing into a series of posts! Brilliant!.

Crazy – You Bet!

So the original project was simply to develop an iPhone app but I figured that since I was putting so much work into the mobile web service why not do two apps at the same time! Since most of the heavy lifting is going to be done by using C# and ASP.NET MVC then It shouldn’t be that hard — will it?

For this series of posts I’ll be keeping track of the iPhone development using my MacBook Pro using Xcode and Objective-C and the BlackBerry development using my Dell XPS using Eclipse and Java. I’m going to try and keep track of the hours spent – but I can guarantee I won’t have a stop watch with me at all times.

Let’s see what happens!
versus

Getting Set Up

This post is probably isn’t going to be very interesting since this mainly goes over getting the two environments setup. You’ve been warned! 🙂

[BlackBerry – 2.5 hours]

Since programming with BlackBerry uses Java I immediately downloaded the latest version of Eclipse along with the SDKs from the BlackBerry website. I got everything downloaded and installed in less than 40 minutes (even though the BlackBerry website wasn’t the easiest thing to navigate)!

So I fired up an instance of Eclipse and started a new project — and… uh… what the heck? My keys aren’t working? I tried closing and reopening and rebooting — nothing! The keys simply would not respond. As it turns out the problem was the BlackBerry SDK itself! Basically, the newest version of Eclipse wasn’t supported so that meant I had to find a previous version (3.4) and use it instead — bummer.

So after downloading Eclipse (again) I was ready to go. I started a BlackBerry project, pasted in some sample code to play around with, hit run and — CRASH! I’ll save the dramatics here but basically the UAC in Vista was kicking in and causing the emulator to die. Disabling it fixed the problem (but turned off UAC which isn’t what I wanted… but oh well). I had considered reverting this back to my VM of Ubuntu but since I had already invested so much time I figured I’d just stick with it.

After I finally figured out how to get the emulator started then it wasn’t long before I had my first “Hello World” program running and the BlackBerry was in business! Not too bad!

[iPhone 4.5 hours]

My new Mac came in the other day and I was ready to get started. Downloading the correct Xcode was a little confusing at first but once I got it figured out I had it up and running without any of the problems I had with Eclipse (although it was a 2GB download – whoa!)

The whole Mac keyboard/touch pad thing is terrible if you’re used to using keys like END, HOME or Right-Clicking (which I’m assuming developers use quite often :)). Even things as simple as resizing a window are painful on a Mac – but really its irrelevant for this discussion.

As s C# developer it wasn’t hard to look at Java code and get a general idea of what was going on. Even the entire Eclipse IDE acts similar to Visual Studio so the learning curve was greatly reduced… but Objective-C… not so much…

I read the documentation on the Apple website several times, watched a couple terrible screencasts and poked around with the Xcode IDE and still nothing. If you haven’t ever seen Objective-C before, make sure to shield your eyes when you do. I can pretty much guarantee it won’t make a bit of sense.

Also, the Apple documentation made some bizarre suggestions on the correct way to define methods… Check out this little gem here…

…method names should interleave the name with the arguments such that the method’s name naturally describes the arguments expected by the method. For example, the Rectangle class could instead implement a setOriginX:y: method that makes the purpose of its two arguments clear…

What? Name your method to emphasize the first argument? Would Steve McConnell approve of this?

Project Status

BlackBerry (3%): IDE installed and sample is working!

iPhone (1%): IDE installed but haven’t been able to understand any of the code yet.

Currently, BlackBerry has the lead with the least development time invested. In fact, the BlackBerry is up and running with a sample application. But after looking at the designer for the iPhone interface it looks like once I get past the initial Objective-C hurdle then development may move a long much faster than I anticipated. Will BlackBerry maintain the lead or will the iPhone catch up? Check back for the rest of the series!

Written by hugoware

September 7, 2009 at 2:11 am