Tuesday, October 30, 2007

Oh How I Hate Command Line Tar

It's cuz I'm dyslexic and I always get things backwards. Which comes first? The file I'm trying to create or the one I'm trying to tar up? Here's the answer for future reference.


tar -cf [the file you want to create] [the file(s)/directory(ies) you want to tar]


The "c" stands for "create". The "f" stands for "file" (the default is to pipe the tarred stuff to stdin). You can also turn it into a gzip file in the same go with the letter "z" or into a b-zip file with the letter "j".

Something of note: man tar actually gives useful examples, unlike most man pages which give information but no examples to help the slow of brain (like me).

Here are some examples from the man page as it lives on our office Web servers which are running CentOS Linux:

EXAMPLES
tar -xvf foo.tar
verbosely extract foo.tar

tar -xzf foo.tar.gz
extract gzipped foo.tar.gz

tar -cjf foo.tar.bz2 bar/
create bzipped tar archive of the directory bar called
foo.tar.bz2

tar -xjf foo.tar.bz2 -C bar/
extract bzipped foo.tar.bz2 after changing directory to bar

tar -xzf foo.tar.gz blah.txt
extract the file blah.txt from foo.tar.bz2

Wednesday, October 17, 2007

Fixing Some Little Network Annoyances

To set your IP address for your Ethernet connection and the gateway address for the world outside your local network, run these as root or sudo them...

ifconfig eth0 [ip address]
route add default gw [gateway ip address]

Tuesday, October 9, 2007

No More IFrames!!!

So, you want to pull some information from another site into a Web page, and your fancy-pants AJAX idea won't work because you can't grab data from a different server using xmlhttprequest?

Don't reach for that IFRAME!!! Use Object instead.

<object data="frame.html" type="text/html">
If you can see this line, your browser doesn't properly support w3c standards.
</object>


Here's the low down in the HTML4.1 Spec and the XHTML 2 Spec.

Monday, October 8, 2007

Secure Copy

scp is like cp for copying files only it can securely copy files from one server to another using the ssh protocol. This is a good thing. The bad thing is that I always forget how to write the line, because I'm a ditz that way.

Here's an example of how to copy a file from a local computer to a location on a remote server:
scp index.php user@web2.websites.com:/mysite.com/httpdocs/index.php

Here's an example of how to copy a whole directory from a local computer to a remote server:
scp -r httpdocs/. user@web2.websites.com:/mysite.com/httpdocs/.

Notice the slash dot thing at the end of the directory name. That's so that everything under that directory gets moved. If you don't use the slash dot after the directory name you will end up with the directory inside the other directory (like /mysite.com/httpdocs/httpodocs/...) which is clearly not what I want.

The -r stands for recursive.

Of course, you can find more details about other options that go with scp by typing
man scp
at a linux-ish or unix-ish command prompt.

Most Israeli Web Development Sux

Why? Because they think that it's OK to develop important sites for IE only. Those of us on Linux are outa luck if we want to use a bank website or do anything at a government website or even use half the businesses in this country. It's stupid in the extreme, and if I had my way, I'd line up all the decision makers who thought that this was acceptable and slap them each upside the head one at a time. Since I don't have the opportunity, however, I have two different solutions.

The first is the petition. If you live in Israel, if you read or use Hebrew Websites, or if you ever have to do business with idiotic Israeli-based sites that are written for IE only, go sign this petition. We can hope that in time it will not be necessary to do the second step at all, and we can all live a Microsoft free life if we so choose. Wouldn't that be lovely?

The second thing to do is load IEs4Linux. Then you can run IE on your beautiful Linux machine or Mac when you really, really have to, and live in peace the rest of the time.

Of course, this also means that if you are a Web developer who works on Linux, you can still create sites that are usable for those that choose to use IE. You see, because it's all about freedom, and if one of my customers wants to use IE, that's their business, and I should not get in the way of their ability to spend money at my site just because I don't like their browser. See?

Live and let live. That's what I say.

Sunday, October 7, 2007

Unlocking the adept package db

When Ubuntu's debian-ish package manager whines about a locked package database, try this:

sudo dpkg --configure dpkg


It will return an error, but your db will be unlocked and you can get on with life.