Jan 18, 2010

iPhone annoyances

There's a lot to like about the Apple iPhone, but just as much to dislike. Here are my top iPhone annoyances:

11. No AM/FM radio. Of course internet radio is great but in Australia we pay through the nose for bandwidth.

10. No FM transmitter. Some of us have old cars (like 8 years old) with no auxiliary audio inputs or Bluetooth.

9. No camera on the front, so no two-way video calls.

8. The camera is crap. OK, so probably all phone cameras are.

7. USB cables cost $30! Come on! It's a short piece of wire between two plugs!

6. You can't sort by rating in the App Store, which means you can't easily find the "cream of the crop" applications -- those which people really like.

5. You can't use the device as a 3G WiFi router (or MiFi as people are calling them these days).

4. Battery life stinks. OK, so because you can do so much with the iPhone, you do use it a lot. But when one charge doesn't even last 24 hours, things are grim.

3. Complexity of programming. Microsoft's developer tools are streets ahead. When I hop into Objective-C I feel like I'm in a twenty-year time warp.

2. No access to the file system. It won't function as a mass storage device, so getting photos off it is a pain, and you can't use it to port random files around.

1. Applications can only be installed from the official App Store, and they have to be approved by Apple first. We paid for the device, we should therefore be free to install any software we like onto it.

Dec 21, 2009

iPhone VPN to Nortel

I am a long-time fan of the Nortel VPN Gateway, which we have at work, and which several of our clients have as well. SSL-VPN technology is just so convenient, you just need a browser and Java, and away you go. The device also supports IPSec connectivity, making it a complete VPN solution.

Until the iPhone came along, with no Java, and support only for Cisco IPSec. So, no VPN to work :(

But what Nortel have done in code release 8.0 for NVG, just released, is include support for L2TP-over-IPSec, which the iPhone does support. And I've just tried it, and it works! Thankyou, Nortel! xoxoxoxoxoxox

I assume that L2TP/IPSec will soon appear in the software for the Contivity series (Nortel VPN Router), if it hasn't already.

Apr 15, 2009

Firing script with an anchor

Quite often I want an anchor (link) to execute a script, and usually I fall into the trap of trying to use onclick and set href to an empty string or leave it out entirely. However, href is a required attribute and empty string is a valid value which means "link to self", so the correct solution is to put the script into the href attribute, prefixed by "javascript:".

For example, here is an anchor which does the same thing as pressing the browser's Back button:

<a href="javascript:history.back();">Back</a>

Thanks JWhittaker for setting me straight.

Apr 9, 2009

Always show a vertical scroll bar

IE always shows a vertical scroll bar for a web page, regardless of whether or not the page is long enough to require one. This is nice for sites with a fixed-width centred layout and a combination of short and long pages, because it means the horizontal position stays exactly the same on every page. Other browsers (Firefox and Chrome at least) don't do this by default.

Finally I've looked up how do this in these other browsers, and discovered that it's actually quite easy. It's not even a hack! Just a CSS rule ...

html {overflow-y: scroll;}

Apr 8, 2009

Styling table columns

It seems so natural to want to set colour and alignment on columns of a table. But CSS2.1 does not allow it, it only allows you to set width, visibility, border and background. Hixie explains why. Internet Explorer supports it, but no-one else does.

The workaround is to use CSS selectors as follows:

#table55 td:first-child { text-align:left; } /* col 1 */
#table55 td:first-child+td { text-align:center; } /* col 2 */
#table55 td:first-child+td+td { text-align:right; } /* col 3 */

This works in CSS-compliant browsers including IE7 and above. Thanks to Simon Pieters for this one.

Mar 23, 2009

Select border styling in IE

OK, so you can’t directly style the border of the SELECT element in IE, but if you’re using absolute positioning you can wrap it in a DIV, do the positioning and border on the DIV, then set a negative margin on the SELECT itself. I found that negative 1 pixel is right for drop-down selects, and negative 3 pixels is right for selects with a non-default size. Sample code below.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<style type="text/css">
#select1,#select2 {position:absolute;left:100px;border:1px solid #666;}
#select1 {top:100px;}
#select2 {top:150px;}
.drop {margin:-1px;}
.nodrop {margin:-3px;}
</style>
</head>

<body>

<div id="select1">
<select class="drop">
<option>One Hundred</option>
<option>Two Hundred</option>
<option>Three Hundred</option>
</select>
</div>

<div id="select2">
<select class="nodrop" size="3">
<option>One Hundred</option>
<option>Two Hundred</option>
<option>Three Hundred</option>
</select>
</div>

</body>
</html>

Mar 19, 2009

JavaScript to convert HTML character entity references

To convert all numerical character entities in a string to their character equivalents you can do this:

str.replace(/&#(\d+);/g, function (m, n) { return String.fromCharCode(n); })