Tuesday 25 December 2007

SOAP: PHP5 and nusoap.php

I've been learning today some SOAP (Service Oriented Architecture Protocol), the protocol for exchanging XML-based messages over computer networks, normally using HTTP.

Also, the simpliest way to make it work without spending hours reconfiguring PHP on your server, is to use nusoap.php. This set of classes is 100% written in PHP and work out of the box with PHP4, but not PHP5! Also, to make it work, you will have to edit the file nusoap.php by changing:

1. Do a search and replace of soapclient to soap_client in the entire document
2. Replace this code:

if (!extension_loaded('soap')) {
/**
* For backwards compatiblity, define soap_client unless the PHP SOAP extension is loaded.
*/
class soap_client extends nusoap_client {
}
}

By this code:

class soap_client extends nusoap_client {}

And now it's time to try your first SOAP script (from http://dietrich.ganx4.com/nusoap/faq.php including the update of the class):

Here is a simple "hello world" example. First create file "hello.php."
Put nusoap.php in the same directory, or in your include directory, or enter
the path to them in the require_once() calls below. Then paste the code below
into the file. That's it!

require_once('nusoap.php');
$server = new soap_server;
$server->register('hello');
function hello ($name)
{
return "Hello $name.";
}
$server->service($HTTP_RAW_POST_DATA);

Accessing the service via a NuSOAP client:

require_once('nusoap.php');
$soap_client = new soap_client('http://yourdomain.com/hello.php');
echo $soap_client->call('hello',array('name'=>'dietrich'));

Thursday 20 December 2007

Install Skype with the webcam support on the Asus EEE

The latest version of Skype for Linux enables the user to use the embedded webcam of the Asus EEE. First thing you will need to do is to install the new version of Skype on top of the original version pre-installed on the EEE.

1. In firefox, enter this URL http://www.skype.com/go/getskype-linux-beta-xandros. This will download the Xandros-specific .deb file. Save it to your My Documents folder.

2. Open a terminal window on type cd /home/user/My\ Documents

3. Type ls -l and look for a file which looks like skype-debian_2.0.0.xxx_i386.deb

4. Type the command sudo dpkg -i skype-debian_2.0.0.xxx_i386.deb with the name of the file find above

Now, when you click on the Skype icon, it will launch Skype version 2.0 Beta instead of 1.4. At this point, you will not be able to use the webcam yet. Indeed, you will have to enable manually the webcam everytime you restart your computer (the webcam is normally off to save battery).

This is a way enable the webcam at launch of Skype, and disabling it when closing it:

1. Open up terminal and type sudo su
2. Then type cd /usr/bin
3. mv skype skype-bin
4. kwrite skype
5. Enter the following text into editor and save, quit
#!/bin/sh
echo 1 > /proc/acpi/asus/camera
/usr/bin/skype-bin
echo 0 > /proc/acpi/asus/camera
6. Finally, type chmod +x skype

You did it !! Skype will automaticcaly switch on and off the webcam !!!

Tuesday 18 December 2007

Asus EEE - Change the font & size of GTK applications

If you have installed application like Skype, VLC or Filezilla on your EEE, you must have noticed that the size of the font was pretty big, and not very suitable for the screen of the EEE. Also, this is a little tutorial to explain how to change this:

1. Open a terminal window

2. Type this command to open the GTK preferences file and create one if you don't already have one:

kwrite /home/user/.gtkrc-2.0

3. Paste these lines in the kwrite window:
gtk-icon-sizes = "gtk-menu=8,8:
gtk-button=8,8:
gtk-small-toolbar=8,8:
gtk-large-toolbar=8,8:
gtk-dialog=8,8:
gtk-dnd=8,8"
gtk-toolbar-style = GTK_TOOLBAR_ICONS
gtk-font-name = "DejaVu Sans 8"


4. Save and close. Start an application like Skype, and voila !

Monday 17 December 2007

What is so great about the EEE ?

Well, how to answer this one... ;)

First, the EEE is an ultra light computer (900g) using an SSD (Solid State Drive) to store the OS and the user's data. The SSD is a very good choice as normal HD often suffer from rough transportation / manipulations on the move, resulting in damaging and loosing all data. The EEE comes in 3 versions, 2Gb, 4Gb and 8Gb.

The EEE is wireless (802.11 b/g) and some versions also have a webcam 1.3M pixels. All drivers are already set-up when booting for the first time, meaning that the user will not have to dig for hour before making anything work, which is pretty cool as it enlarges the audiance of user (from novice to expert)


The screen is small, 7 inches, and uses a resolution of 800x480 widescreen. The color and contrast are pretty good considering the size. At first, anyone, and me included, was thinking that the screen was too small. Let's be honest here, yes it's small, but very much usable ! On each side, you will see the speakers, which have a decent quality.

The keyboard is very small too, so big fingers "be aware". Again, at first, it takes a little bit of time to get used to the small size, but it's only a matter of hours.

There are 3 USB 2 ports, a VGA out, and a SDHD card reader to extend the store of the computer. The battery last 3h30 when using Wifi (at least in my case).

The OS used by default is Xandros with a very simple interface, giving the possibility to children to use it. For advance users (even the one without Linux knowledge), it's possible to enable the advance mode (see [URL="http://wiki.eeeuser.com"]wiki.eeeuser.com[/URL]). The OS looks like a normal Window interface, and is very easy to use and to customise.

The main idea behind the EEE is to have a very portable computer, not the kind replacing your every day computer, but the one you can bring with you all the time.

For example, I am a web developer and when I travel in holidays, I can get my 15.4'' laptop with me cause it weight 4Kg and I would be to annoyed it anything happens to it (if it get stolen, broken, damaged, flooded, ... eaten ?). This EEE is THE perfect computer is this case, cause it will allow me to check my emails, and in cause of emergency fix the problems (it's really easy to install an FTP client for instance).

Also, still using the holidays example, it'll be possible for me to empty my digital camera on my EEE / SD card and share directly the pictures with my friends / family or send them to my blog.

Finaly, this is for me a great platform to learn Linux and practice commands in an dev environment. So far, I managed to learn how to install and update softwares, install Apache, MySQL and PHP to have everything ready on the move.

Again, the EEE will not replace your everyday computer, but it will be it's best companion.

Installing Apache, MySQL and PHP on the ASUS EEE




Here is a little tutorial to install Apache, MySQL and PHP on your beloved ASUS EEE:

First thing, you have to add a new repository. To do so, you will have to press CTRL + ALT + T to open a terminal window and then type: sudo kwrite /etc/apt/sources.list

Then add this line: deb ftp://ftp.uk.debian.org/debian/ stable main contrib non-free

Save and close kwrite.

Then, write the following comment in the terminal to update the list: sudo apt-get update

First, we will install MySQL, like this Apache will see it and configure itself to use it during the installation: apt-get install mysql-server-5.0

Time to install Apache: apt-get install mysql-server-5.0

Now it's the turn of PHP5: apt-get install libapache2-mod-php5 php5-mysql

Once the installation is complete, make sure that Apache is running: apache2 -k restart

Time to test Apache, type the following URL in your internet browser: http://localhost/

If the page load it means that Apache is running properly on your EEE !!!

Finally, we are going to write our first PHP script and run it. Type the following comment to open a text editor: sudo kwrite /var/www/apache2-default/helloworld.php

Put the following code: <? php echo "Hello world"; ?>

Type in your internet browser the URL: http://127.0.0.1/apache2-default/helloworld.php

Voila ! Your computer is set to run MySQL and PHP on Apache !!!

Wednesday 12 December 2007

Asus EPC 8Gb

Last night, I couldn't be happier ! I went to Taoyuan to the computer shopping mall named Nova and I saw the Asus EPC 8Gb, the black version. The price was very attractive comparing to the 4Gb model, only 70 Euros extra, so a total of 300 Euros.

I will post soon some picture to show you this great computer 100% linux !

Friday 7 December 2007

Asus EEE - Mini Laptop

It's been a few weeks now that I am looking at the Asus EEE new laptop and I have to admit I love it !!! I've seen the white, black and pink version so far, I quite like the white and black one.



I am waiting for the release of the 8G version which will feature 8Gb of SSD (HD) and 1Gb of RAM.

Also, a lot of rumors saying that Asus is working on a new version / edition of the EEE which will include a larger screen, probably 10", and one of the latest Intel low power consumption processor to enable a longer use on a normal battery.

Looking at the war which already started in UK and soon in France with the telecom operators, it's pretty accurate to think that Asus will try to integrate a 3G module in the next version of the EEE.