I recently ran into a minor migration issue when going from php 5 to 5.3. property_exists() returns false on some inherited class properties when passing $this. To circumvent the issue use:
property_exists(get_class($this), $property) instead of
property_exists($this, $property).
Using jQuery UI CSS Icons Inline
For those of you familiar with the robust styling offered by the jQuery UI CSS Framework, you may have come accross the following problem when applying the framework to your existing projects. By default, jQuery UI icons can only be used on block level elements, a severe limitation given the tremendous richnes of the icon set.
Here’s a little work around that enables you to apply them to an inline html element.
First add the following to your stylesheet or include it as needed through a seperate file.
img.ui-icon { height: 16px; width: 16px; position: relative; display: inline; border: 0px }
img.ui-icon { text-indent: 0px }
Then, simply apply the desired icon class to an image tag with the src referencing a trasparent gif.
<img src='/images/spacer.gif' class='ui-icon ui-icon-check' />
For a full list of available icons be sure and check out the jQuery UI Themeroller. If you’re not at all familiar with jQuery UI or with their CSS framework, feel free to learn more about them:
- http://jqueryui.com/home
- http://jqueryui.com/docs/Getting_Started
- http://jqueryui.com/docs/Theming/API
| Posted in jQuery | No Comments »
As we all know, the Windows filesystem is filename case insensitive, which means that if you have a file named "temp.txt" or "tEMp.TxT" it makes no difference to the OS. In Linux, a case insensetive OS, it would treat the two as seperate files.
Now heres the situation, my local workstation runs a basic WAMP stack on Windows XP, courtesy of Wampserver 2.0; however, my staging/production code-base is running on a good old Linux box. Once in a while after syncing or pushing a new code revision I run into a file inclusion error due to a discrepancy in the referenced filename case which normally is no big deal - you just go back and change the file reference or physical filename, which can be done by:
- Creating a temporary copy with a different name
- Deleting the original
- Renaming the copy to the intended case of the original
At this point everything should be fine unless of course you’re using a version control system such as Subversion. In my “case”, I am, which means that Subversion won’t recognize the change unless I first delete the original file from the repository and re-commit the updated file.
- Create a temporary copy of the original
- Delete the original file from your repository
- Rename the copy to the intended case of the original
- Add your new file or files to the repository.
Now it looks like we’ve solved the problem, except that you may have noticed that we’re missing all the versioning data that was once associated with our file. To preserve it, if you’re interacting with your repository through command-line you can do a “move” operation with Subversion URLs and then update your working copy. According to the folks at Subversion, this is how its done:
svn mv svn://svnserver/path/to/(filename) svn://svnserver/path/to/(updated filename) svn update * svn update
[Edit]
If you're using TortoiseSVN then there are two other things you can do, the first of which is recommended by tortoiseSVN:
- Commit the changes in your working copy
- Rename the file to the desired case directly in the repository using the repository browser.
- Update the working copy.
OR:
- Rename the file to a temporary name using the submenu rename command
- Commit the updated file
- Then rename to the desired case
- Commit once more
| Posted in Subversion | 2 Comments »
Ever wonder how to add a horizontal rule in office 2007?
Turns out that typing 3 consecutive hyphens “-” and enter will create a “normal line” which is similar to an hr. You can also replace the hyphen with an equal sign to get a double line, or even an underscore for a bold one :)
Note:
It actually creates an element border, so if you want to remove it one thing you can do is set the cursor to the line directly above the hr/border and select the “No Border” option from the border formatting drop down inside the paragraph toolbar. You’ll find it under the “Home” tab in Word 2007 and “Format Text” tab in Outlook 2007.

| Posted in Shortcuts | No Comments »
The Captcha No Human Can Answer!
Folks, we’ve finally arrived at an era where CAPTCHAs have become so convoluted and lacking of context that no person can intuitively answer them. Here’s an example:
For me to register on the Netbeans forum and post some questions, I had to reply to the following:

Now I’m used to the illegible squiggly alpha numeric number combinations, but the previous one left me speechless. I tried answering with: “Netbeans”, “Netbeans IDE”, “Programming”, etc.. but to no avail. Eventually it switched to a more understandable question but not before banning my session for excessive registration attempts.
The fight to prevent spammers from using mass registration as a tool in their arsenal has long been a cat and mouse chase. It seems to me that we’ve finally arrived at the point where our ability to effectively prevent them from compromising our open networks is no longer feasible without greatly sacrificing the accessibility of our applications to the end user.
For those of you using the Tortoise SVN subversion client, you may be wondering how to circumvent that annoying password prompt.
Turns out that its easy as cake to do, found out how from the following site:
http://pjhile.com/getting-around-the-tortoisesvn-password-prompt
Mine worked by setting the (Repository>settings>network>SSH Client) to “C:\Program Files\TortoiseSVN\bin\TortoisePlink.exe” -pw ‘{PASSWORD}’

Just the other day I was having trouble adding CRUD permissions on a new db schema to all available users on a mysql database. Although the query didn’t produce any errors or warnings, the permissions just wouldn’t take effect. After a few minutes, I remembered that I may have to reload the grant tables.
I had falsely assumed that by using GRANT syntax I didn’t have to call FLUSH PRIVILEGES as I normally would if I were creating a new mysql user.
Anyway, here’s the syntax for granting some standard permissions on a particular database to all users:
GRANT SELECT, INSERT, UPDATE, DELETE ON dbschema.* TO ”@’%';
FLUSH PRIVILEGES;
Useful Links:
http://dev.mysql.com/doc/refman/5.1/en/grant.html
[Edit]
Hey Guys, Turns out that: Grant SELECT, INSERT, UPDATE, DELETE ON db.* TO ‘’@’(HOST)’ merely creates a mysql user with no password rather than granting the actual permissions to all mysql users. Looks like we’ll have to insert some rows into the mysql.db table.
Here’s the legit way of adding CRUD permissions on a specific db schema to all mysql users:
(Replace “db_schema” with the name of the db you’re targeting)
INSERT INTO mysql.db (host, db, user, select_priv, insert_priv, update_priv, delete_priv) SELECT host, 'db_schema', user, 'Y', 'Y', 'Y', 'Y' FROM mysql.db GROUP BY user, host;
And again, don’t forget to flush:
FLUSH PRIVELEDGES;
| Posted in MySQL | No Comments »
Here’s a handy script I use for doing global content search and replace in Linux. The basic idea is to use Find to narrow down a recursive list of files within a directory, based usually on the extension, and then perform a text substitution using SED the wonderful “Stream Editor”. In this example, I use “#” as the pattern delimiter instead of “/” to avoid having to escape forward slashes “\/”. For convenience, I’ve color coded the key parts of the script.
- Red: File filters
- Green: Search Pattern
- Blue: Replacement
Note: Anyone unfamiliar with regular expressions may want to learn more about them before doing something scary.
find . \( -name ‘*.php’ -or -name ‘*.inc’ \) -exec
sed -i ‘s#^\s*mail\s*(#require_once(“/home/web/solomon_1.3/include/mailLogger.inc.php”);\nmail_log(#g’ {} \;
Before running the search and replace you may also want to see a list of affected files. In that case, replace the call to sed with grep.
find . \( -name '*.php' -or -name '*.inc' \) -exec
grep -nHi '^\s*mail\s*(' {} \;
Don’t forget that by default both programs use a basic regex flavor. That means:
- To perform grouping, use escaped parenthesis: “\(” instead of “(“
- Avoid errors by making sure that your search pattern doesn’t contain any un-escaped pattern delimiters.
And lastly, remember to make backup files before executing any s/r!!! Believe me, its worth it!
Useful References:
· http://www.grymoire.com/Unix/Sed.html
· http://www.grymoire.com/Unix/Regular.html
Hello World :)
After years of hesitation, the foundatations of my first personal site have been laid in wordpress mortar. In celebration, I have indulged in a pastry and bottle of dark beer
This brings me to the next byte!
After several years of coding, through trial and error, I have learned the value of good documentation. On many occasions a simple search saved me the loss of countless hours running through the uncertain wilderness of reverse engineering. My wish is for this site to serve as a log of my discoveries and to provide a reference point of sorts for all of us lost souls.

| Posted in PHP | No Comments »