Found fix for Universal wxPython+py2app

Posted by ahmadster at August 17th, 2006

If you try to install the latest UB Python + UB wxPython + UB py2app then build an app and package it, will break. The error I get is a couple of missing wxPython libraries in /usr/local/lib/wxPython*. Which is freaky because py2app should have taken care of that. Anyway, I’m doing this fix manually now. I added the following two lines to my build scripts for EDE4


install_name_tool -change /usr/local/lib/wxPython-unicode-2.6.3.3/lib/libwx_macud-2.6.0.dylib @executable_path/../Frameworks/libwx_macud-2.6.0.dylib "dist/Etelos Development Environment.app/Contents/Frameworks/libwx_macud_gizmos-2.6.0.dylib"
install_name_tool -change /usr/local/lib/wxPython-unicode-2.6.3.3/lib/libwx_macud-2.6.0.dylib @executable_path/../Frameworks/libwx_macud-2.6.0.dylib "dist/Etelos Development Environment.app/Contents/Frameworks/libwx_macud_stc-2.6.0.dylib"

Posted in UNIX, Technology| Comments Off | 

MythTV + PVR-500 + DishNetwork

Posted by ahmadster at August 16th, 2006

A while ago I actually got this combination to work. I re-did the whole setup once, so I wanted to put some details up here.

I must say the only pain I got was from the DishNetwork receivers. I got them to hand over two 301 receivers. They were pushing real hard for their own PVR which I did not want. So they actually charged me $5 extra everymonth because I had an extra receiver.

The OS

As you may know, I’m a big Gentoo fan so what else would I be running. Nothing special here, just compiled the kernel 2.6.15-gentoo-r1 with the following options (I also have a pcHDTV3000 in there, so some options are for that also).

Device Drivers->
Multimedia devices->
[*]Video For Linux
Video For Linux->
<*> BT848 Video For Linux
<*> Conexant 2388x (bt878 successor) support
<*> DVB/ATSC Support for cx2388x based TV cards
[*] Build all supported frontends for cx2388x based TV cards
<*> Add support for additional audio chipsets
<*> Add support for additional video chipsets
Digital Video Broadcasting Devices —>
[*] DVB For Linux
<*> DVB Core Support
<*> BT8xx based PCI cards

Here is my kernel config file if you need more details.

PVR-500

This is probably the simplist thing I had to do,

emerge ivtv ivtv-ptune

It gave me media-tv/ivtv-0.4.2 media-tv/ivtv-ptune-0.2.0_rc3. They still work out of the box.

If everything went Ok, you should have these two devices up and running.

/dev/v4l/video1
/dev/v4l/video2

Then I used ptune-ui.pl to adjust the input to S-Video. In MythTV-Setup when you add the Capture Card, add two cards both of type “MPEG2 Encoder card…”. Set the Video Device to each one of the above. Then set the Default Input to S-Video 0 for both cards. Nothing to it.

In the MythTV-Setup (4. Input) map your data feed to S-Video 0 on both cards. If you are not using S-Video, then all you have to do is select Tuner instead.

The IR-Blaster Pain

The hardware was simple, but getting the codes to work correctly with DishNetwork’s receivers was not cool. I’ll save you the trouble, go to this page to get the details. Follow the instructions to get mythtv-ledxmit working. Our only fix is for the multi-tuner-with-one-irblaster. So here goes.

After much trial and error and google searching, I got the perfect ledxmit.conf file. I set tuners in a stack, in the config file I created two remotes, TOP_TUNER and BOTTOM_TUNER. I think I set the top tuner to personality 9 and the bottom to 5. I honestly don’t remember. That just means you get to do some trial-and-error too :)

Next, I needed a script named /usr/local/bin/tune_dish_tuner that MythTV can use to change the channels. Here it is

#!/bin/sh
TS=`date +"%a %b %H:%M:%S"`
HN=`hostname`
echo "$TS $HN $TUNER_NAME: changing to channel $1" >> /var/log/ledxmitd.log
for digit in $(echo $1 | sed -e 's/./& /g'); do
/usr/local/lirc-ledxmit/bin/ledxmit-irsend SEND_ONCE $TUNER_NAME $digit
sleep 0.2
done
TS=`date +"%a %b %H:%M:%S"`
echo "$TS $HN $TUNER_NAME: sending select" >> /var/log/ledxmitd.log
/usr/local/lirc-ledxmit/bin/ledxmit-irsend SEND_ONCE $TUNER_NAME select
sleep 0.2
/usr/local/lirc-ledxmit/bin/ledxmit-irsend SEND_ONCE $TUNER_NAME cancel

It dumps logs to /var/log/ledxmitd.log just so you know what its doing.

Then I created two scripts also, one for each tuner that call tune_dish_tuner. Here is /usr/local/bin/top_tuner

#!/bin/bash
export PATH=/usr/local/bin:$PATH
export TUNER_NAME=TOP_TUNER
tune_dish_tuner $1

And the /usr/local/bin/bottom_tuner

#!/bin/bash
export PATH=/usr/local/bin:$PATH
export TUNER_NAME=BOTTOM_TUNER
tune_dish_tuner $1

IR BlasterI ordered the IR Blaster, its really a very simple thingy. It worked with no problems. But, with a single transmitter LED, it was a probem.

I had some very nice dual LED transmitters from an old Sony-T60 Tivo (the best Tivo).
Sony Tivo IR So this was a no brainer, I solderd the Tivo LEDs to the IR Blaster and it worked like a charm. Here are the pics.

IR Blaster Serial BackIR Blaster Serial
DVC00909_1.JPGDVC00910_1.JPGDVC00911_1.JPGDVC00913_1.JPGDVC00912_1.JPG

Changing the channels is slow and choppy, you will feel every digit as it’s being sent to the receiver and it sucks.

For a remote control, I used an IR keyboard I found at the office and a $19 learning remote. No lircd mess for me.

Well, that’s it, I hope this helps. I must say I switched over to plain non-digital cable and used the PVR-500 tuners instead, it works MUCH better. The only reason I wanted DishNetwork was because they had Bridges-TV and no one else did. But I couldn’t take it anymore.

Posted in UNIX, Technology, Interesting| 3 Comments | 

Gentoofying OSX

Posted by ahmadster at August 6th, 2006

I’m a clean-system freak, I don’t like junk scattered all over my OS.

Bash and Sudo

Many of the settings here are related to things I want to install later on like Python. Here is my /etc/bashrc

# System-wide .bashrc file for interactive bash(1) shells.

# classify and colorify with ll
alias ll='ls -lahFG'

# Textmaket is my favorite editor
export EDITOR='mate -w'
export LESSEDIT='mate -l %lm %f'

# make apps in /usr/local/bin the default
export PATH=/usr/local/bin:$PATH

# make graphics lib apps also available
export PATH=/usr/local/graphicslibs/bin:$PATH

# make postgresql apps available
export PATH=/usr/local/pgsql/bin:$PATH

# make python apps available
export PATH=/Library/Frameworks/Python.framework/Versions/Current/bin:${PATH}

# things I picked up from gentoo
export TERM=xterm-color
export DISPLAY=:0.0
export LESS='-X -e'
export PAGER=less

# this makes the prompt green when logged in as a normal user, and red when working as root.
# very good, thank you gentoo
if [ `/usr/bin/whoami` = 'root' ]
then
export PS1='[3[01;31m]h [3[01;34m]W $ [3[00m]'
else
export PS1='[3[01;32m]h [3[01;34m]W $ [3[00m]'
fi

# Make bash check it's window size after a process completes
shopt -s checkwinsize

Now close your terminal and start a new one. Time to do sudo.
I hate retyping my password every time I need to do anything useful. So I made sudo not ask me by editing the /etc/sudoers file like this
# visudo
Then I made sure the %admin group had NOPASSWD: ALL like this

%admin ALL=(ALL) NOPASSWD: ALL

*BE VERY CAREFUL. If you mess up this file you cannot do anything as root anymore since sudo will be busted, if that happens there is a quick fix. Reboot and hold Command+s as your machine boots up. You will enter into Single-User mode. There you can mount your drive like this
mount -uw /
That will put you back into your drive and you can fix the /etc/sudoers file again.
You can also run
fsck -yf
while you are in there, if you have something wrong with your drive.

Postfix

Enable postfix as a daemon. Edit /System/Library/LaunchDaemons/org.postfix.master.plist ( see Getting Started with launchd to know what the different locations mean).
You want to remove the “-e 60″ from program arguments. Then add a new boolean key under the root named “OnDemand”. Set it to false. Plist should look like this.

.....
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.postfix.master</string>
<key>Program</key>
<string>/usr/libexec/postfix/master</string>
<key>ProgramArguments</key>
<array>
<string>master</string>
</array>
<key>QueueDirectories</key>
<array>
<string>/var/spool/postfix/maildrop</string>
</array>
<key>OnDemand</key>
<false/>
</dict>
</plist>

Next, go to /etc/postfix and backup the current master.cf. Then copy the master.cf.defaultserver over it.
Do the same with main.cf, but edit main.cf with the setting you like.
Postfix may complain if you don’t have mydomain_fallback set to something in main.cf. Set it to localhost.
Open Console and look at /var/log/mail. Then unload, load, and start postfix

launchctl stop org.postfix.master
launchctl unload /System/Library/LaunchDaemons/org.postfix.master.plist
launchctl load /System/Library/LaunchDaemons/org.postfix.master.plist
launchctl start org.postfix.master

Telnet to port 25 and check it out.

Apache2

Get the latest apache2 you want to install (use your favorite mirror from apache.org).
*IMPORTANT: as of Apr 16th, 2006 httpd-2.2.0 segfaults on MacIntel. Use httpd-2.0.55 instead

curl -O http://www.tux.org/pub/net/apache/dist/httpd/httpd-2.0.55.tar.gz
tar xzfv httpd-2.0.55.tar.gz
cd httpd-2.0.55

Now configure

./configure --prefix=/usr/local/apache2 \
--enable-ssl
--enable-dav \
--enable-dav-fs \
--enable-dav-lock \
--enable-vhost-alias \
--enable-mods-shared=max \
--enable-module=most
make
sudo make install

Next, there are a few small modifications to the config files.
First edit /usr/local/apache2/conf/httpd.conf. Set the user and group to www

User www
Group www

For apache 2.2.0, Un-comment these extra config files

# Server-pool management (MPM specific)
Include conf/extra/httpd-mpm.conf
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
# Distributed authoring and versioning (WebDAV)
Include conf/extra/httpd-dav.conf
# Various default settings
Include conf/extra/httpd-default.conf

You may now modify extra/httpd-vhosts.conf to set all your virtual hosts there.
Now edit extra/httpd-mpm.conf to set the correct pid file location OSX expects

#
# PidFile logs/httpd.pid
PidFile /private/var/run/httpd.pid
#


For apache 2.0.55 do the same as above, but everything is in the httpd.conf file
To make OSX use our new apache instead of the default, we just replace the apachectl file with our new one

cd /usr/bin
mv apachectl apachectl-1.3
ln -s /usr/local/apache2/bin/apachectl apachectl

PHP

What I like about this, is that it does not taint my OSX. It installs clean. I need php 4, if you want php it’s pretty much the same. You can look at PHPMac.com for more info.
Recompile with postgresql, mcrypt, and a few other things. Download the latest php from php.net, untar and use this to configure it:

./configure '--prefix=/usr' \
'--mandir=/usr/share/man' \
'--infodir=/usr/share/info' \
'--disable-dependency-tracking' \
'--with-apxs2=/usr/local/apache2/bin/apxs' \
--with-gd --with-jpeg-dir=/usr/local/graphicslibs \
--with-png-dir=/usr/local/graphicslibs \
'--with-ldap=/usr' '--with-kerberos=/usr' \
'--enable-cli' \
'--with-zlib-dir=/usr' \
'--enable-trans-sid' '--with-xml' \
'--enable-exif' '--enable-ftp' \
'--enable-mbstring' '--enable-mbregex' \
'--enable-dbx' '--enable-sockets' \
'--with-iodbc=/usr' '--with-curl=/usr' \
'--with-config-file-path=/etc' \
'--sysconfdir=/private/etc' '--with-pgsql' \
--with-bz2 --with-dom --with-iconv \
--with-mcrypt --without-msql --without-mssql \
--with-ncurses --disable-cgi --with-openssl \
--enable-sockets --with-zlib

Obviously, these are my preferences, you may add or remove what you like. For me, I needed mcrypt. I had to download libmcrypt-2.5.7 from SourceForge.net: mcrypt and do a normal ./configure && make && sudo make install. PostgreSQL was already installed, so that worked.
Now in the php source directory we
make && sudo make install

PostgreSQL

The best universal and latest postgres I found was Marc Liyanage’s. Again, clean installation into /usr/local/pgsql. Follow the instructions on his site and you will be happy.

Graphics Libs (imagemagick, etc…)

This is also from Kyng Chaos - Mac OS X - UNIX Porting Downloads. Download and install the Graphics Libs, it will install into /usr/local/graphicslibs. Since we already have the path set in our bashrc (see above). We will have all our favorite image tools in the command line.

Python, iPython, wxPython

Python.org now has the latest version of Python available for OSX correctly. Just download and install. The default installation is pretty good, it even comes with readline. Except that I want the rest of the system to use this python by default also. The installation modifies the current users .bash_profile to include the correct python path. I actually keep a very good /etc/bashrc that takes care of that (see above).

To get python to talk to PostgreSQL you need psycopg. It’s version 2 isn’t working yet. But version 1 is pretty good. Download it from PsycopgOne - psycopg - Trac. There are many steps to get to it, but it’s totally doable.
To get there you need mxDateTime from egenix here eGenix.com mx Extensions for Python. Download it and untar it then do

sudo python setup.py install

That will do it.
Now untar psycopg, configure like this

export MACOSX_DEPLOYMENT_TARGET=10.4
./configure \
--with-mxdatetime-includes=\
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/mx/DateTime/mxDateTime \
--with-postgres-libraries=`pg_config --libdir` \
--with-postgres-includes=`pg_config --includedir`

Then make && sudo make install
For iPython, just download and install also as usual

sudo python setup.py install

No problems there since readline is already included with Python.

Posted in UNIX| Comments Off | 

Wifi-Radar Still 2nd Most Popular!

Posted by ahmadster at August 3rd, 2006

wifi-radarWifi-Radar is one of my open source projects I am most proud of. It just hit the spot for me and many other linux folks. I’m glad Brian Elliott Finley is doing a great job.

2nd Most Popular on GnomeFiles.org, 4 years and going :)

Posted in UNIX, Technology| No Comments | 

Satellite view of “heat island” in NYC

Posted by ahmadster at August 3rd, 2006

Satellite images show heat and vegetation in New York City, while the text explains the “heat island” that occurs in cities during the summer.

read more | digg story

Posted in Interesting| No Comments | 

PostgreSQL on OSX

Posted by ahmadster at August 3rd, 2006

PostgresqlFinally there is a solid Universal Binary PostgreSQL 8.X package. I didn’t want to go building it myself and this puppy comes loaded with goodies.

I still think PostgreSQL is the best Open Source DB out there (sorry Mårten, licensing does matter to me).

Grab your copy from here.

Posted in UNIX| No Comments | 

WebObjects

Posted by ahmadster at August 2nd, 2006

WebObjectsI’ve been giving WebObjects a test run. It’s really interesting. While it is built on Java (Yuck!) I can see why the decided to go that way. I love Objective-C very much, but the allure of Java’s portability makes sense. 
Apple is trying to gain market share in the enterprise world, but Apple being Apple, they do things their way. The current push is unimpressive by Apple’s “pushing” standard to say the least. I would expect something more solid when they start shipping Intel XServes.

What am I talking about? check out EOModeller, use it for a few minutes, you will see what I mean. It’s disgusting. I’d rather use TextMate and psql any day.

The neat thing though, is the EOModel’s integration with XCode. Who know’s maybe we’ll take them seriously as a competitor at Etelos.

Posted in UNIX| No Comments | 

The View from My New Office :)

Posted by ahmadster at August 2nd, 2006

Lake DesireLast month we moved Etelos to a new office by Lake Desire, Renton, WA. Check out the view :)

Posted in Interesting| No Comments |