Lebowtech Blog

Delay Ajax on Selects

| Comments

Recently I made an application that would reload the data via AJAX when data in a form was changed, standard stuff. The submit action of the form was connected to the AJAX request and the form elements have their onChange action submit the parent form.

A strange issue that we noticed was when using select elements. If you tab to one of the elements and start typing^webkit the select box will change to the option that matches what you started typing.

    <option value="a">a</option>
    <option value="ab">ab</option>
    <option value="abc">abc</option>

If you were to type abc the browser would change the value of our select box first to a then ab then abc, each time firing our form’s AJAX submit each time. You can see how this can add unneeded stress requests to the server, especially if you have a lot of options in your select tag.

The solution that we came up with is to insert a delay before firing the submit action when we are dealing with the onchange handler for selects.


| Comments

So now I’m switching my blog format again, this time to Octopress.

I like the fact that it lets me post in markdown, but my old HTML posts, left over from Joomla days, still work.

Getting it set up was pretty simple and I can post by pushing my changes to a git repository, forcing me to commit often.

It’s based on Jekyll and very robust. In the passed, my dynamic sites got hacked on dreamhost, so anything that creates static content is a plus.


| Comments

So this is going to be my first app that I plan to subbmit to the iTunes store. It is something that I missed from my old treo, you could tell the alarm how many times to repeat its self, that means that it won’t keeping ringing for hours on shabbos morning ( or when I forgot my phone at home ).

My app will create weekly alarms that will ring for a few times then quit.

Aditionally it shows a clock with the hebrew date, and the touch screen will not respond to touches when the alarm is firing, to limit chilul shabbos.

I hope to add some screen shots and submit to appstore soon.

Count Words in Html Files

| Comments

We created a new translation system for a project where we are using html files that will be then sent off for translation. This allows us to make changes to the layout if needed to fit a specific language.

The translation company needs to know the word count to give us a price quote, and we don’t want then to take into account the tags.

Here is a one-liner in fish shell that should get the word count for all the .phtml files.

cat (find . -iname "*.phtml"  ) | w3m -dump -T text/html  | wc -w

In bash you would probably replace the parens with backticks.

Also we are using PO files for short text throught the site. The translator we are using doesn’t know how to work with po files. So we used po2csv to create them files that they can open in a spreadsheet, although it makes me wonder what type of translation company can’t use po files.

Here is som fish shell code to make the csv files and bundle them into a zip and send them off:

# for each lang directory make a csv dir and put the new csv's in there
for lang in ??
    ehco $lang
    mkdir $lang.csvs
    po2csv $lang $lang.csvs

# zip up our csv and po files
find -name "??_messages.*" | sort | zip csvsAndPos -@

# mail it off
mutt -a csvsAndPos.zip 


| Comments

I’ve been hacked!!

So my joomla site was hacked. No real damage done except that I was marked as malware on google.

So here is my replacement for now.


Headup Safari Extension

| Comments

HeadUp adds tool tip type info to key words.

This extension will add the headup script to every site that you visit.

Note: You wont see the links the first time you visit a site, try reloading the page after a few min.


Problems After Upgrading to 10.6

| Comments

Date: 8th of Cheshvan, 5770

Keywords: OSX SnowLeopard Upgrade


I was using the Zsh Osx templates and after the update nothing seemed to work, and it didn’t even seem to be reading my .zshrc file either.

I tried installing the SVN version from the google site, but that didn’t work.

What did work was that I moved my .zsh dir and .zshrc file to a backup location and reinstalled from the tarball. Then I was presented with the nice config dialogs.

Then I moved my old stuff back into place

~> cp old/.zshrc .zshrc 
~> source .zshrc 
~> cp old/.zsh/zshprompt .zsh/zshprompt 

Text Mate

The mate command stopped working for me , but after fixing zsh , it works again.


So PHP 5.3 comes with OSX 10.6 ! That would be excelent except that nothing works !!

Time zones


had to reinstall 5.2.10 using my instructions …

but add EXTRA_CFLAGS="-lresolv" make -j2


And it looks like I have a problem with GD , so needs to be built with out gd

CFLAGS='-arch x86_64' ./configure  \
            --without-iconv  \
            --with-apxs2  \
            --enable-pdo  \
            --with-zlib=/usr \ 
            --with-curl  \
            --with-mcrypt \
            --with-pdo_mysql=/usr/local/mysql/bin/mysql_config  \
            --with-mysqli=/usr/local/mysql/bin/mysql_config  \
            --with-mysql=/usr/local/mysql   \
            --prefix=/usr  \
            --without-mcrypt -mandir=/usr/share/man  \
            --infodir=/usr/share/info  \
            --with-apxs2=/usr/sbin/apxs  \
            --with-config-file-path=/private/etc  \
            --sysconfdir=/private/etc  \
            --enable-cli  \
            --enable-ftp  \
            --enable-mbstring  \
            --enable-mbregex  \
            --enable-sockets  \
            --with-ldap=/usr    \
            --with-mime-magic=/etc/apache2/magic  \
            --with-zlib-dir=/usr \


after recompiling JPEG libs I recopiled php adding the following options.

--with-gd --with-jpeg-dir=/usr/local --with-png-dir=/usr/X11R6


look here for apple’s patch

PHP 5.3.0 on Mac OS 10.6 (Snow Leopard)

diff -Naur php-5.3.0/ext/iconv/iconv.c php/ext/iconv/iconv.c
--- php-5.3.0/ext/iconv/iconv.c        2009-03-16 22:31:04.000000000 -0700
+++ php/ext/iconv/iconv.c          2009-07-15 14:40:09.000000000 -0700
@@ -51,9 +51,6 @@
 #include <gnu/libc-version.h>

-#undef iconv 

 #include "ext/standard/php_smart_str.h"
 #include "ext/standard/base64.h"
@@ -182,9 +179,6 @@

-#define iconv libiconv

Still missing TTF


Hebrew dates.

I use hebrew dates on my OS and it worked fine , but now mails in my exchage box are getting wired dates. This is only happening in the message listing pane, but in the message view pane that date is fine.

Turns out it isn’t a problem with hebrew dates, I have the same issue with gregorian dates :(.

I moved my ~/Library/Mail folder and let Mail rebuild it , and that didn’t work …

I switched to using my old IMAP setup for this exchange account and it seems to work now .

Make not found..

Trying to install Xcode …

Run Ie6 ( and Windows Xp ) for Free on Osx

| Comments

This will let you use IE6 ( and XP ) on OSX for free!!

It uses Suns VirtualBox emulator.

I set back the clock so it won’t expire and it seems to work fine…

This will only work on an intel mac , and it is tested on 10.5 ( as well as on XP )

XP_SP2_with_IE6.dmg (755MB)

md5sum : d9e80d9bf8d03a146d35ef56ebef5f2c

More info to come , and check back here for updates.

Update 20th of Elul, 5769

I’ve updated the torrent file to use a http seed so you can keep downloading even when there are no available peers, or you have NAT/Firewall problems. As long as this doesn’t kill my bandwidth usage I’ll keep it going.

Please let me know if things are working or if you have any issues.

Osx Security Update 2009 005 Breaks Php

| Comments

OSX Security Update 2009-005 Upgrades to PHP 5.2.10 and wrecks havoc on a custom compile..

This morning when trying to work I started getting strange empty pages, I broke my head on this problem before and solved it by recompling PHP.

It turns out that Apple Security Update 2009-005 also upgrades to php 5.2.10, this would be a good thing for most normal users, but since I had a custom compile of PHP it killed my sites.

From Apple’s site:

CVE-ID: CVE-2009-1271, CVE-2009-1272, CVE-2009-0590, CVE-2009-0591, CVE-2009-0789, CVE-2008-5498

Available for: Mac OS X v10.5, Mac OS X Server v10.5.8

Impact: Multiple vulnerabilities in PHP 5.2.8

Description: PHP is updated to version 5.2.10 to address multiple vulnerabilities, the most serious of which may lead to arbitrary code execution. Further information is available via the PHP website at http://www.php.net/ These issues do not affect Mac OS X v10.6 systems.

The solution is to recompile php again with my custom configuration, lucky for me my old comple was still sitting in my downloads folder , so I just had to do a:

sudo make install 

now everything seems to be back to normal.

Compling Php on Leopard (Osx) in Intel C2duo

| Comments

I recently updated my Powerbook G4 to a MacBook C2Duo, and I wanted to get working quickly so I cloned the hard drive from the PowerBook to the MacBook, and I was able to pick up working right where I left off, that is until I one of my Joomla projects stopped working.

One of my joomla projects was just returning me a blank page, no error message and nothing in the logs.. everything worked fine on the live sever, after about 6 hrs of banging my head on the keyboard, I had a genius idea. I powered up the old powerbook , and the project still worked there! I quickly realized the problem. I had done a custom compile of PHP on the powerbook, and it probably wasn’t working so well on the Intel MacBook.

The obvious solution was to recompile PHP, so I downloaded PHP 5.3, excited about the built in Mysql driver. Configure went fine, make went fine, and then I try to restart apache :

 org.apache.httpd[79275] httpd: Syntax error on line 114 of /private/etc/apache2/httpd.conf: Cannot load /usr/libexec/apache2/libphp5.so into server: dlopen(/usr/libexec/apache2/libphp5.so, 10): no suitable image found.  Did find:\n\t/usr/libexec/apache2/libphp5.so: mach-o, but wrong architecture 


So I found a solution , recompile Apache, and I wasn’t really in the mood for that, so I figured I’d try an older version of php.

I tried PHP 5.2.10 , and after some twiddling with config options and reinstalling MySql, configure, make, make install, and now my project is working again.

here is the configure command I used

CFLAGS='-arch x86_64' ./configure --without-iconv --with-apxs2 --enable-pdo --with-zlib=/usr --with-curl --with-mcrypt --with-pdo_mysql=/usr/local/mysql-5.1.37-osx10.5-x86_64/bin/mysql_config --with-mysqli=/usr/local/mysql-5.1.37-osx10.5-x86_64/bin/mysql_config --with-mysql=/usr/local/mysql-5.1.37-osx10.5-x86_64 --disable-dependency-tracking --prefix=/usr --without-mcrypt -mandir=/usr/share/man --infodir=/usr/share/info --with-apxs2=/usr/sbin/apxs --with-config-file-path=/private/etc --sysconfdir=/private/etc --enable-cli --with-curl=/opt/local --enable-ftp --enable-mbstring --enable-mbregex --enable-sockets --with-ldap=/usr --with-ldap-sasl --with-kerberos=/usr --with-mime-magic=/etc/apache2/magic --with-zlib-dir=/usr --with-gd --with-png-dir=/usr/X11R6 --with-xpm-dir=/usr/X11R6 --without-jpeg-dir --enable-exif


If you want or need libjpeg or true type support for things like imagettfbbox or imagejpeg. The needed libraries comple simply with a , configure, make, make install.

You can get them from here

http://www.ijg.org/files/jpegsrc.v7.tar.gz http://ftp.cc.uoc.gr/mirrors/nongnu.org/freetype/

Setting the appropriate environment variables also might help , but I’m not sure if this is required.

MACOSX_DEPLOYMENT_TARGET=10.5 CFLAGS="-arch x86_64 -g -Os -pipe -no-cpp-precomp" CCFLAGS="-arch x86_64 -g -Os -pipe" CXXFLAGS="-arch x86_64 -g -Os -pipe" LDFLAGS="-arch x86_64 -bind_at_load" export CFLAGS CXXFLAGS LDFLAGS CCFLAGS MACOSX_DEPLOYMENT_TARGET

be sure you get the newest version of freetype as some of the older versions won’t compile the shared libraries in 64 bit.

CFLAGS='-arch x86_64' ./configure --without-iconv --with-apxs2 --enable-pdo --with-zlib=/usr --with-curl --with-mcrypt --with-pdo_mysql=/usr/local/mysql/bin/mysql_config --with-mysqli=/usr/local/mysql/bin/mysql_config --with-mysql=/usr/local/mysql --disable-dependency-tracking --prefix=/usr --without-mcrypt -mandir=/usr/share/man --infodir=/usr/share/info --with-apxs2=/usr/sbin/apxs --with-config-file-path=/private/etc --sysconfdir=/private/etc --enable-cli --with-curl=/opt/local --enable-ftp --enable-mbstring --enable-mbregex --enable-sockets --with-ldap=/usr --with-ldap-sasl --with-kerberos=/usr --with-mime-magic=/etc/apache2/magic --with-zlib-dir=/usr --with-gd --with-png-dir=/usr/X11R6 --with-xpm-dir=/usr/X11R6 --with-jpeg-dir=/usr/local --with-freetype-dir=/usr/local --enable-exif

One other thing I’d like to mention: If you use zsh you can do tab completion on php configure options, this has to be one of the awesomest things I’ve seen in a while.