Archive for November, 2005

Oh yeah…I almost forgot

In addition to my rant below…

A coworker today (an Ubuntu user) was trying to use the Gnu tool ’sort’. ’sort’ has a switch to ignore case, but we didn’t want it to ignore case (in essense, preserve case, or asciibetical) So that it would sort words based on the alphabet, but put the capitilized letters in order and then the lowercase words in order. Like:

Alpha
Beta
alpha
beta

However ’sort’ relies on your LC env vars. From the man page:


***  WARNING  *** The locale specified by the environment affects sort order.  Set LC_ALL=C to get the traditional sort order that uses native byte values.

In other words, if your distro sets the LC vars to use UTF8 for internationization, it will break sort. That is all well and good and I am a fan of being international. But christ man, you broke sort!! Gentoo however uses “POSIX” for it’s LC settings, thus preserving ASCII, and that is what I want. No more no less. I WANT MY ASCIIBETICAL SORT!!

So you prolly think I am a Neanderthal because I want sort to work, and you might be right, but remember this:

I don’t care.

***EDIT*** Appearently, according to Mark the LC part that matters is ‘en’ not UTF8. ***EDIT***

Ubuntu

As soon as I get a free weekend here I am going back to Gentoo. I have given Ubuntu what I consider a fair shake and it just doesn’t live up to the hype. It does do some things for you that are nice. Binary installs are faster, install is faster (and I do like to start fresh now and again, since old installs get krufty, and I hate that, it grates on me). However, it’s just not enough. Portage is king. There is no substitute.

apt-get.org is all well and good, but monodevelop has seen 2 (count ‘em, 2) releases and I have seen no move on the repositories, while Gentoo has .9 in masked. I tried to install JDE today, didn’t work, it installed emacs and half way through it died on me. Sorry. Not. Good. Enough. If I am gonna install stuff from source and fight to get new stuff, I am gonna do it with the best package management system there is.

No offense to Ubuntu fans, it really is a good distro. However I am a big fan of Gentoo, and I haven’t gained enough in the plus column to stay with apt and Ubuntu.

mmmmm, stack overflow

tomcat again

quick and dirty…that’s how I like it. Continually stopping and starting tomcat is a pain, as I have said before. ctrl+r makes it a little more bearable b/c I can recall the shutdown.sh script. But, better still (and why it took me till today to do this I have no idea).


ln -s /opt/tomcat5/bin/startup.sh  /usr/bin/tomstart
ln -s /opt/tomcat5/bin/shutdown.sh  /usr/bin/tomstop

kalarm

While I am not a big fan of QT based apps, I installed KAlarm today. My main problem is that I don’t often realize how much time I have been using the computer and time flys by and then I don’t accomplish things. However with this program today I was able to get about 5 loads of laundry and my grocery shopping done. It was suprising to see how fast an hour goes by when coding :) Or just chatting on IRC.

Distros

I have to wonder if people that develop for one distro ever try another? It would seem that they do not. No wonder there are so many.

AFAICT Debian’s init system hasn’t changed in 100 years. It’s essentially a series of directories with symlinks to the /etc/init.d scripts. To disable them you can either take away the executable bit or at your discretion unlink them. Gentoos init system using various tools like rc-update is elegant and easy to use.

I am not saying that Gentoo does everything right, I found it to be annoying from time to time as well.

**queue dream sequence**
“If I had a distro I would seek to take the best parts of all the distros and make an uber distro”
**end**

Seriously though, there may even be a better way than the way gentoo handles it. ( and to be fair there is probably some gnome GUI tool in Ubuntu to handle this, but who uses Gnome?!? ) And this “Not invented here” crap is lame.

10 Things

As I was driving home tonite from dinner with Eric, I was thinking…what 10 things should every linux admin know. I am not going to qualify each one with the statement “in my opinion”…it is implied.

I came up with these:

1. Scripting
Every linux admin ought to know enough scripting to automate repetative tasks. You have 2 choices, learn Shell/Sed/Awk or Perl.

2. Vi(m)
Stop complaing. Every linux admin worth his salt ought to be able to use Vi (or alternatively ViM). It will be on every *NIX machine you ever log into, you don’t have to be a wiz at it, but you should have basic Vi editing skills.

3. Databases
You don’t have to be a DBA, but you should know enough to query a RDBMS from the command line to see how it is doing what it is doing. You should also know enough so that you can set up an application that uses a DB for the backend.

4. ssh (and redirects)
You should know how to use ssh, and redirects for tunneling other applications. Hopefully (unless there is a reason for it) the admin at the other end has every port closed but 22. At 2 am when you are remote from your boxes you will still be able to look at your LDAP server.

5. Keyboard shortcuts
Not just ones for the shell either. You should learn the keybindings for any application you use at least weekly. It will make you more efficent.

6. Compile C apps
You don’t have to know how to write C, but in the event that there is neither a README or an INSTALL file, you should know “./configure && make && make install”.

7. Look at logs
Before you utter a word upon failure of an application, look at the logs. Chances are the answer is right there waiting.

8. Generosity/Humility
If someone asks, tell them everything you know about a particular subject. Conversley, when in the company of someone who knows more than you, ask enough questions to learn what search terms will be needed later to learn about that subject.

9. Read
RTFM is some of the worst advice I have ever heard. Man pages are not for study they are for reference so you don’t have to hold all the switches and conf file locations and syntax in your head. Buy books, lots of them, and read them.

10. Open things
One of the things that helps me tackle tough problems is taking a really good look. Open the conf files, open the code and take a look. Sometimes a conf file comment is all you need to win through and make something work, don’t just fill in values and expect programs to start. If it’s not clear at first, that’s ok…it’s nothing staring at it till you cry won’t fix.

…think I missed one or got one wrong? That is what the comments are for :)

d0llartree1nc

I guess the people that set up the dollar tree’s AP where 1337 Hax0rz.

So wrong

There have to be much better ways to do this :)

netstat –numeric-ports -lp | grep :80 | awk -F” ” ‘{print $7}’ | awk -F\/ ‘{print $2}’ | sudo xargs killall -9 && sudo /etc/init.d/apache2 start

Oracle script

A coworker gave me this script and it rules:


set pause off
set echo off
set scan on
set verify off
set pagesize 0
set feedback off
set recsep off
set termout off
spool drop_&1._objects.sql
select 'spool drop_&1._objects.log'
from dual
/
select 'drop ' || object_type || ' ' || owner || '.' || object_name
      || decode(object_type,
                     'CLUSTER', ' including tables cascade constraints;',
                     'TABLE', ' cascade constraints;',
                     ';')
from dba_objects
where owner = upper('&1')
  and object_type in ('CLUSTER', 'TABLE', 'VIEW', 'SEQUENCE', 'SYNONYM',
                      'FUNCTION',
                      'PROCEDURE', 'PACKAGE')
/
select 'spool off'
from dual
/
spool off
set feedback on
set pagesize 24
set termout on
prompt Run @drop_&1._objects to drop &1's objects ...

Run that in sqlplus and it will output another script that will drop all your sequences and tables in a DB,. Very handy for development. Don’t forget to have a dump of data incase you need to get back to where you were :)

Next Page »