Categories
Computing

Now for something different: Web Fonts

You may wonder just how I added these custom font types. I'm the last person to believe your choice of font should affect the message you wish to convey. Alas Web designers love custom fonts and often spend countless days wrestling with various technical solutions to reproduce the graphic designer's wishes on all browsers. Back in the day, they had to resort tricky Javascript libraries such as Cufon or, heaven forbid, Flash-based solutions such Sifr. These solutions could actually crash some browsers. Some will even buy special fonts and then waste more hours testing them on different browsers and devices. Luckily with Web fonts those days are over.

As a backend Web developer (I do all that Geeky database and data-mining stuff in my day job), I'd be very pleased if everyone could just make do with Courier, ideally using a text-only browser like the venerable Linx. However, now thanks to openfontlibrary.org, you can easily jazz up your site. All the fonts here are available in font packs to support all modern browsers. If you combine this resource with the free FontPrep application (sadly available only for Mac) or a Web service such as everythingfonts.com or freefontconverter.com , you can even support older versions of IE.

FontPrep and everythingfonts.com will even generation the @font-face CSS for you. Then just reference your new custom font in your stylesheet by applying font-family: MyCustomFont, Helvetica, Ariel, sans-serif; either to the body tag or a specfic region or set of tags. It is that simple.

If you fancy creating your own font, you can download and install the free BirdFont app. This is available for Windows, Linux and Mac. It seems to import best from the newer OTF font types and let you import SVG files for individual glyphs.

I then resorted to a little javascript magic to load a random custom font on each page load. Doesn't change the meaning of anything I write and you can always change it in the accessibility toolbar on the right.

Categories
Computing Power Dynamics

Rebel without a cause

Do you like to indulge in drugs and booze ? Surely only boring losers would abstain from the exciting social life facilitated by binge drinking, cocaine parties and ecstasy-enhanced all-night raves. Maybe you like to gamble or play first-person shooters online with your virtual friends and imaginary foes. And what self-respecting young adult would not watch hardcore horror movies and gory action thrillers? You might even enjoy rapid-fire techno music and gangster rap. Could you conceive of a better way to unleash your inner demons than a visit to the nearest laser shooting range or a whole weekend of unadulterated paint-balling? It's hard to deny the growing popularity of these pursuits.

Any discussion of their potential long-term psychological or, indeed, neurological side effects would open another can of worms. Gamers are adamant that their favourite vice has no adverse psychological effects and endlessy recycle the theories of industry-friendly experts. However, many participants still feel they are somehow rebelling against someone or something. At the back of their mind are images of puritanical clerics, admonishing them not to sin against God, their grandparents telling them to turn down that awful noise or some populist politician promising a crackdown on drunken and disorderly behaviour. By conjuring up these effigies of a bygone establishment (against which to rebel), today's hedonists can always cite former opponents of cultural progress such as Mary Whitehouse (mainly concerned with pornography) or the occasional conservative columnist decrying our youth's obsession with these unworthy pursuits.

Oddly these apparently subversive acts of rebellion are a multi-billion business. Booze, gambling and gaming millionaires have friends in very high places. Indeed the UK government not only deregulated gambling, but went as far as granting video game businesses special tax breaks and reaping huge windfall revenue from the licensing of premium adult services on 3G mobile. Advertising for these hedonistic goods is ubiquitous in all media from billboards to the sides of buses, TV ads and, of course, the Internet. Saturday morning shoppers are greeted by sales teams promoting Sky-TV contracts, paint-balling fun sessions and the latest and greatest shoot-em-up games, all with the full blessing of the shopping centre management. Such endless promotion is often punctuated with ads for financial services. A growing number of public places resonate to the deafening blast of loud fast-beat muzak, supposedly to entertain and enliven customers. The entertainment business promotes even technically illegal drugs by glamorising narcotised pop stars and providing venues for mind-numbing sounds, which frankly can only be enjoyed under the influence of MDMA (ecstasy). Away from the remotest rural backwaters, it is practically impossible to avoid advertising for these pursuits. Today abstaining from all such indulgences sets you apart from the rest of the crowd, especially if you're under 40.

In my misspent teenage years I briefly identified with the so-called punk scene, yet another expression of youth culture reflecting the anxieties of the age of consumerism, industrial decline and economic uncertainty but skilfully exploited by big business. I could see plenty wrong with the world around me. Screaming at the top of my voice "God Save the Queen and the Fascist Regime" seemed an apt act of rebellion against the hypocrisy of teachers who would allow little discussion in class or against class mates more interested in football and cars than overthrowing the capitalist establishment. Of course, most Punk music was absolute drivel, barely listenable and anyone paying attention could easily learn how wealthy media executives manipulated the masses, not just to boost their bottom line, but to channel all dissent through safe outlets. All was revealed in the 1979 exposé movie "The Great Rock and Roll Swindle" on the Sex Pistols' short-lived stardom.

My father worked for the military-industrial complex and despite all the grandiose talk about freedom and democracy, life seemed pretty monotonous with little room for manoeuvre. One just had to fit in and go with the flow, although compared to the current era a wider of selection of hobbies and special interests were acceptable. If you wanted to collect snails or build rudimentary radio transmitters from electronic kits rather than play football or hang out with the cool kids, that was just fine. In reality the mid 1970s saw, comparatively speaking, the greatest level social equality and general prosperity that had ever existed in Britain and in the pre-PC era there seemed to be much more heated political debate. Revolutionary trotskyists and devout catholics with very traditional views on family and marriage could somehow coexist in peace or antinuclear campaigns as I discovered during my CND days. With no Internet, only very primitive video games and a limited choice of terrestrial TV stations, rebellious teenagers were attracted more to outdoor activities, clubs and protest groups. Yet gangland crime was mainly confined to a few inner city areas, pubs would close at 10:30 and few young adults could afford to frequent nightclubs on a regalar basis. To put things in perspective it was not until the late 1970s that basic video game consoles and video recorders became affordable. If you wanted to unleash your dark side back then, you might consider joining a gang or the army, but most kids just played with Action Men, slingshots and plastic guns, nothing even approaching the hyper-realism of today's games, but at least providing great haptic feedback, i.e. contact with the real physical world. If you chewed the head off your Action Man, you had a headless male doll and could not simply restart the game and parents were back then much less inclined to surrender to infantile pestering for a replacement toy. Your only option was to paintakingly repair it. As detailed by Canadian authors, Joseph Heath and Andrew Potter in their 2004 book the Rebel Sell, the advertising business has simply co-opted all deviant strands of contemporary counter-culture. even if the ideologies, associated rightly or wrongly with past regimes or revolutionary movements, have been re-marketed as mere brands that may appeal to non-conformist individuals seeking to set themselves apart from dominant cultural brands. MacBooks tend to appeal to more creative nonconformist types precisely because they are not a regular laptops preloaded with Microsoft Windows and associated with boring conformist office workers. While digital revolutionaries would run a free and open source Linux distribution, many of us would hardly bat an eyelid at the sight of a jeans clad advertising executive whose top of the range MacBook Pro not only sported an illuminated Apple logo but also a CND peace symbol and a Che Guevara sticker. It would also not surprise us if the very same advertising executive were discussing a comarketing venture between a leading gay bar chain and paintballing events company. It is all just a game.

Categories
Computing Power Dynamics

Multinational Scroungers and Tax Dodgers

Just before Christmas the British media revealed some large up and coming multinational outfits had taken advantage of tax loopholes and the wonders of early 21st century globalised trade to evade taxes. Suddenly Labour supporters had a cause they could all rally behind and win support from hardworking voters rightly fed up with high taxes and shoddy services. Let's force evil Amazon and Starbucks to pay their taxes in the UK. For a fleeting second, I thought we had returned to the early 1970s when the Trade Unions and Labour activists advocated import controls and high tax rates for the rich. Then as my mind returned this century, I remembered the spectre of a New Labour-appointed EU commissioner, Peter Mandelson, urging other European countries to open up their markets to competition from the Far East and elsewhere, to deregulate big business and banking and cut corporation tax. Under New Labour, the financial services sector continued to grow as manufacturing shrunk even further.

While I sympathise with the various populist campaigns to force multinationals to pay more taxes (e.g. Ensure that international companies like Amazon UK, pay fair tax), much of the UK economy depends on tax evasion, money laundering and huge government handouts to myriad service sector agencies. Organisations like KPMG, Deloitte, Ernst & Young (EY) and PricewaterhouseCoopers specialise in corporate tax avoidance. Moreover, most contract workers have their own limited company, yet to you or me, they're just nurses, teachers, software developers, office workers etc. They would lose their competitive edge if they had to pay full UK income and corporation tax.

The trendy left's newfound enthusiasm for local independent retailers seems rather perplexing, given the previous and current governments' track record. Retail chains and large agribusinesses have expanded to the detriment of independent traders and small farms as detailed in Joanna Blythman's excellent book Shopped. Small book shops are only a very small part of a much larger picture. Paper books will inevitably suffer the same fate as typewriters. People will buy a few as collectables and for display purposes, but books are going electronic. Of course, it is very important that no one entity has control of something as important as literature, but oddly it is much easier to find "dissident" books on Kobo or Amazon than in Waterstones or specialist bookshops. Fortunately, as long as the Internet remains open, it is relatively easy to set up rival outlets for electronic books. We may wonder why some powerful lobbies would like to restrict this freedom in the name of questionable intellectual property rights.

Starbucks has been notorious not only for tax dodging but also for employing mainly newcomers to the detriment of young adults born and bred in the UK. Yet the politically correct left dare not mention this fact and have often suggested such progressive employers boost the economy through their smart branding of caffeinated froth. A casual visit to any Starbucks in London will soon reveal most customers are Guardian-readers, whose favourite newspaper is on sale before they part with at least £2.50 for your fair trade jug of flavoured hot milk.

Considering the government's love affair with big business we may reasonably ask who benefits most from this negative publicity campaign. You guessed it, other multinationals, who use a slightly different strategy to embezzle ordinary taxpayers. Much of the left has been rather uncritical of some of the worst quasi-monopolists and control freaks and Microsoft is a prime example. Amazon built its empire on open-source software. Its servers run Linux as do its now ubiquitous e-readers and tablets (Kindle Fire). Microsoft had successfully persuaded key policymakers that word processing, spreadsheets and presentations were their exclusive preserve. To suggest using a word-processor other than Microsoft Word in public sector IT departments not only attracted bewilderment and ridicule but usually fell on deaf ears. As a result, UK taxpayers have transferred billions of pounds to one US Multinational, which has only ever spent a very small fraction of that on actual software development. Besides Microsoft Office and Windows licences, they earn hundreds of millions for SharePoint, Exchange and SQL Server. Now Apple, Amazon and Google have shown the public IT not just Microsoft. Software development is moving to the Web and Microsoft's desktop franchise is under threat. If you can knock up a diagram and Gantt chart online, why spend over £100 on a piece of desktop software that will be out of date soon anyway? Do we seriously want to entrust our digital future, including the internals of what was until recently the dominant desktop operating system and productivity software, to a US based multinational? By not releasing the source code to their ubiquitous products, Microsoft can spy on you (and they have a dismal security record too). In the open-source world, you can view the human-readable source code to find any hidden backdoors. In my experience, the UK tax and social welfare system penalises honest hard workers and rewards fraudsters the Banks! Hedge Funds. Some benefits cheats are just small-time chancers and other huge international operations with their tentacles in most government bodies.

Categories
All in the Mind Computing

All true conservatives are green

I sometimes enjoy Peter Hitchens‚ antidote to mainstream trendy Neo-Liberal thinking, but fear he is on some subjects in bad company and a tad ill-informed. No rational person could deny volumes of hard evidence showing the exponential rise in humanity's collective impact on our planet's delicate ecosystem, both in terms of our numbers (rising from just 750 million at the start of the industrial revolution to 7 billion now) and our per capita consumption. Our population will probably peak in the next 10 to 30 years, but at the expense of adopting modern high-consumption lifestyles. And now 2500 million Chinese and Indians are preparing to join the mass consumer frenzy, resources that previously seemed almost unlimited, are nearing depletion.

The fact that scientific forecasts have so often proven wrong should lead us to take a more rather than a less cautious, and thus conservative, approach to future development. Climatologists know full well our climate is subject to multiple natural and, dare I say, anthropogenic factors, but man's impact on our environment has reached unprecedented levels. But climate change is just one of many potential side effects of our rapid overdevelopment. James Lovelock has merely conceded that some of the more alarmist forecasts made 20 years ago have not been supported by subsequent observations. So what! They were just forecasts. Meanwhile, other forecasts, such as available oil reserves in Saudi Arabia, have also turned out to be gross exaggerations. That's why Brazilian geologists are busy surveying fossil fuel deposits 2 miles below the surface of Mid Atlantic Ocean, the Chinese are sealing deals with Nigerian businessmen and Western Oil companies see Libya as a mere gateway to oil in Chad and Darfur, despite the huge costs of building pipelines and other infrastructure.

Wishful thinking cornucopians would like to see the current era of cheap mass motoring for all continue without drastic consequences and place blind faith in scientists to find to magic techno-fixes. Climate change denial, so popular in Neo-Conservative circles, has little to do with any understanding of the actual climate (which may get warmer, colder, wetter or drier in different parts of the globe) and everything to do with the same culture of entitlement Mr Hitchens so rightly denounces in his columns. Claiming to have a god-given right to drive your car to a suburban shopping mall, funded by your non-productive marketing job, is just the same as claiming a right to welfare handouts to subsidise your hedonistic idleness. If we are to tackle our very real environmental challenges and avoid unprecedented loss of life resulting from a grotesque overconsumption, we need to power down.

Categories
Computing Power Dynamics

The Bankers are bankrupt and so are we

Today over a hundred thousand demonstrators will descend on Central London to protest against cuts in public spending. I can sympathise for I've joined many similar protests‚ defending the rights of ordinary working people and against wanton waste and wars. Why should ordinary people suffer because politicians and bankers have wasted billions on wars and billionaire bankers continue to reward themselves huge bonuses? Unfortunately many have misdiagnosed the problem. While undoubtedly many welfare dependents may suffer hardships as a result of cutbacks and some public sector workers will lose their jobs, we do not suffer from underspending on key public services such as health and education, but from huge waste on unsustainable bureaucracy financed mainly by a non-productive tertiary sector, offering services that nobody really needs. Demonstrators will be entertained by the spectre of a former New Labour cabinet minister and now their leader, Milliband, claiming we can keep spending as if there were no tomorrow. Few will dare challenge the previous‚ administration‚ on their grotesque overspending, fuelled by an economic boom based on property trading, banking, lobbying and media, and worse still their bail-out of the very bankers who caused the mess in the first place. In 2008 the country stood on the brink of financial collapse as banks could no longer sustain such a level of bad debt, i.e. debt on loans to people who could never repay. Throughout the late 1990s and early 20 zeroes manufacturing industries continued to close as retail outlets and other services expanded. New Labour oversaw more than a decade of private and public waste. Ordinary folk were urged to indulge in cheap holidays abroad, large plasma TV screens, more cars, electronic gadgets, boozing and gambling. While New Labour monitored and regulated the habits and behaviour of private citizens, it deregulated the hedononism‚ business and let bankers offer loans to those who could never realistically repay. At the same time despite official declines in unemployment, millions remained dependent on a multitude of benefits. In 1997 John Reid responded to demands for the re-nationalisation of the railways by simply stating "We can't afford the projected cost of £20 billion". Since then the government has not only spent more on subsidising private rail companies but has also squandered billions on PFIs (Private Finance Initiatives) to build new hospitals and schools, which the general public do not even own. Inflation-adjusted public health spending has doubled, but the quality of health care has seen no measurable improvement as the NHS is overburdened with the side-effects of hedonism and, dare I mention, unsustainable levels of net immigration. Politicians‚ on both sides of the House continue to talk about economic growth and none more so than Ed Milliband. Yet by growing demand for consumer products and promoting a non-productive service sector, we simply increase the country's reliance on global markets and imports. If the world economy as a whole proves unsustainable and, as recent events in Libya and Japan should surely remind us, energy becomes more expensive (i.e. a higher EROEI = Energy Returned On Energy Invested), we will find it much harder to readapt to the real world, where we need to be largely self-sufficient in food staples and material resources and can only provide for the weak and elderly through hard work. Our current model of development is entirely based on marketing and thus dependent on a plentiful supply of cheap human and material resources. However, as China and India grow and demand a larger share of the world's finite resources, their labour will become more expensive. Why should we rely on outsourcing menial office tasks to India and production to China, Vietnam or Indonesia? Why should their labour subsidise our consumption?‚

Practical Solutions

  1. Phase in a 30-hour working week and give people more flexibility. This may be bad for business and economic growth in the short terms as some of the best workers will be able to work less, but it will encourage a wider section of the population to aspire to high-skill jobs.
  2. Cut all child benefits after the second birth (i.e. allowing for twins, triplets etc.). If couples choose to have more children, they should not expect the state to subsidise it.
  3. Remove all NHS help for IVF and facilitate adoption when couples are unable to have children naturally.
  4. Cut all forms of unemployment benefit after 1 year, unless a person has a genuine disability preventing work. After this period, the out-of-work will be employed on the minimum wage in a vast range of environmental and social projects for up 30 hours a week.
  5. Reward housewives or househusbands who choose to stay at home to look after their children until the age of 14. There are also plenty of new remote working opportunities allowing parents to work part-time if they so choose. Couples could be granted 20 hours of parental time a week deductible from their income tax. The tax system should clearly encourage small two-parent families, in which at least one parent works.
  6. Raise the minimum wage for antisocial working hours. We do not need to shop 24/7.
  7. Treat mental health as primarily a psycho-social issue rather than a medical issue. Cut NHS spending on the promotion of mental health issues and address the very real psychosocial causes. Reduce dependence on psychoactive medicines.
  8. Encourage school leavers‚ uninterested‚ in academic subjects or hard sciences, to undertake vocational courses in practical trades such as plumbing, building, farming‚ mechanics etc. There is no need for 40%+ of school leavers to go to university. We should target further education spending on the 10 to 15% who can make a real difference.
  9. Provide special bursaries for degrees in hard sciences, medicine and engineering.‚
  10. While immigration would naturally fall as a result of declining domestic demand for superfluous consumer goods and services, we should ensure migration is both manageable and socially responsible.
Categories
Computing

Old Browsers

If the main body of this page has rounded corners and subtle drop-shadow effects with a stylish Diavlo font face instead of Arial / Helvetica / sans-serif, chances are you are already using a modern browser. If you see square borders and a default sans-serif font, then you should be aware your browser doesn't support the latest Web standards making the life of Web designers rather difficult. This site looks great on Android phones and tablets, iPhones and iPads, but will look rather dated in Internet Explorer 6, 7 and 8.

Modern browsers such as recent versions of Firefox, Chrome, Safari, Opera and Microsoft's upcoming Internet Explorer 9 support CSS 3 meaning effects that previously required a complex maze of background graphics and endless hours of testing of different variants of major browsers can now be achieved with a few lines of code.
Newer browsers also render javascript much faster, making it easier to develop Web applications that look and feel like native applications.

Still using Internet Explorer 6?

Here are just some of the reasons you might want to upgrade:

  • It does not support W3C standards.
  • It is not compatible with CSS3 and only partially supports CSS2.
  • It has a very low score in Acid 3 test.
  • It is insecure and slow.
  • Several movements against this browser have sprung up: IE Death March, Dear IE6, Stop IE6.
  • Google has officially stopped supporting it in its Web applications.
  • A funeral has been celebrated
  • Microsoft has discontinued support, focussing on its next generation IE9
  • The browser lives on in intranets reliant on dated and inherently insecure Active-X technology and unpatched versions of Windows XP. IE7 was released in early 2006.

We strongly recommend that you download one of the following browsers:

Bad Boy Browsers

When the Internet took off in the mid to late 90s, most sites were, by today's standards, rather basic pages, often handcoded and uploaded via FTP.  Tim Berners Lee invented HTML as a medium for linking a web of related text documents. Indeed the image tag was added almost as an afterthought in HTML 2. However, as the World Wide Web expanded, the two main browsers of the era, Netscape Navigator and Internet Explorer, added a plethora a style tags and designers began to use tables, originally intended only for tabular data, to implement complex pixel-perfect designs. By the late 90s most commercial sites were a maze of nested table, tr and td tags with reams of inline style information. When Internet Explorer won the first round of the browser wars, its quirky implementation of the World Wide Web Consortium's (W3C) HTML 4.0 and CSS1 became the de-facto standard and Microsoft didn't see fit to update its IE6 browser released in 2001 until 2006. While innovative in its time, IE6 is simply ancient in terms of Web evolution. HTML is only 17 years old and IE6 over 9 years. For more advanced behaviour Microsoft introduced its own proprietary scripting language, Active X, integrated with its proprietary operating systems Windows 95/98/200/XP. While this faciliated the development of Web applications and their interaction with native WindowsTM programs, it was a security nightmare outside firewall-protected intranets. As Web usage expanded exponentially post 2002 with the advent of broadband services, demand grew for better integration of images, audio and video as well as cross-platform Web applications, but mainstream browser technology clearly prevented further progress without resorting third-party plug-ins such as AdobeTM
Flash or more recently Microsoft Silverlight. This means not only purchasing proprietary software (Adobe Flash Studio, Illustrator and/or Photoshop or M$ Visual Studio), but also hiring expensive AS3 developers instead of letting a Web designer accomplish the same ends. While such third-party solutions can provide impressive results for some games and special effects, they are not integrated with other Web standards such as HTML, CSS (Cascading Style-Sheets), Javascript and the little-known SVG standard (Scalar Vector Graphics). It has largely been the open-source community, the Mozilla Foundation and more recently a rather ironically, Apple Inc., to insist on Web standards for multimedia. HTML5 now supports not only more advanced style effects, but also video, audio and canvas elements enabling videos, sound clips and vector-graphic animation to be embedded into your browser natively and directly manipulated by Javascript. Recently we've seem huge gains in browser performance with Chrome, Safari and Opera regularly claiming the top spot with Firefox 4 catching up fast. Even Microsoft, with its new IE9 browser (only compatible with Windows Vista and 7), has shifted its focus from Silverlight to HTML5.


For once we have good news for Web Developers and bad news for vendors of proprietary solutions.

Categories
Computing

Get ready for the Big Corporate Takeover of the Web

The Internet is not going to disappear any time soon, at least short of a nuclear holocaust or a world-wide power outage. Big business has simply invested too much money in it to let that happen. What's at stake is the pioneering concept of a free and open network of hyperlinked resources. Media leviathans may feel threatened by You Tube, but they'll learn to work with it. Although server farms and desktop PCs may still produce an annoying hum, they represent a tiny fraction of global electricity consumption. The dot com boom years let a lucky few exploit new opportunities, but ten years on most large Internet enterprises would not have seen the light of day or night were it not for huge capital investment from the usual suspects. To attract millions of paying visitors to one of over a billion Internet domains, you need to invest heavily in advertising. The other day I caught sight of a huge billboard for www.ask.com. Why bother spending millions on an antiquated poster campaign if people can search the Web for alternatives to Google (the default for Firefox, Safari, Opera and Konqueror users), Yahoo and Microsoft's Windows Live (the default for IE 7 users). Tech-savvy users with a modern browser (i.e. post IE 6 era) can always add a search engine to their search bar. I've added Clusty, Yahoo, Creative Commons, php.net, Wikipedia, Ask Dot Com, Google Maps UK and even Window Live to my Firefox search box. But most Web users just use whatever comes standard just like most users of word processors do not know how to save in a different format (File > Save as in most cases). Unless they see a huge billboard on the way to work or are advised by close friends to try another search, they might never dream of fiddling with their browser's default settings. Anyway I gave ask dot com spin. If you want to search a well known organisation, person or authorised information on a given subject, ask dot com will suit you fine. Your average BBC news fan and Daily Mail reader, accustomed to officially sanctioned truth, will love it. Want to learn about retiring Prime Minister Tony Blair? Let's cut out all the crap from numerous sites exposing the man's sheer hypocrisy and corruption and go straight to 10 Downing Street's site or New Labour's site or maybe a review of a favourable biography on Amazon Dot Com. This is great for your kids' homework too. Their Blair/Brownite teachers will give them full marks. Want to know about the 9/11 destruction of the World Trade Center? Again the only references to conspiracy theories are ones denouncing or debunking all theories that challenge the orthodox version of events. You certainly don't want your child suggesting in a school essay the physical impossibility of a near perfect vertical collapse of a 400 metre tall skyscraper without a controlled demolition using thermite. What if your child wishes to learn more about human reproduction? Many parents would understandably prefer their inquisitive children not to view certain pornographic sites, which in all honesty, offer little enlightenment on any aspect of sexuality. With ask dot com's filters you can rest assured that should your 5 year old daughter types pussy cat, she will only see listings hits pertaining to friendly furry felines.

In its early years the World Wide Web was mostly used by academia and computer geeks expanding rapidly to IT-literate businesses, but online shopping was confined to a technophile elite until 2002/3. Indeed globally it still is. Now even Sun-readers and Sky-TV addicts do their Tesco shopping online. They don't care about thei socio-environmental impact of Tesco's domination of the grocery trade. It's cool to shop online from the comfort of their sofa and they can have some more quality to time to play with their kids or maybe gamble online or engage in a mindless blether via MSN, preinstalled on their Tesco/PC World/Currys PC or perhaps upgrade their preinstalled edition of Norton AntiVirus (happily using over half of their brand new system's resources and requiring a memory upgrade to 4GB so they can crop that picture of kids on holiday in Ibiza last year). To test the technical competency of modern UK resident, ask if they trust Internet banking or consider IE6 a safe browser as long as they have donated £40 to Symantec. If they believe the hype about the Internet banking revolution, they probably have little understanding of its inner workings. Yes, key-logging software, often installed with the free gizmos (search bars and famncy cursors) you can install only on Windows, can capture confidential data even if your Internet connection is encrypted via SSL. Your only real protection against fraudsters is to set up a firewall, use a sensible non-Microsoft browser, (Firefox,Opera or Safari) and uninstall all crapware and best of all not use MS Windows, but don't expect anyone from corporate estalishment to tell you that. Indeed they'll tell you the opposite, e.g. Channel 4's 40D Player will only work with WIndows Media Player 11 and Internet Explorer and basically we don't care a less if you accidentally download viruses if Internet Explorer activates My Web Search Bar. The whole debate about the platform-neutral provision of copyright-protected media using Digital Rights Management is rather tedious, as DRM empowers remote organisations to control content on your hard drive.

Does Internet smut debase women (men and children). Of course is does. Is Internet gambling even more addictive than bricks-and-mortar casinos? Probably. Does prolonged exposure and addiction to violent video games desensitise young minds to the true horrors of warfare? Again the weight of evidence and common sense suggests it does. The sad fact of the matter is that none of these pursuits either require a free and open World Wide Web or started with mass adoption of broadband Internet access. Porn has long used print media and videotapes. Virtual violence evolved mainly with game consoles plugged into TV sets and gambling has always thrived where governments let a few entrepreneural crooks entice the masses with dreams of limitless wealth. The Internet is just another vehicle. Phenemona like spam, viruses, spyware and phising simply destroys people's confidence in the Internet as a medium. What governments and karge organisations fear most is the continued democratisation of the Internet. They lose little sleep over morons who claim to have seen two-headed purple extraterrestrials in their back garden. They worry more about those intent on exposing the sheer hypocrisy an corruption of the ruling elite.

A.N. WIlson of the Daily Mail favourably reviewed Andrew Keen's The Cult of the Amateur, bemoaning staff cutbacks at the Encyclopaedia Britannica, as a result of the phenomenal expansion of Wikipedia. Not only is Wikipedia much more comprehensive than the Anglosaxon establishment's authorised fount of all knowledge worth knowing, it allows contributions from the general public. In reality numerous contributions on controversial or sensitive topics have already been censored by Wikipedia editors, partly an act of self-censorship to appear credible to the corporate and state elite. What worries large corporations is the wealth of information not yet censored and numerosity of links to unorthodox sources of information. They fear not so much that casual surfers may stumble on more disinformation, which thrives in the mainstream media, but they may find out what their masters are up to, verify facts and challenge their allegiance to the ruling elite.

By equating the massive potential the Internet has for unbridled commercial exploitation, cultural decay and brainwashing with the disinformation of amateurs daring to have their own say, Mr Wilson expects us to trust the likes of the BBC (who have broadcast their fair share of moronic violence) to decide what we may or may not access. They would like to see an unfree Web. Broadly speaking Windows Live, CNN, the BBC, Tesco, the Encyclopaedia Britannica and a plethora of censored blogspots and moderated discussion groups (lest someone express a racist opinion of course). The entertainment industry lobby will ensure public access to online casinos and first person shooters. Plenty of eye candy, a wide selection of DRM-ed media and games, but we can kiss goodbye to our freedom of expression. It's your Internet, treat it like your neighbourhood. If you let crooks and gangsters seize control, you'll need heavily armed police and curfews to provide of minimum of security. But if you let a community spirit prosper in the treu spirit of peace and open debate, you might just hold your rulers to account.

My unpublished comment:

While I share Mr Wilson's concern over cultural decay, Internet smut and a growing obsession with virtual violence, I disagree over collaborative projects such as Wikipedia, which, warts and all, remains one of the Internet's greatest achievements. Why should we in a democratic society rely solely on state and corporate entities such as Encyclopaedia Britannica?

The aforementioned social trends started long before most of us had an e-mail account, mainly thanks to multi-million dollar blockbusters, MTV and soap operas, produced by media leviathans who now see their grip on the collective psyche challenged by P2P file sharing. The Web has both reflected and accelerated existing trends, but with its increasing commercialisation we see its early democratising aspects drowned in an ocean of flashing ads, scams and disinformation. May I suggest the main concern of the British establishment is not protecting children from porn or violence, but silencing dissent?

Categories
Computing

Implementing an Ajax-like Interface: A Quick How-to

In the Web development world there's been a lot of buzz about an acronym many of us previously associated either with a brand of detergent or a Dutch football team. In a nutshell Asynchronous Javascript And XML means inserting new information into a Web page without reloading the whole page. Traditionally Dynamic HTML would use complex Javascripts to replace parts of a page with data that had already been downloaded or was based on user input. That's fine when managing small amounts of data, but if you needed more records from a large data source you had to make a call to the server and effectively reload the page. One common workaround used frames, but these break the unified concept of a seamlessly integrated Web interface and rely on Javascript to keep the disjointed parts together and prevent casual visitors from viewing only one frame. Whole books have been written on the wonders of Ajax, but given the ongoing state of flux in the evolution of Web browsers and competition from proprietary technologies requiring plug-ins such as Adobe's new Flex framework for Flash or Microsoft's Silverlight, many just think Ajax is more trouble than it's worth.

Surprisingly having read Christian Heilmann's excellent "Beginning JavaScript with DOM Scripting and Ajax" it took just a little experimentation to integrate Ajax into this site, so all internal links effectively load within the same page. Consider a 1000 word article or 6000 characters embedded in HTML. This would be unlikely to occupy more than 12KB the equivalent a small compressed jpeg image. By contrast reloading the whole page with linked header graphics, stylesheets and Javascripts may require way over 100Kb and although modern browsers cache such data, they still need to check for changes on every page reload.

The first challenge in deploying Ajax is capturing the correct variant of the XMLHttpRequest object, effectively XMLHttpRequest for Firefox, Safari, Konqueror, Opera and even IE7 and ActiveX for IE5.5 and IE6 (although the latter will still work with IE7, but is disabled by default due to ActiveX's inherit vulnerabilities on the Windows platform). Only users of IE Mac 5.2 (not updated since 2001), IE 4 and the old Netscape Navigator are left out, but we have a fallback solution for this dwindling pool of users. The second is to provide valid Web links that Search engines and Ajax-incapable browsers can use.

First the Ajax script:

The first module can be applied to many projects. Basically it takes two parameters the id attribute of target element (in quotes) and the URL of the script you wish to call in the background. This may be any script, static or dynamic supported by your server. It then simply replaces the content of the target element with the content returned by the script.

/* 
Adapted from Christian Heilmann's Beginning JavaScript with DOM Scripting and Ajax 
*/
simplexhr = {
doxhr : function( container, url ) {
   if( !document.getElementById || !document.createTextNode) {
      return;
   }
   simplexhr.outputContainer = document.getElementById( container );
   if( !simplexhr.outputContainer ){ return; }
   var request;
   try{
      request = new XMLHttpRequest();
   } catch ( error ) {
      try {
      request = new ActiveXObject( "Microsoft.XMLHTTP" );
      } catch ( error ) {
         return true;
      }
   }
   request.open( 'get', url );
   request.onreadystatechange = function() {
   if( request.readyState == 1 ) {
   simplexhr.outputContainer.innerHTML = '<h3>loading...</h3><hr /><p>Please wait while the server retrieves the requested information.</p>';
   }
   if( request.readyState == 4 ) {
      if ( /200|304/.test( request.status ) ) {
      simplexhr.retrieved(request);
      } else {
      simplexhr.failed(request);
      }
   }
   }
   request.send( null );
   return false;
   },
   
   failed : function( requester ) {
   simplexhr.outputContainer.innerHTML = '<p>Could not retrieve the requested data.</p>';
   return true;
   },
   retrieved : function( requester ) {
   var data = requester.responseText;
   simplexhr.outputContainer.innerHTML = data;
   return false;
   }
}

Strictly speaking we should use DOM scripting for the next bit, but we need workable links within the href attribute and an easily solution we can switch on and off dynamically, e.g. via browser detection to cater for those with non-Ajax-enabled browsers (practically IE5.2 Mac, IE Win < 5 and the old Netscape Navigator < 5. The simplest solution is to call the Ajax function within the onclick attribute. If Javascript is disabled the onclick attribute will be ignored. Moreover, the server can detect problematic browsers and, if the Ajax function is stored as a server-side variable, simply not include it for these browsers. In my PHP script I use a class variable $this->ajaxLink, which is set to ' onclick="ajaxLink();"' for compliant browsers and '' for others (a dwindling minority).

function ajaxLink(el) {
   remSelected();
   if (el.href!='#') {
      var script = el.href;
   }
   else { var script = el.title; }
   el.className='selected';
   var concat='&';
   if (!/?/.test(script)) { concat='?'; }
   script += concat + 'temp=1';
   simplexhr.doxhr('body-text',script);
   window.location='#head';
   return false;
}
function ajaxSearch(type) {
   if (type==2) {
      var f = document.asearch;
   }
   else {
      var f = document.search;
   }
   var w = f.searcht.value;
   var script = 'search.php?temp=1&w=' + escape(w);
   if (type==2) { 
      var sm='all';
      var rb=document.getElementsByName('smode');
      for (var i=0;i

This is called in compliant browsers with the following code:

<a onclick="ajaxLink(this);" href="/article.php?id=4567">Interesting Article</a>

The word this in parentheses refers to the current element and lets us grab and reset its attributes. First we get its href attribute and append the query string '&temp=1' so that the script only returns the article without the header, menu and footer. We also set its class to selected so it can be highlighted appropriately in the menu via the stylesheet. Lastly we set the return value to false.

Removing Inline onclick Event Handlers

We could convert this to a DOM-scripted version by adding a special attribute, ideally by assigning a special value to rel attribute such as "internal" to denote links we wish to load asynchronously in the targeted element.

<a rel="internal" href="/article.php?id=4567">Interesting Article</a>

Next we should replace our $this->ajaxLink (or the equivalent in your server-side language of choice with ' rel="internal' and use this DOM script to rewrite add the onclick event.

function addAjaxLinks() {
   var aTags=document.getElementsByTagName('a');
   for (var i=0;i<aTags.length;i++) {
      var rel=aTags[i].getAttribute('rel');
      if (rel=='internal') {
         aTags[i].onclick=function() {
         ajaxLink(this);
         return false;
      }
   }
}
window.onload=addAjaxLinks();

An additional function handles the search utility and I've yet to implement an Ajax solution for posting messages. Some might argue this solution avoids the X for XML, that would involve slightly more code and only really for long listings rather than simply pulling in data from scripts designed to return HTML.

Lastly the PHP script file would return either just the body text, if Ajax is enabled, or the whole page. Here's my solution:

<?php
include('/inc/blog.inc.php');
// If temp get variable is not set, set to 0
if (!isset($_GET['temp'])) { $_GET['temp']=0; }
// If temp equals 1 set $articleOnly parameter to true and remove
// header, menu and footer from returned script
$articleOnly = intval($_GET['temp'])===1 ? true:false;
// If mode is not set, use 'page' as default
if (!isset($_GET['mode'])) { $_GET['mode']='page'; }
// Cast the id to 0
if (!isset($_GET['id'])) { $_GET['id']=0; }
$_GET['id']=intval($_GET['id']);
// The 'Blog' class  calls all classes required 
// to build the page from a database query.
$page = new Blog($_GET['id'],$_GET['mode'],$articleOnly);
?>
Categories
Computing

Dear Macophobe Charlie Brooker

In response to Charlie Brooker's piece on Guardian Comments Free: Why I hate Macs

Hey, I'm using a Mac and also use Linux on another machine, use Windows XP + Linux at work and have endured my fair share of woes with the various incarnations of fenestrated operating systems falling victim to viruses, spyware and persistent crashes. I also plugged in a three-button wheel mouse as I'd become accustomed to frequent right clicks in my Windows days. However, with a Mac mouse, you just control-click to bring up a context menu. Besides Macs have so many command, option and control + other key combinations that right-clicking is really something for the clueless, "Err what do I do here?"

Next, the relative absence of first-person shooters would seem to be one of the most endearing advantages of this platform, but if you are seriously so demented (and I mince not my words) you could simply install VM-Ware or Parallels, but as I said such moronic games are for losers I would certainly not trust to approach my children.

If you are a real man and want to understand the inner workings of a computer, install Gentoo Linux, learn VI and do all your file management at the command line just like I can do this on this MacBook. Under the hood, beneath the superficial eye candy of the Aqua frontend, it's rocks-solid Free BSD. In my experience most Windows users cannot even install a lousy graphics driver (and I should know as I used to work on tech support for moronic video games), something many will have to do when they upgrade to Vista. I bet you're one of those hostages to MicroDoom who think you need a bloated proprietary Office suite to reproduce a few bullet points and spell-check your 300 word articles. Thanks to the grip that Microsoft holds on the collective psyche, millions of working class school kids are unaware that OpenOffice (or NeoOffice on the Mac) is a free and 100% legal download or the age of the £50 Linux laptop is upon us. Quite frankly IT in most UK secondary schools should be renamed Microsoft Point and Click Product Training. That's why Apple can make frankly pathetic claims that Macs run Office too. So what? The future lies clearly with XML, open standards, peer-to-peer networks and virtualisation technology, not with monolithic and monopolistic software suites.

While I have no illusions in the philanthropy of Steve Jobs and dislike any association with trendy I-podding consumers, I hope you enjoy the benefits of your deference to an even bigger predator. The fact is if you want a reliable machine for Web surfing, writing, number-crunching, editing photos and videos and programming that also has a battery of life of up to 6 hours (usually around 4 hours), can fit into your knapsack, can vpn into Windows or Linux networks, runs NeoOffice with full interoperability with ODF (Google it) as well as Microsoft Office formats and PDF and the Gimp (Google it) free of charge as well as 100s of open-source Unix apps, then a MacBook running Mac OS X ain't a bad choice. Otherwise get yourself a second-hand PC on ebay from some nerd upgrading to Vista and install Ubuntu.

Categories
Computing

CSS Two Column Layout

If you view this site with Firefox or other browsers based on the Gecko 1.8+ engine, you'll see the body of articles neatly arranged into two free-flowing and self-balancing columns. This relies on the new CSS 3 column module, implemented in Gecko browsers as -moz-column before ratification by the W3C. Safari and Opera have introduced limited support for multiple columns and will implement stylesheet workarounds for these user agents as soon as possible. Although IE7 is doubtlessly an improvement over IE6 with some of its best features inspired by Opera and Firefox, it has yet to implement support for all CSS 2 properties. If you can't be bothered to download or open a new browser just to view this site as designed, don't worry, it should look fine in one wide column except where pictures are aligned to look best in two-column view.