Thunderbird sucks, Claws owns! 7

Posted by Hisham Wed, 02 Jul 2008 01:46:00 GMT

I was setting up my signature file (~/.sig) in Thunderbird today, and I thought to myself, "hmm, let me create a fifo instead, and pipe some output from fortune into it". So I mkfifo'ed ~/.sig and wrote a little perl script to write out my signature into the fifo when Thunderbird asked for it. The script is pretty simple:

#!/usr/bin/perl -w

chdir;
$FIFO = '.sig';

while (1) 
{
    unless (-p $FIFO) 
    {
        unlink $FIFO;
        system('mknod', $FIFO, 'p') 
            && die "can't mknod $FIFO: $!";
    }

    # next line blocks until 
    # there's a reader
    open (FIFO, "> $FIFO") 
    || die "can't write $FIFO: $!";
    print FIFO <<EOF
--
HMB.
(hisham.mardambey\@gmail.com)
Codito Ergo Sum.

EOF
;
    print FIFO `fortune`, "\n";
    close FIFO;
    sleep 5;    # to avoid dup signals
}

The result of which will be:

--
HMB.
(hisham.mardambey@gmail.com)
Codito Ergo Sum.

Guy in chicken costume:  The world is gonna end at midnight tonight. Y2K. 
Peter Griffin:  Y2K? What are you selling, chicken or sex jelly?

And to my amazement, as soon as I fired up Thunderbird and tried to compose a new email, the entire user interface blocked, and my CPU usage went through the roof. A quick check showed that Thunderbird was infinitely reading from the fifo. Son of a ... After some google'ing around, I found this to be a common bug in the 2.x.x series, so I upgraded to 3.x.x, and, they had introduced a "fix". What sort of fix might you ask? Well, I could compose a message alright, except the ~/.sig file wouldn't get read at all. What a fix! If the file is a fifo don't read it? Thats hilarious. At this point, I was fed up, Thunderbird was going away. I remembered another mail client I used to use, Claws. A quick call to emerge installed it, and 2 minutes later, I had it all set up and it was reading my ~/.sig file properly. Claws 1, Thunderbird 0.

Configs 1

Posted by Hisham Mon, 23 Jun 2008 18:44:00 GMT

I added some of my configuration files here. You can take a look at them in the configs page accessible through the menu.

On Tomcat 6.x, Hibernate 3.x, MySQL, and JNDI 2

Posted by Hisham Sun, 06 Jan 2008 00:12:00 GMT

After lots of googling and documentation reading, I got a setup of mine to work properly with Tomcat 6.x, Hibernate 3.x, MySQL, and JNDI datasources. For what its worth, most of the resources on the web regarding setting this up with the versions I specified are worthless. To save myself the future hassle, and the lot of you who might be having a hard time setting this up, here are the configuration files and directives required.
yourapp/web/META-INF/context.xml:
  <Context>
  <Resource name="jdbc/my_app" 
            global="jdbc/my_app"
            auth="Container"
            type="javax.sql.DataSource" 
            username="user"
            password="XXXX"
            driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/my_db_name?autoReconnect=true"
            maxActive="8" 
            maxIdle="4"/>
</Context>

yourapp/web/WEB-INF/web.xml:

...
<resource-ref>
  <description>DB Connection</description>
  <res-ref-name>jdbc/my_app</res-ref-name>
  <res-type>javax.sql.DataSource</res-type>
  <res-auth>Container</res-auth>
</resource-ref>
...

hibernate.cfg.xml:

...
<hibernate-configuration>
  <session-factory>
    <!-- Database connection settings -->
    <property name="connection.datasource">java:comp/env/jdbc/my_app</property>
    <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
    <property name="current_session_context_class">thread</property>
    <mappings here>    
  </session-factory>  
</hibernate-configuration>
...

You can get your session factory as usual:

sessionFactory = new Configuration().configure().buildSessionFactory();
or whichever way you prefer.

Jed config files (Enlightenment style) 1

Posted by Hisham Sat, 30 Jun 2007 09:12:00 GMT

Dale asked me for the Jed configs I use so I decided to put them up here for him (and others) to nab. You basically need to put raster.sl in /usr/share/jed/lib/colors/raster.sl and the other file can be appended to your ~/.jedrc.

ln -s /bin/zsh /bin/bash

Posted by Hisham Thu, 21 Jun 2007 16:39:00 GMT

So I finally decided to give Zsh a try. I spent some time customizing my .zshrc, fixed the prompt, got everything the way I like it, and I must say, its pretty nifty. The auto-completion is very well done, and I certainly do prefer it over Bash's. If you havent taken the time to look into it yet, I suggest you do.