Archive for July, 2007

Installing LaTeX on Ubuntu

Thursday, July 12th, 2007

I guess LaTeX isn’t included with Ubuntu, at least not for Dapper. I was kind of dissapointed to see:

chiefinnovator@blackpearl:~/$ latex
bash: latex: command not found

So I tried to install it:
chiefinnovator@blackpearl:~/$ sudo apt-get install latex
Password:
Reading package lists... Done
Building dependency tree... Done
Package latex is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
tetex-extra tetex-base
E: Package latex has no installation candidate

But that didn’t work either. At this point I should have read the end of that error message instead of searching since it does say the answer. Instead I found this helpful Ubuntu Wiki page saying the same thing but in more friendly detail.

So the answer is:
chiefinnovator@blackpearl:~/$ sudo apt-get install tetex-base tetex-bin

Workaround for – You Can’t Set onClick Attribute in IE (Javascript)

Wednesday, July 11th, 2007

It took me nigh near forever to figure out why this javascript code was working in EVERY browser but internet explorer:

var newlink = document.createElement('a');
newlink.setAttribute('href','#');
newlink.setAttribute('onClick','alert("clicked link");return false;');

Meaning once I put that new link on a page, and clicked it, nothing happened!

Well it turns out that IE’s setAttribute() method does not allow “onclick” to be defined.

Here’s the fix I ended up doing and it now works in all browsers I’ve tested.

var newlink = document.createElement('a');
newlink.setAttribute('href','#');
newlink["onclick"] = new Function("preview();return false;");

The Secret of Using Temp Tables in a DTS Transform Task

Wednesday, July 11th, 2007

Say you want to take one of your static tables and flip it upside down and backwards by using a temp table, then export it to some file or something using SQL Server 2000’s DTS.

I’m not sure how often this is actually useful, because the reason I have to do this is because i have a 60+ field table that we call a database that has 6 fields that really should be one 2 fields (id & data field) in an another table.

Trick #1
You can’t use a regular temp table. You have to use a global temp table. You can create these just the same as a regular temp table, but you need to use two number signs. oooh, fancy.

--Create a regular temp table
CREATE TABLE #RegularTemp (Column1 varchar(5))
--Create a global temp table
CREATE TABLE ##GlobalTemp (Column1 varchar(5))

Put all your create statements in a SQL Task and then populate the table. This also works if you’re doing a “SELECT INTO” statement.

It’s also a good idea to put a preliminary SQL task to check for the existence of the temp table in case the table already exists when the package is run. That would look something like this

--Check for temp table and delete if it exists
IF object_id('##GlobalTemp') IS NOT NULL
BEGIN
DROP TABLE ##GlobalTemp
END

WARNING: Running this from Query Analyzer won’t work, because you have to name the DB as in…. object_id(tempdb..##GlobalVariable). But that syntax won’t work in DTS, you have to NOT name the database.

Trick #2
This was the hard part to figure out. The DTS Transform task won’t populate the column names or types unless it can find the table somewhere. You can get around this by going to Query Analyzer and creating the temp table. Then return to the DTS package creator, Put in your SELECT * FROM ##GlobalTemp in the Source Query for the Data Transform Task, then move to the Destination tab. Click Define Columns (might not be necessary), Populate from Source, Execute, and you should be set!

What is an Al-Ghirayri or Al-Girta

Wednesday, July 11th, 2007

This strange article “Giant badgers terrorise Iraqi port city” says that these giant man-eating badgers are known as Al-Ghirayri and locally as Al-Girta. I did a search for that name and turned up nothing. Shame, I really wanted to see a picture of man-eating badger.

Al-Ghirayri or Al-Girta maybe
(just a regular badger I guess)

Here’s some progress towards an answer. The folks in the comments on the Digg article of this suggest that this is a video of one of the beasts. And here is a the Wikipedia entry on your standard Honey badger (maybe the same thing?).

Using MySQLDump When Your Password Has an Ampersand

Thursday, July 5th, 2007


Apparently Bash doesn’t like ampersands (&) within your commands. So when I tried to run Mysqldump with my new password with an ampersand I got this dumb error:
mysqldump -uusername -ppass&word --host=elite.db --add-drop-database --add-drop-table --hex-blob --all-databases

-bash: word: command not found
Usage: mysqldump [OPTIONS] database [tables]
OR mysqldump [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...]
OR mysqldump [OPTIONS] --all-databases [OPTIONS]
For more options, use mysqldump --help

Anyway, the trick (as I graciously learned here) is to use the longer --password option and to enclose the password in escaped quotes as so:
mysqldump -uusername --password=\"pass&word\" --host=elite.db --add-drop-database --add-drop-table --hex-blob --all-databases