Monday, April 13, 2009

Annoying pit fall using apache on windows

I've been using apache to develop my php scripts, and landed on the most annoying bug ever, whoever ported apache to windows, did not allow using windows based ascii file format,
the outcome is that normal windows line breaks, are not read as such by the server,
which lead to my RewriteEngine on command to be part of the earlier command line (Options +FollowSymLinks) and apache simply couldn't understand that.

In the name of all that is sacred - yuch! what a nasty time "filler".

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.

    Tuesday, January 6, 2009

    A change of heart calls for a change of blog name

    I had to see it coming, no longer about flash, so fundter from now on.
    also got me the domain www.fundters.com which i intend (or not) to someday make something out of.

    Why fundter?
    2 reasons
    1. it's catchy.
    2. was available here in blogspot and as a domain (bought it earlier this year).

    so... here we go...

    Sunday, January 4, 2009

    NAS - chosen platform for sentimental valued data.

    I've been thinking a lot about how would i keep all my pictures, videos, ebooks etc'.

    my requirements:
    1. single location, preferably accessible from everywhere (AKA www).
    2. redundant - no data loss
    3. forever within reach - no "we went broke" policy (see iwantsandy.com...)
    4. serves as base for media center.
    5. data forever accessible - no single network/raid card that goes out of production could stop me.

    for the above reasons, i've selected netgear ReadyNAS duo, with 2 HD of 1 TB each
    RAID 1 configuration, which means that one is the exact replica of the other, but on the same breath, i can take any of them and simply mount it anywhere else, data is not encypted/xored in any way.

    The only problem is that when i connected my brand new macbook to the switch the read was soooo slow, it was simply not useful.

    snooping through NetGear's forums (god bless), i found out that all i needed to do was run:
    sudo sysctl -w net.inet.tcp.delayed_ack=0
    in order to persist it to survive reboots, i created a file /etc/sysctl.conf and added the line
    net.inet.tcp.delayed_ack=0

    and viola - it runs fast over wireless, and everybody's happy!

    next task is to mount all the data in, and buy a decent UPS to protect & serve.
    after that we'll set up the media center - mac has built in FrontRow but i didn't find a way to configure it to harvest my NAS.

    tc,
    n./

    Mac Book, the bomb

    For years i've been dieing to turn to the other side, and start using Linux, i had a few days with ubuntu, but never got the chance to really get into it, or even have it set up on a decent machine.

    My partner, one Shay, has recently managed to push me off balance and without noticing i found myself with the new macbook.

    1. I'm damn impressed with the sensation this baby gives ya. no windows does it.
    2. It's damn hard to get used to such a change - I feel like my toolbox has been taken away from me, even the little tweaks should be re-acquired.

    the fun thing is that its basically FreeBSD beneath the mask, so it's not so far off linux, and it comes with lots of perks.

    my biggest mistake over the first week, was that i ran to install VM and set it up with windows, for safety measures. I wasn't gonna be left out without my familiar env.
    It turned out that i found myself with a brand new 4GB 2.4Ghz machine, running on VM with somewhat unsatisfying performance. i was disappointed.
    Only when i decided to try do things on mac, i found the real beauty, it can all be done directly on mac (unless you need to develop some .net code or run heavy Excel/Word documents - you need to keep windows for these bastards).

    Groovy enough, you can take your old machine and convert into a VM using VMWare converter.

    like i said, being the open source freak that i am, here's what i'm using now:
    Filezilla ftp client,
    MAMP PHP/Apache/MySql for mac,
    JEdit - took me a while to configure nicely, has crappy Look&Feel (someone said Java???), doesn't get even close to notepad++, but it works just fine!
    RapidSVN - svn client.

    in addition, there's microsoft RDC (RDP client for mac), FireFox, Skype, MSN and more, so things aren't looking bad at all.

    last issue was the keyboard. damn mac people don't think much of keys like delete, home and end, (the american version has delete button, and in israel i got the backspace button, but they are the same).
    to the rescue comes doublecommand (which installs itself to the settings window if u cant find it), and SharpKeys for windows users.

    next i'll be talking about the NAS i've purchased, requires it's own post...

    tiny keyword tracker - a cool keyword tracking utility

    Obligated to declare my involvement in this project, i'm quite happy to say that we've managed to come up with a cool little tool that helps you track your sites and how they are reflected in google. you set up the target sites, and their respective keywords of interest, and you get daily google ranking with a nice lil' graph that say it all.

    keyword tracking, enters tiny keyword tracker

    Total coolness, It was developed under adobe air, which means that it runs on just about any OS, as long as you have flash set up, you're good to go.

    a quick wrap of action script - personal debt

    Since there's no one out there reading this, one has to assume, then merely for my own sensation of closure:
    what happend with ActionScript? I made it through, started out with FlashDevelop, then moved to Flex builder in order to hasten development of one, yet another, custom CMS i developed to suite the needs of my customers.

    you may have the sources, should you find it interesting for your own pecuilier reasons at http://code.google.com/p/customcms
    I found google to be a kind and pleasent nest for code hosting, ez to setup, no questions asked.

    soon more posts over the new real deal...