Comparison of JavaScript compression methods

While creating the build system for our Java web application, I set out to do some benchmarking on some of the different JavaScript compression methods. When our project builds, I configured our Ant build script to create three different version of our JavaScript files; full source, minified (comments and whitespace removed), and packed (compressed).

I also configured Tomcat to use gzip compression and then ran six different test, the three version of our JavaScript files without gzip compression and the three versions with gzip compression.

I measured the load time and size using FireBug from within Firefox and recorded the following results:

Full Source Minified Packed
Without GZIP 167 KB | 329ms 95 KB | 281ms 70 KB | 313ms
With GZIP 67 KB | 297ms 48 KB | 219ms 47 KB | 312ms

Although my "tests" are very informal, I think that it is clear that the minified version with GZIP server compression offers the best results. It is only slightly larger than the packed version in size, but it loads almost 30% faster (due to the overhead of decompressing the packed version).

Topics: ,

Struts 2 bug – s:submit tag type=button rendering

In Struts 2.0.11, the s:submit tag with type=button does not render properly.

While working on a project using Struts 2, I was attempting to create a HTML button that looked something like:

<button type="button" class="button positive save">
    <img src="/images/tick.png" alt="Save"> Save
</button>

I followed the Struts 2 Tag Reference for the submit tag and tried the following:

<s:submit type="button" cssClass="button positive save">
    <img src="/images/tick.png" alt="Save"> Save
</s:submit>

Instead of rendering like my example above, it looks like:

<img src="/images/tick.png" alt="Save"> Save
<button type="submit" id="test_0" value="Submit" class="button positive save">Submit</button>

Not exactly what I had in mind... ;)

Read more »

Topics: , ,

Conditional page/post navigation links in WordPress (redux)

After more helpful input, I've decided to update my original solution.

Instead of overriding four WordPress functions and adding two new ones in my functions.php file, I have slimmed it down to just one:

/**
 * If more than one page exists, return TRUE.
 */
function show_posts_nav() {
	global $wp_query;
	return ($wp_query->max_num_pages > 1);
}

This function will tell me if there is more than one page...and if there is, I will show the posts navigation (next_posts_link and previous_posts_link). I updated my WordPress (index.php, archive.php and search.php) files with:

<?php if (show_posts_nav()) : ?>
<div class='navigation'>
	<span class='older'><?php next_posts_link('&laquo; Older Entries'); ?></span>
	<span class='newer'><?php previous_posts_link('Newer Entries &raquo;'); ?></span>
</div>
<?php endif; ?>

As for the single post next/previous links, I decided to remove the check because I'll always have more than one entry.

Much cleaner and less code ;)

Topics:

Conditional page/post navigation links in WordPress

Update: This post has been replaced with an updated version.

While creating a new theme for this site, I added some CSS styling around the page/post navigation links.

For example, in my index.php page, I have the following HTML/WordPress code:

<div class='navigation'>
  <span class='older'><?php next_posts_link('&laquo; Older Entries') ?></span>
  <span class='newer'><?php previous_posts_link('Newer Entries &raquo;') ?></span>
</div>

And the following CSS code:

.navigation {font-size:.7em; background:#353535; height:16px; margin:0 -16px 8px -16px; padding:8px 6px 0px;}
.navigation span {margin-top:-4px;}
.navigation .older {float:left;}
.navigation .newer {float:right;}

Everything looked great, until I brought up a page that did not have a previous or next link. The styled navigation div was still there, but there was nothing in it. So, I set out to conditionally display the navigation div if either a previous or next link existed.

Read more »

Topics:

New site design

I finally got around to updating the theme for this site. It was quite an adventure learning about WordPress Themes and its API. The more I use WordPress, the more I like it!

Thanks to my brother-in-law, Max, for helpful tips on my new logo and also to Michael Heilemann for his default WordPress theme, which I used as a reference.

As time allows, I'll be adding content to the about, resume, projects and contact pages.

If you have any comments or criticism ( hopefully constructive ;) ) on the new site design, I'd like to hear them...

Topics:

Running Ubuntu 7.10 in VMWare Player

I wanted to check out the latest Ubuntu release, so I downloaded the following VMWare image:
http://isv-image.ubuntu.com/vmware/Ubuntu-7.10-server-i386.zip

After extracting the 2 files, I opened Ubuntu-7.10-server-i386.vmx in VMWare Player. A dialog appeared asking me if I had moved or copied the image opened, so I selected "I copied it".

After which, I received an "error" saying something like "This CPU is VT-Capable but VT is not enabled ...". It appears that even though the image I downloaded was for an i386 machine, it was defined as a 64-bit machine in the vmx file. After the OS loaded, I logged in (ubuntu/ubuntu) and did a shutdown:

Read more »

Topics: ,

Clearing VMWare Player Recent Virtual Machines list

The VMWare Player does not include an option to clear the list of "Recent Virtual Machines" (why not?!?!). Since the list of virtual machines that I had opened was growing quite long, I set out to find a way to clear it myself.

After searching in a few places (Windows XP), I came across the file that holds this information. It's called preferences.ini and is located in:
[drive]:\Documents and Settings\[user]\Application Data\VMWare

UPDATE: In Windows Vista, the file is located in:
[drive]:\Users\[user]\AppData\Roaming\VMWare

At the bottom of the file, you should see entries like (where X is a sequential number):

pref.mruVMX.filename = "..."
pref.mruVMX.displayname = "..."

Just delete/reorder the entries as desired, save, then start VMWare Player to see the changes. VMWare Player will need to be closed before you make the changes, or they will not be saved.

Topics: ,

Shared object error during cPanel Apache build

I was trying to add PHP Zip support on my cPanel server today and when Apache went to restart, it failed with the folowing error:

Cannot load /usr/local/apache/libexec/mod_bwlimited.so into server: /usr/local/apache/libexec/mod_bwlimited.so: cannot open shared object file: No such file or directory

After a Google search, I found that I needed to run:

cd /usr/local/cpanel/apache

/usr/local/apache/bin/apxs -iac mod_auth_passthrough.c
/usr/local/apache/bin/apxs -iac mod_bwlimited.c
/usr/local/apache/bin/apxs -iac mod_log_bytes.c

I was able to start Apache afterwards and everything is back to normal...

Topics: , ,
  1. Pages:
  2. 1
  3. 2
  4. 3
  5. 4
  6. 5
  7. 6
  8. 7
  9. 8
  10. 9
Eric Martin
1home
2blog
3projects
4photography
5about
6contact
ssearch
ccomment
p/←previous
n/→next
ttop