Centered LI in UL without Float

It’s so simple. You want to use UL elements for your menus. You want to style them with CSS. You want all the LI items centered.

Until now I’ve been using “float: left;”, which then leaves you to manually center the whole UL with specific margins. I’ve developed a simple CMS system which generates all the menus with LI entries, and this obviously poses a big problem with template design. I’d mostly ignored the issue until my latest client, who wants the CMS and lots of centered menus.

I had a quick look online, and most of the sites out there suggest this feature is some kind of black magic, requiring the sacrifice of some poor capra family mammal. Obviously, any simple solution would require decades of tweaking to work in Internet Explorer 6 (from this point forward to be known as “The I Hate Microsoft Browser”).

Nope. In the inimitable and immortal words of “The Meerkat”: Simples.

Here’s whatcha do:

Step 1: It puts the “text-align: center;” in the UL.

Step 2: It puts the “display: inline;” in the LI.

Step 3: It doesn’t put the float in either.

(Don’t worry, this doesn’t involve Buffalo Bill or ointment)

This appears to even work in IE6. (Yes, I know. Shocking isn’t it?)

Apple HTML5

Yes, two posts in one day!

Apple have released a cutting edge HTML5 demonstration site, rejoice! It’s at http://www.apple.com/html5/

It demonstrates a number of features provided by CSS3, Javascript and a couple of HTML5. A couple of HTML5.

It’s viewable in all HTML5 compatible browsers, as long as your HTML5 compatible browser is Apple Safari.

Wait… What?

Yup, that’s right. Apple’s HTML5 demonstration site doesn’t really showcase a lot of HTML5, more alternative standards like CSS3, and you have to use Safari to see it. Why, isn’t the ‘Apple WebKit originally “borrowed” from Linux’s Konqueror and used in Google’s Chrome‘ good enough? Is Mozilla Firefox “chopped liver” now, in the eyes of Apple? Is Opera now considered HTML1?

The whole point of HTML5 is cross-platform support. I’m getting sick and tired of Apple’s campaigns, arrogance and disrespect for the industry as a whole.

Apple, Windows, Linux…

I’ve spent a lot of time using Mac OS X Snow Leopard, Windows XP and 7, and Ubuntu over the last year. It’s remarkable and amusing how similar and dissimilar they are in surprising ways. I think the main issue people overlook is what the core of the operating system is built on, or derived from.

Mac OS X is Unix based/clone

Linux is Unix based/clone

Solaris is Unix based/clone

Windows XP and 7 is WinNT based

Well, isn’t that lovely, but what does it mean or matter?

Operating systems based on similar systems tend to work in a similar way. To oversimplify this, I often use a tool “rsync” to update content from my desktop to my web server. I’m familiar with this tool. I booted up my Macbook and wanted to copy a large folder to it, but didn’t have Samba installed on my Ubuntu desktop… I used “rsync”! The desktop options are also similar (or identical) between Gnome/Linux, Mac OS X and Solaris.

Windows is a highly proprietary ”beacon” of sorts on the landscape now. Ubuntu is doing wonders for the Linux world in general. Mac OS X is pushing ever forward courtesy of Mr Jobs and his zealous band of fanatics. Solaris will probably remain a niche product and go the way of OS/2 eventually (die a slow and painful death).

This operating system selection is now giving me a headache.

I use Adobe Photoshop. I play World of Warcraft (yes, I said it. I actually admitted it). To get anything above Photoshop CS2 working AT ALL in Linux (courtesy of Wine), you need to pray the Wine developers find the time to develop their software further, or Adobe suddenly decides to release a Linux version. To get World of Warcraft working in Linux, you need a supported graphics card (most Nvidia cards, or modern ATI cards) with proprietary drivers. On this note, might I add I use an ATI X1250; Screw you ATI. Screw you. Apparently this chip isn’t modern enough to let me run the official ATI drivers.

If it wasn’t for my crap graphics card, ATI being bastards and needing more memory to properly virtualise Photoshop, I think I’d actually uninstall Windows now. The utility and synergy between my Linux desktop and Mac laptop are far more useful to me than kludging around with Windows integration with either, and aside from the two examples, the software available in Linux and Mac OS X suits my needs perfectly.

I find myself wondering, if hardware manufacturers spent more time supporting alternative operating systems such as Linux, would a lot more people switch? I know I’d have my grandfather on Linux if his random choice of multi-function printer was supported fully.

P.S. Take note ATI, if you’re too lazy to support slightly older graphics cards in your official Linux drivers, I’m too lazy to continue my 15 year support of you. Next purchase: Definitely Nvidia.

H.264

I’ve taken some time to calm down after recent statements by Apple and Microsoft regarding their choice of HTML5 codecs. I’ve tried to consider all sides, and yes, I can see the (probably FUD based) uncertain patent landscape with Ogg (Theora, Vorbis). I don’t think this is the only reason for it.

Lets back up a moment and look at Flash. I personally think, though useful some years ago, it is unnecessary, cumbersome and a resource hog. Flash used to be necessary for graphically advanced websites and video. It still is for Internet Explorer (at the time of writing). I guess I back Steve Jobs stance on Flash in general. I think it’s about time we stopped using it and Silverlight. We should now embrace HTML5, Javascript and the new video tag. I still use Flash for video playback as a fallback mechanism for PPC Macs and IE<9 of course.

Now, the HTML5 drafts were being written up and someone somewhere must have said “Well, we need to pick a video format”. You can almost see the conversation:

Apple: Well, our gadgets have H.264 decoders built in, so really we can only support H.264.

Microsoft: Yeah, H.264 is a good idea, it’s err, better quality. Umm, the patents are clear too because we’ll just licence it. Yeah, that’s great.

Microsoft directs a small grin in Firefox’s direction.

Firefox: Wait a minute guys, we’re open source. We actually can’t get a licence for H.264, what’s wrong with Ogg Theora/Vorbis anyway?

Chrome: Yeah, what about our Linux distribution of Chrome? Licensing H.264 for that isn’t feasible.

Apple: Well, we don’t have Ogg decoding chips, so no offence, but screw you guys.

Microsoft: Tell you what then, we’ll allow DirectShow wrappers so people with Ogg codecs installed can view your precious open source Ogg.

Now let me explain what’s wrong with this scenario:

Web developers and hosting providers like myself now have clients requiring video content on their sites. They’re keen to use this HTML5 they’ve heard about, and I’m keen to avoid Flash. Not to mention the obvious benefit of supporting Apple devices. My last project had an additional requirement of working properly on PPC Macs, which I found to have issues working with H.264 Baseline video either through HTML5 or Flash.

I’m now looking at tripling my disk storage requirements for video content. MP4 H.264, Ogg Theora/Vorbis and Flash FLV (dependant on client requirements).

While I’m more than happy to upsell my hosting to account for this additional space, all my clients now have to pay more for their video content as a result.

Microsoft’s solution stinks of anti-competitive behaviour, as their “install a codec” policy even goes against their “bundle more codecs so people don’t download malware ridden ones online” policy in Windows 7. Similarly, why can’t Apple support the Ogg format on their desktops at least?

I don’t actually use Firefox, but I’m angry on their behalf. They’re being pushed into a corner, and I can’t see a way out for them.

Just do me a favour: Make sure you provide Ogg format video every time you use HTML5 video and show these guys, they’re not going to push Firefox into obscurity like it’s predecessor.

On a related note, I’m developing a distributed video re-encoding system to ease deployment of fully compatible video solutions. Information on this will be available on lamped.co.uk soon.

News Just In: Piracy Bad!

Every day I take the time to read my iGoogle. It has my weather, news, email and RSS feeds. There is no better place to get my daily dose of informationm and kudos to Google for managing to provide such an excellent facility. I’m aware other sites can provide similar, but they tend to be filled with a lot of extra crap I really don’t want – popups and the like.

Today I bumped into http://www.telegraph.co.uk/technology/microsoft/7545722/A-third-of-people-think-it-is-acceptable-to-pirate-software.html – an article based on Microsoft research. Apparently most people use pirated software. My last employer used pirated Windows Server, pirated Windows XP on every workstation, pirated Adobe CS3 suite, pirated Microsoft Office.

For the record, I use a legal Windows XP for gaming and entertainment, and Ubuntu for everything else. I even get my music through Spotify – I expect my sainthood any moment! If anyone has any tips for Spotify randomly crashing in Wine, that’d be lovely.

If Microsoft’s poll wasn’t so blatantly a political move in light of the Digital Britain legislation, one might suggest they change the focus and find that actually, 99% of people use pirated software, without issues. They quote figures relating to viruses and crashes, presumably in the hope it’ll scare people off. I often wonder if the Microsoft execs don’t live in a different world. Infact, I’m sure they do. While I’m on the subject, I have an old friend who works for Microsoft, I’m going to point him here and seek his anonymous feedback.

On a slight tangent: How do people start up using industry standard software, when such software is quite so expensive? I want to type a piece here about Photoshop and Gimp (yes, there’s Paint Shop Pro etc, etc. Photoshop and Gimp are the big boys of proprietary and free in my world). There’s lots to be said for cost of ownership – free support in Windows and paid-for support in Linux, and it’d be a never ending debate. In the grand scheme of things, Photoshop is known by many and despite the initial cost, you may employ trained people quickly. Gimp is less known and has training costs, and potentially harder to recruit for.

Anyway, I’ve rambled through this entire post. I don’t know what the answer is. I DO know, I won’t pay for Windows 7 or Photoshop while Ubuntu / Windows XP and Gimp will suffice. I really hope http://www.reactos.org/ gets somewhere, though I imagine it’ll suffer similar fates to DR DOS and the AARD debacle (look it up).

Security

A weird thing happened to me today. A rogue group invite was sent from my Facebook account. While I would normally admit I could have mis-clicked something, it included a message that I would never have typed. This could have been a bug with Facebook, or it could have been someone accessing my account. I used a pretty insecure password there, and this got me thinking.

How secure are your passwords?

Though I use secure passwords on “important stuff” like my server, it got me thinking and frankly a little paranoid.

Courtesy of TrueCrypt and a secure volume protected by a key file on a flash drive (which I’ve printed and kept very safe – you never know when those pesky flash drives will decide to stop working), I now have 20+ letter, number and symbol combination passwords on all my accounts.

This does have me thinking though. No one is going to break the passwords without my flash drive or piece of paper, but there’s always an avenue of attack. Key loggers for one, are a very dangerous thing. Insecure scripts can allow restricted access to some places you may not wish them to.

I’ve seen too many websites get hacked in my time, and too many key loggers installed on other’s PCs. People in general don’t take security seriously enough and don’t really anticipate the consequences of their actions on their PC. Looking at some of the posts on codingforums.com gives me nightmares. Basic security measures aren’t being met by our newest influx of developers, and it scares me.

For all my TrueCrypt volumes, sanitized and snapshotted virtual machines and overly zealous security precautions in my code, I wonder: Am I going too far? Am I too paranoid? Should I relax a little?

Without a moment’s hesitation:

NO. I am not.

This is my data, and the data of my clients. Paranoia is good.

Adobe screw-up leaves Flash flaw unpatched for 16 months

I’m an avid reader of ZDNet for my technology news, and today came across Adobe screw-up leaves Flash flaw unpatched for 16 months.

I’ve never been a fan of Flash, I see it as some kind of blight on the internet. When I was a Windows network administrator, I often had to tell users to shut down tabs running flash because they were using 50% of the CPU. I side with Jakob Nielsen too, with his opinions on usability and ergonomic website design. Though flash applications can be easy to use, most developers seem to take the flexibility and power afforded by it as an excuse to go over the top on garish, cryptic designs. Steve Jobs (though I’m not a fan of Apple, more on that another time) has even earned some begrudging respect for his recent stance.

The internet is moving forward with HTML5 and exceptional Javascript libraries like jQuery. I believe the need for flash is rapidly diminishing, and that makes me very happy. It’s just a shame the community and contributing organisations couldn’t agree on one video codec (Vorbis would have been good, if not for the greed of large corporations, in my opinion).

This security issue should undermine a lot of respect and support people have in flash, but unfortunately I don’t see the “flash fanclub” doing anything but pushing forward ever more aggressively.

Just do me a favour: Next time you think “Oooh, I could use flash for that”, pause a moment and wonder “Can I use Javascript instead?”.

Spam

One thing that always amuses me about electronic communication in general, is the amount of spam one can get. I check this blog regularly to clean out the dozens of spam comments I get daily.

Still, I suppose I should be pleased. Most of them aren’t “performance pills”.

Hey, bot. Yes you! This is moderated. Move on!

Future of Desktop Linux

My PC runs Windows 7 Ultimate and Ubuntu 9.10. Windows for Adobe software and gaming, Ubuntu for development. Recently my Nvidia graphics card started playing up, so I removed it. Thankfully, my motherboard has a fairly adequate ATI card built in. I removed the card, restarted Windows and continued as normal. Windows detected the card, installed appropriate drivers. All I had to do was reselect my resolution.

Later the same evening, I restarted into Ubuntu.

Ubuntu greeted me with it’s cute little white logo, all is well. Then the problems started. I’m notified the proprietary Nvidia drivers aren’t functioning and asked if I’d like to reconfigure my graphics settings. Yes please! Apparently I’m not allowed, it can’t save the new settings. I ask nicely to edit the configuration manually, and restart. Success! No. Apparently my ATI X1250 and 21″ CRT can’t support more than 1152×768. I try “vesa”, “ati”, “radeon”, “radeonhd” with no success, and finally move on to the ATI website to get official drivers.

I’m not going to rant about ATI, but suffice to say: If they can’t be bothered to make an installation that requires less than an hour of my time, requiring steps 99% of the population wouldn’t stand a chance of completing, I’m not going to bother. I’m simply going to save myself the bother in future by never using ATI again.

I fixed my problem by following a complex guide on the Ubuntu website, purging all traces of Nvidia drivers and reapplying the “radeon” driver. I then went to an unrelated website about advanced configuation of “xorg.conf” and guessed a number of settings to type in. Fairly certain my edits would simply cause the system to crash, I crossed my fingers, restarted and… It worked! It actually worked. I got my 1600×1200 back. I lost all 3D support, but at least I don’t have to bother keeping Wine installed anymore…

What’s my point?

I really want to recommend Ubuntu to friends and family, like most of the Linux fan base would. Frankly though, that’s years away from happening. There are so many fairly fundamental usability issues in Gnome and KDE that mean installing it for my parents would result in many hours per week in technical support to them.

Something as simple as adding items to the “quick launch” or “start menu” equivalents is a sweat inducing trial of endurance for anything but the most technical person. Running scripts on startup that require elevated privileges is something that’s eluded me so far, and I open a terminal to “sudo” run them manually every time I start the PC.

Ubuntu is a great operating system though. Having a LAMP server setup on my desktop PC in a few lines of text makes me very happy. The range of 1-click install software on hand is wonderful. I just wish some of the fairly basic features you expect to find (like intelligent driver selection…) were worked on a little more.

PHP 5

I hear Geocities has gone forever. Well, it’s hardly surprising, but it is a little sad. I remember signing up for one of their quaintly named sites all those years ago. Still, I went investigating and found Yahoo Web Hosting! (I feel everything with Yahoo! needs exclaiming, it is like some kind of marketing ploy of theirs, right!?)

I was curious to see what kind of features such a major player like Yahoo! would offer in their web hosting, and after a few clicks I found Perl and PHP support. Now before you pull out the party hats and invite your friends over, I mean it has “PHP” support. 4.3.11 to be precise.

This leads me onto a pet hate of mine. The PHP community have been moving ever forward and have hit a great milestone with version 5.3. It’s a great, rapidly maturing language – I use it daily. Hourly, even. Version 5 of PHP has been around for an eternity (in IT years, they’re like dog years you know…) and yet a large subset of the internet web hosting companies STILL INSIST ON USING PHP 4!!! WHY!?

I suggest next time you find a company “offering” you PHP 4, you send them a polite email reminding them version 5 was released in July 2004, and while you appreciate 5 years clearly isn’t long enough for them to evaluate and upgrade, perhaps now is the time to “take the plunge”.

For the record, my Lamped hosting offer 5.3.1.