The Dev Pages

A knowledge base for simple (and beyond) web applications development

Archive for the ‘General Dev’ Category




private function XMLtoHTMLEntities($string){
//get rid of any XML entity encoding that may have been applied (like in an RSS feed)
$unXMLEntify = str_replace ( array ( '&' , '"', ''' , '<' , '>'), ->
array ( '&', '"', "'", '<', '>') , $string );
return htmlentities($unXMLEntify);
}

phpunit: command not found


Posted on August - 4 - 2009



phpunit: command not found

Your phpunit file needs execute access and has to be in a ‘bin’ folder (/usr/bin or usr/local/bin)

How to install the pdo myql drivers for php


Posted on August - 3 - 2009



First install pdo.

I already had php 5 with the pdo extension included in the build. But I needed the mysql driver for the php extension since it only came with 2 (sqlLite, sqlLite2).

To add the mysql driver for pdo in your php install, put (pdo_mysql.so – you’ll have to compile this) in your extensions directory and then enable that extension in php.ini. WTF, pretty simple but there are no web pages with instructions. And compiling in Mac OS X sucks because you need to install extra Developer tools and than run the command line compile commands.

http://pecl.php.net/package/PDO_MYSQL




-When you setup additional folders outside of the ‘Sites’ folder to serve files, they cannot be in a directory path where in higher up directory has restricted rights (you can’t serve files from anywhere in the ‘Documents’ folder).

-If you add a virtual host, make sure the home directory/ doc root has a corresponding directory entry. So the <VirtualHost>’s docroot needs to have a <Directory> to make it so the default apache settings for directories don’t deny the server access.

-When you uncomment the link to the virtual hosts file, make a vhost for localhost too.

-When you specify an error log output file for php, chmod it to be globally writable (so php can write to it).

-Eclipse in Mac OS X is funky (Ganymede) with the pdt plugin.

-The debugger module does not work for php unless you compile a 64-bit version of xdebug, which didn’t work easily.

-the zend_path or whatever sucks! This needs to point to the xdebug.so, this was not documented anywhere for mac os x. You have to move it to the weird extensions folder in usr/lib/php or edit the extension_dir, after you have compiled and put the xdebug.so in that location.

-The extension_dir should not be ‘./’, which just means current folder, but should point to ‘usr/lib/php/extensions’ or something (by mem, update later)

-Updating the mysql values in php.ini is pretty straight forward.

Cruise Control and/or ANT out of memory error


Posted on February - 4 - 2009



When setting up a flex app auto build task, I started getting the following error consistently.

Error: null
java.lang.OutOfMemoryError

THE FIX, for me was: Add to ant.bat, antRun.bat

set ANT_OPTS=-Xmx512m
set ANT_OPTS=-Xms64m -Xmx512m

First I tried changing the Cruise Control memory settings in cruisecontrol.bat (CC_OPTS=-Xms256m -Xmx768m -Xmn256m).But I think it was less likely for the cruise control process to have memory issues than the ant tasks I was using (as Jeffrey pointed out before I could clean this up a bit – thanks).

I was noticing that the java.exe service that was handling the process would go up to 100 MB of memory usage, and then stop there, and then tank. The following article points out how to change the ant task memory settings. Because of the way cruise control was calling the ant task, it made it necessary to modify the the .bat files in the ant folder (You can use the … tag, as per the links below, in some cases). Once the .bat’s had the ANT_OPTS memory settings in place, the process would use more memory and build the flex app. Nice.

Check out the following articles:

http://confluence.public.thoughtworks.org/display/CC/OutOfMemoryError

http://cruisecontrol.sourceforge.net/main/configxml.html#ant

javascript history with jquery


Posted on November - 10 - 2008



http://plugins.jquery.com/project/history

this rocks and is better than (and probably inspired by) rsh




Summary – In Access, select your table and then do File->Export->ODBC Option (The last one)

I was missing the mysql table dumps that you can do from phpmysqladmin when my task at hand was to import an access table of postal codes (with their corresponding lat/long coordinates) into a SQL Server database. I decided to go nuts and attempt the task blitzkrieg style with no googling or research first. After only a minute or two looking at save and export options I found the following gem:

File->Export->ODBC Option (The last one)

If your access database is on the same machine as your SQL Server just blast through the ODBC setup menu choosing localhost, and then choose the default database as the database where you want the exported table to appear.

Or if you want to the exported table to appear in a remote sql server database (or any kind of ODBC compatible database I suppose), I think you can specify the ip or host name for that database. Then you choose a table name for your exported table and the thing will appear in your default database!

Fortunately, a few weeks ago I had needed to figure out how to set up an ODBC connection on a server box. Info: ODBC sources are like middlemen for apps to connect to a database. Set these guys up in Admin Tools->ODBC in windows if you are using about any language to access a database. So if the language requires a database connection and there aren’t any built in andd fast easy functions, you can set up connections using ODBC functions.




THIS FIX DIDN’T WORK FOR FF ON A MAC. I’m still baffled about how to fix this. I think put a link for a firefox update may be the best solution.

When you select an input in FF <= 2, the blinking cursor wasn’t showing up on a form that was buried in a few layers of divs. No cursor was showing up at all, though some inputs had a half cursor (like it was pushed up off the input).

Looks like FF 3 is okay, but the older versions were acting funny. I guess this is a bug in firefox. I don’t know exactly how the bug works, or what the fixes are, are even what the different causes of the bugs are. There are tons of variations on those 3 items. All I know for me is that by doing the following it fixed the problem:

Wrap each input in <div style=”overflow:auto”></div>.

That fixed it for me. overflow:visible also worked. Overflow hidden has been mentioned as working too, but that broke it again for me. Not sure what the implications of these stylings are on how the inputs display, but they seemed to work fine for me.




So I had an image that was not loading, and could not figure out why, in Firefox 3. Turns out it was a plugin, mos tlikely adBlock plus. When all plugins were disabled, the image loaded fine. Here were the URLs which the plugins blocked, and the one it let by.  Looks like the plugin blocks certain URLs based on specific words.

Always worked:

test

Only worked with plugins disabled:

test
test




So if you have

<cfmail to=””

an error occurs

but apparently when you have

<cfmail to=” ”

It just completes successfully without sending an email to anyone and doesn’t throw errors