Site Network: Personal | Professional | Photography

Technical Blog

This blog will contain content related to Java, Seam, Security, my sites and projects, as well as other technical subjects I am interested in.

Comments and questions are welcome!

Archive for the ‘General’ Category

Eclipse, Subversion, and SSH_OPEN_ADMINISTRATIVELY_PROHIBITED

Wednesday, November 19th, 2008

If you use the Subclipse plugin to access subversion repositories from Eclipse using the ssh+svn protocol, you may see errors like this:

SSH_OPEN_ADMINISTRATIVELY_PROHIBITED

when you try to do too many things at once.

When I tried switching to JavaHL instead of SVNKit, I got different errors, so that was out.

Adding this line to my eclipse.ini file fixed it though:

-Dsvnkit.ssh2.persistent=false

It prevents the SVNKit adapter from issuing multiple sessions through a persistent SSH connection, which seems to trigger the error on some SSH servers at least.

Apache mod_deflate and mod_cache issues

Tuesday, November 18th, 2008

The Problem: Using Apache mod_deflate and mod_disk_cache (or other mod_cache) together can create far too many cached files.

The Background: Apache is a web server with many different modules you can load in to enhance it. Two common ones are mod_deflate and mod_cache (or mod_disk_cache).

Mod_deflate compresses content that is sent to the webserver using gzip. It can take 100k of html, css, or javascript, and compress it down to ~10k, before transmitting it to the user's browser. The browser then uncompresses it, and displays the page. Most web servers (depending on how your site/application is structured anyway) are not CPU limited. Therefore, you can spend some extra CPU doing the compression, and get much faster content delivery times to your users, who are often bandwidth limited. Not only does this make pages load faster for your users, but it also allows request handling threads to complete sooner, letting your web server handle more requests.

Some web browsers are not able to handle gzipped content correctly, therefore it's important to add in some logic to only send gzipped content to browsers who can handle it. Also, there are different types of files which are already compressed and hence trying to gzip them is a waste of time and resources, such as images, video, etc...

A common configuration may look like this:


# Insert filter
SetOutputFilter DEFLATE

# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html

# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip

# MSIE masquerades as Netscape, but it is fine
BrowserMatch \bMSIE no-gzip 

# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
# the above regex won't work. You can use the following
# workaround to get the desired effect:
BrowserMatch \bMSIE\s7  !no-gzip !gzip-only-text/html

# Don't compress images
SetEnvIfNoCase Request_URI \
\.(?:gif|jpe?g|png|swf|flv)$ no-gzip dont-vary

# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary

This basically says:

"For files under /"
"Compress them"
"Unless it's Netscape 4.x, then only compress text/html files"
"Or, if it's Netscape 4.06-4.08, then don't compress any files"
"But if it's IE, don't compress any files" - NOTE: this is different than the common version you see floating around which turns back on compression for IE. If you are loading content from a Flash swf within IE 6, that content can't be compressed, even though IE 6 handles it fine. Flash doesn't for some reason. So this setting is safer. If you aren't using Flash, feel free to change this.
"but if it's IE7, undo the no compression settings we made before, activating compression"
"but don't compress already compressed files like images and video"
"Set the response Vary header to User-Agent so that any upstream caching or proxying won't cache the wrong version and send a compressed version to a browser which can't handle it, or an uncompressed version to a browser that should have gotten the compressed file"

Confused yet? :)

Mod_disk_cache allows you to specify various files to be cached on the web server and lets you set a cache expiration time, etc... It's of great value when those files are being served out of a web application, and not coming from the local disk. For instance if Apache is serving files from an ATG instance, mod_disk_cache, lets you have the web server cache images, css, js, videos, etc... from your WAR. There's also a memory based cache, mod_mem_cache, but it's more trouble than it's worth, and you can trust the linux kernel to cache recently accessed files in memory anyhow.

Got it?

So this is where it gets tricky.

If a response has a Vary header set, mod_disk_cache will cache a different version of that file for each value of the Header that Vary references.

So for a file compressed as above, there will be a different version cached for each User-Agent. In theory this will mean that browsers which support gzip compressed content, will get the compressed content, and browsers which don't, will get the uncompressed version.

In practice, due to the amazing tiny variations of the full User-Agent string, you end up with thousands of copies of the same file in your cache. On a disk cache only a few hours old, there were over 4,400 cached copies of the same javascript file. Each with a slightly different User Agent string, even though there were less than 10 actual browser types represented.

This is a problem for several reasons: Firstly, you end up using far more disk space than you really need. Secondly, you negate the kernel's in-memory file caching, since those 4,000+ version of the single file are being accessed, it won't be able to simply keep the two different files (compressed and uncompressed) in memory. Thirdly, you make cleaning out the cache much slower, since you have to delete these thousands of extra files and their containing directories.

The Solution: I'm not sure... Any ideas?

10 Skills You Need That You Won’t Learn In School

Thursday, July 31st, 2008

I just read this article: 10 Skills You Need to Succeed at Almost Anything.

I think it's a great list. At least for my career path, I can directly attribute a great deal of my effectiveness and successes to skills on this list. Being able to communicate clearly and articulate a point or argument, verbally or in writing, is critical in almost any career path. Being able to manage your time, tasks, and staying productive is a no-brainer. I won't go through the whole list, but it's all pretty key skills for many situations, both business and personal.

The thing that really struck me, is that most of these skills aren't taught. Or at least aren't taught well before college. I never finished college, so it's entirely possible that many colleges cover many of these skills directly at some point in a four year bachelor program, I really don't know. But these are all things that should be taught and expanded on during elementary school and high school.

When I was in high school for half a year at Manchester by the Sea, I joined the debate team. I did some policy debate, but mostly Lincoln-Douglas debate. I enjoyed it and was pretty good at it (I probably still have a trophy somewhere to prove it). My time on the debate team did amazing things for me in terms of enhancing my ability to research, analyze data, and create a comprehensive case based on a combination of raw data and what people care about and want. And of course lots and lots of public speaking under pressure.

I can directly attribute what I learned on that team with my being able to stand out among my peers in meetings, being able to push ideas for new projects or policies through, and otherwise make a difference (work-wise). This reaps two sorts of benefits: Firstly, I was more able to change my working environment, projects, etc... to be better/faster/more interesting/more efficient/etc... than most of my coworkers. This leads to more job satisfaction and less negative stress. Secondly, in part due to the first benefit and in part due to being visible to peers and those higher up the corporate food chain as someone who can communicate clearly and is remembered, I was more easily able to have my needs met by my employers. That can take the shape of a nicer computer in the office, or a promotion, or more money, or more interesting projects, or other things.

I think a mandatory high school debate class would have infinitely more positive impact on a person's life and career than memorizing the dates of the formation and dissolution of African countries over the last 100 years. (Now part of that is probably my dislike of how History and Social Sciences in particular are taught in most high schools).

We should be teaching people how to think for themselves, how to analyze peices of information and come to a conclusion, how to do research, how to compose their thoughts and opinions into an ordered structure, how to communicate effectively in writing and verbally, how to manage time and tasks, how to prioritize, how to manage stress, how to handle a household's finances, how to plan ahead, how to learn, etc... Yes, we still need to teach math, and english, and history, and all that, and frankly a lot of that could be tied together.

The number of people out there who lack those skills, who get all their news from one biased source, who can't communicate clearly, who can't manage their time/money/stress, who can't think through a question or problem and come up with approaches to solving it, is scary. These people are voting, managing departments, and working on teams you deal with.

Ignoring the specialties of my field, I am still shocked at how much time I spent in school focused on things that I never use (directly or indirectly), and didn't learn the vast amount of stuff that I use every day.

Doing The Best Job You Can

Tuesday, July 29th, 2008

I was reading a story about some airline employees failing to take care of a passenger with MD, and one comment mentioned how a Japanese airline employee hand delivered a jacket a passenger had left behind on the opposite side of the country. Without making any particular comments on the US airline industry's current level of service or on the impact of cultural differences on job dedication, I started thinking about what it would mean if we all committed to excelling at our jobs.

Regardless of the job: J2EE Architect, startup founder, plumbing, vacuum cleaner sales, whatever it is. Spend every moment on the job, doing the absolute best job you can. Doing your duty and as much more as is possible. Not complaining, not shirking, not stopping at the bare minimums. Doing your job in a way where you would be proud of every moment, every line of code, every happy customer. Helping out your coworkers and clients beyond the scope of your defined job.

What would happen if 10% of people did that? If your mechanic, your doctor, your pet sitter all did the best, most complete, most detail oriented job possible. And went further than that. If your mechanic fixed a couple things for free while he was in there. If your doctor gave you a two minute answer on the phone for free. If your developer wrote well documented, efficient, and clean code.

What if it was only 1%? What if those 1% could find each other and do business with each other.

It's probably not feasible to be 150% on the job all the time, but try to make it a goal. Put up a reminder to yourself on your desktop.

Who's in?

Pixily - Go Paperless!

Monday, July 21st, 2008

I have a filing cabinet filled with paperwork, receipts, warrantees, contracts, rental agreements, and more. I'm basically a computer person, and I love searching and instant gratification, so I've always wanted to scan everything in, and have a bunch of searchable PDFs that take up no physical space, and are easy to back up off-site. However, all I have is a small, slow, flatbed, single-side, scanner. Scanning in tons of documents isn't viable.

Yesterday, i was reading Hacker News, and I saw a posting about a new startup called Pixily, that solved this very problem. You mail them documents, they scan them into searchable PDFs, send you back the originals, and give you the PDFs. I'm sold.

Then today, I found out that the company was started by the husband of a good friend of mine from Boston. So now you have two great reasons to use the service.

Check it out: Pixily!