Zend Debugger: Cannot read a valid value of zend_debugger.httpd_uid

If you happen to have setup Zend Debugger for debugging your PHP code and you encounter the following error in the webserver error log:

Zend Debugger: Cannot read a valid value of zend_debugger.httpd_uid or zend.httpd_uid, will not perform dropping of privileges

then your setup will fail when you try to debug over a tunnel. This is caused by the debugger not being aware of the uid of the process which runs the web server.

To fix this, we need to find the user ID of the httpd process that runs the Zend Debugger. One way of finding the UID is by opening up the /etc/passwd file. You should see something similar to:

_www:*:70:70:World Wide Web Server:/Library/WebServer:/usr/bin/false

Now to fix the problem, we update the zend config in the php.ini file and restart the webserver. Here is my complete zend debugger configuration:

[zend]
zend_extension=/opt/local/lib/php/extensions/no-debug-non-zts-20090626/ZendDebugger.so
zend_debugger.allow_hosts=127.0.0.1,10.1.1.2,10.1.1.3,10.0.1.149,10.0.1.123,10.0.1.124
zend_debugger.expose_remotely=always
zend_debugger.httpd_uid=70

Now for some real debugging :) .

Posted in Debugger, Macintosh, Zend | Leave a comment

Install PDT for Adobe Flash Builder

I have come across several people trying to do this in a convoluted way. Here is the simple way of adding PDT to your Flash Builder IDE.

Since current Flash Builder is basically built on Eclipse Galileo, you just have to add the update site for Galileo

In Flash Builder, go to
Help > Install New Software

Click on “Available Software Sites” link, which should open up “Available Software Sites” window. If you don’t have the Galileo update site already configured, add a new Software site. Call it “Eclipse 3.5 updates” and add the URL: http://download.eclipse.org/releases/galileo/

Back in the “Available Software” screen, select “All available sites” for the “Work with” section. In the search input below that, type in PDT and you should see PDT as an item on the search result. Select it and click the next button. Eclipse will now prompt you with a review screen of the packages which are going to be installed. Click next and complete the installation. You may have to restart the IDE for the changed to take affect.

Shown below is the review screen of PDT installation.

PDT Installation for Flash Builder

PDT Installation for Flash Builder

Posted in Adobe Flash Builder, Eclipse, Software | Leave a comment

Return to Blogging

Yes, I am back! After a long absence of over 2 years I hope to blog again. Lots of things have happened since the last time I wrote an entry. Life has changed ever since I became a father around 2 years ago. My son Denzel will be 2 years old in September and it has been a hectic but enjoyable journey so far.

Posted in General | Leave a comment

MySQL Date Age Calculation

I have always had the need to calculate the age as year and month from a MySQL field of type date. No doubt you can achieve this with a bit of PHP, but when you require to do the conversion right from MySQL, you can only go as far as getting the age in “years”.

I have used here a MySQL stored routine to achive this:

DELIMITER $$
DROP FUNCTION IF EXISTS `my_database`.`getage` $$
CREATE DEFINER=`root`@`localhost` FUNCTION `getage`(pdate DATE) RETURNS char(30) DETERMINISTIC
BEGIN
DECLARE years INT;
DECLARE months INT;
DECLARE days INT;
 
DECLARE current_year INT;
DECLARE current_month INT;
DECLARE current_day INT;
 
DECLARE year_diff INT;
DECLARE month_diff INT;
DECLARE day_diff INT;
 
DECLARE yearstring CHAR(6);
DECLARE monthstring CHAR(7);
 
SELECT YEAR(pdate) INTO years;
SELECT MONTH(pdate) INTO months;
SELECT DAY(pdate) INTO days;
 
SELECT YEAR(CURRENT_DATE()) INTO current_year;
SELECT MONTH(CURRENT_DATE()) INTO current_month;
SELECT DAY(CURRENT_DATE()) INTO current_day;
 
SELECT (current_year - years) INTO year_diff;
SELECT (current_month - months) INTO month_diff;
SELECT (current_day - days) INTO day_diff;
 
if (current_month < months) THEN
	SET month_diff = (((months - 12) * -1) + current_month);
	SET year_diff = (year_diff - 1);
END IF;
 
if ( month_diff = 1 ) THEN
	SET monthstring = "month";
ELSE
	SET monthstring = "months";
END IF;
 
if ( year_diff = 1 ) THEN
	SET yearstring = "year";
ELSE
	SET yearstring = "years";
END IF;
 
if ( year_diff = 0 ) THEN
	RETURN CONCAT_WS(' ', month_diff, monthstring);
ELSE
	if (month_diff > 0) THEN
		RETURN CONCAT_WS(' ',year_diff, yearstring, month_diff, monthstring);
	ELSE
		RETURN CONCAT_WS(' ',year_diff, yearstring);
	END IF;
END IF;
 
END $$
 
DELIMITER ;

You can then make use of the stored routine to convert Dates into ages by doing so:

SELECT getage(BirthDate) as UserAge FROM my_database.users
Posted in MySql | Tagged , | Leave a comment

Arduino IDE on 64bit openSUSE

Arduino BoardArduino is a tool for making computers that can sense and control more of the physical world than your desktop computer. It’s an open-source physical computing platform based on a simple microcontroller board, and a development environment for writing software for the board.

Unfortunately the serial port communication driver (RXTX) which comes with the arduino download is not 64 bit compatible. I will describe here how I successfully compiled & installed the driver to get the Arduino IDE running on a 64 bit openSUSE installation. Most of the instructions should be pretty straight forward to be replicated on an other rpm based distribution. For ubuntu/debain based distributions, you can find the instructions provided by Tero Karvinen useful.

Packages Required for Arduino IDE

The following packages are required to run the Arduino IDE:

  • java-1_5_0-sun
  • cross-avr-gcc
  • cross-avr-binutils
  • avr-libc

Linux USB Serial Converter Driver

Besides the above software, you will also need a compatible kernel. This means version 2.6.x or at least 2.4.30. For example, it needs USB serial support with the FTDI driver. After connecting an Arduino board to your computer via an AB USB cable, it should load the ftdi modules automatically. Ensure ftdi_sio and usbserial modules are loaded by executing:

lsmod | grep ftdi

It should return output similar to whats shown below:

ftdi_sio               54280  0
usbserial              52688  1 ftdi_sio
usbcore               156456  6 ftdi_sio,usbserial,usbhid,ohci_hcd,ehci_hcd

If not, as root, run:

modprobe ftdi_sio

If there are no errors from the above command, then the module is loaded successfully.

System Requirements

The Arduino IDE is java based and RXTX [2] is a native java library providing serial and parallel communication for the Java Development Toolkit. The RXTX lib uses lock files by default. So Before you use lock files you need to do one of two things:

  1. Be the root or uucp user on your machine whenever you use rxtx
  2. Or add the specific user that needs to use rxtx to the group uucp. (preferred)

Add your user account to the uucp group by going to yast2 > Security and Users > User Management. Once you have added yourself to the group, you will need to restart your session to make it affective. Once you are in the new session, verify that your account belongs to the uucp group by executing “groups” on the shell. It should give return you a list of groups your account belongs to.

Continue reading

Posted in General, Linux, openSuSe | Tagged , , , , , , , , | Leave a comment

openSUSE “Packaging Day II”

openSUSe Build Service logoEver had problems finding a package for your favorite application for your favorite distro? Are you an application developer or project contributor, and want to learn how to provide binary packages for all the popular distros (including openSUSE) automatically?

Using the openSUSE Build Service, you can provide software packages for most popular Linux distros using one single service. Rather than maintaining separate systems to build packages, you can take advantage of the openSUSE Build Service and let it do most of the work.

To learn how to leverage the build service, join the openSUSE community on April 4th and 5th on IRC to hone your package building skills. The Packaging Days II event will be held on Freenode at #opensuse-buildservice. Community members will be standing by to provide support and answer questions about using the build service and creating packages.

Find out more about the Packaging Days II event at: http://en.opensuse.org/Packaging/Packaging_Day

Posted in Linux, RPM, openSuSe | Tagged , , , , | Leave a comment

Importing TV shows into Mythtv

mythtvI have been using the popular open source multimedia programme called mythtv for a while now. Apart from recording my favourite TV shows, I also utilise the various modules like mythmusic, mythnews, mythvideo and mythweb. Though you can use mythvideo to view videos which are not tv recordings, there are no specific modules which can import a show into mythtv.

But wait, just when you think its not possible to import a show into the mythtv recordings, there is a way to do so. There is a perl script called “myth.rebuilddatabase.pl” which comes with the mythtv-doc package of mythtv. Usually the “myth.rebuilddatabase.pl” script resides at “/usr/share/doc/packages/mythtv-doc/contrib/” folder. Else, If you are on an rpm based system you can look for its path with the following command:

rpm -qal "myth*" | grep "\.pl"

This should return all the available perl scripts which are distributed with mythtv. Now to use the script, we need make a copy of the script to your home folder and configure it. Edit the file and update the relevant mysql mythtv database connection details. Now copy the tv show files which you want to import, into your mythtv recordings folder.
Continue reading

Posted in Linux | Tagged , , | 2 Comments

Two Twenty20 tickets for sale

Cricket gone badI have had enough of the game of cricket, specially involving the Australian cricket team. First it was the racial accusations made by the Australian cricket team while they were touring the sub-continent.

I have seen the so called “racial monkey taunts” made by the the crowds at Vadodra and Wankhede stadium in India. In my opinion it was meant to be a humorous joke just making a comparison to how Andrew Symonds stands out amongst his own team mates. I mean look at him when he has the white sun screen protection on his lips and his fluffy hair to go with it. He looks more like a clown than a Monkey. And if you call me a racist after this comment I made, then go to hell.

Akhil Tandulwadikar’s comment on Andrew Symonds hair would explain what this “monkey chants” are all about.

Therefore, it has led me to conclude that the only possible rational explanation to these monkey chants lies somewhere else. Something that the media–in Australia and India–has totally missed in its hurry to earn some TRP

And then we have Australia chasing a record 16 test win in a row at the SCG this year. It is definately the worst game of cricket I have seen. The way the Australian team appealed for Dravid’s wicket in the second innings was just embarrassing. You can’t call any Australian player a gentleman after this test match. They play the game just to get a record in their name. Cricket is a gentleman’s game. A fine example was when Yuvraj Singh “walked” after he realised he nicked the ball.

At an interview, the Indian Captain was asked if he thought the match had been played in the right spirit, Kumble said, “Only one team was playing in the spirit of the game.” It was reminiscent of Australian captain Bill Woodfull’s words during the Bodyline series. Shame on you Australia.

And finally to prove how bad the game of cricket has become, which included few poor umpiring decisions and a some embarrassing cricket played by the Australian team. This is how they won the second test match:

Ruled in favour of Aus:
1. Andrew Symonds caught on 30
2. Ponting caught on 15
3. Andrew Symonds stumped on 48
4. Andrew Symonds lbw on 103
5. Andres Symonds stumped on 140 (not even reffered to third umpire).
6. Hussey plumb lbw on the back foot in the second innings.
7. Hussey caught down the leg side by the keeper.
8. This could have gone either way… Kumble’s hatrick ball to Symonds.
9. Dravid caught a padded shot by the keepoer and appealed for wicket (most
embarassing appeal)
10) Gangully caught by Clarke, clearly on the half volley and the umpire asked
Ponting if he caught it. Why woudn’t Ponting say “yes” to that?

Ruled in favor of India
1. Ricky ponting inside edge given lbw on 55.
2. This could have gone either way… Sachin LBW when on 48.

This is not cricket. Oh by the way, I am an Indian born Australian citizen. I am not making any biased comments because I am Indian. In fact I loved how the Australians played their cricket, until what I saw unfolding at the SCG.

Now for those who came looking for the twenty20 ticket I am offering, shoot me an email at tickets@fernandez.net.au and if you are lucky, you can enjoy some more embarrassing cricket played by the Australian team at the MCG. they have been sold.

And here is what some others have to say:

Man I loves this list of Top Sledges

Posted in General | Tagged , , | Leave a comment

Automate SSH logins with RSA/DSA keys

Automated Shell LoginOften when you are administrating remote Linux servers, you tend to login to the servers via your favorite shell. And every time when you login you are prompted for a user name + password to authenticate your session. This gets a bit tedious if you have many passwords to remember for different logins. This is were ssh keys can be used to save you from typing your credentials for every ssh login you execute. Once you have setup your SSH key, you are just one step away from making your life a whole lot easier.

I have put together a shell script which saves me the trouble of remembering various combinations of user names + passwords. It looks something like this: cat ~/.ssh/id_dsa.pub | ssh jeffery@example.com "(mkdir .ssh&>/dev/null; chmod 700 .ssh && cat - >> .ssh/authorized_keys ) && chmod 600 .ssh/authorized_keys" Continue reading

Posted in BASh, Linux | Leave a comment

qBittorrent v1.0.0 Release

qBittorrent v1.0.0 ReleaseqBittorrent is a Bittorrent client using C++ / libtorrent and a Qt4 Graphical User Interface. Its been under heavy development for a full year now and finally its maturing into one of the best torrent clients out there. I am the Project Consultant + Packager of the application for my distro of choice: openSUSE. Packages for other distributions are available (qBittorrent Downloads) and a Windows port is coming soon.

Packages for openSUSE 10.2 and 10.3 can be obtained from my openSUSE build farm account at : home:jefferyfernandez. If you encounter any bugs in the package or the application itself, please report them at: qBittorrent Bug-tracker. Happy torrenting :)

qBittorrent Home: http://www.qbittorrent.org

Posted in Linux, Packages, RPM, openSuSe | Leave a comment