A Blog about Linux, Open Source and Code! 
Symsys Inform Blog Home

Symsys Ltd Text logo in the banner area





 

 

I’ve decided to re-write my PHP How To’s. This is the first, it doesn’t actually include any PHP, instead this tutorial simply shows you how to setup a basic HTML form with two input boxes and a button, the tutorial following this one will explain how to write a php script that will receive the details from this form, process them and then do something with the result.

This tutorial assumes that you already have a relatively in depth knowledge of HTML and how it works, if you don’t then stop reading now, go and learn a little HTML first, before you try starting with PHP, if you don’t understand the supporting language of HTML then you will not understand what the PHP is doing. I also assume that you have some form of a test server, be it a server or shared hosting that supports php, you must have some way of testing your PHP code for this tutorial to work, if you don’t have one, get one. I will try to write a tutorial on installing a basic LAMP (Linux Apache MySQL PHP) server at some point in the future and link to it here, but as yet I have not written one.

So after declaring our HTML DTD and putting in our standard html, head and body tags, we need to start writing our form. We are going to use label tags here because in a later tutorial I’ll show you how to use them to properly space out your form using CSS and of course we are using input tags for our text boxes and submit buttons. The most important attributes of these input tags are the “name” tags, these are the identifier tags, which will get passed across to our PHP script in the next tutorial via the POST method.

Once you’ve got your form laid out the way the code shows above (Yes at this point you can copy n paste a little, but beware you need to understand what you’re copying and pasting or the other tutorials may not work properly and you may not benefit from them) you should be able to upload it and see a basic HTML form in your web browser.

Save the file as something simple like “my-first-form.php”, save it as a .php file, this way we can test that the PHP engine is running first and foremost but later we are going to do error handling and that will require the form to be a php document. It’s not pretty right now and it’s nothing special, but it’ll work for what we want.

Your form should have a textbox to enter a name, another to enter your age and a simple submit button. If your form does not show the way I’ve described, then something has gone wrong and you should start again or you may need to look at your server setup if the page does not display at all. If your form displays correctly then all is well and you can move on to PHP Tutorial 1.1 – Processing simple form input using PHP and the POST method.

The code in this tutorial is under no license whatsoever and is completely free to be re-used by anyone and for any purpose. No warranty of guarantee is provided with this code and it is used, re-used, re-distributed or sold at the persons own risk. In no way is Symsys, or the author of the tutorial, responsible in any way, for the way this code is used by a third party or how it may be developed by that third party. Please use any and all code here responsibly.


Filed under: PHP ... Comments (4)


  

 








 

 

I didn’t think Adobe would ever release Creative Suite natively for Linux

And the fact is they still might never do it. But, and believe me this is a big BUT, through the course of something completely different and irrelevant, I had the ear of a Senior Engineering Manager in the Installation, Deployment and Licensing department at Adobe the other day, so I asked the question, not surprisingly his response was that there didn’t appear to be any real requirement for Adobe CS products to be released on Linux natively and so with that in mind it would probably never happen. I replied to his email politely, but with somewhat of a rant about why there was a business requirement for CS to be released on Linux natively, expecting it to be completely ignored, I couldn’t resist while I had his ear though of course.

Senior engineering manager agrees with comments

The reply I got to my Linux rant was rather surprising indeed and even more pleasing, it basically said, “I read through the Linux rant and I agree with a lot of what you said, so I’ve passed it on to our business team”.

Could this mean I’ve made some headway? Or could he just be blowing smoke up my ……. Well I’d like to think of course that I made some sense in my little rant, I’d also more importantly like to think it’ll make some sense to the business team as well. I’m not sat at the machine I wrote the email on at the moment so I can’t simply copy n paste, however the points I made have been on my mind for some time, so I’ll try to summarize them here for you, let me know if you think they make sense or not and if you think the business team will just ignore it, or take heed and actually make a move eventually. I can’t see my little rant being the reason that Adobe suddenly announces it’s going to bring out CS on Linux, but I’d like to think the rant helped if it happens.

Designers are free spirited

And that tends to lead to them wanting to be different from the norm, hence a lot of designers using Macs instead of PCs. I know many designers, including our very own Gremlette, who have dual boot systems with XP and Linux on the same machine, unfortunately the requirement within a designers job to use Adobe products, not just Photoshop and Illustrator which can occasionally be by-passed with GIMP and Inkscape (Although not always as those products are not quite perfect and are meant as an alternative not clones) but things like In-Design and Acrobat Professional which don’t really have any comparitive or competetive products available freely or in fact for Linux at all really, keeps these designers like Gremlette tied to Windows. Given a choice of Linux or Windows XP if both could run Adobe CS4, I know Gremlette would choose the Linux machine and I know many more designers too who would switch from both Mac OSX and Windows to Linux as well.

Microsoft share prices are low, if Windows 7 fails like Vista then

Where does that leave companies like Adobe, it doesn’t take a rocket scientist to realise that Windows 7 may well be a complete and utter f**k up just like Vista was, it’s likely to be less of one I admit, but now that Apple have released Snow Leopard and there’s a new Ubuntu release every 6 months, which is MORE than just usable but in actuality fantastic, plus KDE4.3 being an absolute and resounding success with likely an even better release by the time Windows 7 even hits the shelves, not to mention other distributions releasing every year or less, it’s going to be hard for Windows to compete really, let’s also not forget the almighty Google, who lets face it, don’t really fail at anything they try to do, are going to release Chrome OS somewhere between now and 2011, does anyone really think that Windows is going to continue competing for much longer?

Another valid point on this subject is the recent actions of major OEM machine manufacturers like Dell, HP, Lenovo, IBM, ASUS, Acer etc. All of these companies and more, have recently made agreements with companies like Canonical and Novell to use Ubuntu and OpenSUSE as their OEM operating systems, this has started out small time, but my genuine belief as to why they’ve even initiated these deals is that they’re just as aware of the fact that if Microsoft goes bust or at least faces major financial problems that prevent it from keeping it’s position in the market, they’ll be left without an operating system to use OEM. If that happens, what would Adobe do with no native Linux release available to sell to all the customers now running Linux, lose a hell of a lot of money is what.

Microsoft do have a track record of releasing a terrible OS, and then quite a good one to recover

But the fact is a lot of people are truly sick of Microsofts new-found ultra-paranoia, with Windows Genuine Advantage getting worse and worse it’s like the DRM of operating systems, and we all know how many people love DRM don’t we. Now Windows 7 is built on Vista, so it could go one of two ways. Windows Vista is the new Windows ME, just as Windows 98SE was the new Windows 98. Windows 98 was a pretty terrible OS, it crashed more than anything else ever had, it could run much when it first started and it had more problems than a de-hydrated dog with both Mange and Ticks, Windows 98SE however was fantastic in comparison, it was built entirely on Windows 98, it had the same interface, just as Windows 7 appears to have the same interface as Vista (Which is not really a well liked one I must admit). Windows 98SE was definitely a hit, but then they blew it, they released Windows ME, the MOST diabolic operating system MS has released to date, it didn’t just crash it ate hardware, refused to recover things it had deleted itself, half the time it wouldn’t boot up and to make things worse you couldn’t get a refund or an exchange or a downgrade.

Windows XP first release was terrible, SP1 was better, SP2 was fantastic, SP3 made the OS almost unusable and completely in-compatible with hardware and software that had worked perfectly before the SP was installed. Vista was a complete re-write apparently, different kernel, different interface (Although familiar with the start menu etc) even MS themselves admit publicly that it was a complete failure, so will Windows 7 be a slightly better OS like Windows 98SE was to Windows 98 or will it be a completely diabolical re-hash like Windows ME, or will it be like Windows XP SP2, a brilliant re-build of a terrible OS? Only time will tell, unfortunately I don’t think it’s going to save MS as much as they think it is and I’m not only thinking it’ll fail, I hope it will.

Adobe and Linux could be peas in a pod

If Adobe do release the CS on Linux then I think it will be great, not only for Adobe but for the general consumer. The whole thing is a viscous cycle, because Adobe products are not available on Linux, the OEM manufacturers know that designers and web designers will likely decide not to buy a Linux OEM box, likewise because the OEM boxes with Linux installed are not yet so plentiful, Adobe thinks there isn’t enough of a market share to spend the money developing a release for Linux. All it will take is for companies like Adobe, who do have a great deal of vendor-lock-in power out there, to start releasing products for Linux. Once Linux isn’t SO reliant on open source/free software and has corporate software available for it too, the OEM manufacturers will feel far more comfortable about shipping more machines, the customers will feel much happier about buying the OEM machines and the companies like Adobe continue to make money no matter what happens to those lovely people in Redmond.


Filed under: Product Reviews ... Comments (2)

Tags: , , , , , , , , , , , , , , , ,
  

 





Author:  Hollow
November 28, 2008



 

 

Does a purist attitude hurt the development of Linux?

When you have something like Linux which is available FOR free and IS free, you have the inevitable issues of people taking advantage of the situation and giving nothing in return. This is something that unfortunately is just a fact of life, if you offer something at no cost, people will take it, however if you offer something that is free “as in liberty”, not everyone will want it, nor will they care, if you combine the two you’ll attract both types of people. This is why Linux appeals to so many people already and why it’s user-base and developer-base is expanding daily. You have the people in this world who are idealists and want everyone to be nice to everybody else and be ethical, you have the freeloaders, the cheapskates and the pompous, then you have the realists, like me. Linux manages to cover all these people quite nicely, with Red Hat, Canonical, Debian, Novell and the volunteer only operations.

Red Hat does not have a purist attitude

As far as the purist attitude goes, Red Hat shouldn’t really exist, or if they do, they certainly shouldn’t charge for what they do. In the purist’s eyes, Red Hat is a corporate company, capitalizing on the freedom of Linux and other GPL software, even if they do give back development. The truth is, without corporates, money, trade and a marketplace, the world would almost literally stop rotating, and then we all float off into space and we can’t breath anymore, that’s not a good thing in case you were wondering. To the best of my knowledge, when Linus, Richard and the other Open Source pioneers invented their respective softwares and laid down the rules & regulations that became the GPL and the “mantra” if you will of Open Source Software, there was nothing said about being unable to charge for the software, or for services pertaining to it, the only rule that came close, was that it had to also be available freely and you had to provide the source code with it, along with any copyright notices, the GPL itself and maintain the credits of any original works. So is Red Hat a bad company? Not in my opinion no, they provide direct competition for Microsoft in the server market and they don’t really do all that much in Desktops, except at the “Super Corporate” level.

Is it wrong to be a freeloader?

Not entirely no. Freeloaders are actually required in order to make anything grow, let’s face it, without all the people who use Linux and other GPL software on a day to day basis, that don’t have the knowledge or expertise to do anything other than use it, there would be no reason for the developers to improve things so much, on such a regular basis. This is almost the same as asking if money is a bad thing, it is in many ways the root of all evil, but the fact is, without it, there would be very little motivation for people to make things, invent things or develop existing creation. Now don’t get me wrong, things would still get invented, developed and refined, it’s human nature to do these things, the difference without money and/or demand though, is that the motivation to do these things is much less. Without companies like Canonical and Red Hat for example, who ARE in it for money, regardless of how much or how little they actually make at present, the current state of the Linux Desktop would be NOWHERE NEAR what it is today. If companies like these weren’t out there, constantly trying to develop a product that they can use to make money, in order to compete with the ultimate corporate (MS), the desktop would still get developed, but it would be done at a very slow rate in comparison.

Without compliance there can be no harmony

So the purists believe that we should rid our systems of anything proprietary, that includes NVidia and ATi drivers, it also includes any proprietary software such as Adobe Reader, Flash or Photoshop, not to mention the various other programs that are required to do certain jobs, which I’m sorry, there just isn’t an equivalent for in FOSS sometimes. One of the things Symsys does for it’s customers is produce ready to print images, these can be for anything from articles in a newspaper or magazine, to a flier, brochure, business card, car graphics or even a 50ft billboard advertisement. Unfortunately, as much as we adore FOSS, Linux and all that is GPL, we have absolutely no choice in some of these situations, but to use proprietary software to get the job done. Before the purists jump on their bandwagon of, “You just can’t be bothered to look for the software”, we have, we found some in certain circumstances and it either didn’t do the job at all or it didn’t do it anywhere near well enough, quickly enough or without a severe amount of intervention, now that’s not FOSS fault, it’s not the developers fault, it’s the proprietary software developers fault, for developing industry standards and not giving anything away to the FOSS developers to work with, regardless of your views on how imoral that may be, they have the legal right to do so. Unfortunately if there just isn’t any FOSS available to do the job, we need to find software that will, or turn the job away to a competitor, that just wouldn’t be good business and unfortunately feeding my family is my number one moral.

We use FOSS where and whenever physically possible, we even custom write software occassionally to make it do what we want, but that isn’t always practical, possible or financially viable with deadlines, customer expectations and workloads. The fact that I run dual 19″ screens and our designer runs dual 22″ screens, means that without Nvidia drivers we’d be running one screen each, because getting them working, to a standard that is acceptable, usable and productive, would be completely futile in terms of time, money and resources to make it happen in-house. Instead we use NVidia drivers, we want the functionallity that comes with using Adobe Reader to read PDFs and we want the compatibility that you only get when using Flash player to watch Flash movies, Gnash is great but it just isn’t Flash.

Purists are doing the very thing they supposedly hate

In expecting every single user of FOSS to return something, they are themselves demanding the software be paid for in some way, collaboration and co-operation is imperitive to FOSS and the world itself, the fact is though, so are freeloaders. Without freeloaders there is less demand, without demand, there is very little production, simple. Most FOSS is developed initially, because it fills the purpose of the person developing it, or the person that hired them to develop it, later though it is developed further because a demand exists. The developer chooses to make it freely available to anyone, anywhere, anytime and they also make a conscious decision that they allow people to do what they want with the source code (for the most part), change it, make addons for it, convert it to different platforms etc. and in doing so they also acknowledge that people can go and sell it as a boxed product and make money from it, even though they’ve done nothing but burn it to disc and stick it in a box. People and companies are also free to charge for services pertaining to that software, no matter what, they didn’t have to develop it, change it in any way or even have anything to do with it, up to the point that they advertised the service relating to it. If they didn’t, the adoption and spread of Linux would be far slower, thus lowering demand, thus slowing production and development.

Purism itself isn’t evil, it has the best of intentions

There’s nothing wrong with idealism, there’s is certainly nothing wrong with purism if you can obtain it, however preaching about purism in the open media and insisting that everyone follow your lead, makes you seem very much like a cult/religious evangelist, and certainly makes you seem very immature and unrealistic. Trying to enforce your views and your methods on the rest of the world around you, that just isn’t groovy baby and it certainly isn’t the way of FOSS. The ability to make Open Source business models financially rewarding and viable, is imperetive to FOSS development, as is the ability for people to use it freely, with no investment whatsoever, be that time, money or skills. Without these two primarily and unfortunately “unfree” attributes, FOSS would surely be underdeveloped. To enable the adoption of FOSS and reduce the market share of proprietary software, FOSS must first keep it’s enemies closer than it keeps it’s friends, it must enable it’s users to interact with people that have not yet seen the light, in order that they might see it in the future. When looking at things practically, without the ability to sell services for FOSS, I wouldn’t be in business, without the ability to use NVidia drivers, I wouldn’t be able to use Linux productively and without the freeloaders, Linux wouldn’t even be developed enough for my customers to want to use it so I’d have no target market. The previous paragraph may sound selfish because I’ve used my own business as an example, but I need freeloaders, Linux and FOSS needs freeloaders, Red Hat, Google, Canonical, Novell, they all need freeloaders and so indeed does the world itself. I admire purists for their ability to make themselves completely vendor independant, to make their own choices without detrimental effects to others and having such a clean concience, they need to realise though that not everyone can do that, no matter how much they may want to.


Filed under: Linux Reviews ... Comments (0)

Tags: , , , , , , , , , , , , , ,
  

 








 

 

Over the years I’ve been a helpdesk agent, a telecommunications network administrator, an I.T. engineer, a .NET programmer, a web applications programmer and a Linux evangelist (The last one is a full time job but it doesn’t pay as well as the others). Needless to say that in these roles and over such a long period of time I’ve used my fair share of cloning programs and definitely used more than my fair share of partitioning tools. Clonezilla and GParted have really made an impression on me though.

Let’s just take a scenario where you might use these programs. You’ve installed your Linux Desktop machine, you used guided installation for partitioning, but you were clever enough to make home a seperate partition. Automatically Linux installers tend to assume (On guided partitioning) that you only need 7 – 8GB of space for the main operating system and gives the rest of the drive to swap and home. This is absolutely fine, until of course you install too many programs that require /usr/sbin /opt and /etc, at which point you find yourself quickly running out of space on your main partition and the rest of you’re entire disk is used up with free space.

So given this scenario what do you do? Well if you’ve got a free hard drive you could boot up a Live CD, mount your partitions, create new partitions on your second hard drive for  /etc, /var, /opt, /usr or any other folder that has a lot of data in it and could free up some space by moving the data there, then mounting them with fstab spreading your file system around another one or more disks. The problem with that is that you’re then using up another/more hard drive(s) and worse yet you’re also spreading your file system accross lots of different drives, some people actually choose to do this, it gives multiple points of failure instead of just the one, the problem though is what happens if the drive that holds your /etc /opt and /var folders dies while everything else stays in tact? Or what happens if on a boot up, one of these very important mount points fails. There are pro’s and con’s for it and against it as with everything. My personal choice if the primary drive was big enough, and I had a second drive to move data to temporarily would be ….

Create folders in /media for the data you need to move around, for example mkdir /media/TempHome, then (If your other drive is sdb with 1 partition, formatted as ext3 for example)

mount -t ext3 /dev/sdb1 /media/TempHome,

then

mkdir /media/TempHome/home/

cp -Rp /home/* /media/TempHome/home/

This will copy everything from the /home/ directory (Including other peoples home folders if it’s a multi-user system) to the second drive (sdb1, mounted at /media/TempHome) maintaining all permissions on files and folders so that the same command later, with locations swapped around, will bring everything back, without the need to mess around setting permissions back. The next thing to do is obtain a copy of clonezilla, and burn it to a disc as a bootable CD. Reboot with Clonezilla in the CD drive and once it boots up you have a very self explanatory guide to help you “Clone” your main hard drive (Probably sda or hda on most systems, but it can be different), effectively backing up your existing system, “as-is” without changing anything, to a different drive, network location or removable media as a clonezilla image. This is an important step in the process because when you’re playing with partitions you never know if it’s definitely going to work without breaking things and having that clonezilla image allows you to just boot back up into clonezilla upon finding your broken system, select the image, select the primary drive and hit restore.

So you’ve copied your /home data to a seperate hard drive, you’ve cloned your entire system “as-is” and saved the clone image to the second drive with the use of Clonezilla, what you need to do now, is change your existing partitions around to make them more usable and give your main system more space. Sounds easy right? Well it is. You should have already downloaded GParted (Although I didn’t tell you to yet you should have guessed :D ) and burned it to disc. Stick the GParted CD in the drive and boot up your machine, you’ll automatically boot into a fluxbox interface and the GParted program will start automatically as well. From previous experience GParted doesn’t usually have a problem, deleting, re-sizing or adding new partitions, but everytime I’ve tried to move one, it’s failed on me, so my recommendation is to delete your home partition on /dev/sda6 in GParted(Remember you’ve copied your entire home folder to sdb already AND you’ve cloned the drive, so you’ve double backed everything up already in case of disaster), delete the swap partition as well if it’s in the same extended partition, then delete the extended partition, this shouldn’t take much time at all.

Next on the list is to enlarge your main partition (we’re assuming /dev/sda1) to an appropriate size, now regardless of what size your hard drive is, you don’t want to waste space, and unless you’re a software hoarder (I am) then you probably won’t need an sda1 partition any larger than about 50GB maximum. So let’s re-size that partition in GParted using the GUI, make it 50GB in size (50000MB), this can take a bit of time, as it tends to do two file checks while re-sizing (This is a good thing that lots of partition manipulators don’t do). Once it’s done we can go ahead and create a new extended partition that spans the entire free space on the drive. Next create a new SWAP partition, this needs to be EITHER twice the size of your RAM, so if you’ve got 1GB of RAM you should make SWAP 2GB but I usually just go for 2.5GB no matter what, if you’ve got less RAM you’re more likely to run out and if you’ve got more RAM then it won’t hurt because you’ve likely got a large hard drive anyway. Anyway, once you’ve created the partition, you’ll need to highlight it and choose swapon from the menus in GParted, this will activate the swap partition for your system to use.

Now that you’ve created swap you need to create your home partition again, obviously the size just needs to be the remaining space left on the hard drive, unless you want other partitions on it because you’ve got a 1TB drive or something. That should be set to ext3 when you format the partition. Next you can close the GParted GUI but don’t reboot yet. Click on the console icon on your desktop and type the following commands.

mkdir /media/Home/
mkdir /media/OldHome/

mount -t ext3 /dev/sda6 /media/Home/
mount -t ext3 /dev/sdb1 /media/OldHome/

cp -Rp /media/OldHome/home/* /media/Home/

Now working on the assumption (As we have been throughout) that you’re using sda as your main hard drive, it has /dev/sda1 as the primary partition, then an extended partition of /dev/sda2, then swap is /dev/sda5 (Remember the first LOGICAL partition on a hard drive is ALWAYS 5) and finally /dev/sda6 is going to be mounted as /home on your main system and you had two seperate partitions in the first place for home and your main system, this should be it and you SHOULD be able to reboot.

If however you didn’t have a seperate home partition in the first place and have been following this to perform specifically the task of creating a seperate home partition, you’ll still need to do the following before you reboot. You should now have all your data in the right place, with the right permissions and you should also still have the data backed up in both normal files and the form of a clonezilla image on that second hard drive, so we’re nearly finished. All you need to do now is edit you’re /etc/fstab file on your main system before booting into it, otherwise you won’t be able to login. So follow the remaining commands before rebooting.

mkdir /media/System

mount -t ext3 /dev/sda1 /media/System

cd /media/System/etc/

nano fstab

Then add the following line to it, to make sure it mounts your /home partition on boot:

/dev/sda6       /home           ext3    defaults        0       2

Be careful when editing /etc/fstab, make sure you have the correct partition number (/dev/sda6 for example) and make sure you have the right mount point (/home in this case) and the right file system (ext3 usually but occasionally people use ext2 or other file systems) and you should be fine.

Either way, hopefully you can see from the seriously low amount of command line actions required in this guide, Clonezilla and GParted are excellent tools for people who need to do all the technical stuff, but just aren’t strong on the command line or prefer something graphical, or even if you just don’t have the time to type all the commands, plus it’s far less risky to use a program specifically designed to only issue certain commands and does it with everything unmounted, than trying to unmount the right partitions at the right time, issuing all the commands by hand which could be proned to errors and you’ll still need something like Clonezilla to clone the drive instead of just copying it elsewhere anyway.


Filed under: Linux Reviews ... Comments (0)

Tags: , , , , , , , , , , , , ,
  

 





« Newer PostsOlder Posts »

Enter your email address:

Delivered by FeedBurner