Archive for August, 2007

Support Mozilla!

Friday, August 31st, 2007

Many people use Mozilla, and I would daresay most of them don’t think about all the time and effort that goes into a piece of software. Well they should! Don’t forget, Mozilla is provided at no charge for the betterment of the Internet!

So please, support Mozilla by purchasing some really awesome Mozilla gear like:
Use Open Standards!

and:
Polo

And if you haven’t used Firefox before, you should give it a try!

Cron Fails - Max Run Limit

Thursday, August 30th, 2007

Wow it’s been a long week. Thank goodness I have tomorrow off.

My crontab exploded. It really sucked, since many of our process rely on it -_- So I thought I’d document alittle about some cron subtleties, especially since they aren’t too well documented in other places.

First, new golden rule:
Don’t let regular users have a cron!
Because if they write bad scripts, they WILL cause the cron to break.

For those that don’t know, the cron in a UNIX machine is a service that runs applications in a users crontab (schedule of programs that need to be run) based on the time. Every minute it checks all of the crontabs on the system, and sees if anything needs to be run.

What I didn’t know, is that cron has a max queue. If that max is hit, it will first attempt to reschedule the jobs, but will continue to do them in order. Most cron setups don’t set a maximum, so the default is used, which is 100. That’s alot of processes, so it’s usually not a problem.

But when there is a problem, like if a program that is cron’d fails to close, and is set to run every minute, it will saturate that queue rather quickly. This is unfortunate, because it’s very hard to figure out that it’s the cron that is the problem. In my case, news of scripts not running slowly trickled in, but manually running the script cleared the problem, and is easily shrugged off. “Must have been a script error first time, oh well!”.

You can set the queue max in the queuedefs file (usually in the /etc/cron.d directory. This is a rather cryptic file that looks like this:

#
#
a.4j1n
b.2j2n90w

It’s pretty simple though. The “a” line stands for at. An at runs several jobs immediately, and with a normal priority. 4j means 4 jobs can run simultaniously, and 1n means they will have a “nice” of 1. A nice is a priority number, and 1 usually stands for “normal”.

The b stands for batch. It runs commands 2 at a time with a nice of 2. The 90w means that it waits 90 seconds in between every 2 jobs. It’s alot like an at job, but runs with less priority, and less process at a time.

These lines can usually be ignored, because the defaults work fine, and are seldom changed.

Back to the max queue. You can add a c line at the bottom, and it stands for “count” (or as the man says, the default queue). This is the maximum amount of commands that can be running by cron at any time.

I left my cron the way it is though. The default is more than enough, and while crontab dieing seems bad, a server that seizes because too many processes get started is MUCH worse IMHO. Monitoring is good, if you have important crons that you want to know are being run. Unfortunately, you usually use cron to run check scripts :) If you have a monitoring suite, you can use the log file to check for errors. The error that accompanies the queue maxing out is: “! c queue max run limit reached“. It’s owned by root, so keep that in mind. I wouldn’t recommend changing it’s permissions, it’s a highly sensitive file, and can give a hacker the info he needs to compromise a system VERY quickly.

Of course, you could always setup cron to send you and email every minute.

If they stop coming, well…. you know it’s not working!

Fun fact, there’s 525,600 minutes in a year. :) Cheers!

JBoss… We Meet Again

Wednesday, August 22nd, 2007

I’ll admit, I hate Java. It’s not that it’s bad in principle. Conceptually, it’s genius. Write one piece of code, run it on anything! Cellphone, Sparc, x86, RISC, Commodore. It just doesn’t work out that way in reality. First, even with the virtual machine, the compatibility doesn’t work. Actually, it’s more annoying because it’s suppose to be portable!

Also, as I believe John Carmack once said, Java takes a nice program and makes it run 100 times slower than it should. We just got a new CMS at work, which will remain unnamed for now. It does everything I could ask a CMS to do. Actually, it kinda resembles an uber CVS system. It manages versions of files, then pushes the files out to a location; whether that’s a webserver on another network via FTP, or the local file system.

However, it runs on JBoss in Tomcat which I have seen scary things from in the past. JBoss apps tend to need a metric crap load of RAM (that’s a new form of measure btw), and runs painfully slow on even our fastest systems. Only time will tell whether my fears are warranted. Luckily, it only handles the content, and none of the actually serving of said content (Apache FTW!).

The Castillo Crew

Thursday, August 16th, 2007



DSC_0102.JPG

Originally uploaded by -seek-

This is a kewl picture my brother took during the Castillo Reunion afew weeks back. I’m amazed it came out so good. On the far left is my cuz, Lala, and on the far right is my sister…. freaking out for some reason. That’s me in the middle, just chillin. That’s how I do.

My cousin there recently enlisted in the Army, and we’re all very proud of her. I forget what she’s doing, but I think she’s specializing in chemicals or something. Remember, civil service guarantees citizenship!

“MultiViews” is Voodoo

Wednesday, August 15th, 2007

I’m feeling very sickly at the moment, but I figure doing a post will help distract me.

Afew weeks back I began attempting to get Apache webserver to take a request, sans the extension, and give me back a php file with the same name (e.g. /admin displays /admin.php). I was puzzled to find that my rewrite wasn’t working as it should in some Apache configurations in my development environment.

Enter MultiViews!

“MultiViews” is an Apache option that was created mainly to deal with content negotiations where a server has several language specific versions of content available to web users (index.en.html, index.fr.html, etc). More info on MultiViews can be found at the Apache content negotiation pages. I use Apache 1.3, so please keep that in mind when reading this. I’ll explain why I use Apache 1.3 in a later post.  You must specify the MultiViews directive in the Options line of your httpd.conf or .htaccess file for it to function.

But what is it?

The above documentation sucks, so I will sum up what it says. MultiViews was created so when it is on, Apache will serve content that is derived from the request, based on the information the browser passes, and if the specified files are present. So, MultiViews takes a logical request and returns the contents of a physical file that is closest to what is requested.

What does it do?

If you request index.html, but specify EN as your language, Apache will return index.en.html to your browser. And if you request /admin (and assuming the directory doesn’t exist), Apache will return admin.html if it exists. Why? Because admin.html is of the html/text type (.html) and starts with admin. Your browser by default expects html/text. It basically guesses which file you are requesting based on the browser request. Keep in mind that this is based on the extension of the file and it’s associated type. Apache uses the left most extension first to make a match (index.en.html). For my purposes, this isn’t important, since I only care about one extension.

Yay! Wait, no yay. That’s not what I wanted. I wanted it to return admin.php!! MultiViews returns admin.html!

Luckily, if admin.html doesn’t exist, and admin.php does, it will return the latter. This is where I noticed something wrong while writing my rewrite. I won’t get specific, but I wrote my rewrite in such a way that it would deliver PHP before HTML (admin.php over admin.html, if both exist), but it was returning the HTML first, because MultiViews was governing what was returned, not my rewrite. It took me days to figure out MultiViews was the culprit… Ok, now we celebrate.

Known Issue!

Wait! A major issue has been documented around the net about MultiViews. Allegedly, if you use MultiViews to display PHP without an extension, the server will incorrectly report the mime type as application/x-httpd-php. Normally, the php parser returns text/html, and Apache usually reports it as such. However, the server will not return content to a browser that does not support that type; it just throws a server error, the dreaded error 406 - Not accepted. Well, most browsers will accept the application/x-httpd-php type. The Googlebot browser however, will -not- accept the application/x-httpd-php type. I would venture to say that not being indexed by Google is unacceptable to most people.

Is It Fixed Though?

After experimenting (by passing a spoofed agent string to my Apache webserver) I have discovered that this issue seems to have been resolved in my version of Apache 1.3 and in our testing version of Apache 2.0. So when I request a PHP file without an extension, Apache returns the correct html/text type. I can’t find any documentation that specifically mentions it being fixed, so I will move forward very cautiously. Luckily, we have a Google Appliance at work, so we can point it at a test system and see what happens, just to be sure. I would hate to redo the entire UH website with this technique, and then lose our ability to index the site… *shiver*

This gave me such a headache, I hope collecting this information in one place will help others. I’ll try to find out officially if this issue has been resolved in the latest versions of Apache.

Bad Documentation, Hard to Implement

While I’m on this subject, MultiViews’ documentation is painfully incomplete, and the option is also unfriendly and not configurable. I can’t tell it to prioritize PHP content over HTML, or atleast it’s not documented.

I shouldn’t be complaining, lest I forget that this webserver is -free- and open sourced, so if I want to correct MultiViews’ shortfalls bad enough, I should shutup and checkout some code from the Apache repository.</rant>

New Software, Design!

Sunday, August 12th, 2007

Elo again. I put a new design up, because the old one was kinda very crappy, and I installed WordPress, because I like it. Don’t judge me.

I should mention that this is my third attempt at writing this post. Firefox wasn’t being herself, and crashed afew times.

I’m hoping Cathy will finish my new blog design soon, so I can switch from this one to my new kewler one :)

The links up top don’t work yet, so don’t click on them…

See, I told you not to.

Oh, I just noticed… All of my posts are in the “nonsense” category LOL. Well, truth in labeling laws are very strong in Texas.

I think I’m coming down with a cold, I feel kinda cruddy and have the chills. Let’s hope this doesn’t last, I don’t have time to be ill -_-

Cheers!

Tired -_-

Wednesday, August 8th, 2007

Hello all! I don’t post nearly as often as I use to, so I thought I’d try to start making it a regular thing again.

First, I neglected my family by not getting the Castillo Reunion pictures up in a timely manner. To be honest, I was expecting them to come out lousy, because so often they do. Wow was I wrong! That Nikon D40 is amazing (thanks mommy)! Most of these pictures were taken in low light, and one of my favorite outside in the dark. Also, I wasn’t feeling great so it was hard to keep the frame still. Despite all of this, they came out amazing. I think only one of them came out blurred, but I think it made it look artistic.

It was nice seeing the family. I always wondered why we had these silly reunions when I was younger. I think I understand now.

Work is currently annoying. I’ve just moved a new web farm worker into production. It will be there for about 2 months before the whole system is replaced. Yet again, extra work for no benefit and because of PPP.

The UH website won’t start it’s beta on time. “On time” being this last Monday. I also won 50 bucks because the CMS we are trying to purchase wasn’t procured before the first of August. The bet was made in April. Hehe. I laugh because it hurts my brain when I think about it too hard.

The design is solid though, and that makes me happy. I don’t really care if we launch on time or not in the end, as long as the pages look good, and the content is improved. All of which is happening, so no worries! We have a neat blog called UH Web Posse that has more info. I just found out today that the Web Posse blog is kinda broken in IE6. My troubleshooting suggestion? Asking politely that you get IE7 :) Or better yet! Get a real upgrade, and download Firefox.

It’s late, nite.

Griffin iTrip Auto H4x

Monday, August 6th, 2007

I just got a Griffin iTrip Auto for my brand new iPod Nano (blue 4gig(thank you sweetie!)). At first it peaked my interest because you could use any frequency in the US range of FM channels, instead of whatever presets the maker decides to include.

Even better though, there is an undocumented workaround that enables ALL of the international FM band. Simply press the “preset” button and hold. After about 10 second, it will blink LX. Keep holding it! LX and DX (stereo and mono) are the two broadcast types. (hint: if you set it to DX, you get a better signal, in mono only… good for audio books?).

After you hold the button down for around 15-20 seconds, US will blink in the corner of the screen. Press up or down to set it to International. You now can set the station to any frequency between 76-90Mhz!

Why does it matter? Well, the reason these devices generally don’t work very well is FCC regulations that require they remain underpowered and accept interference from transmitters that have licensed frequencies. To make them work better, you simply need to use free radio frequencies…. and since the international frequencies are in the TV band here in the states, they are less likely to have signals that interfere. Even less likely because many cities in the states don’t have channel 5 and 6 (where these frequencies exist).

Unfortunetly, most car stereos only function in the legal US bands, but it does allow you to use the 87Mhz channels and is crystal clear!(atleast in Houston)

Circuit City has these online for only $39.99, while you can get them anywhere else for around $75. I went to a Circuit City retail location and they happily gave me the online price.

Awesome. Cheers!