When I was building the mobile TV guide I found that there are a couple of things needed to make the website look better on the iPhone and iPod. They both have some extra capabilities that is easy to utilize when you know how.
The first is the zoom level. By adding the meta-tag below, you can specify the viewport to fit perfectly with the iPhone/iPod. The meta-tag tells the Safari browser to zoom in to a specific level as specified. It was a trial and error process of finding the correct zoom level, but very easy as well.
<meta name="viewport" content="width=280, user-scalable=yes" />
Another tag tells Safari that when a website is bookmarked, it should use a specific icon to put on the dashboard of the iPhone or iPod. For some reason Apple invented a new link-tag for this instead of just supporting the favicon standard. The link-tag looks like this:
<link rel="apple-touch-icon" href="favicon.ico" />
Since the TV guide is made especially for mobile phones, it was important to keep the download size of the page as small as possible. That’s why I choose not to add these two tags by default, but only when the browser visiting the site was either an iPhone or iPod.
To do that programmatically, I simple added this method to my master page:
private void AddIPhoneHeaderTags()
string ua = Request.UserAgent;
if (ua != null && (ua.Contains("iPhone") || ua.Contains("iPod")))
HtmlMeta meta = new HtmlMeta();
meta.Name = "viewport";
meta.Content = "width=280, user-scalable=yes";
HtmlLink link = new HtmlLink();
link.Attributes["rel"] = "apple-touch-icon";
link.Href = "favicon.ico";
Of course, these two tags will work for all websites – not just the ones made especially for mobile phones.
Yesterday evening, the BlogEngine.NET team released a release candidate of BlogEngine.NET 1.5. It is available for download at CodePlex.
It is the first time we have made a release candidate, so I hope as many as possible will play around with the bits and report any bugs or issues back to us. It has been tested by all the team members and no breaking bugs where found. However, there is always an edge case scenario or server setup you can't account for.
Try it out now!
I’ve been tweaking the performance of BlogEngine.NEXT today using my favorite tool: YSlow for FireBug. One of the things YSlow checks for is the expires HTTP header for static content such as images, script files and style sheets. Since BlogEngine.NET has always used custom HTTP handlers for serving scripts and stylesheets, only the static images have been a problem.
The problem is that with images on hosted environments on IIS 6, it’s impossible to control the serving of them without redirecting them through an HTTP handler. That’s not a good idea for several reasons:
- It adds unnecessary overhead by going through the ASP.NET ISAPI
- You need to add custom code to handle the requests
- You need to change the URL from .gif to .gif.axd or similar
Here is what YSlow finds on my website that needs the expires header set to a far future date:
As you can see, it is all my static images that lacks the expires header.
If you run IIS 6 there is no good way of adding an expires header to images unless you have control over the IIS. If your site is hosted then you probably have no control at all. If you are using IIS 7 however, you can very easily add the header in your web.config’s system.webServer section like so:
<clientCache httpExpires="Sun, 29 Mar 2020 00:00:00 GMT" cacheControlMode="UseExpires" />
What happens is that all static content will now have an expires HTTP header set to the year 2020. Static content means anything that isn’t served through the ASP.NET engine such as images, script files and styles sheets. This is one of the very easy tricks that will increase the performance of your site as well as your YSlow score.
We’ve had a tradition of doing geek dinners in Copenhagen for the past 2 years. It’s always very good fun and there’s a bunch of interesting .NET guys to chat with. However, it has always been very intimate and most of the people going have been there before.
We need new blood and that’s why it’s time to take the geek dinner concept to the next level and the name is .NETworking dinner. The basic concept remains the same but in a much larger scale. It’s still an informal dinner arrangement with free beer, but this time I’m aiming for at least 50 people. This is important from a networking perspective.
The point is to meet a lot of new people in a relaxed atmosphere and talk about coding, business or just plain fun. Hopefully, that will help strengthen the Copenhagen .NET community and open up new opportunities.
Since numbers are important, please tell your colleagues and friends about this event and sign up to the event on Facebook. It’s Tuesday, April 21st after normal work hours and it's free.
I’ve been a little quiet on my blog lately. That is due to my grand plan for 2009 which was born as my New Year’s resolution. The original plan went like this:
In average, I need to visit a new country I have never visited before, every month of 2009.
That means 12 trips to a new destination for the entire year. I soon realized this was too ambitious, expensive and time consuming. I needed to adjust the plan to something more realistic and this is what I came up with:
In average, I need to visit a new country that I may have visited before, every month of 2009.
So, still 12 different destinations but it is now ok for me to visit countries I’ve seen before. So far it is going quite well. Here is my itinerary for 2009 as it looks right now.
- January: Germany
- February: England and Moldova*
- March: USA
- April: Spain, Gibraltar* and Portugal*
- May: Scotland*
- June: Holland*
- July: Greece* and Albania*
- September: Turkey*
- December: Egypt*
* = have never visited before
These trips have been a mix of business and pleasure. Whenever I go on business trips, I always try to find time to explore the place I visit. Lately I’ve fallen for the idea of visiting the countries along the old silky way including Azerbaijan, Kirgizstan, Georgia, Armenia and a few more. I hope to find the time to spend some time there in the fall. Also, I’ve never been in Asia or Oceania so that’s also very high on my wish list.
Often times when travelling, I don't have access to a PC so I don't read or write many blog posts. Instead I tweet from my mobile phone just to keep a little up to date with the news in tech world.