Saturday, February 21, 2009

ZigVersion - Svn client for mac users

I just recalled i previously created a partial list of usable freewares I found while starting to use my mac book.

wanted to update on the SVN client, I've found ZigVersion which does an excellent job and has a built in diffing tool, which i couldn't find any free software in mac to diff (someone, please compile winmerge for darwine).

so FYI - ZigVersion

Wednesday, February 18, 2009

backing up mysql in rough terrains

I recently got a hold of a new domain, which is hosted on a virtualization, managed with plesk.

and so it turns out, the MySql DB of the CMS had to be backed up (practice!).
now, plesk offers only a conclusive plesk server backup, which covers the db, but a lot more, and you cannot extract the db from it.
phpMyAdmin on the other hand, could not deal with the size of the db, and export simply failed giving me blanks any way i tried to go about it.

the DB files were also not accessible via FTP, so my last resort was SSH & SCP.
the trick is that them files were sitting on a restrictive area that only super user is allowed to access, and SCP doesn't offer su services.
so i did as following:

1. login via SSH with my user.
2. su root (provided pwd)
3. mkdir /home/myUserDir/temp
3. cp /var/mysql/dbName/* /home/myUserDir/temp/.
5. chmod 777 * (making them readable to everyone)

then i went to my windows command line and run:
5. pscp myuser@myserver.com:/home/myUserDir/temp/* "c:\temp\."
6. rm /home/myUserDir/temp/*
7. rmdir /home/myUserDir/temp

and voila - they are here...

come to think of it, i could've added in my .bash_profile the su command and maybe pscp could've then copy directly from the /var director...maybe next time?!

content is king, and I'm quite content :-)

UPDATE:
It comes to show you that late night work is not always preferable.

duh! how about using mysqldump instead of copying the db files?
this would've saved me the need for su, and file copying to my home directory.

the new procedure:
1. ssh to machine, with normal user.
2. mysqldump > /home/myUserDir/temp
3. pscp...

far easier...

Tuesday, February 17, 2009

be extra careful - google adsense disapproved applications...

You can find many posts over the web, same drill every time:
You apply for a google ad-sense account, you get disapproved for various legitimate reasons such as content accessibility, fresh domain, little content, you might even just got the dang domain name wrong during the application.

the reason doesn't matter, the outcome is: you're now banned from adsense program for good.

the help center says otherwise claiming that you can resubmit your application once you've fixed the problem, but its a blunt lie - there's currently no way back!

careful, one chance to get it right.

Tuesday, February 10, 2009

Setting up a PHP debugger with ZendDebugger.dll, and Eclipse PDT

The nice thing about PHP, is that you can do it all for free, from the IDE to the Web Server.
but as such freebie, the setup of the dev env, is not that straight forward.

while you can definitely develop PHP without an IDE, just with a text editor, it is agruably time consuming to work on nasty bugs without a debugger...

so this is yet another tutorial of "how to set up PHP debugging on windows with Apache".

Prerequisites:
  1. Installed apache web server with PHP- there are numerous all-in-one setups "a la" LAMP. to name some xampp, wamp, mamp for mac etc' (google it, you'll find more).
    I'll be using xampp for this example, it is also well integrated into the PDT. you can download it at http://www.apachefriends.org/en/xampp.html
  2. Sun's Eclipse PDT - it's a setup built to debug PHP, so it has the proper php-debug prespective we're after. downloadable from here:
    http://www.zend.com/community/pdt?ecl=EclipseZend
  3. ZendDebugger dll:
    http://downloads.zend.com/pdt/server-debugger/
    choose the zip file that regards windows (currently ZendDebugger-5.2.15-cygwin_nt-i386.zip )
    make sure you're extracting the 5_2_x_comp/zenddebugger.dll, assuming that you're using php 5.2.x
    and put the dll in any location (i usually put it in the eclipse root dir or xampp root dir).

Making the bastard run:

changing the php ini file to support debugging with Zend
* make sure you're changing the right php.ini file by running the phpinfo()- can be done usually through the interface like (http://localhost:82/xampp/phpinfo.php
* you cannot run both xdebug and zend, so comment out all the [xdebug] category lines
* sometimes you'll find that the zend optimizer cannot run together with zend debugger, so comment out those as well, since it is not a production env - u don't need it anyway.
like the following section:


[Zend];
zend_extension_ts = "C:\xampp\php\zendOptimizer\lib\ZendExtensionManager.dll"; zend_extension_manager.optimizer_ts = "C:\xampp\php\zendOptimizer\lib\Optimizer"; zend_optimizer.enable_loader = 0;
zend_optimizer.optimization_level=15;
zend_optimizer.license_path = ...

so just comment it out using semicolons ";" at the begining of the line.
* now you're ready to add the Zend debugging lines:

[ZendDebug]
zend_extension_ts="C:\Program Files\eclipse\ZendDebugger.dll"
zend_debugger.expose_remotely=always
zend_debugger.allow_hosts=127.0.0.1/32

I'm not sure that the /32 of the IP in the allow_hosts config does, but it works that way, just leave it...
5. now we need the dummy.php which is the test file for PDT to see that the debugger works.
I found one saint that posted the contents of the file: http://www.webtdo.com/dummyFile.php
you need to create a file called dummy.php and put it in the document root - eclipse will be looking for it.

6. configuring eclipse.
* open eclipse, any workbench is ok, just create a new php project.
* on window->preferences->php->debug->installed debuggers, edit the client host/IP and leave only the 127.0.0.1
* now open the debug configurations, create a new PHP web page configuration, and select Zend as the server debugger, and configure the PHP server to point to your apache root including the port number if other than 80.
* hit test debugger - if it says success - we're good, otherwise you need to start thinking about what went wrong: is apache up? is dummy.php in place? is zend debug section added to the right php.ini file? etc'.
*select the file to start from, and the "debug" button should start being enabled.\

that's it! we're good as new.

good luck folks, it's not trivial, i know...

    Monday, February 9, 2009

    some things about SEO

    I've been researching about SEO tools and know hows lately, and learned quite a lot,

    I'll share some of it here from time to time with the audience (the main/only current reader says my analytics) ,
    It seems like a great knowledge base tool, this blog.

    so cloaking:
    what is cloaking? disguising one's site as another, there are 2 kinds, both are evil.
    1. You can cloak content for the google bot, to make it believe you have a certain site content, while users will see other content.
    2. redirect your site to present another site to present a different page rank than your real one.
    - this is done mainly by people who try to sell their site, and want to increase the site's market value artificially. I will not get into the details of how, for obvious reasons. (see no evil, spread no evil).

    how to determine clocking of the second kind? basically there are open sites out there to do the job for you such as database-search.