Monday, June 22, 2009

PHP'n Rio 09

The PHP Local User Group of Rio de Janeiro - PHP Rio are pleased to announce their 1st PHP'n Rio conference. It will be held July 03rd at the
Infnet Institute, Rio de Janeiro. It is a one day mini conference, aimed on providing experienced developers and beginners a chance to learn more about PHP frameworks, web
applications built in PHP and testing code.

The keynote speaker is Jan Schneider that will talk about the Horde project. We will also have sessions about other frameworks and a PHP TestFest.

PHP'n Rio sessions goes from 6pm to 9pm. Then PHP TestFest follows up
to 10pm. No fees or subscription required. Participation is entirely
free !

Whether you live here or are around just enjoying the marvelous city,
come and join us :)

For more information please visit the official site (portuguese only).

We are looking for sponsors so we can bring even more speakers from
around the country while keeping a great conference for free. If you
see your company fits as our partner, please email Igor Feghali <ifeghali at phprio.org>

Saturday, March 7, 2009

PHP Test Fest 2009

What is it ?

The TestFest is an event that aims at improving the code coverage of the test suite for the PHP language itself. As part of this event, local User Groups (UG) are invited to join the TestFest. These UGs can meet physically or come together virtually.

When is it going to happen?

UGs are free to pick any timeframe in April - June 2009. Each local TestFest can last a day, a week or any other timeframe.

Where do I get more info?

At the official site of the event.

Scalable logo for advertising

I used Inkscape to vectorize the official logo designed by Vincent Pontier, so you can make smaller/bigger bitmaps while keeping the good quality.

Sunday, December 21, 2008

Compiling SQLite 2 on Mac OS X 10.5 Leopard (for x86_64)

Mac OS X 10.5 Leopard comes with SQLite v3 bundled. But many times having SQLite v2 can be handy, given that version 3 is not backwards compatible. The hardest step here is to find the download link for version 2 in the official SQLite site. Don't ask me how did I achieve that... I don't remember ;) Fortunately I wrote down the link so you don't have to bother digging the web again :)

So we start with:
$ wget http://www.sqlite.org/sqlite-2.8.17.tar.gz
$ tar -zxf sqlite-2.8.17.tar.gz


The next big problem comes with CFLAGS. The package we are about to install comes with a pre-made configure script that doesn't respects the CFLAGS environment variable when creating the dynamic library. It took me a while but I have the patch for you, too.

--- configure.old 2008-12-21 18:50:24.000000000 -0200
+++ configure 2008-12-21 18:57:11.000000000 -0200
@@ -8253,7 +8253,7 @@
;;
esac
output_verbose_link_cmd='echo'
- archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring'
+ archive_cmds='$CC '$CFLAGS' -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring'
module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
# Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's
archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'


After applying the patch to the configure file we can proceed as usual:

$ ./configure --prefix=/usr/local LDFLAGS="-arch i686 -arch x86_64" CFLAGS="-arch i686 -arch x86_64"
$ make


I like to take full advantage of my system so I like to have things working at 64 bits. Just for the case I ever need a tool that won't go 64, I keep a fat binary with both archs 32 and 64. At this point we should check our work:

$ file .libs/libsqlite.0.8.6.dylib
.libs/libsqlite.0.8.6.dylib: Mach-O universal binary with 2 architectures
.libs/libsqlite.0.8.6.dylib (for architecture i386): Mach-O dynamically linked shared library i386
.libs/libsqlite.0.8.6.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64


Everything seems fine. So we finally install it:

$ sudo make install

Monday, May 19, 2008

How to sync your Nokia 5200 with your Mac OS 10.5 Leopard

  1. Download the following plugin:
  2. Go to your Applications folder, look for iSync.
  3. Right click iSync, click "Show Package Contents"
  4. Navigate thru Contents\PlugIns\ApplePhoneConduit.syncdevice\Contents\PlugIns
  5. Extract here the zip you just got
  6. Enable bluetooth on your computer and phone
  7. Open iSync
  8. Press Command+N to configure your phone settings and you are done

Wednesday, May 7, 2008

How to record your Mac OS 10.5 Leopard screen to SWF

Sometimes when you want to demo an application or even create a step by step tutorial on something, there is nothing better then a live recording of the action. In those cases vnc2swf is a small and very handy python script able to help you on that job.

I am not very sure on what it depends, but you would need X11, Freetype 2, jpeg and Python Imaging Library (PIL) at least. Python of course, but Leopard already comes with version 2.5. I am not sure about GTK, I already had that on my system. If you don't, please take a look at Compiling GTK+ on Mac OS X 10.5 Leopard and get it to your system. That same post would help you setup all the dependencies but PIL, that we are going to cover now.

Download PIL source code to /usr/src. I assume all your own compiled libraries are installed to /usr/local and you used architecture i686.


cd /usr/src
wget http://effbot.org/downloads/Imaging-1.1.6.tar.gz
tar -zxf Imaging-1.1.6.tar.gz
cd Imaging-1.1.6


Now you need to hack setup.py accoding to that diff:


--- setup.py.orig 2006-12-03 09:37:29.000000000 -0200
+++ setup.py 2008-05-06 21:13:29.000000000 -0300
@@ -131,14 +131,10 @@

elif sys.platform == "darwin":
# attempt to make sure we pick freetype2 over other versions
- add_directory(include_dirs, "/sw/include/freetype2")
- add_directory(include_dirs, "/sw/lib/freetype2/include")
+ add_directory(include_dirs, "/usr/local/include/freetype2")
# fink installation directories
- add_directory(library_dirs, "/sw/lib")
- add_directory(include_dirs, "/sw/include")
- # darwin ports installation directories
- add_directory(library_dirs, "/opt/local/lib")
- add_directory(include_dirs, "/opt/local/include")
+ add_directory(library_dirs, "/usr/local/lib")http://www.blogger.com/img/gl.link.gif
+ add_directory(include_dirs, "/usr/local/include")

add_directory(library_dirs, "/usr/local/lib")
# FIXME: check /opt/stuff directories here?


Then you are done to build:


export ARCHFLAGS="-arch i686"
export CFLAGS="-arch i686"
python setup.py build
sudo python setup.py install


Now you would just unzip and go vnc2swf but I couldn't make it work with Leopard's built-in VNC server (Screen Sharing) so you first need OSXVnc. Download the disc image, mount it and copy Vine Server to your Applications folder. Run and start the server.



You are now ready to go vnc2swf:


cd /usr/src
wget http://www.unixuser.org/~euske/vnc2swf/pyvnc2swf-0.9.3.tar.gz
tar -zxf pyvnc2swf-0.9.3.tar.gz
cd pyvnc2swf-0.9.3/pyvnc2swf/
./vnc2swf.py -n -o /tmp/myMovie.swf

Thursday, March 27, 2008

How to hack iphone locales

You may already seen out there some projects that translates the iPhone user interface to many different languages. Locale strings are stored in a totally different way though. Things like "Monday" and the Portuguese equivalent "Segunda-Feira" are stored in a ICU (International Components for Unicode) data file.

For 12 mondays I had to stand looking at "Segunda-Feira" being printed out of the bounds of iCal icon. Until today. I tried fgrep'ng the whole iPhone for the string "segunda" with no luck. Then I tried converting all the plists from binaries to XML and fgrep'ng again and still no luck. Doing some research I found that apple uses ICU on iPhone, which drove me to find our target: /usr/share/icu/icudt34l.dat. This is a 8.5MB file bundled with all the locales (timezones, region formats, etc.).

To start playing with it, the first thing we will need is obviously the file itself:
cd /tmp
ssh root@iPhone cp /usr/share/icu/icudt34l.dat /usr/share/icu/icudt34l.dat.bak
scp root@iPhone:/usr/share/icu/icudt34l.dat .
Now we need the ICU version 3.4 tools. Again, I don't like macports or fink so I had a bad time trying to compile it myself (remember I am on a Mac OS X Leopard). You have now the cake recipe:
cd /usr/src
wget ftp://ftp.software.ibm.com/software/globalization/icu/3.4.1/icu-3.4.1.tgz
tar -zxf icu-3.4.1.tgz
mv icu icu-3.4.1
cd icu-3.4.1/source
For some weird reason the configure script for darwin is broken, so I had to fix that with the following patch:
--- config/mh-darwin 2004-05-18 18:54:24.000000000 -0300
+++ config/mh-darwin.new 2008-03-27 23:48:45.000000000 -0300
@@ -58,6 +58,7 @@
@echo "generating dependency information for $<" @$(GEN_DEPS.c) $< > /dev/null
@mv $@ $@~
- @echo -n "$@ " > $@
@cat < $@~ >> $@
@-rm $@~

@@ -65,6 +66,7 @@
@echo "generating dependency information for $<" @$(GEN_DEPS.cc) $< >/dev/null
@mv $@ $@~
- @echo -n "$@ " > $@
@cat < $@~ >> $@
@-rm $@~
Now we can run configure:
./runConfigureICU MacOSX --disable-samples --disable-draft --disable-extras --disable-tracing --disable-tests
and make it:
make
sudo make install
I couldn't manage to get file from bin/ installed on my system, but anyway I wasn't really interested on going deeply on that. Heck, I want to get rid of that "Segunda-Feira" thing !

Lets extract our package now:
cd /tmp
/usr/src/icu-3.4.1/source/bin/decmn icudt34l.dat --pkgdata > out.lst
cd icudt34l
boom ! we got a lot of files... and look who is laying around:
-rw-r--r-- 1 igor wheel 51K Mar 28 00:14 pt.res
-rw-r--r-- 1 igor wheel 496B Mar 27 23:06 pt_BR.res
-rw-r--r-- 1 igor wheel 3.7K Mar 27 23:06 pt_PT.res
The file we want is pt.res, but its a binary file. I couldn't manage to convert it back to something readable but again I am more interested in the quickest solution possible. Just download the pt.txt here. Near to the end you will find the calendar day names. Edit accordingly. Important: remember to use UTF-8.

Now its time to generate our new resource:
/usr/src/icu-3.4.1/source/bin/genrb pt.txt
and re-package:
/usr/src/icu-3.4.1/source/bin/gencmn -v -n icudt34l 0 < ../out.lst
At this point you cross your fingers and hope this works... worked for me :)
scp icudt34l.dat root@iPhone:/usr/share/icu
reboot and you are all set.

If you can read Portuguese you might find this entry interesting as well. It describes the similar process of updating Mac OS X timezone. It makes use of `icupkg` though, that is not available on ICU version 3.4.

Wednesday, March 26, 2008

GTK Python bindings for Mac OS X 10.5 Leopard

Following my previous post we are now ready to compile and install the python bindings in order to have UMIT ready to go.

we start with pygobject which is cursed by Murphy's law. At the first attempt I got make stopped by an error message, that could be fixed by telling which python version we would like to use (one more time thanks to macports).
wget http://ftp.gnome.org/pub/GNOME/sources/pygobject/2.14/pygobject-2.14.1.tar.bz2
tar -jxf pygobject-2.14.1.tar.bz2
cd pygobject-2.14.1
./configure --prefix=/usr/local --disable-glibtest CFLAGS="-arch i686" PYTHON=/usr/bin/python2.5
make
sudo make install
next pycairo:
wget http://cairographics.org/releases/pycairo-1.4.12.tar.gz
tar -zxf pycairo-1.4.12.tar.gz
./configure --prefix=/usr/local CFLAGS="-arch i686" PYTHON=/usr/bin/python2.5
make
sudo make install
and finally pygtk:
wget http://ftp.gnome.org/pub/GNOME/sources/pygtk/2.12/pygtk-2.12.1.tar.bz2
tar -jxf pygtk-2.12.1.tar.bz2
cd pygtk-2.12.1
./configure --prefix=/usr/local CFLAGS="-arch i686" PYTHON=/usr/bin/python2.5
make
sudo make install
that's the end of our saga. You can now enjoy UMIT on your Mac OS :)