Archive for December, 2004

Annoyance: ID Fields in SQL dabase tables 5

You know what annoys me slighty? Let me tell you.

Assume you have a database table; let's call it tblFriends. Next assume this table has two columns, ID (which is of type autoincrement integer) and Name which is of type string/varchar/text. It stores a list of your friends, and each of them have a unique ID, which would be the primary key.

It would annoy me if you named the fields FriendID and FriendName. I assume that tblFriends.ID is the ID; it doesn't need to be tblFriends.FriendID. It's more common to see the ID field named stupidly, but both are equally unnecessary.

This annoys me slightly.

Moveable type default <img> properties 0

When I have an image in a story on lambie.org, I always use the same formating: I force no border around the image, I have it on the left, and give it a 10 pixel border on the right between it and the story text.

I should change Moveable Type's code to do this for me each time. That would be smart.

I really seem to be an efficiency-improving mindset at the moment. See below for proof.

Associations in my mind 0

Screenshot.jpgI've had a good idea, and I want to 'blog it before it falls out of my head.

Exhibit A (to the left/above) is a screenshot of my desktop, as of about 20 minutes ago. I'm guessing, but the time in the top left will tell you exactly, if you're picky. You'll notice that Rachel Bilson is my desktop wallpaper, and that I have a shell open with Britney Spears as its background - this last part is important. You will also notice that I have several other shells open within that one window. This is called "tabbing" and I find it's an effective way to minimize the number of running programs.

If you're using Firefox, try hitting CTRL-t now and you'll see it opens a new tab within the same browser. Incidently, middle-clicking (if you have a scroll-wheel that clicks down like a button - try it) will open the link in a new tab, which makes reading news stories online, and following their links later really simple. But I digress.

When I start my day programming, I normally open a shell, then open three of four other tabs. Then in each tab I SSH (connect) to prime, our server. Then I login with my password. Then I sudo su username to change to the user that I'm working as. For example, I've changed to "webpilot" for this recent project - I assume that client's identity. Then I'll normally start work. I have to repeat this procedure for each shell that I've opened. It's not hard work, but it's repetetive, and Computer Scientists don't like that, do we? Can I get a hooah? Good, then I'll continue.

The terminal shell I'm using supports different profiles, which means I can change features like the wallpaper in that tab, the text colours (do I want white on black, or black on white, or green on black, etc.) and what is displayed in the tab title. This is good because I have set up two profiles so far: Rachel and Britney. You'll see Britney has "MySQL" before her name, because she's the lucky lady that gets to have my connection to the database "in her".

Each shell normally has a different purpose: I'll have a database connection open in one to interact with the database, I'll have a few vim windows open to edit the files, and I might have another monitoring log files for example, or compiling the application as I fix bugs (not that I compile much anymore - web programming doesn't need this step).

So, each girl will have her own purpose. Like I said, Britney's my database babe, and Rachel seems to be the "default" profile. I'll get more profiles made later.

Now, this is where it gets real good. I can pass in paramters to the gnome-terminal application when I start it, meaning that I can say "don't just open one window, open it and then launch two Rachels, a Britney, a Kylie and a Maggie, and in the Rachels connect to prime and login as me, change to user X and go to their public_html folder, and in the Britney tab connect to prime and login as me and change to user X and connect to MySQL user user X with password Y,and in Kylie..." so on.

I'd then link this (huge) series of steps to a single icon on the launcher bar. One-click and I'd "be at work" ready. Sounds more like it, right?

"Hooah!"

Now I've really got something to play with over the Christmas break. If I can't "script" the solution, I can always download the source to gnome-terminal and modify it to work the way I want, which would involve adding a dialog box that requests some information, like the user that I want to change to, their database username and password and other such details. I could even have a drop-down menu with a list of clients, and store their credentials locally (securely, of course) and the "type" of window configuration I would want to launch (do I want two Rachels and a Britney, or three Maggies for example).

Thinking out aloud, I could even write this handler as a seperate launcher that determines the list of parameters to pass into gnome-terminal. I wonder if I could really simplify this and have Firefox launch a local application? I don't think it would out of the box, but maybe I could do some panel beating there?

Either way, I'm excited at the prospect of knocking out the 60 seconds of repetition that I do at the start of every day.

What a brain-dump!

Edit: 24/12/2004 - 3:40AM
Considering how unstable my ADSL has become over the last few months, this would be even handier. It's bad enough going through the motions at the start of the day, let alone repeating it later when the net drops out.

Though, Steve's wireless might fix all of these issues ;)

Image manipulation with PHP and GD2 0

If you ever find yourself doing image manipulation with PHP, be sure to use a true colour image as the target when using imagecopyresized() as it doesn't mess the colour palette up. This means you're not restricted to 256 colours, which can look really, really crap.

Note that the manual page for imagecreatetruecolour() doesn't mention its superiority over imagecreate(), but imagecreate's page mentions its inferiority.

Stay on Target! Stay on Target! 2

I read an article about Ritalin and the effects it can have on attention span and concentration. It's mid-afternoon, and I'm begining to waver. Admittedly, I've been coding a fair bit the last few days, though not as much as I was a month ago - 52 hours in a 72 hour period!

I wonder if I have some kind of condition, or if it's the boring, repetitive work that I'm doing at the moment that is really getting me down? Withered in the past has said he thinks it's that. I know taking dexamphetamine (medication often given to children with ADD/ADHD) has in the past given me greater concentration (mum, if you're reading this, it's a common practice among uni students, and no, I'm not addicted ;) Further evidence that this might be the case is that if I'm really interested in a topic I can spend hours on it without any problem.

Or am I just pushing myself too hard? I mean, I wouldn't care if I was working for someone else and didn't feel that I was giving 100% towards the end of the day. Adam and I have talked about how if we're not "in the mood" for working, there's no point sitting at the keyboard just to plug away at a reduced efficiency. It's a nice idea, and actually makes sense, but doesn't help with ever pressing deadlines.

I have a book that I bought a few weeks back about Smart Drugs, so I might read a bit over the Christmas break.

<adds to list of things to do over Christmas>

The irony is I got distracted for a few minutes reading an article about medication that prevents you from allowing external distractions to take over :)

« Previous PageNext Page »