Index syndication
comment syndication

Archive for October, 2007

Perl while loop memory hog

I was trying to use someone elses script for logging dansguardian events to an RDBMS.The script was chewing up 99% of my CPU! I got chatting to a friend and a perl coder about this, and got some ideas. He showed me about the perl debugger using the -d switch. Awesome. I finally got my perl script working. Installing the DBI package on OpenBSD was a snap with pkg_add (pkg_add -v p5-DBD-Pg-1.47.tgz). My logical debugging was as follows.

first I read that DBI was a memory hog so I wrote it out and put in a native postgres call, but the pgsql for perl was borked.
(comment from coding friend “DBI is fine man, works for the massess”). Next I changed the while loop over the the file to a Tail::File method, but the module was badly documenting and had issues.

I actually ended up using IO::File to tail the log and looped over the lines (in a mad loop), but it was still broken.
So I went back to DBI, which as my friend pointed out was never a problem. It worked!

It turned out the loop was the CPU hog and all I had to do was put in a sleep 1; if there was no new line in the tail.
In the process I rewrote the whole script and it barely resembles the original except for the idea. Now it has 0.5% CPU load at best. A win for coding. I’ll post the script soon and also send it to dansguardian.

Comment from perl coding friend: of course - i guessed that after u left. :-)

Gmail gets IMAP - for some

According to the Download Squad Google’s Gmail has just integrated IMAP. This in conjunction with the recent storage space is the second big thing for google in the mail arena in recent days. I applaud them for this move as the POP3 access they previously offered was great for desktop PC’s but difficult for mobile devices.
I can confirm that it appears to be only in select accounts, because as of now, I still only have POP access.

read more | digg story

Power issues - OpenBSD failover?

Having had aircon installed today, my headless web server did not recover from the scheduled power outage. It was stuck in a stupid “Press F1 to Boot” screen, and as such Tech Debug was down for the majority of the day. Now I have it all back online it is time to consider two things:

  • A UPS
  • A secondary Web/DB server running OpenBSD

Does anyone know they best way to have a failover apache+mysql+postgres OpenBSD server?

Quicksilver Web Searching

Daniel Miessler discusses the benefit of using Quicksilver, one of the mandatory mac applications, for searching the web - instead of using your browser. So you are in any app and you want to search for something online? Use Quicksilver. I blog from Textmate, so if I need to search for something on google (or elsewhere) - Quicksilver does it for me.

Its a very simple process to use as described by Daniel on his blog entry. What I will show here is how easy it is to enable the built in Quicksilver Web Searches. I will assume you have already installed Quicksilver.

  1. First launch quicksilver with your defined trigger
    Qs Search 1
  2. Press Command (⌘) + comma to open your quicksilver preferences, then select the Catalog Icon
    Qs Search 2
  3. From the Catalog window, tick the box against the “Web Searches” row, and then press the Refresh ButtonQs Search 3
  4. The number of catalog entries for the web searches should be some number greater than zero
    Qs Search 4
    You can now close the quicksilver window
  5. Launch quicksilver with your defined trigger, and type the name of a search engine in, i.e. wikipedia - tab through to the third field and type in your search text - press Enter - Et Voilà!
    Qs Search 5

You can try these example keywords when launching your quicksilver window: youtube, wikipedia, google, amazon and there are many more to try!

Gmail goes to 4GB

I was logged into Gmail today and noticed it states You are currently using 92 MB (2%) of your 4044 MB. This is close to a doubling of the email capacity for normal accounts. I’m not sure if this applies to all users, or gets applied progressively, but it is a fantastic number to see at the bottom of your inbox.

In comparison, Windows live (aka hotmail) offers 1GB to their users, albeit in the form of a “Skydrive. Skydrive is an online storage space.

Correction: Thanks to Taylor’s comment, I do note that as a Windows live user my inbox shows 5GB of space available. Methinks Microsoft are playing catchup! Too little too late? We shall see, as both services are still the most popular (where are you yahoo!)

As detailed in the comments, Microsoft were actually offering Windows Live users more than Gmail sometime over 2 months ago. As I use Gmail primarily it slipped by my radar.

As I use both, I may review them in detail sometime.

Next entries »