Code, Code, Revolution!
NOTE! I’ve updated the InternetImage class, read about it in this post: Downloading an image asynchronously. Revisited!, you will also find the revised code there.
In a recent post I showed you how to round of edges of an image. But how can you go about downloading images from the internet in your iPhone app? There are two possible ways of doing it: synchronously and asynchronously. Which way is best depends on what you are trying to do but it’s generally better to download asynchronously as the user probably doesn’t want to wait for an image to show up before being able to interact with the application. Downloading an image synchronously is well easy:
UIImage *myImage = [[UIImage alloc] initWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:strImageUrl]]];
Downloading an image asynchronously requires a little more work. I created a class to handle the download for me. Instead of posting the entire class I’ll explain it a little bit and provide the actual code files at the end.
Downloading an image, or anything else for that matter, asynchronously from the web requires the use of a NSURLRequest and NSURLConnection. Supply the NSURLRequest to the NSURLConnection and provide a delegate for the connection. The delegate is self, because i want my class to handle the events from the connection. We also need NSMutableData to hold the downloaded bytes.
Read the rest of this entry »
UPDATE 2009-04-05
I’ve updated the code in the post and the sample project at the end of the post. Many thanks to Xavier Schott for his helpful comment!
I recently dwelled into the world of Cocoa programing for the iPhone a few weeks back. My good friend and collegue at Avantime, Hampus, and I bought iPhones 3G when we were on vaccation in Italy this summer. Italy sells unlocked iPhones so we’re not stuck with using Telia which is the only Swedish operator who carry iPhone. I actually had a quick look at iPhone development when the first iPhone came out using the toolchain but I didn’t really enjoy it at the time, perhaps it’s because I only owned an iPod touch at the time.
Anyhow. Hampus and I have been hacking away on our first iPhone app and I thought I’d share some usefull code for rounding off corners of an UIImage. This code is based on various stuff I found on google but I made a nice image manipulation class which rounds of corners:
Read the rest of this entry »
I was recently involved in a big Sharepoint MOSS project for a major Swedish technical consultant firm. They have offices spread out over Europe and participate in global projects. The new Sharepoint project involved a process management tool and project collaboration areas, both tools to make their daily work easier. But the goal of the entire project was to provide a tool that made it easy to re-use solutions and spread experience throughout the organization, ie, make it searchable. Sharepoint was the perfect platform for them! One of the major challenges with this project is the huge amount of data they produce each year. CAD-drawings and documentation push their yearly data to somewhere around 3TB each year!
What does this have to do with SQL 2008 binary data performance you may ask, or you already know because you have Sharepoint experience. Sharepoint stores all it’s information in an SQL database. Normally that’s not a problem when people share documents and presentations well under 50Mb each. The default limit in a standard Sharepoint MOSS / WSS 3.0 installation is 50Mb per file. In a servicepack however Microsoft enabled the possibility to increase this limit to 2Gb per file. 2Gb is a lot and arguable files that big shouldn’t be stored in a database, at least not a SQL 2005 database.
Read the rest of this entry »
A while ago a customer invested in a SQL-cluster and naturally wanted to move all databases there. There are a number of articles on the net on how to migrate to a new server, some more complicated than others. In my case I had a working SQL 2005 instance which was dedicated to the MOSS installation and wanted to move to a new SQL 2005 cluster. Instead of rebuilding the entire farm like some people suggest i found it easiest to use the “rename server” command in stsadm. Here’s a step by step guide:
Read the rest of this entry »
Here I go, my first blog post ever! Why this late you might wonder, or: oh noes, another blog! Being a techy/nerdy guy I should have started a blog 4 years ago, before blogs were even cool or hot. I haven’t thought much of blogs in general, perhaps because too many people have blogs that really shouldn’t. What made me change my mind is all the useful blogs I actually visit pretty much every day while searching for solutions to my current problems. I also realized that there are very few good resources with iPhone related solutions.
Besides my recent intrest in Objective-C programming for the iPhone I’m professionally a systems architect focusing on integration and web development on the .NET platform using EPiServer and/or Sharepoint. Hopefully I can provide some useful articles for both iPhone hackers and .NET nerds alike.
And oh yeah, welcome to my blog
!
With this blog I try to provide useful tips and solutions for programming .NET, Objective-C and more. My name is Björn Sållarp, and I love writing code.