Monday, October 17, 2011

Glasses-Free 3D Smart Phones – A game changer

I am a gadget freak. I love experimenting with new gadgets and I get totally involved in the inner workings of some of these gadgets. Today, with all new technology gizmos around, it was hard for me to choose one, when I was asked to write a technical article. After scuffling around, I chose to talk about 3D technology, more focused on 3D Mobile technology. At first I was wondering, what is all that malarkey going around about 3D Smart Phones, but when I took a closer look at demo and actually held a 3D phone in my hand, I was intrigued with the way they work, especially without 3D glasses. At this point I am assuming that most of you already own a Smart Phone, or are planning to get one or at least know what they have to offer. Coming straight to the point, So, what is a 3D Smart Phone: A 3D smartphone is, as the term suggests, simply is a smartphone that’s capable of showing content in 3D.

But, the question is, do you really need one? At present, some of us think it’s a waste of money, but there are the others who think 3D Phones may be the next in-thing for smart phone users and could possible change the way we live. It depends, if you love movies, games, videos, photography, and YouTube a 3D smartphone will make life more entertaining and absorbing wherever you are. I personally think, it will have its own market, especially in gaming, photography, videography aspects.

3D phones are getting to be very popular among mobile techno-freaks today. Not only have a whole host of new 3D phones come into the market recently, but there are also an equally huge number of customers just waiting to get their hands on them, as and when they are released. So what exactly is this concept of 3D phones and how do 3D phones work?

3D technology has been around for many years. Only, we so far had 3D movies and then 3D HDTVs came by. But it is only now that 3D has made its foray into the mobile industry. Bringing this technology into a relatively small mobile device is indeed a challenge and the heights of innovation. One can easily watch 3D movies using special 3D glasses for the same. But it would seem silly to do the same with a mobile device. Hence, 3D phones have to have a 3D display without the need to use special glasses. This is what excited me the most about 3D technology on the Smart phones.


The Technology behind 3D Phones
Normally, when you are watching a 3D movie, the special dark glasses create a different image for each eye, thereby giving you the seeming effect of a live, 3D image. In actuality, the human brain mixes up these two different images and creates a composite, “breathing”, 3D image.
So how is one able to perceive 3D content without wearing these special glasses? Well, an interesting technology called the APB or Autostereoscopic Parallax Barrier is what gives a glasses-free 3D display. Here, a device (something like the 3D glasses) is kept in front of an LCD and this is what enables the user to get glasses-free 3D content. So, next, lets understand how does the “Parallax Barrier” work.

How does the ‘Parallax LCD’ Work:
So how does a parallax LCD work? Most people know that when you're watching a 3D movie and wearing those dorky glasses, a different image is being sent to each eye; your brain mashes these two images together to create a composite 3D image. But, what you may not know is that a 3D display incorporates an overlay that is placed in front of the LCD. This is called a parallax barrier and it polarizes the glasses giving the 3D effect. In other words, your eye is fooled into watching 3D. Interesting!!!

In other words, when you wear the glasses, each eye receives a different image, by way of blocking out light, hence the different color frames. Our eyes then put these images together to form a combined image – and one that appears to be 3D. The parallax barrier is a filter that goes over the screen to direct the different images to the correct eye, allowing us to then form that combined image and view the phone’s display in 3D.

There will come a time when users will be able to shift between 2D and 3D with a flip of a button. In fact, it is said that the Japanese electronics giant, Sharp, has been working on this technology for quite some time. But they employ it a little differently. They use a “switching LCD”, which can shift between 2D and 3D imaging, without using special glasses or goggles. When the switching feature is turned off, the TFT-LCD displays 2D imaging as normal, but when the parallax barrier is switched on, it controls the way light leaves the display, meaning different patterns of light reach the left and right eye thereby giving the 3D effect.

Note: A parallax barrier can only really work on a smaller screen, due to the intricacies involved. There is a specific position, or “sweet spot” that allows the eyes to create this 3D image. On a television screen, this is not really possible. However, for a small screen like a mobile phone or tablet, it is ideal.
Check these illustrations below to exactly depict what I mean.



However, to view 3D, we need to record in 3D, hence the need of a 3D camera, so lets get a gist of how a 3D Camera works.
How does a 3D camera work?
To create a 3D image, we take two 2D pictures of slightly different perspectives and put them together, as we have seen with the display explanation above. Like human eyes, 3D camera lenses need to be a distance apart so as to ensure that the camera gets the specific perspectives required to produce a 3D image. This isn’t the only way, though. For instance, some cameras use built-in software to get the different perspectives – something that requires the user to take multiple pictures, which are then put together to form the 3D image.
Few benefits of 3D-SmartPhones
So, now that we understand how 3D phones and cameras work, lets understand some benefits of a 3D SmartPhone.
1. 3D movies and games: Watching films and playing videogames in 3D is sure to be one of the biggest selling points of 3D smartphones. Details of how and where you’ll get 3D smartphone films from, and how much they’ll cost, are still being ironed out. It’s widely expected that online 3D download stores - similar to iTunes and Android Market - will soon emerge to service your every 3D whim.  These stores will also probably let you download 3D videogames directly onto your 3D smartphone. LG, for example, has already formed a partnership with several big-name game developers, including Gameloft, to create 3D versions of new and popular videogames. Epic have already launched 3D games such as the Infinity Blade 3D, for this future platform. It’s even rumored that a 3D Angry Birds videogame is in the works.
2. Shooting videos in 3D: 3D smartphones will also let you take your own 3D videos because they come with two lenses on the back - instead of the normal one - to mimic how your eyes see the world. Just imagine snapping videos of your friends at the beach or in a bar and then seeing them in glorious 3D on your smartphone’s screen. You’ll also be able to shoot 3D mini-movies on your 3D smartphone.
3. Sharing 3D content: In addition to the normal ways of sharing content between phones, such as Bluetooth, the LG Optimus 3D smartphone has an exclusive partnership with YouTube 3D - a special version of the website dedicated to 3D mini-movies, adverts and film trailers. This means any videos shot in 3D on your smartphone can then be easily uploaded onto YouTube 3D for friends and family to enjoy. However, they’ll need a 3D TV or other 3D-capable gadget to see your films in 3D. I am sure, HTC, LG, Samsung also have similar options.
Current Limitations/Issues with 3D Smart Phones
Every great technology comes with some caveats, only then there is a scope of improvement. At the moment of this writing, mobile 3D is still in its infancy and there are some limitation/issues as described below.
1. 3D Content: There is also a shortage of movies and other 3D content right now. This is because the way movies are shot is different, 3d movies require multiple cameras (min 2) from multiple angles, this means all recording hence forth will need to be done in “3D” style. This also means that all our current 2D recorded movies cannot be viewed in 3D, but all the new 3D recorded movies can be switched to 3D. 
2. Battery Consumption: Another problem is the battery consumption of 3D phones. At present, 3D phones are power hoggers and users will have to charge their phones 2 to 3 times a day to keep up to 3D. 
3. Eye Angle, position: 3D effect is strongly dependent on angle, distance. So the eye position with the 3D screen would need to be accurate.
4. Cost: 3D smartphones will remain a premium product for some time yet, just like the iPhone 4 and other top-end smartphones. 
However, all these above problems are expected to be set right in due course of time.
Now, the exciting part, lets take a look at some of the 3D SmartPhones and their carriers.

Phone Model ImagesCarrier
HTC EVO 3D
Sprint
LG Optimus 3D
AT&T
Samsung W960 Amoled 3D
N/A
LG Thrill 4G

AT&T


If you need to know which 3D SmartPhone to choose, then goto: http://www.gsmarena.com/ and do a compare to check out the latest and greatest features.
Some 3D Image views (Next generation UI):

View Video: http://bit.ly/pGC4gi
As of now and as far as my knowledge goes, only 3 major manufacturers are selling 3D phones on a global scale. They are the HTC EVO 3D and LG Optimus 3D, LG Thrill 4G and Samsung’s W960 Amoled 3D. It is anticipated that Apple may also soon have a 3D version of its iPhone and so will Motorola. 


Future growth of 3D
The 3D display technology and market forecast report published by DisplaySearch shows the total stereoscopic 3D display market is expected to grow from 0.7 million units and $902 million in revenues in 2008 to 196 million units and $22 billion in revenues in 2018, a compound annual growth rate (CAGR) of 38% for revenues and 75% for units.



News: HTC smartphone sales beat estimates, but HTC EVO 3D has "real thunder":  http://bit.ly/o5x445


Conclusion
In conclusion, 3D phones seem to be poised to become the future of mobile phones. Experts are already working round the clock to create better 3D technology and so, one can expect a veritable 3D phone boom in the coming couple of years. This article is prepared to the best of my knowledge and is subject to change.
_________________________________________________________
Naveen Noel J | Sr. Solutions Architect | ZSL, Inc | http://www.zsl.com

Thursday, August 11, 2011

Developing .NET Applications for iOS and Android - Mono and MonoTouch

I have been watching a cool platform from Novell called MonoTouch. for quite some time. From what i see, it has matured a lot since I got a look at it a while ago, there have also been a lot of books and articles published. All iPhone, iPad, Android developers, You must check this out.

Developing C# Applications for iPhone and iPad using MonoTouch shows you how to use your existing C# skills to write apps for the iPhone and iPad. Fortunately, there’s MonoTouch, Novell’s .NET library that allows C# developers to write C# code that executes in iOS. Furthermore, MonoTouch allows you to address all the unique functions of the iPhone, iPod Touch, and iPad. And the big plus: You needn’t learn any Objective-C to master MonoTouch!

The magic is in Novell’s implementation of Apple’s Cocoa libraries in MonoTouch. You’ll master the same elegant and rich Cocoa environment, but without the need to learn a new programming language. How cool is that. Check out MonoTouch here.

What is MonoTouch?
MonoTouch allows developers to create C# and .NET based applications that run on Apple's iPhone, iPad, and iPod Touch devices, while taking advantage of the iPhone APIs and reusing both code and libraries that have been built for .NET, as well as existing skills.
Please note that MonoTouch requires a Mac, Apple's iPhone SDK and you must be part of Apple's iPhone Developer Program to test and deploy your software on a device and to redistribute your code.
Read their MonoTouch Roadmap to learn about upcoming features and developments.

Mono for Android:
Mono for Android enables developers to use Microsoft™ Visual Studio™ to create C# and .NET based applications that run on Android phones and tablets. Developers can use their existing skills and reuse code and libraries that have been built with .NET, while taking advantage of native Android APIs.

eBook:
I also stumbled across an ebook - "Developing C# Applications for iPhone and iPad"
This book, using MonoTouch takes you from your first “Hello, World” example through the major APIs and features of iOS. The coverage is comprehensive and makes use of frequent examples, complete with sample code you can download and reuse to create your own powerful and playful apps. You can get this book here

Thursday, August 4, 2011

Installing MySQL 5, lighttpd, PHP 5, fastcgi, Wordpress 3 on a CentOS 6 x64 box


In this post i attempt to explain how to install MySQL, lighttpd, enable fastcgi and mysql support for php5 on a CentOS 6 x64 box. Finally I go onto explain how to install wordpress.
Versions of Software used in this post.
SoftwareVersion
CentOSRelease 6 (Final)
MySQLVer 14.14 Distrib 5.1.52
PHP5.3.2
lighttpd1.4.28
WordPress3.2.1
This post is divided into 5 parts as follows:
1. Part I: Installing MySQL
2. Part II: Installing and configuring lighttpd
3. Part III: Installing PHP and configuring MySQL support in PHP
4. Part IV: Installing and configuring WordPress
5. Part V: Credits

Part I: Installing MySQL
1. Install MySQL
[root@testserver /]# yum install mysql mysql-server

2. Create Startup links
Then we create the system startup links for MySQL (so that MySQL starts automatically whenever the system boots) and start the MySQL server:
[root@testserver /]# chkconfig --levels 235 mysqld on
[root@testserver /]# /etc/init.d/mysqld start

3. Create root password
Create a password for the MySQL user root (replace yourrootsqlpassword with the password you want to use):
[root@testserver /]# mysqladmin -u root password yourrootsqlpassword

4. Check where MySQL is listening
Then check with netstat -tap | grep mysql on which addresses MySQL is listening.
[root@testserver /]# netstat -tap | grep mysql
If you see something like
tcp        0      0 localhost.localdo:mysql *:*                         LISTEN      3147/mysqld
then you are safe which means MySQL is listening on localhost.localdomain only, then you're safe with the password you set before. But if the output looks like this:
tcp        0      0 *:mysql                        *:*                         LISTEN      3147/mysqld
then you should set a MySQL password for your hostname, too, because otherwise anybody can access your database and modify data:
[root@testserver /]# mysqladmin -h testserver -u root password yourrootsqlpassword
You are done!!!.

Part II: Installing and configuring lighttpd
What is lighttpd?
“Security, speed, compliance, and flexibility — all of these describe lighttpd (pron. lighty) which is rapidly redefining efficiency of a webserver; as it is designed and optimized for high performance environments. With a small memory footprint compared to other web-servers, effective management of the cpu-load, and advanced feature set (FastCGI, SCGI, Auth, Output-Compression, URL-Rewriting and many more) lighttpd is the perfect solution for every server that is suffering load problems.” For more information, refer http://www.lighttpd.net
Ref: http://www.kernelhardware.org/lighttpd-and-centos-5/
The installation process of lighttpd is described below:

1. Install lighttpd via YUM
Lighttpd is not available from the official CentOS 5.0 repositories, but from the RPMforge repositories (see http://dag.wieers.com/rpm/FAQ.php#B2 for instructions). We install the RPMforge package for RHEL 5 which works for CentOS 6.0 as well:
1.1 RPMForge Install
1.1.1 RPMForge i386 install
[root@testserver /]# rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
[root@testserver /]# rpm –Uhv http://apt.sw.be/redhat/el6/en/i386/rpmforge/RPMS/rpmforge-release-0.5.2-2.el6.rf.i686.rpm
1.1.2 RPMForge x86_64 or 64bit install
[root@testserver /]# rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
[root@testserver /]# rpm –Uhv http://apt.sw.be/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm

2. Install lighttpd
[root@testserver /]# yum install lighttpd
(OR)
1.2 Direct Install
1.2.1 Get the lighttpd RPM
[root@testserver /]# wget http://pkgs.repoforge.org/lighttpd/lighttpd-1.4.28-2.el6.rf.x86_64.rpm
1.2.2. Install the rpm
[root@testserver /]# rpm -ivh lighttpd-1.4.28-2.el6.rf.x86_64.rpm
warning: lighttpd-1.4.28-2.el6.rf.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 6b8d79e6: NOKEY
Preparing... ########################################### [100%]
1:lighttpd ########################################### [100%]

3. Create Startup links
Create the system startup links and configure Lighttpd to startup automatically when system starts/boots
[root@testserver /]# chkconfig --levels 235 lighttpd on

4. Check status
[root@testserver /]# /etc/init.d/lighttpd status
lighttpd is stopped

5. Create required run directory and give user lighttpd permission. (typically if your yum install of lighttpd server is not working this is the fix to the problem)
[root@testserver /]# mkdir -p /var/run/lighttpd
[root@testserver /]# chown lighttpd:lighttpd /var/run/lighttpd
[root@testserver /]#

6. Make sure Port 80 is free
Verify that Apache is running on a different port.
[root@testserver /]# service httpd status (or) [root@testserver lighttpd]# /etc/init.d/ httpd status
httpd is stopped
Or a better way to check is to see if any webserver us running on Port 80 as follows:
[root@testserver /]# netstat -tulpn | grep 80
[root@testserver /]#
This command returns nothing, which means, port 80 is free.
If apache is running, then stop it by running the command
[root@testserver /]# /etc/init.d/httpd stop [ OK ]

7. Verify Lighttpd config file syntax
[root@testserver /]# lighttpd -t -f /etc/lighttpd/lighttpd.conf
Syntax OK
[root@testserver /]#

8. Start lighttpd
[root@testserver /]# /etc/init.d/lighttpd start
Starting lighttpd: 2011-07-30 06:52:41: (server.c.722) couldn't set 'max filedescriptors' Permission denied
[FAILED]
You might get this error above, this error is an SELinux Error.If you do not get this error, then skip to point 11.

9. Lighttpd checks
Check lighttpd is listening for connections
[root@testserver /]# netstat -tap |grep lighttpd
tcp 0 0 *:http *:* LISTEN 2922/lighttpd

10. Disabling SELinux
There are 2 ways to turnoff/switch off SELinux
Permissive - switch the SELinux kernel into a mode where every operation is allowed. Operations that would be denied are allowed and a message is logged identifying that it would be denied. The mechanism that defines labels for files which are being created/changed is still active.
Disabled - SELinux is completely switched off in the kernel. This allows all operations to be permitted, and also disables the process which decides what to label files & processes with.
a. Permissive mode:
Temporary switch off enforcement. Run the command to temporarily switch of enforcement

[root@testserver /]# setenforce 0
The method switches off enforcement temporarily - until you reboot the system. If you want the system to always start in permissive mode, then check “b. Permanently Permissive”.
b. Permanently Permissive:
This method switches off enforcement permanently, then here is how you do it.
Edit /etc/selinux/config and change just change SELINUX=enforcing to SELINUX=permissive, and you're done.
c. Fully disabling SELinux:
Edit /etc/selinux/config and change just change SELINUX=enforcing to SELINUX=permissive, and you're done.
Check this article for more details on SELinux: http://www.crypt.gen.nz/selinux/disable_selinux.html

11. Start lighttpd again
[root@testserver /]# /etc/init.d/lighttpd start
Starting lighttpd:                                                                                                                                [ OK ]
[root@testserver /]#
This verifies that lighttpd started properly.

12. Check Status of lighttpd
Check the status of lighttpd process, just to be sure its running properly.
[root@testserver /]# /etc/init.d/lighttpd status
lighttpd (pid 3049) is running...
[root@testserver /]#

13. Creating the index.html page
In my installation, I did not have an index.html page, so needed to create one, incase you already have an index page, then you can skip this step.
a. Find the Document Root/Home directory.
Find lighttpd.conf file. Usually it is in /etc/lighttpd/lighttpd.conf
Search for the variables server_root and document-root:
Concatenating your server_root and document-root gives you your Home DirectoryDocument root.
   1: var.server_root = "/srv/www"
   2:
   3: ##
   4: ## Document root
   5: ##
   6: server.document-root = server_root + "/lighttpd"
So, this means, your Document root/home directory is /srv/www/lighttpd
b.Check if index.html exists
[root@testserver /]# ls /srv/www/lighttpd
If this returns nothing, then you need to create the index.html file as follows
c. Creating your index.html file in the home directory.
[root@testserver /]# vi /srv/www/lighttpd/index.html

 1:  <html>
 2:  <title>lighttpd test page</title>
 3:  <head> </head>
 4:  <body>
 5:  <h1>CONGRATULATIONS!!!, <br>You are running lighttpd...</h1>
 6:  </body>
 7:  </html>
Save and Exit.

14. Check if lighttpd is running
Open http://192.168.1.17/ in the browser, you should see your test page which you just created.


Congrats!!! you have lighttpd running.
Note: Lighttpd default paths
Directory Root (where to put your website files): /srv/www/lighttpd/
Lighttpd Config File: /etc/lighttpd/lighttpd.conf
Lighttpd log files: /var/log/lighttpd/

Part III: Installing PHP and configuring MySQL Support in PHP
15. Install PHP with yum
[root@testserver /]# yum install lighttpd-fastcgi php-cli
16. Configuring Lighttpd and PHP5
To enable PHP5 in Lighttpd, we must modify two files, /etc/php.ini and /etc/lighttpd/lighttpd.conf.
16.1 Modifying /etc/php.ini
First we open /etc/php.ini and add the line cgi.fix_pathinfo = 1 right at the end of the file:
[root@testserver /]# vi /etc/php.ini
16.2 Find and uncomment module "mod_fastcgi"
For this, we need to find the server.modules section
server.modules = (
#                                              "mod_rewrite",
#                                              "mod_redirect",
#                                              "mod_alias",
                                                "mod_access",
#                                              "mod_cml",
#                                              "mod_trigger_b4_dl",
#                                              "mod_auth",
#                                              "mod_status",
#                                              "mod_setenv",
                                                "mod_fastcgi",
#                                              "mod_proxy",
#                                              "mod_simple_vhost",
#                                              "mod_evhost",
#                                              "mod_userdir",
#                                              "mod_cgi",
#                                              "mod_compress",
#                                              "mod_ssi",
#                                              "mod_usertrack",
#                                              "mod_expire",
#                                              "mod_secdownload",
#                                              "mod_rrdtool",
                                                "mod_accesslog" )
The server.modules is sometimes located in /etc/lighttpd/lighttpd.conf or /etc/lighttpd/modules.conf. Since this section was found in /etc/lighttd/modules.conf, i will proceed taking this as the path.
Edit /etc/lighttpd/modules.conf, find and uncomment the line #include "conf.d/fastcgi.conf"
[root@testserver /]#vi /etc/lighttpd/modules.conf
Your config file should look like this
##
## FastCGI (mod_fastcgi)
##
include "conf.d/fastcgi.conf"
Save and Exit.
16.3 Changes in conf.d/fastcgi.conf
Edit conf.d/fastcgi.conf and find the section "fastcgi.server"
[root@testserver /]#vi /etc/lighttpd/conf.d/fastcgi.conf
Find the following section
#fastcgi.server = ( ".php" =>
#                           ( "php-local" =>
#                              (
#                                 "socket" => socket_dir + "/php-fastcgi-1.socket",
#                                 "bin-path" => server_root + "/cgi-bin/php5",
#                                 "max-procs" => 1,
#                                 "broken-scriptfilename" => "enable",
#                               )
#                           ),
#                           ( "php-tcp" =>
#                               (
#                                 "host" => "127.0.0.1",
#                                 "port" => 9999,
#                                 "check-local" => "disable",
#                                 "broken-scriptfilename" => "enable",
#                                )
#                           ),
#
#                           ( "php-num-procs" =>
#                               (
#                                 "socket" => socket_dir + "/php-fastcgi-2.socket",
#                                 "bin-path" => server_root + "/cgi-bin/php5",
#                                 "bin-environment" => (
#                                 "PHP_FCGI_CHILDREN" => "16",
#                                 "PHP_FCGI_MAX_REQUESTS" => "10000",
#                                ),
#                                "max-procs" => 5,
#                                "broken-scriptfilename" => "enable",
#                             )
#                         ),
#                      )
Things to do in this section
a. Uncomment the entire section
b. Verify your php-cgi directory and change the directory from /cgi-bin/php5 to /usr/bin/php-cgi in sections "php-local" and "php-num-procs"
c. Change socket_dir from /var/lib/lighttpd to /var/run/lighttpd in /etc/lighttpd/lighttpd.conf
Verify the socket directory
[root@testserver ]# grep -r 'home_dir' 'socket_dir' /etc/lighttpd
/etc/lighttpd/lighttpd.conf:var.home_dir = "/var/lib/lighttpd"
/etc/lighttpd/lighttpd.conf:#var.home_dir = "/lib/lighttpd"
/etc/lighttpd/lighttpd.conf:var.socket_dir = home_dir + "/sockets"
/etc/lighttpd/conf.d/scgi.conf:# "TMP" => home_dir + "/rails/someapp",
/etc/lighttpd/conf.d/trigger_b4_dl.conf:trigger-before-download.gdbm-filename = home_dir + "/trigger.db"
/etc/lighttpd/conf.d/webdav.conf: webdav.sqlite-db-name = home_dir + "/webdav.db"
/etc/lighttpd/conf.d/fastcgi.conf:# "TMP" => home_dir + "/rails/someapp",
/etc/lighttpd/conf.d/fastcgi.conf:# "TMP" => home_dir + "/rails/someapp1",
/etc/lighttpd/conf.d/fastcgi.conf:# "TMP" => home_dir + "/rails/someapp2",
[root@testserver ]#
Notice that the socket_dir = /var/lib/lighttpd/sockets
Edit /etc/lighttpd/lighttpd.conf
[root@testserver ]# vi /etc/lighttpd/lighttpd.conf
Find the line "var.socket_dir = home_dir + "/sockets" and change it to var.socket=/var/run/lighttd
After the change, /etc/lighttpd/lighttpd.conf should look like this
##
## Base directory for sockets.
##
## used in:
## conf.d/fastcgi.conf
## conf.d/scgi.conf
##
var.socket_dir = /var/run/lighttd"
Why we do this: because creating the socket in /tmp/ is a bad idea. This might have been the default in the included example a while back and the current still reads: "socket" => "/var/lib/lighttpd/php-fastcgi.socket"
d. Verify whether /var/run/lighttpd exists, id it does not, create it
[root@testserver ]# mkdir -p /var/run/lighttpd
Your final fastcgi.server section should look like this
fastcgi.server = ( ".php" =>
                           ( "php-local" =>
                              (
                                 "socket" => socket_dir + "/php-fastcgi-1.socket",
                                 "bin-path" => "/usr/bin/php-cgi",
                                 "max-procs" => 1,
                                 "broken-scriptfilename" => "enable",
                               )
                           ),
                           ( "php-tcp" =>
                               (
                                 "host" => "127.0.0.1",
                                 "port" => 9999,
                                 "check-local" => "disable",
                                 "broken-scriptfilename" => "enable",
                                )
                           ),

                           ( "php-num-procs" =>
                               (
                                 "socket" => socket_dir + "/php-fastcgi-2.socket",
                                 "bin-path" => "/usr/bin/php-cgi",
                                 "bin-environment" => (
                                 "PHP_FCGI_CHILDREN" => "16",
                                 "PHP_FCGI_MAX_REQUESTS" => "10000",
                                ),
                                "max-procs" => 5,
                                "broken-scriptfilename" => "enable",
                             )
                         ),
                      )
Then we restart Lighttpd:
[root@testserver ]#/etc/init.d/lighttpd restart
Check whether lighttpd is running properly
[root@testserver ]#/etc/init.d/lighttpd status
Check if /var/log/lighttd/error.log is clean
[root@testserver ]#cat /var/log/lighttpd/error.log
2011-08-04 00:14:45: (server.c.1512) server stopped by UID = 0 PID = 2403
2011-08-04 00:14:49: (log.c.166) server started
[root@testserver lighttpd]#
But, if you see errors something like
2011-08-03 22:48:36: (log.c.166) server started
2011-08-03 22:48:36: (mod_fastcgi.c.978) bind failed for: unix:/var/lib/lighttpd/sockets/php-fastcgi-1.socket-0 Permission denied
2011-08-03 22:48:36: (mod_fastcgi.c.1399) [ERROR]: spawning fcgi failed.
2011-08-03 22:48:36: (server.c.938) Configuration of plugins failed. Going down.
To fix this issue:
[root@testserver ]# mkdir /var/run/lighttpd
[root@testserver ]# touch /var/run/lighttpd/php-fastcgi-1.socket
[root@testserver ]# touch /var/run/lighttpd/php-fastcgi-2.socket
[root@testserver ]# chown -R lighttpd:lighttpd /var/run/lighttpd
16.4 Creating a sample PHP script
Since the document root of the default web site is /srv/www/lighttpd, we will now create a small PHP file (info.php) in that directory and call it in a browser. The file will display lots of useful details about our PHP installation, such as the installed PHP version.
[root@testserver ]# vi /srv/www/lighttpd/info.php
<?php
phpinfo();
?>
Now we call that file in a browser (e.g. http://192.168.1.17/info.php):
As you see, PHP5 is working, and it's working through FastCGI, as shown in the Server API line. If you scroll further down, you will see all modules that are already enabled in PHP5. MySQL is not listed there which means we don't have MySQL support in PHP5 yet.
17. MySQL Support in PHP 5
[root@testserver ]# yum search php
Pick the ones you need and install them like this:
[root@testserver ]# yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc
Now restart Lighttpd:
[root@testserver ]# /etc/init.d/lighttpd restart
Now reload http://192.168.1.17/info.php in your browser and scroll down to the modules section again to find the "MySQL" section. You should now find lots of new modules there, including the MySQL module:

Part IV: Installing and configuring WordPress
Based on the scenario, there are different ways to install wordpress, but in this part, i will explain how to install wordpress on a server to which you have shell access.
1. Download and unzip WordPress
a. Download wordpress from http://www.wordpress.org/
[root@testserver tmp]# wget http://wordpress.org/latest.tar.gz
b. Unzip WordPress
[root@testserver tmp]# tar -xzvf  latest.tar.gz
The WordPress package will extract into a folder called wordpress in the same directory that you downloaded latest.tar.gz
c. Move the wordpress folder to webroot
[root@testserver tmp]# mv wordpress/ /srv/www/lighttd/

2. Create the database and User using MySQL Client
For convenience, in this post, i am assuming the following values
ParameterValue
Databasenamewordpressdb
WordPress Usernamewordpressuser
WordPress Passwordwordpresspasswd
Hostnamelocalhost
WordPress Installation directory/srv/www/lighttpd/wordpress
a. Login to MySQL
[root@testserver tmp]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.1.52 Source distribution

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>
b. Create the database
mysql> create database wordpressdb;
Query OK, 1 row affected (0.00 sec)
Replace databasename with a valid database name.
c. Granting privileges
mysql> GRANT ALL PRIVILEGES ON wordpressdb.* TO "wordpressuser"@"localhost" IDENTIFIED BY "wordpresspwd";
Query OK, 0 rows affected (0.00 sec)
d. Flush all Provileges and exit.
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

mysql> EXIT
Bye
3. Setup wp-config.php
By default wordpress package does not come with a wp-config.php file but it does have a sample wp-config-sample.php, the easiest way is to copy wp-config-sample.php to wp-config.php
[root@testserver wordpress]#cp wp-config-sample.php wp-config.php
Then, edit wp-config.php
[root@testserver wordpress]#cp wp-config-sample.php wp-config.php
Replace DB_USER, DB_PASSWORD, DB_PASSWORD and DB_HOST with actual values. The final configuration should should look something like this
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'wordpressdb');

/** MySQL database username */
define('DB_USER', 'wordpressuser');

/** MySQL database password */
define('DB_PASSWORD', 'wordpresspwd');

/** MySQL hostname */
define('DB_HOST', 'localhost');

/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');

/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');
Security Keys
In Version 2.6, three (3) security keys, AUTH_KEY, SECURE_AUTH_KEY, and LOGGED_IN_KEY, were added to ensure better encryption of information stored in the user's cookies. (These collectively replaced a single key introduced in Version 2.5.) In Version 2.7 a fourth key, NONCE_KEY, was added to this group. When each key was added, corresponding salts were added: AUTH_SALT, SECURE_AUTH_SALT, LOGGED_IN_SALT, and NONCE_SALT.
You don't have to remember the keys, just make them long, random and complicated -- or better yet, use the the online generator. You can change these at any point in time to invalidate all existing cookies. This does mean that all users will have to login again.
Example (don't use these!): Your final config file should look somewhat like this
/**#@+
* Authentication Unique Keys and Salts.
*
* Change these to different unique phrases!
* You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
* You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
*
* @since 2.6.0
*/








A secret key makes your site harder to hack and access harder to crack by adding random elements to the password.
4. Run the install script
Point your browser to http://192.168.1.17/wordpress/wp-admin/install.php
Wordpress looks for a /srv/www/lighttpd/wordpress/wp-config.php and if found, it picks takes the settings from there (which we setup earlier), else it creates wp-config.php
Since we already set it up, we should see a page like this.
If this page appears, this means that wordpress is configured and is able to integrate with MySQL.
Part V: Credits
The following sites were very helpful and helped me complete this post. Thanks to all.
http://www.howtoforge.com/lighttpd_php5_mysql_centos5.0
http://www.howtoforge.com/lighttpd_php5_mysql_centos5.0_p2
http://www.kernelhardware.org/lighttpd-and-centos-5/
http://redmine.lighttpd.net/boards/2/topics/1717
http://codex.wordpress.org/Installing_WordPress

Wednesday, July 27, 2011

Installing Tomcat 6 on a 64-bit Windows machine

To install Tomcat on a Windows 64 bit box, you would need to do the following:

1. Grab and install the latest and greatest 64-bit version of Sun Java from here

I am using Java 6, but I am sure other versions will work just as well.

2. Download and install the latest version of Tomcat from here. the current version as on date is : 6.0.20
Now, this version is 32-bit. Next, you will need to obtain a 64-bit version of the tomcat6.exe and tomcat6w.exe binary. It was tricky to find, but there is a post on Apache's Bugzilla containing a pre-compiled file ready for use.

3. Grab it from here.

Note: Make sure you have the same version of tomcat that you initially downloaded and the 64-bit versions of the executables.

For a complete list of the 64-bit versions, goto http://svn.apache.org/viewvc/tomcat/tc6.0.x/tags/, click on the right version and then browse to res/procrun/amd64/ to pick up tomcat6.exe and tomcat6w.exe

4. Next, You need to replace the tomcat6.exe and tomcat6w.exe programs in Tomcat's bin directory with the 64-bit versions.

5. Restart the service and you should be good.

I tried this on a Windows 2003 Enteprise Edition R2 x64 and it works fine. However this should also work with other 64 bit Versions of Windows (XP, Vista, 2008, Windows 7)

All the best.
_________________________________________________________
Naveen Noel J | Sr. Solutions Architect | ZSL, Inc | http://www.zsl.com

Friday, July 22, 2011

Cloud Computing – Use Cases & Best Practices

Hi Everyone,

I recently gave a webinar on Cloud Computing – Use Cases & Best Practices, check it out.


Feel free to post your comments or ask any questions.

With Regards,
Naveen Noel.

Thursday, July 21, 2011

Solving Outlook 2007 Error: Cannot start Microsoft Office Outlook. Cannot open the Outlook window

Hello Everyone,

Last night when I was opened the outlook to check my e-mails, I was shown welcomed with a horrible error in outlook saying:

Cannot start Microsoft Office Outlook. Cannot open the Outlook window.

I run on Windows Vista with Outlook 2007.

I tried a lot of times, but in vain. I then restarted my system, still no luck.

Then I browsed google and it came up with a few forum links:

http://support.microsoft.com/kb/252304

http://forums.techguy.org/business-applications/544134-cannot-start-microsoft-office-outlook.html

I tried all their suggestions in it. But still it did not work... Then I began to get worried as I had a whole lot of mails in it (atleast 2 years data) and to my bad, I never took a backup.

Then one link gave me a suggestion which actually worked.

Basically you would need to locate Outlook.exe and run it with /resetnavpane

Please see the steps below for the non-techies.

Steps:

1. Locate Outlook

Outlook.exe is typically located in one of the following folders, depending on the version of Outlook that you are running:

* Microsoft Office Outlook 2007
C:\Program Files\Microsoft Office\Office12
* Microsoft Office Outlook 2003
C:\Program Files\Microsoft Office\Office 11
* Microsoft Outlook 2002
C:\Program Files\Microsoft Office\Office 10
* Microsoft Outlook 2000
C:\Program Files\Microsoft Office\Office 9

2. Open a command prompt. Click on Start->Run and type cmd

3. Type cd C:\Program Files\Microsoft Office\Office12

Note: This was my case since I was running Outlook 2007, if you are using another version of Outlook, change your directory appropriately.

4. This should change your directory to C:\Program Files\Microsoft Office\Office12

5. Type Outlook.exe /resetnavpane
C:\Users\Naveen>cd C:\Program Files\Microsoft Office\Office12\

C:\Program Files\Microsoft Office\Office12>Outlook.exe /resetnavpane

C:\Program Files\Microsoft Office\Office12>

6. This should bring you back to the command prompt, then you are done!!!

7. Try Opening Outlook again and it should work.

Good luck!!!

With Regards,

Naveen...