All Blogs by Date
The future of Linux
Over the years I've dabbled in and out of Linux and whilst I think that its a great OS, (especially for servers - I use it myself on my servers) I still personally prefer Windows on the desktop. Why? Well partly because its better the devil you know (and lets be honest all operating systems can be little devils at times) but also because up until recently Linux was lacking a bit of polish. Its starting to come on in leaps and bounds though so does it have a future?
What could help Linux gain ground?
Well apart from the crazy legacy file-system security modes (rwx) (which badly need to be ditched entirely in favour of ACL's) and a couple of other niggles, the core of Linux and its underlying structure is actually pretty good. In many cases far better than Windows. So why has adoption remained so low for so long, for whats essentially a free operating system?
Well, it's my opinion the main problems with Linux currently lie with its GUI framework (you know stuff like X-Windows, the Window Managers, GTK that sort of thing) and its applications. One might even say this was evident by the fact that Apple took the BSD system (which shares many similarities with Linux) bolted on a decent GUI and Window Manger, wrote some applications and made a success with OSX.
So what if we took Linux, scrapped X Windows, GTK and all the other horrid legacy systems which have held back Linux for years and started again with a new look and new applications? You know, got rid of all the ugly, bloated, buggy, inconsistent applications which currently lumber the repositories (such as those awful Geko based browsers they insist on shipping by default) and replace them with some slick, nice to use apps and a decent webkit browser followed by a simple re-brand? A quick rename away from the fruit-loop titles of the past (such as Linux, Red Hat and Ubuntu, etc) to something more palatable, you know like "Android" or something like that and you could have all the manufacturers clambering over themselves to get the new OS on all their latest tablet PC's by xmas!
...oh wait, that's already happening...
Could there really be a better way forward than the traditional X Windows based Linux?
Although the above was meant to be a bit tongue in cheek you have to wonder why Android has achieved mass end-user market share in less than 2 years with pretty much nothing more than Linux and a new GUI on a different hardware platform - whereas the traditional Linux market share has remained stagnant for decades. Perhaps there is some truth behind my above jest?
Personally I think it will be very interesting to see how long term Android evolves from its phone roots into bigger things. Expanding into the tablet PC market is after all halfway to a laptop.
I can't help but think that as computers migrate to true 3D gesture based interfaces over the next 5-10 years, Androids widget based touch interface may be a more appropriate starting point to build on than the antiquated X-Windows/GTK platform of the past. Who knows the future of Linux could be in the palm of your hand?...
Posted by Daniel: 17:53, Fri 3rd Sep 2010
How to grant "log on as batch job" in Windows 7 Home Premium
I just spent an hour trying to figure out this one so I thought I'd share the wisdom...
If you have been trying to schedule a task and run it as a regular user in Windows 7 you will probably have come across this...

This is due to a basic security measure implemented in all recent versions of Windows which requires users that run scheduled tasks to have a special security right. (A similar security measure is also used in the services system but when you change the user in the services manager it automatically grants the user the right and tells you its done so.)
Here's where the fun starts... If you have Windows 7 Professional, Ultimate or whatever you can simply go to the local security policy editor (under administrative tools) and assign the right; unfortunately if you are using the home versions you are stuck as the local security policy editor doesn't exist!
So what do you do?
Well you could compromise the security of your system and run the task as an administrator or something but personally I like all my applications to be contained in their own login as a form of damage limitation. Why give a scheduled task access to your whole system when it only needs to read 3 files?
The other option is to find a way to add the right... Being a determined chap I made that my goal, and heres how I managed it:
- Download and install the Windows Server 2003 Resource Kit Tools (yes I know its not the right version of Windows but we only need one executable and that at least seems to work)
- Open a Command Prompt as an administrator. You can do this by clicking the start button followed by "All Programs" then "Accessories". Then right clicking "Command Prompt" and selecting "Run as administrator". (You will need to authorise this if it asked for a password or confirmation.)
- Type the following command:
ntrights -u COMPUTER\User +r SeBatchLogonRight
Remember to replace COMPUTER\user with your computer name and the user account you wish to use.
Job done!
Hope this helps!
(Updated: 9:13, Fri 9th Jul 2010)
Posted by Daniel: 11:14, Mon 1st Mar 2010
Gizmo of the Month - 3G PAYG Dongle with no expiry!
Vodafone are offering 3G dongles with no pay monthly fee and no expiry on download credits purchased. See here for details.
As far as I know they are the only company currently offering this, although if anyone knows otherwise I would be very interested.
Basically you buy the dongle for £39 with a gigabyte of credit for free, then when it runs out you buy another gig for £15. There no requirement to do this and there's no expiry on the 1GB you have purchased (unlike all other offerings I have seen). £15 per gig isn't very cheap admittedly but at least you don't have to pay it every month!
I've actually owned one of these for 3 months now and I can recommend it. The GPRS fallback its a bit slow obviously but on 3G it zooms along. I actually managed to download a large file quicker on the dongle than my friend could on his broadband the other day....
(1 comment)Posted by Daniel: 13:38, Thu 3rd Sep 2009
Codeigniter Hints and Tips
I'm actually feeling a bit guilty as I haven't added anything to this blog for quite some time, mainly because I've been so busy... but anyway to try and make up for it here's some hints and tips to help solve some real challenging problems I came across when using CodeIgniter...
How to get $_GET queries:
Now as many of you may have found out already, CodeIgniter basically discards query strings (anything after the ? in your URL's) for what are essentially conceptual reasons. Now I have to say I do agree with their strategy but sometimes you absolutely have to use GET and there's no alternative.
After searching around I found many people giving examples which require modifying the main Codeigniter application. Now I don't know about you but this seems a bit overkill to me just to do a simple one off $_GET, so I looked around for something simpler. After much research and testing I found a nice simple solution. Edit your application/config/config.php file and change the line:
$config['uri_protocol'] = "AUTO";
...to...
$config['uri_protocol'] = "PATH_INFO";
This basically stops CodeIgniter generating 404 errors when your URL has a ? in it.
Now you need to get the data. As mentioned before $_GET doesn't work. The solution? Use $_REQUEST instead, its as simple as that.... Sure you have to be careful to make sure your cookies and $_POST variables don't get mixed up but it is a quick clean and simple solution.
How to pass URI segments as parameters to your default index function:
Usually passing segments to a CodeIgniter controller is easy. Lets say your URL is:
http://mysite/blog/show/32
or if you haven't got the redirect set up yet...
http://mysite/index.php/blog/show/32
You create a controller called blog.php with a function called show which looks like the following:
function show($id = '')
The value $id will then be set with then number 32....
The problem arises when you want to do the following:
http://mysite/blog/32
or if you havn't got the redirect set up yet...
http://mysite/index.php/blog/32
It seems like it should be as simple as setting up an index function like so:
function index($id = '')
But it doesn't work....
The reason it doesn't work is because CodeIgniter is looking for a function called 32 inside your blog.php which doesn't and can't exist. Really the correct path would be:
http://mysite/blog/index/32
or if you havn't got the redirect set up yet...
http://mysite/index.php/blog/index/32
...but that would be horrible.
Again there is a simple but not very obvious solution...
Edit your application/config/routes.php file and add the following:
$route['blog/(:num)'] = 'blog/index/$1';
Now when any URL containing blog/ with a number after it is submitted it will jump to your index function. You can even extend this to:
$route['blog/(:any)'] = 'blog/index/$1';
...but remember, that will mean no other functions in your blog class will work as they will all be redirected to your index controller and passed as a parameter!
How to load models inside a model:
Am I insane? Perhaps, but I occasionally I find the need to load a model inside another model. Unfortunately it appears that CodeIgniter, well at least version 1.7.1 of CodeIgniter (which is current at the time of writing) has a problem doing this. For example, if you load a model inside you model like this:
$this->load->model('my_model');
$this->my_model->my_function();
...it simply wont work.
Again once you know it the solution is simple....
$CI = &get_instance();
$CI->load->model('my_model');
$CI->my_model->my_function();
How to set a date field to the current date using the active record class:
Lets say you wanted to insert or update a bunch of fields in the database using the active records class but you also want to set an entry with the current date using the MySQL NOW() function. As you probably guessed the following doesn't work...
$my_data = array( 'created' => 'NOW()', 'field_1' => 'data', 'field_2' => 'data' );
$this->db->insert( 'my_table', $my_data );
The reason it doesn't work is because the active records class correctly escapes your NOW() string and executes SET `created`='NOW()' instead of SET `created`=NOW() which is what you want. Well it turns out the solution is simple...
$my_data = array( 'field_1' => 'data', 'field_2' => 'data' );
$this->db->set( 'created', 'NOW()', FALSE );
$this->db->insert( 'my_table', $my_data );
The FALSE tells it not to escape the field! Thats it, job done!
Goodbyes...
Hopefully I've shown a couple of very simple ways to achieve tasks which would otherwise be quite complicated. If I just save one person the hours of work it took me to solve some of these riddles then its all worth it!
(3 comments)(Updated: 16:16, Fri 8th May 2009)
Posted by Daniel: 17:36, Thu 7th May 2009
Ubuntu 8 - Is the penguin finally coming of age?
OK I admit it, I'm a Windows boy. I've been using Windows now from 95 through to Vista, working on networks from small businesses to large corporations. As much as I hate to admit it I even know a few registry keys off by heart... but that doesn't make me blind to what else is going on in the operating system world. Closing your eyes to other systems in the fast moving field of IT can often leave you stranded but can also mean you miss out on something which could improve your life dramatically. After all I might have more windows experience than a Canary Wharf glass cleaner but I still run my web servers on Linux and Apache because its the most sensible choice.
Of course if you do spend all your time looking at grassy hills through Windows, the first time you venture down penguin alley and take a bite out of an Apple you may find you end up with muck on your trainers and a sour taste in your mouth. This is usually enough to put most people off but what you need to remember is the first time you tried to look through windows you ended up banging your head on the glass. Just because its not what you are used to it doesn't mean you should discard the opportunity. Once you have realised how to step over the penguin dirt and only pick the juicy Apples you will be amazed at the freedom you will find.
Today I'm heading into Ubuntu land which appears to be the trendy Linux desktop of the moment. What I will find, who knows but as always there's an adventure to be had...
The Hardware Setup
This time around I decided to use my Dell Vostro 1400 for the test. The reason I chose a laptop and not a desktop is due to a number of factors:-
Firstly: Linux (and indeed Unix in general) has historically had a hard time dealing with machines of the non tethered variety. This is simply because Unix has its roots in always-on, networked mainframes, where the sheer thought of not having a network connection was inconceivable.
Secondly: Laptops present their own complications and challenges such as the issues associated with power-saving, standby and hibernation, not to mention proprietary hardware and strange screen resolutions.
Thirdly: With Dell being one of the largest PC suppliers in the UK and laptops fast becoming the computing platform of choice it seemed sensible to head in this direction.
Now before I end this section I should mention one last thing, my laptop has the optional nVidia GeForce 8400M GS upgraded graphics card. There is a special significance in this which I feel I should point out: If you plan to install Linux (as any experienced user will tell you) you need to make sure you have an nVidia graphics card. The reason for this is graphics cards are possibly the hardest device to write drivers for. Not because the technology is complex (although that pays a big part) but mainly because the manufacturers work in obsessive secrecy so not to allow their competition to gain any of their technologies. If all the interfaces are secret how can you develop a driver? The end result is you simply choose the company that puts the most effort into supporting Linux with their own drivers which at this point in time is nVidia.
Prepararing for the Install
Getting ready to install Ubuntu is easy and guess what, you don't even have to sell you soul to PC World to be able to afford it. You simply go to the Ubuntu website, download it, burn it to a disk and boot from it. You can even run the disk from within Windows and install it alongside, although personally I think the most sensible option is to have it in a different partition.
As it happens the machine I am using contained a Dell MediaDirect partition at the end of the disk. Apparently this is some standalone OS thing which allows you to watch DVD's without booting into Vista, something I have never used and have no intention of using so I killed it. I didn't even know it existed until I pressed the home button by accident on my keyboard one day instead of the power. As it turns out even after deleting the partition I can still run MediaDirect under the Vista OS so in my opinion I didn't loose anything.
However just deleting the MediaDirect partition on its own probably wasn't going to provide enough space for Ubuntu so additionally I shrunk the Vista partition by a few gigs using the built in Vista Disk Management tools. I could of course have let the Ubuntu installer take care of it but I did it myself just to see how the Vista tools coped.
Installation
During installation I noticed a couple of things which I felt could have been done better, although to be honest they were all pretty minor compared to the Windows installers insistence on asking you what country you are in over and over again in multiple different dialoges. I swear after the 3rd or 4th time I actually start to wonder if maybe I am in America after all... but anyway back to Ubuntu.
Timezone selection:
Personally I found the timezone zooming in thing a little odd but nowhere near as odd as after having selected the correct zone Ubuntu telling me the time was an hour ahead of what it actually was. Now being of a techy nature I know this is most likely due to the fact that Windows deals with the hardware clock in a slightly different way to Linux, and to be fair, once Ubuntu had rebooted the time was correct and additionally remained correct in Windows. Therefore I guess I have no real cause for complaint... however putting my "I'm a complete novice" hat on I can see this could throw people a little.
Usernames and passwords:
Those of you that know me personally will have heard me complain about this over and over, and yes I am going to do it again. Why oh why can I only use lower case letters and numbers in my username? For an operating system that boasted long filename support long before Windows was even out of nappies, why is it my username has to look like a DOS folder? All I want to do is have Firstname.Lastname as my login so it matches every other system I log into from Windows accounts to email address and web page signins. Sure I could just use my last name in lower case with a bunch of numbers after it but that's so 1970's. "I am not a number - I am a free man!"
After having spoke to multiple people on this issue it seems it's a rather superficial/historic limitation and not a real restriction at all. You can actually go in at a low level and change it afterwards to whatever you want and nothing is affected (which I have done in the past and will do this time). So what the wizards problem is I don't understand?
The other thing which struck me as being a bit odd was I don't recall giving any information about what to do with the root accounts password? Did it use the same password as my user account or what? I guess for the average newb coming from Windows this isn't a concern but some indication would have been nice for those of us that know what a good root can do for a man.
Partitioning and boot loader installation:
As mentioned before, I had already cleared some disk space for Ubuntu so I selected the guided option relating to installing the OS in the free space. Now while I appreciate that the installer is aimed at being smooth and easy to use for novices, I think in this case it was maybe a little too over simplified. My impression of what 'guided' meant was "show me what needs to be done and as long as I click next you can do it", as it turns out what it actually means is "just do it and don't bother me again". The next thing I knew partitions were being formatted infront of me which isn't the most reassuring thing when you have a cherished Vista partition on the same drive. However as it turns out my Vista partition was perfectly in tact and the Grub boot loader quite happily gave me the option to boot it, so I had no real cause for complaint (apart from a little distress of course).
Summary:
Overall the first part of the installation went very smoothly and certainly smoother than any other Linux installation I have ever done. It did seem a little slow (in fact possibly slower than installing Windows) but I have to admit I didn't exactly use a stopwatch so it could just be that I'm not used to watching orange screens instead of green ones. Of course doing things from a CD-ROM drive doesn't help, I forget how slow optical media is sometimes and Vista ships on DVD now so that could be it.
If anything, the Ubuntu installer was perhaps a little overly slick. Completely glossing over things which perhaps the more experienced user might want to know about is maybe taking things a little far in the name of "keeping it simple". Its great for the average Joe but a couple of little pointers for those more experienced wouldn't go a miss...
Getting the Hardware Up and Running:
To be honest first boot was a bit of an eye opener for me into how much Ubuntu has progressed since I last installed it (version 6 I think). All the hardware just worked and did exactly what it said on the tin, something which I wasn't quite expecting...
WiFi:
Guessing that my WiFi probably wouldn't be working straight away I booted Ubuntu for the first time with a network cable connected. This isn't an usual practice and to be honest I would probably have had to do the same thing if I were installing Windows. However what did surprise me was how quickly and efficiently the system got the WiFi up and working. What I thought was going to be an arduous task of downloading and installing drivers was a simple popup balloon and a few mouse clicks - arguably easier than installing drivers under Windows!
One of the things that did pose a bit of a worry was during the WiFi install a couple of dialogue boxes talked about uploading firmware. For most people upgrading firmware is not something to be taken lightly and I have to admit, worried that it could upset my Vista installs drivers, I myself hesitated. As it turns out this isn't the sort of firmware we usually experience. In fact its not actually very firm at all, something which could have been made clearer perhaps in a brief statement along the lines of "this change is not permanent and will not affect any other systems which use this hardware" but it wasn't. As it turned out a brief reboot back into Vista did indeed confirm other operating systems were unaffected.
The WiFi interface itself is surprisingly slick. In fact after putting up with Vista's pathetic, clunky efforts to manage WiFi over the last couple of years this was a breeze. I simply clicked on the icon, clicked the network I wished to access and entered the key. It really doesn't get any easier than that. Whilst I realise Vista's efforts to provide extra functionality are admirable sometimes basic simplicity and efficiency will always win out.
Graphics:
Graphics has always been a tough one for Unix, historically changing screen resolutions and configuring drivers has always been a pain. Its for this reason I was genuinely quite impressed to be presented with an interface in full colour and the right screen resolution. Lets face it when installed from scratch even Windows doesn't get that right all the time and that's on an operating system supported by the manufacturers.
What made the experience even more pleasing was the same simple hardware wizard I used to install the WiFi drivers quite happily upgraded my display drivers to the proprietary nVidia ones and still managed to give me the right screen resolution! Sure I had to reboot the computer (which for us Windows users is always kinda comforting) but hey it all worked!
Sound:
Like graphics, for some reason sound has also been area of historical suffering for Linux users. I remember days where they would say "ditch that proprietary soundcard and get yourself a real soundblaster - its the only way to do it". Well as my laptop booted it played an intro tune. What can I say, it worked without issue, at least for me..
Bluetooth:
I'm not going to go into a whole lot of detail about Ubuntu Bluetooth support yet as basically I haven't used it, so I can't provide any comment. However I will say that it all appears to have installed correctly and I have a nice little Bluetooth icon on the gnome bar. One thing which is a little odd is there seems to be no way to completely switch it off for the purposes of saving power and since my laptop has no hardware switch that leaves the BIOS as the only way to control the power for it. Not ideal as I'm sure you will agree...
Docking:
The next big challenge for any operating system is being slammed into a docking station. Sure mines not massively complex, in fact its not really a docking station at all its just a laptop stand with a bunch of USB peripherals and a power pack. But to my surprise everything just worked. Additionally my mouse and keyboard instantly worked, something which Windows has never managed to do. I'm often caught sitting wiggling the mouse waiting for something to happen.
Topped off with a nice little notification to say the laptop was on a power pack, it seems this 'just working' thing is something I am going to have to get used to!
Conclusion
In this day and age anyone who says "Linux is harder to install than Windows" is either using the wrong distribution or needs their head testing. I have a LOT of experience of installing Windows and I can tell you installing this version of Ubuntu does appear to be significantly easier than most Windows variants. At the end of the day installing any operating system is tricky and buying a computer pre-installed is always easier than installing one yourself but if you do have to install Ubuntu, at least in my experience, it most definitely isn't harder.
Whats Left?
This of course isn't the end of the story... Once you have your Ubuntu installed you need to get accustomed to it and install all the software you require - or at the very least their Linux equivalents. That however is the subject for another blog, which I may or may not write using Ubuntu.
Posted by Daniel: 11:44, Thu 1st May 2008
