The Way Of Life: March 2012
Google

Friday, March 30, 2012

Ubuntu-Apache-PHP-FreeTDS-MSSQL


This article is part two of my previous articles that is Android-PHP-Microsoft SQL Server. This time i will share, how to make web server in the "real life", this web server used Linux Ubuntu as operating system. Why I call "real life", because we are not used XAMPP again like on Windows at development phase. We will make real web server on Linux to handle data from SQL Server to our android application. Using the web server as a link between the android and MSSQL has several problems that we must understand.

You must understand that web server respond is not as fast ADO connection on desktop programming. Second, web server used internet connection that have up and down speed connection that we cannot guarantee. With that problems, you must learn how to make a several query in SQL that handle several process on android, and make on one "single shoot" to Microsoft SQL Server to reach "Speed of Light". The point is how to make minimum data traffic between Android and MS SQL Server. And the last you need to secure data path with cryptographic protocol (SSL) to prevents Man In The Middle Attack.

Okay, lets began our project, first we must collecting our tools :
1. Linux Ubuntu ver 11.10 you can download the ISO here, and burn to CD.
2. Apache Web Server for Linux.
3. PHP.
4. FreeTDS, to get PHP seeing Microsoft SQL Server.
5. Microsoft SQL Server as database server.

First, we must fresh install Linux Ubuntu on our Linux Box. I think I do not need to explain on this part.

And then , we must install apache web server on our Linux Box, with several command on terminal windows.

# sudo su
# apt-get install apache2

then install PHP 5

# apt-get install php5
# /etc/init.d/apache2 restart


Install FreeTDS to get PHP seeing Microsoft SQL Server, i found really good and simple tutorial and i was added several steps, as below:

1. mkdir source and then cd source
2. apt-get source php5
3. tar -xf php5_5.3.6.orig.tar.gz
4. cd /php-5.3.6/ext/mssql
5. apt-get install freetds-dev

6. apt-get install php5-dev
7. phpize
8. ./configure –with-mssql
9. make
10. php -i grep | extension_dir

10. cp /modules/mssql.so /usr/lib/php5/20090626+lfs
11. nano /etc/php5/apache2/php.ini and add on a new line the following ; extension = mssql.so then save
12. /etc/init.d/apache2 restart


13. nano /etc/freetds/freetds.conf and add this on the end of the file :

[yourserver]
host = your.server.name
port = 1433
tds version = 8.0 

14. and test your mssql_connect , on my php script i was select sysobjects table on Microsoft SQL Server, and if it return values from mssql_rows_affected then display "SUCESS" as the picture below.

Have Fun! Someday i will show you real android application that i make. There are many uses of Android Applications, such as mobile POS, e-prescribing, if your are a doctor, you can prescribed from anywhere in the world with android apps, if you are a boss you can check the balance sheet and income statement in the Hawaiian beach with drinking coconut ice with android apps.If you have any questions, you can email me at budy_wijaya@yahoo.com , or via comments on this blog.


picture take from here
related links:


Android - PHP - Microsoft SQL Server

How Fast is JSON on Android? 

Could Not Find libtds.so

A Beginner’s Guide to SQL: A MySQL Tutorial





Labels: , , , ,

Sunday, March 25, 2012

Game Nostalgia

3dfx Voodoo3 3000

Belum lama ini saya mendownload game, game ini merupakan game lama yaitu game Driver dari GT Interactive. Game ini dirilis sekitar tahun 1999, yang pada waktu itu saya belum mempunyai komputer, jadi jika saya mau main game ini harus main di kompie teman. Game Driver ini mengusung teknologi 3D yang pada saat itu komputer yang bisa memainkan game ini harus dilengkapi VGA yang support OpenGL. Pada jaman itu VGA Voodoo3 dari 3dfx yang mempunyai support cukup bagus dibanding VGA Card lain.

Dan pada jaman itu VGA seri Voodoo dari 3dfx merupakan salah satu VGA yang mendominasi gamer di tanah air. Tampilan box VGA Voodoo 3 pun sangat keren waktu itu, bisa dilihat di gambar atas. Dan lebih keren lagi tampilan box Voodoo 3 3500, seperti di bawah ini.

3dfx Voodoo3 3500

Meskipun sangat disayangkan 3dfx akhirnya bangkrut dan dibeli nVidia, dan salah satu peninggalan Voodoo yang dibawa nVidia adalah teknologi SLI yang bersaing dengan teknologi Crossfire dari AMD.

Kita lanjut ke game Driver dari GT interactive, game ini sebenarnya varian dari game Destruction Derby yang kemudian dimodifikasi menjadi game kejar kejaran yaitu Driver. Sekarang game ini bisa dijalankan "hanya" di laptop Lenovo G460 dengan VGA onboard Intel. Game ini sangat menarik ( bagi saya ), karena mobil yang dipakai adalah mobil jalanan, dengan efek drifting dan adanya efek point kerusakan, adapun cheat di game ini yang menjadikan mode "Super Fast Car", sehingga anda bisa mengejar musuh atau melarikan diri dari musuh dengan berjalan mundur :-).

Game ini mempunyai banyak mode, a.l Pursuit, Getaway,Survival dan masih banyak lagi, cocok untuk menghilangkan stress setelah seharian coding, silakan mencoba.


Gambar diambil dari sini, sini, dan sini.

Labels: , ,

Sunday, March 04, 2012

Android - PHP - Microsoft SQL Server

As I promised before, now I would like to share how to create Android applications that connect to Microsoft SQL Server database, using PHP Web Service. And one more thing I want to teach you about how to make Android application WITHOUT using the JAVA programming language. Okay, the tools we will use this time are:

1. Basic 4 Android, you can download it here.
2. XAMPP as a web server, you can download it here.
3. Microsoft SQL Server 2000, 2005 Express, 2005, 2008 or later, you can download it here.
4. Microsoft Drivers for PHP for SQL Server, you can download it here.
5. Android SDK which you can download here and Java JDK here.

First you must install the Basic 4 Android, and of course you have to buy licenses to use the library functions in it.

Then install XAMPP, need to be considered for connection to Microsoft SQL Server 2000 I recommend to use the old version for example XAMPP version 1.6.8. If you use Microsoft SQL Server 2005 and above, I recommend to install the latest version of XAMPP and also install the SQL Server Driver for PHP which you can download here. This is because the new version of XAMPP is not included drivers for connection from PHP to Microsoft SQL Server.

I will not go into too much detail for the setting on the Basic 4 Android, then XAMPP, I assume that you can, because if I was too detailed to discuss this article becoming too long. I hope you can understand, if you have any questions , you can email me at: budy_wijaya@yahoo.com or through comments on this blog.

First time we will make the user interface in the Basic 4 Android, by first running the Android SDK - AVD manager.


Then connect the menu Designer at Basic 4 Android to AVD manager.


Then create a login view, user text box, password text box, then the Login button, then save by name Login_Form, as shown below


Then we move to make the code in Basic 4 Android, the language used is Basic, or Visual Basic Like. First put all the variables in Sub Globals, as shown below


Then the procedure Activity_Create type the code shown below, the function of this code is to load Login_Form. And do not forget to checked the necessary library ,library http and json library.


Then create a procedure to capture input on user text box , create a procedure and code like in the picture below


For complete syntax querp.php you can see here and you have to replace mysql_connect to mssql_connect (because we used Microsoft SQL Server not MySQL as database server), if you use XAMPP is necessary to note problems like this.

Then at procedure hc_responseSuccess, type the code as shown below:


When finished,try to run the program in Basic 4 Android, for the initial setting Basic 4 Android, you can see the tutorial here


Then try the user name previously already exists in Microsoft SQL Server database, and then press enter, if successful it will appear as below:


Related Links:

How to connect Java to MySQL

How to connect Java to SQL Server

Ubuntu-PHP-Apache-FreeTDS-MS SQL Server 

How Fast JSON on Android?





Labels: , , , , ,