Telman Yusupov’s Blog

(def *inglab*) …

Dealing with CSS problems in IE

without comments

Working on my wife’s website (2011: no longer online as we closed the business) I came across the dreaded problem of making my site work with as many browsers as possible. Unfortunately, this meant dealing with Internet Explorer 6.

Some simple CSS that worked on all browsers (even IE 7) would present some problems in IE 6. Much has been written on the Internet about IE issues and I don’t want to add yet another entry to the long list of existing rants.

Asking users to upgrade the browser is a little bit too dramatic for a spa site. Doing CSS hacks would be a major waste of effort and oh so inelegant. Googling around, I found this wonderful library:

http://code.google.com/p/ie7-js/

From Dean Edwards, the developer of the library:

“IE7 is a JavaScript library to make Microsoft Internet Explorer behave like a standards-compliant browser. It fixes many HTML and CSS issues and makes transparent PNG work correctly under IE5 and IE6.”

In less than a minute, all of my CSS headaches were gone and the site displayed correctly in IE6.

Thanks a lot, Dean for this wonderful piece of software!

Written by Telman Yusupov

September 25th, 2009 at 9:13 pm

Posted in Web Design

Basic Clojure Setup – Part 1: Installing Clojure

without comments

Before We Start
In February 2009, I wrote 3 posts that were meant to help new users with the initial setup of Clojure.

Since then, many things have changed in Clojure world and my posts became quite outdated. There is also much more information available on Clojure than was available in early 2009.

So, I’m consolidating the posts (and removing old comments as they are no longer relevant) keeping only the most basic information that is still valid in 2011.

Even though these instructions are geared towards Mac users, they should work for other Unix-like systems with small (if any) changes. I hope it saves some time to anyone new to Clojure.

1. Get JDK
Clojure runs on JVM, so you will need to download the latest JDK from Sun (for Windows and Linux) or Apple (on OS X).

2. Setup JAR file directory
JAR files are Java libraries that can be used by other Java programs. In effect, Clojure itself is a JAR file run by JVM. It’s important to make sure that Java knows where to find these JAR files on your system.

I found that keeping all of the JARs (or symbolic links to them) in one directory is a great way to keep things organized. So, I’ve created /opt/jars directory for this purpose.

mkdir /opt/jars

3. Configure CLASSPATH variable
Once you have JDK installed, you need to configure the CLASSPATH variable so that your Java installation knows where to look for JAR files to execute. It’s somewhat similar to the regular PATH variable but for Java.

Add the following to your personal profile file (.login or .profile or .bash_login file in my case).

On old JDKs (before 1.6) you had to either list all of the JARs individually (huge pain!) or use something like this script (borrowed from from Eric’s Lispcast blog entry) to build it interactively:


# Build Classpath interactively for earlier versions of Java.
# Assumed JAR file location is /opt/jars directory - change appropriately for yourself
# Make sure to use backquotes (`) on the first line
for i in `ls /opt/jars/*.jar`
do
CLASSPATH=${CLASSPATH}:${i}
done

However, starting with version 1.6 you can specify the directory only without having to list each file individually:

CLASSPATH=/opt/jars/*

Test your CLASSPATH setup to make sure that you see all of your JAR files:

echo $CLASSPATH

4. Get Clojure
Clojure-contrib is the official library for Clojure contributions and has a lot of very useful stuff. You’ll definitely need it!

Head over to http://clojure.org/downloads and download the latest STABLE release of Clojure and Clojure Contrib. Both are available as zip files for download.

Extract clojure.jar from clojure.zip and clojure-contrib-X.Y.Z.jar files from their respective archives into the jar directory that you created in step 2.

Please note that jar for clojure-contrib is located in the “target” directory of the downloaded zip file.

5. Test it!
Go to your command line and try to run Clojure by typing:

java clojure.main

If you have setup everything correctly then you should see Clojure’s prompt:

Clojure
user=>

Try the obligatory Hello World example:

>(println "Hello, Clojure World!")

Output:

Hello, Clojure World!
nil
user=>

6. Better command line interaction
Now you have access to Clojure’s REPL (command line interface), but it’s not very friendly to work with: it has no command history and other goodies that we are used in other shell environments.

There is a utility called JLine that can help us with it. Download it from http://jline.sourceforge.net, unpack it and copy jline-0.9.94.jar (or whatever the latest version is) to your JAR directory (/opt/jars in my case).

Paste this little script into a new file and call it something like clj and save it in a directory that is in your PATH variable:


#!/bin/bash

if [ -z "$1" ]; then
java jline.ConsoleRunner clojure.main
else
java clojure.main $1
fi

Don’t forget to add execute privilege:
chmod +x clj

If you run this script with no arguments, you will have a nice command line access to Clojure. You can also run a Clojure script by passing an argument to this script, i.e.


> echo '(println "Hello, Clojure from script!")' >> hello.clj
> clj hello.clj

Hello, Clojure from script!

Written by Telman Yusupov

February 16th, 2009 at 6:31 pm

Posted in Clojure

Tagged with