Archive for March, 2008

Passing By Reference

Monday, March 31st, 2008

Today I had an awkward thought as I walked out of the bathroom at work today. I went down to the second floor because the third floor is under construction, but the bathrooms look exactly the same. This got me thinking that it would be funny if the bathrooms _were_ exactly the same, and depending on which door you went through, it’d be like warping from any current point you’re at, to the same bathroom; a pass by reference if you will.

This got me thinking about some of the things in life that we wouldn’t want to pass by reference (assuming we could).

Bathrooms

Imagine how crowded they’d get. Sure you’d save on building costs, but you’d pay for it with customers standing around pinching their knees together. Bad news.

Restaurants

Think of Portillo’s during lunchtime. Now think of all the portillo’s in your state pointing to the same one Portillo’s. Can you say “waiting for the rest of eternity at the drive through” ?

Significant Others

We don’t need to stew on this one too long, we already know it’s bad news. Cool in theory, problematic in implementation ;-)

Drop a comment if you’ve got some other good ones.

In other news I paid off my credit card! wooooo! … … …poor!

I have 1 other card to pay off, but it has 0% interest right now, so I’m not in a big hurry. The other card had 9% and had a balance of 1000+ on it so it was high time I started cutting it down. I’ve lived more-or-less off of debit the last couple months. It’s less difficult than I thought it would be, but it does take quite a bit of self control not to go on frivolous shopping sprees with people like Joe. Don’t worry Joe, you’re still cool.

I won a fleece sweater today at work (random). I was apparently drawn at random from the safety database that is on site. Ok, whatever. It’s really warm though, and I needed something like this for motorcycle during cold days. Hoorah!

Finally I ran into a small coding problem that I guess I didn’t think would be a problem. MDB2 and PEAR Date recently updated themselves. I’ve made some custom additions to each of them, so immediately I was like “oh crap, I need to port changes”. The problem is that both libraries have changed quite a bit since the last time I downloaded them. Come to think of it, I don’t even know which versions I’m using any more.

I thought about the difficulty that was going to be involved in porting them, then I quickly became depressed by the sheer volume of work, then I got an idea, and now I’ve skirted the problem.

Inheritance. Win.

I figured well, I have these Date and MDB2 classes, why not just extend them and then override the methods with my own. I can call the parent methods if need be. What a novel concept. I quickly did this with the Date class and now I can upgrade the core libraries willy-nilly. The MDB2 package is next, although I don’t think it will be terribly complicated to do. It mainly involves extending some postgres libraries, so I’ll probably resort to making a pgsql2 protocol and extending the original pgsql (sounds more difficult than it actually is).

So yeah, lots of stuff happened today, and furlough paycheck is : (

Tez Tomorrow

Sunday, March 30th, 2008

I feel really bad about not putting the effort in to fixing tez’s problem with nessquik. I’ve been engrossed in the netflow app and other small things and nessquik has been put on hold since then. I’ve decided to focus on his problem tomorrow.

I started Blue Dragon today; awesome game! It’s everything I like in an RPG. I was kinda thinking it was going to be crap because I’m really sick and tired of the DBZ-like characters. But the plot if fun and there are new ways of battle that feel fresh while at the same time maintaining the good-old FF type of gameplay.

I also got back in to Bioshock this weekend. The game really is crazy cool when you get further into it. My problem was that I got frustrated with it and reloaded from my last save point…which was 2 hours ago. Doh! I solo’d one of the big daddy’s and got my ass handed to me. Oh well, cool game none-the-less.

I’ve equipped my kitchen with a knife set and a hand mixer. I really wanted cookie dough tonight and didn’t have a mixer. Well, now I do :-)

Subprime Funny

Saturday, March 29th, 2008

My dad passed along this little bit-o-happiness summing up the subprime mortgage mess. Enjoy.

subprime mortgage mess

Whoops

Friday, March 28th, 2008

I fat fingered a rm command the other day and sent several chunks of code into the ether. Normally this wouldn’t a problem because of subversion…except I had been lazy recently and forgot to commit changes; double whoops.

Anyways, I’m kinda sorta recovered from it.

Sexy Gams

Wednesday, March 26th, 2008

Can be had by playing DDR.

I’ve got both games for Xbox and just beat the 2nd one so I’m going back to play the first. I like the 2nd one more than the first.

Today I gave a presentation at Illinois Institute of Technology for their NetSecure 08 conference. It’s a local thing that they do every year, and while I wouldn’t consider some of the people who attend, the uber cream of the computing crop, it’s an interesting and informative conference that I get a lot of value out of each year.

Joe says I need to lighten up on things that I’ve failed at in life. Ok, that’s putting it kinda harsh, but he thinks I tend to make the worst of any bad situation. I guess I can agree with that. I put myself under unnecessary stress and grief when I don’t accomplish something because I can’t stand people who can’t seem to get anything accomplished.

I need a hobby. I come home and have nothing to do and it’s starting to get depressing. That, coupled with the dimming situation at work is just making things worse.

And I don’t like computers any more because of simmer.

Ohh regex you naughty naughty boy you

Thursday, March 20th, 2008

So at work today I needed to revisit a regular expression that I often need, but often can’t get to work right. It looks like this when done correctly.

[^"]*

It says give me everything between a set of quotes. For instance the string [ "this is" not captured "but this is" ] returns a list that has “this is” and “but this is” in it.

I was going about it all wrong trying to make .* work for me but quantifiers are greedy. I heavily thank this page for showing a correct example (see the Pitfalls section)

In other news I had to do some reverse name lookups with a lot of IPs recently. I had a script that did it sequentially, where I would give it roughly 50,000 addresses and it would take a bit long to resolve them. Well, I had to do upwards of 6 million an hour, and 50k here and there just wasn’t cutting it.

I thought about maybe forking multiple processes of 50k, but that because error prone because each of these IPs is a unique record, so I would have needed to select 50k or so, mark them as being “in progress” and then move on. They’re not in a format that has any sort of indexes on them for quick selection, so to sequentially scan that many would take a while and I would very likely be repeating many resolutions.

Anyways, I looked around Google and found a blog where a Michael Schurter had been faced with a similar (albeit smaller) problem. He had to do around 3000. I needed to do around 100,000 every couple seconds.

I used his examples and got it working for my own data. I was doing reverse lookups is the only real difference. I must say, python-adns does exactly what it is advertised to do. My results closely mirror his. I resolved ~660,000 IPs to their DNS name in ~2 min and 30 seconds. Compare that to the multiple hours it _was_ taking going at 50,000 every so often.

It’s so fast/parallel that I brought the DNS server down, so we resorted to using a local caching server on the host doing the resolving. That made things sane again. Well, I just wanted to plug python-adns and Mike for having a great post that really helped me out.

Business. Not Family

Monday, March 17th, 2008

Cry me a river mac people.

So Splunk 3.2 is really pissing me off. For the life of me I can’t figure out how to use the REST API. There’s something (ok a lot of things) that the online documentation just doesn’t tell you. I figured the syntax to create a new search would be similar (said identical) to how you use it in the Web UI…but it isn’t. The documentation on the site is literally starved for examples. I’d like to know how exactly they’re using the query parameters they describe, because I’ve used just about every incantation I can think of, and my searches don’t return didly squat.

You could say I’m very frustrated. I need to have it ready for a potential dire need at work and frankly it doesn’t look like it’s going to be ready. I don’t think Splunk is using their own REST API in their product either. The reason I say that is all the requests to /v3/ in 3.2. Didn’t you guys say that was deprecated?

Undo what you’ve done

Tuesday, March 11th, 2008

I tend to hate time with respect to programming. It always sucks when you have to dick around with timezones and daylight savings-this-and-that. Well, when a library uses functions that alter your environment, things tend to suck more.

Case in point, the PEAR Date class. It has two really cool functions called “after” and “before” that you can use to see if one date is after or before another date. Cool.

Well, the first problem was that the function alters your existing objects…so you don’t have your original object after you use either function. Gay.

Ok, I fixed that. The next problem had to do with the way that the function compares the times. It converts both of them to UTC and then does the comparison. Ok, that all is fine and dandy…when you dont use the PHP “putenv” function to do that.

See, putenv modifies the environment that the script is running in. In this particular case, it sets an environment variable, TZ, to UTC…but it doesn’t unset it. It assumes that the script execution will stop and putenv will restore the original value (which it will _if_ script execution stops).

In my case though script execution continues (this is a daemon). So it modifies the environment, changes my timezone from America/Chicago to UTC. And then all future time calculations are like 6 hours off. Way to go.

I fixed that too (I consider it a bug; dont touch my environment unless you untouch it).

With those 2 problems fixed, the Date class has mildly restored my confidence in it. I’ve made numerous other fixes and enhancements to the class and posted updated copies of the class on my work page in case you’re interested. Apparently it’s not maintained anymore? I dunno.

When is furlough over?

Friday, March 7th, 2008

No, seriously, when is it over? I need to tell Joe something but I guess I can’t because that would be considered work.

Ok, I have a grand idea. I’ll blog about it, and then hope that he reads the blog in time.

In the event that he does, here are a list of things that Joe has not been doing while I’m away.

  • unmapped application alerts from nagios are going to cst-admin
  • scratch partition on roaster is almost full (goodbye splunk ngreps when it reaches 100%)
  • netflow partition on roaster is almost full (adios netflow from datacom)
  • I’ll bet Joe hasn’t done the 1 thing I asked him to do while I was gone. Remember what it was Joe?

So if Joe happens to stop by and read this post before things blow up, then great! Maybe he’ll fix them! If not, well, I guess they’ll be waiting to be fixed on Monday because I know noone else will fix them; only Joe and I can make things work.

Wait! I’m Batman!

Thursday, March 6th, 2008

I’ve been in Ft Wayne visiting professors and friends I knew during college. Marty has offloaded a ton of sci-fi books on me to read (yay!) looks like I’ll need some more furlough…oh wait, that shouldn’t be a problem now should it.