improve.ro

Web development blog.

Should IE7 Mobile (Still) Be Supported?

Among the variety of mobile platforms available today, one that gets its fair share of media coverage is the Windows Phone platform. I’ve only used it for about a week last year (on an HTC HD7) and I can’t say it’s bad, although I suffered a bit being primarily exposed to Android before using it. The point I’m trying to make is that Windows Phone 7 doesn’t matter in the long run and that it’s harmful to take IE7 Mobile into account when developing a mobile website or webapp.

Although StatCounter is not the most accurate source for mobile stats, it clearly shows that IE Mobile is not a force to be taken into consideration. It is not a feature phone, to say that it has JavaScript disabled and doesn’t get tracked by metrics scripts. Other studies also show that it just doesn’t have enough market share compared to its competitors.

So, it’s pretty clear that Microsoft missed out on the start of the smartphone boom, but they certainly have the capacity to gain users (especially in the case of a Nokia takeover). Even in this case, IE7 Mobile will not grow. All new released Windows Phones ship with WP 7.5 that comes with an IE that has its rendering engine based on IE 9 as the default browser. It’s almost impossible to downgrade, although I don’t imagine why anyone would want to do that.

Also, Microsoft allows existing WP 7 users to upgrade to 7.5 so existing users could get the new IE without having to change their device. And even if they did have to, users change their phones a lot more often than they change their computers. This means that the meager slice of the market the IE7 Mobile has will be gone in no time.

I won’t rant against IE and all its wrongs in this post. Probably every web developer on the internet has done that at one point. What I am trying to say is that supporting a non-standards compliant browser with dismal market share and practically no prospect for growth is a waste of money.

If you do decide to drop IE support you’ll end up with an improved baseline for development that is closer to the standards of today’s web development ecosystem. Major sites are dropping IE7 support on desktop, where it’s market share is more significant. If they can afford to do that, considering their traffic, it’s hard to believe that it won’t be more profitable for you to do this.

Mobile Analytics on Top Trafficked Sites

This is a short analysis on how web analytics are implemented across a few top trafficked websites. Part of them were picked from the Alexa rakings for shopping websites and some are the homes of popular tech giants.

I tested this in Mozilla Firefox with a spoofed iPhone 3 user-agent (via the User-Agent Switcher plugin). The drawback of this method is that for sites using feature detection and client-side redirection versus redirection based on the UA string I would still be getting the desktop site. That being said, I didn’t find any of the sites to have this behavior.

Also, I didn’t check all of them with a featured phone UA. I only did this for sites that had clues to different enhanced/featured implementations in their URL structure. The only one that had this, from the sites I tested was Groupon.

I used Firebug to check the requests being made and the size of the scripts. I also used the online JS Beautifier and the closure-compiler interface to swing back and forth between minified and unminified scripts.

I tried the domain of the companies directly (i.e., canon.com) and I did not navigate deeper into the site structure for any of the tested websites. It may be possible that some sites who reported to not have a mobile optimized site to simply not redirect to it when accessing them directly.

SVN 1.7 Quickstart Guide for Windows

At work we use SVN for version control, so I need to be able to connect to the repository from my Windows machine. After reinstalling my system, I remembered what a pain it was to have the whole client/plugins/libraries/certificate stuff set up. Especially if you try SVN 1.7. It’s working copy format is incompatible with previous versions, so you’ll have to have every client using this particular version (as a bonus feature for using 1.7, you get to change the case of a filename in one step on Windows :).

My main use cases for SVN are:

  • trying out stuff on the command line. I want to have the svn commands available for scripting too, just in case I want to automate something.
  • handling versioning straight from my IDE (in this case, Eclipse)
  • provide Apache Maven with the right svn capabilities so that its versioning plugins work.
  • having to checkout a repository on disk. I’m not really confortable in the Windows shell so I end up doing this from Windows Explorer most of the time.

The architecture of these solutions on Windows is a bit convoluted, so I’ll take a shot at explaining how they interact with each other and how you should configure them. Also, there are some annoyances if you need to use certificates to authenticate yourself (https) but there are some tips here that help.

Mobile Browsers and PDF Files

Troubleshooting a PDF download tool, I was surprised to find out that some mobile browsers behave unexpectedly when trying to directly access a PDF resource through HTTP. While it was pretty obvious that they are lightweight and do not have PDF viewing plugins embedded as their desktop counterparts, even downloading the resource was behaving strangely in some of them.

I tested on my Samsung Galaxy S (GTi9000), a Palm Pre Plus, a Blackberry Torch (9800) and an iPhone 4. All browsers are WebKit based. The test case was pretty simple - download a PDF file from my domain. The PDF was ~200KB in size, to keep the tests quick.

To debug the actual HTTP traffic of the devices, I interposed Fiddler as a reverse proxy between my domain and them. This way, I was able to log all the headers and content of all the HTTP requests and responses made.

Let’s start with the responses, the server was not configured in any way to serve PDFs, so it gave the same response regardless of the request headers it received.

Using LessCSS in Your Ant Builds

I created a fork of the Java flavoured wrapper around LessCSS to enable including it directly in Ant build processes. You can find the source on GitHub. The reason I needed to do this and not use the servlet to build them on the fly (and cache them, of course :) is because one of the envrionments I’m using is a CMS setup that imposes a lot of constraints on how you organize your resources. For the moment, generating the files on my development machine and uploading them manually in the CMS seemed the better option, as CSS explosion was iminent :).There wasn’t much to modify, I just added a class that implements the Task interface from Ant. You can alias it in your buildfile like this:

1
2
3
4
5
6
<target name="build.css">
<taskdef name="lesscss" classname="com.asual.lesscss.LessEngineTask" classpathref="build.aux" />
<property name="css.dir" value="[your_css_dir]" />
<lesscss input="${css.dir}/[less1]" output="${css.dir}/[css1]" />
<lesscss input="${css.dir}/[less2]" output="${css.dir}/[css2]" />
</target>

The classpath reference must contain at least Mozilla Rhino (js-1.6R7.jar) and the Apache Commons Logging library.You can integrate this with Eclipse by adding your buildfile to the Ant view. When you double-click the build.css task, the final CSS files get generated. If you have auto-refresh enabled in Eclipse, you can see your updates immediately, even if your server is running.To build the project you need to have Maven installed. If you don’t/can’t want to do that, you can download a prebuilt one.

Proxy Settings With HTTPClient and Spring

Since I didn’t find any example on the Web on how to do this, I’ll give it a go here and try to explain things a bit. I’m going to treat the particular case of using HTTPClient and Spring. For changing the proxy value in the JRE, see the official documentation on Java Networking and Proxies.

From the documentation, we see that in order to set up a proxy for requests made through HTTPClient you have three options: specifying it directly, getting it from the JRE or implementing a custom RoutePlanner to have complete control over the HTTP route computation.

Rotating Rectangles

Working on the maps48 project, one of the problems that needed solving was calculating the amount of map space needed to be retrieved to allow rotating the map without introducing any blank space in the viewport. As you can see from the diagram below what we actually need is to get the rotated rectangle’s horizontal and vertical projection as the new width and height.The black border represents the viewport. If we were to only have an image the size of the viewport and rotate it, we’d end up with something like the orange rectangle. Notice the blank spaces in the viewport :). The solution is to resize (or import a larger bit of the map, in our case) the image - the pink rectangle - so that when rotated it fills up the viewport entirely, as does the green rectangle.

Problem description

This can be easily achieved through some basic trigonometry. The key to this are two angles: alpha, the angle the rectangle was rotated by and beta, the angle the diagonal makes with the width.

Weblogic Encoding Issue

Trying to deploy some RSS feeds as .jspx views on a WebLogic 10 server, I noticed that it mangled all UTF-8 output. This was part of a Spring MVC web-application. The problem was that on my local development server (Apache Tomcat 6.0) everything rendered fine, but on the WebLogic server all non-ANSI characters were not outputted correctly.

In Firefox, I saw something like: <summary>Formaci�n</summary>. The byte sequence for the strange character was 0xEF 0xBF 0xBD and I seemed to get that for all UTF-8 chars that I was supposed to receive in the tests I was conducting (á, ó, í). I checked the content-type and encoding in Firebug and it seemed ok (Content-Type: application/xhtml+xml; charset=UTF-8).I later found out that is the Unicode Replacement Character U+FFFD and that the problem was probably caused by the fact that the server, although told to output UTF-8, sent out ISO-8859-1.

Huawei and the VPN Saga

After a horrendous experience, usually I feel the need to share my findings with the world. Other unhappy souls shouldn’t go through what I’ve gone through yesterday.My company offers the possibility of working remotely, by connecting to its VPN. I have a USB dongle with my certificates and also a preinstalled software that manages the VPN connection. I travel fairly often to my hometown, Braşov. This week was no exception, I decided to work remotely for a couple of days.

In Bucharest I have no issues connecting to the VPN from home, I’ve done it quite a few times. The first surprise came to me when I realized that, although I have the same ISP (Clicknet, Romanian DSL provider), in Braşov my VPN connection failed. Moreover, when I tried to connect to it, I’d lose internet connectivity for about a minute. I first thought it’s a port forwarding issue, although it seemed strange that an ISP would have different port forwarding policies in different cities. Also, I couldn’t explain the connection loss. After being on the phone with “technical” support for about an hour, passed around by 4 or 5 people, trying to explain to most of them what VPN means, I finally got a straight answer from one of them: they aren’t blocking any ports, anywhere. I took a closer look at the modem/router’s behavior and then I noticed something. Whenever I tried to connect to the VPN, my router would reset (!) itself.