Friday, 29 February 2008

Getting KCacheGrind for xDebug on Windows with KDE

As I am playing around with xDebug, I need a profile file GUI. I tried WinCacheGrind, but as it is two years out of date, I wished to try KCacheGrind as well.


So, how do you install a Linux KDE application on windowsXP?


As it turns out, quite easily.


Here's how...


1. download the installer to C:\KDE4 from here:
http://download.cegit.de/kde-windows/installer/


2. Run the installer
2.1 Choose you packages, I choose all of them.
(NOTE: KCacheGrind needs Kdesdk package)


3. Add "C:\KDE4\lib" to the %PATH%
3.1. Start > Control Panel > System > Advanced > Environment Variables, Select PATH, click [edit]..


4. Create env variable KDEDIRS with value "C:\KDE4"
4.1 Start > Control Panel > System > Advanced > Environment Variables, click [New]


5. Do this... at a command prompt
(temporarily needed, check KDE link below to verify)
cd C:\KDE4
C:\KDE4> bin\update-mime-database C:\KDE4\share\mime
C:\KDE4> bin\kbuildsycoca4 --noincremental


THAT'S IT.... ALL DONE. How quick was that...


6. Testing...
run c:\KDE4\bin\assistant.exe to test a QT program.


Now run KCACHEGRIND..
run c:\KDE4\bin\kcachegrind.exe



These instruction are a summary of the KDE on Windows project

Simple tricks for Windows Programming automation using batch files

I thought I might mention a few of the simple tricks I use when I am developing...


Keyboard assigned Shortcuts


I often need to restart apache very regularly, ie: every other minute.


This is a real bore when I have to find either a GUI or and command prompt. So I set up shortcuts in windows..


I create batch files to do what ever I want, create a shortcut to the batch file and then assign key strokes to them.


ie:


CTRL+SHIFT+F9 => start apache service


CTRL+SHIFT+F10 => stop apache service


Then all I need to do is keep an eye on the Apache Monitor.


NOTE: You must put the shortcuts in a folder in your Start menu... otherwise they will never run when you hit the assigned keys.


While it seems simple, I have noticed how few people truly automate the tasks they perform again and again and again....


Do it.
This alone saves me hours every week when I have my head in code.


 


Automating a task with Batch file and viewing the results


Use set /p varName="ask for data" then use the variable to call the correct thing.


You can also use this to stop the box from closing, so you can see the results, put this at the end: set /P Done="Press return to close."


Here is an example for an ant build:


@echo off
set /P TARGET="Please enter Target(clean,compile,build,run,javadoc):"
CMD /C ant %TARGET%
echo -------------------------------------------
set /P Done="Press return to close."
:End

Wednesday, 27 February 2008

How Microsoft caused apache & php_mysql.dll to fail...using VISTA (dwmApi.dll)

The Background

Last week I discovered I had quite a few viruses etc.. on my laptop. So I needed to reformat the hard-drive and re-install WindowsXP before I started my new job.

Now before I did all this, I made sure I had a complete back-up of everything off the machine. NB: this is my main development machine... it is a very nice HP laptop.

Before I did this, I had a very nice fully working development environment, i.e.: Cygwin, IDEs, Java VM (1.4/1.5/1.6), mySQL, all my tools, compilers, disassemblers, apache 2, php 5, remote access etc...

So WHY.... did PHP5 refuse to work when I re-installed it today....?!!!

Well, sit back and I will tell you a story of detective work and a serious mistake that seems to have got through to cause me and others, a huge problem.

The Story

I needed to re-install a php environment today, so I could test the environment I am recommending to my current client.

So I copied everything back on my machine, ran a quick command line PHP test (which worked) and tried to start apache.... and it FAILED... with:
PHP Warning: PHP Startup: Unable to load dynamic library 'C:\\_dev\\php5\\ext\\php_mysql.dll'



Considering it had worked on the command line, I thought this was a little strange. But config issues are normal, so... it needed a little work. I am quite used to this, having done it far too many time over too many years.

Over the next FOUR hours... I re-installed apache twice, PHP twice, rebooted a few times and re-ran the configuration at least four times.
NONE OF IT WORKED...

I still had php alone working fine, but php through apache failing... with a message that simply made no sense.

So now I started to get frustrated and went hunting on google..

The Chase

After a while, I found a few forum threads that talked about using Dependency Walker to see what php_mysql.dll actually needed, and why it should be failing.. So I downloaded the software and checked it out.

Dependency Walker immediately reported a failure in the dependencies. DwmAPI.dll.

Ok, that seems a little odd...

So, off I went back to google to see what I could find out.

It turns out that DwmAPI.dll is a Desktop Windows Manager API... and after a load more research I found out... for Windows VISTA...!!!!

Now I was pissed.

The Fury

Some idiot had compiled a dependency to the wrong operating system into one of my tools.

At least I now had a culprit... all I had to do was track down the criminal.

AND GUESS WHAT.... it was Internet Explorer 7.



Look at the tree... DwmAPI.dll is a dependency of IEFRAME.dll, which I recently gained, when I decided to bite the bullet and install IE7.

What a £$%&ing mistake that was...

So now I was even more pissed off.

I had spent hours debugging to find an error that should never have existed from the people who created the operating system I depended on.

At least I should be able to fix it.

The Fix

Well, on that point I can at least put one happy note forward.

IE7 uninstalled in 5 minutes... I rebooted... I started apache... I checked the error log files and..... IT WORKED...!



And just to prove a point...
Here is the Dependency Walker result after I had un-installed IE7.





And the moral of this story.....

IE7, PHP, Apache and the word NOT features quite heavily.

... you work it out. :->



But... this has been enough of a serious headache to make me think about ditching windows for a *nix machine. Either OSx or Linux.

Considering I have been a windows(less than fanatical) user for quite a while, mainly due to client pressure... it is ironic that the systems I use to develop and now being pushed off machines that keep me using their software...

To Microsoft:
VERY POOR SHOW...
You have created a bug that makes the primary web development environment crash. And you have done it with your browser.. something the same web developers really need to install for testing.
I AM VERY DISAPPOINTED.
Were I a more paranoid type... I would be suggesting this was deliberate.
FIX IT. NOW.

Eclipse Update URLs

I have been using eclipse for long enough to have often run into the problem of locating the update URL for any specific project and more importantly for the required bits needed to run that extension. So here are all the update URLs I know of:


* Graphical Editing Framework (GEF)
UPDATE URL: http://download.eclipse.org/tools/gef/update-site/releases/


* Eclipse Modeling Framework (EMF)
UPDATE URL: http://download.eclipse.org/tools/emf/updates/


* Java EMF Model (JEM)—from the Visual Editor Project (VEP)
UPDATE URL: http://download.eclipse.org/tools/ve/updates/1.0/


* Web Tools Platform (WTP)
UPDATE URL: http://download.eclipse.org/webtools/updates/


* PHP IDE
UPDATE URL: http://download.eclipse.org/tools/php/updates/


* PHP Development Tool (PDT)
UPDATE URL: http://downloads.zend.com/pdt


* Aptana HTML, CSS, Javascript(APTANA)
http://update.aptana.com/update/3.2/


* PHPEclipse
http://phpeclipse.sourceforge.net/update/nightly (unstable)
http://phpeclipse.sourceforge.net/update/releases


PDT(PHP Development Tools)
http://download.eclipse.org/tools/pdt/updates/


JSEclipse
http://download.macromedia.com/pub/labs/jseclipse/autoinstall/


 


[note: xml?]

Friday, 22 February 2008

GIT on Windows XP (winXP)

I am still experimenting with this... but...


You can get GIT running by simply downloading and running the cgywin installer.


Run the installer in standard configuration, and obviously include GIT... but also make sure to include VIM, as this is required to edit the comments. (PERL is required, but should be in the default installed packages. Make sure it is.)


Finally, you need to fix the whitespace issue caused by the difference between UNIX and WINDOWS carriage-return/line-feed. If you edit a file in a windows tool, it will leave an extra line-feed that triggers the error. The fix for this comes Capi's Corner...


Edit .git/hooks/pre-commit and comment the following lines(c. line 58).




if (/\s$/) {
bad_line("trailing whitespace", $_);
}


You should now be able to commit properly.

Wednesday, 20 February 2008

Why Git

I suppose the first thing you should do is watch the videos.


Here is Linus Torvalds explains GIT philosophy to googleTech:
[video]http://www.youtube.com/v/4XpnKHJAok8&rel=1[/video]


And Randal Schwartz with more details about using GIT
[video]http://www.youtube.com/watch?v=8dhZ9BXQgc4[/video]


You should now know enough to realise why GIT....


If you are still in egypt... de nile... then here are some thinking points.


these are coming as soon as I organise my thinking....