Archive for March, 2012


Since I don’t want to register with the site just to post a comment, I’ll leave it here.

To follow up with the discussion, you need to set your Spring config like so:

<bean id="quartzScheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
    <property name="triggers">
        <list>
            <ref bean="XXXXXXXXXXXXXXXXXXXX" />
            <ref bean="XXXXXXXXXXXXXXXXXXXX" />
        </list>
    </property>
    <property name="autoStartup">
        <value>${service.quartz.autostart}</value>
    </property>
    <property name="quartzProperties">
        <props>
            <prop key="org.quartz.scheduler.skipUpdateCheck">true</prop>
        </props>
    </property>
</bean>

Quartz ‘phoning home’ at start up.

From http://www.javacodegeeks.com/2011/07/top-97-things-every-programmer-or.html:
It’s never too early to think about performance – Rebecca Parsons

From Effective Java:
More computing sins are committed in the name of efficiency (without necessarily achieving it) than for any other single reason—including blind stupidity.

—William A. Wulf [Wulf72]

We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil.

—Donald E. Knuth [Knuth74]

We follow two rules in the matter of optimization:

Rule 1. Don’t do it.

Rule 2 (for experts only). Don’t do it yet—that is, not until you have a perfectly clear and unoptimized solution.

—M. A. Jackson [Jackson75]

When I started programming I thought the goal was to produce code that was fast. So I wrote concise code without regard for readability. Now, I lean toward readability. I guess I’m just trying to differentiate performance and optimization. Performance is good. (Premature) optimization is bad. I struggle with this because I find it easier and more enjoyable working with the details and not at a system level.

This post was created a long time ago. I’m just publishing it now.

I was thinking of my optimization categories and thought I needed to rethink my categories. First we have the “value” optimizations: colors, quotes around urls, combining values. These are all “safe”. Also “safe” was the removal of characters that don’t even get parsed: whitespace and comments.

The next level of optimizations I think of as “declaration” optimizations: optimizations that are dependent of the declaration and optimizations that are just declaration optimizations. I can’t compress the font-weight values unless it is for the font-weight declaration.

“(declaration) block” optimizations: whitespace? comments?

“rule” optimizations: combining rules, removing empty rules

“rule-set” optimizations: combining rules

“style sheet” optimizations

“gzip” optimizations: making anything lowercase

Cars

This post was created a long time ago. I’m just publishing it now.

The auto industry has received a lot of media attention in the last year. I just wanted to jot down my thoughts about bailouts and recalls.
First, the bailouts. Looking back I am glad the gov’t bailed out GM. At the time I didn’t like the idea because 1) it was coming from a fund created for bailing out the finance sector and 2) I didn’t like the idea of bailouts. I didn’t like the “too big to fail” argument. The bigger they are, the harder they fall, but they still fall. I’m glad the fed wasn’t as shortsighted. I’m glad that GM was helped and believe that if the fed hadn’t bailout GM and the financial sector we would be in a much worse situation.

I wish they hadn’t helped Dodge/Chrysler. I’m never been a fan. Even the Viper received little respect from me. When I see my friends driving a Chrysler I point and snicker… well, at least in my head. (Sorry Eric and Hope!)

I’m so proud of Ford! I feel like a parent and my step-child just won the spelling bee! They haven’t been admired by me in the past, but they’ve made some smart moves in the last decade and I’m willing to make ‘em part of the family. (In fact, the last car we bought was a Ford.)

Too bad for Toyota

I feel sorry for Toyota. I believe they make quality cars. Even now, after the recalls I’m thinking that maybe I can get a deal now on a Prius with all the bad publicity Toyota has received. The loyal customers are the ones who will probably feel burned the most. I keep wondering how my Toyota-fan friend is feeling. A co-worker I talked to
Toyota employee thinking there was some gov’t conspiracy.
Dodge/Chrysler can die. Snicker and point at friend’s cars.

So I finally got up the courage and reformatted my hard drive so I could install… (drum roll) Windows 7! It’s pretty, but, is it functional? Here are my initial thoughts about the newest Microsoft operating system.

Windows 7, why do you make me click on “Switch User”? When I’m not the last one logged in, I have to click “Switch User” and then click my name. With XP, there was just one page with all of the accounts listed. You’ve added an extra step in there.

(The rest of the article never got written.)

So, I was thinking on my way home how clunky wanting to add text to a page with JavaScript. My use-case is this: I want to add the current year to my page. But because I’m just using HTML, I don’t have any server-side ability to add this. So I’m using:

<span id="thisYear"></span>

And then later…

<script type="text/javascript">
// set copyright year
$("#thisYear").text(new Date().getFullYear());
</script>

So I wanted a different way to do it. I looked at using an empty tag (<var id=”thisYear” />) but Firefox doesn’t seem to like that, because it was swallowing up text behind that. I did a search for empty tags and found this article on empty elements.

The question arises whether “Tags for Empty Elements” in XML, i.e. things like <hr /> (or <hr />), really comply with SGML rules. The SGML Handbook seems to say they don’t. The start tag syntax there (p. 314) says that between the tag name (“generic identifier” in SGML terminology) and the closing “>” (“tagc”, for tag close), only attribute specifications and whitespace is allowed.

So it seems that XML empty tags don’t really comply with SGML rules!
So what is Firefox really doing?

So, what do you do when you hosting company won’t allow you to use Apache’s mod_deflate?

I wanted to use PHP’s “auto_prepend_file” and php_value directive in .htaccess to automatically prepend a file, but my server evidently doesn’t support “php_value” directives.

method I found here which ________

Here’s what I came up with.

The first step was to tell the PHP engine to compress all PHP files.

php.ini:
zlib.output_compression=on
# let the server decide which level to use
zlib.output_compression_level=-1

auto_prepend_file=

Now, I had to make my static files PHP files. That was fine, but then it was returning the Content-Type as “”.

styles.css.php:
<?php
header (“Content-Type: text/css”);
?>

combined.js.php:
<?php
header (“Content-Type: application/x-javascript”);
?>

.htaccess:
# Check to see if the browser accepts gzipped files
RewriteCond %{HTTP:ACCEPT-ENCODING} ^.*gzip.*$
# Now, see if that file appended with “.php” exists.
RewriteCond %{REQUEST_FILENAME}.php -f
# If so, point to that file. (Don’t allow files that start with “.”.)
RewriteRule ^([^.]+.+) /home/path/public_html/$1.php [L]

Here are just a couple of my thoughts about today’s code retreat.

Firstly, I’m a little tired of pair programming. I spent most of Thursday and Friday doing it. And then today I had to do more. I wish I had some time to work on TDD alone.

The meals today were pretty good. I would’ve done it for a pizza lunch, but I got breakfast, lunch and a fancy dinner!

It was nice to meet some of the contractors my company uses. Too bad I don’t work with any of ‘em.

The “Game of Life” problem was fun to work on. And I didn’t mind not finishing it each iteration. I get it that it wasn’t about solving the problem. I was hoping for some more “thinking outside the box”, from myself or from others.

I would’ve like to have 2 keyboards and mice at each PC so we could more easily pair program, but I was told that was a no-no. (Damn unions.)

I felt there was a lot of camaraderie among us there today. Again, it is nice, but too bad none of my teammates were there. (Well, I guess Tim was, but I didn’t interact with him at all.)

We had parent/teacher conferences tonight. It has always been good and tonight was no exception. The teachers had nothing but good to say about Alyssa and Joel. I still wonder what am I doing right? How do I know if I will keep it up? I also worry that my kids have set the bar high early on, so will I expect high marks for the rest of school? Also, my parents were very strict when it came to grades. I got 3 B’s the first semester of high school and was grounded for a month. Recent proof shows that my kids are smart. I don’t want to put so much pressure on them, but I know they are capable of good grades. That’s what my parent’s thinking was when I was growing up. So, on one hand I think my parents were too strict, but on the other hand I can see how it is easy to believe that my kids are capable of good grades.

Alyssa peppered me with questions tonight about God and heaven. Being an atheist it is hard to answer those kind of questions. There’s an urge to tell her it’s all hogwash, but at the same time she is a child and I want her to be optimistic and believe in magic, like Santa. I feel like as an adult I am very much a pessimist. I could use some advice on how to raise a child when one person is Christian and one an atheist.

All views expressed here are of Adam Koch solely and do not represent his employer's.