Aug 31

Quick thought on programming and distractions

“The way is not in the sky. The way is in the heart.”
Buddha

Too often it’s easy to spend hours days weeks far too long reading blogs and wilfing doing research.  Looking for that perfect tool.  Looking for a wonderful library.  Looking for a new technique.  Looking, looking, looking.  Almost like Hans Guck-in-die-Luft, not paying attention to everything around and not where you’re going, let alone the task at hand.

A wise man, recognizing that the internet is but an illusion, does not act as if it is real, so he escapes the suffering.

The net is an illusion, created by its participants, and a large part of its illusion lies in creating desire.  These desires are, indeed, illusions — when was the last time you could hold that ultimate WoW weapon in your hand?  Or the person on the other side of the world with whom you spend hours and hours chatting — are they real?  Illusion, all of it.  And yet we spend hours and hours — gotta get to the next level…  One more gold and I’ll have enough to buy it…  Surely that library will allow me to make the perfect code….

The good thing about the net is that we have access to more information, people, places, and things than ever before in human history.  The bad thing about the net is that we have access to more information, people, places, and things than ever before in human history.  Or at least we think we do.

There are more things in heaven and earth, Horatio, than are dreamt of in your internet….

Sometimes it’s important to get off the net, to leave the illusions behind and spend some time in meatspace. It’s still possible to be distracted in meatspace — in fact, it is very easy, but there isn’t quite the immediate temptation to click one more link, to see what’s behind the next url.

“Illusion is the first of all pleasures.” —Oscar Wilde

Next time I sit down to code, I’m first going to take some time and look inside, finding the thread of the code within. Then with my connection to the net severed, I’m going to write. I’ll spend at least an hour simply writing without any distractions. If I come to something I need to lookup, if I don’t have it at hand, I’ll mark it and move on.   I think that I will be surprised at how much I can complete.

Enhanced by Zemanta

Aug 25

Using jnp as a JBoss heartbeat

jnp is a JBoss protocol which exposes jndi.  It is, by default, bound to port 1099.  I’d been using that port as a heartbeat, but “cheating” — I would open a socket and then close it immediately.  However, this caused problems.  jnp is chatty.  And it got upset at my not letting it say ‘hi’ before I dropped the connection.   So, here’s a code snippet (jruby, the Java should be an exercise for the student) which allows you to actually do an intelligent check.

Enhanced by Zemanta

Jul 30

z-index and events

Today’s lesson has to do with z-index and events. I’d had a png with transparant portions that I wanted to use as a mask, so that information from underneath would not show. However, buttons, links, and hovers were not working — the top level element was taking the events and eating them. A change of z-index and they started behaving as expected.

Jul 29

JBoss port confusion

We ran into a case where JBoss was unable to come up; it gave the following (partial) exception:

java.rmi.server.ExportException: Port already in use: 1098; nested exception is:
java.net.BindException: Cannot assign requested address

After poking around with netstat and lsof, we couldn’t find anything that was binding to the port.  I’d made the assumption that it was bound, totally missing the next line.  As it turns out, we were attempting to bind to a vip which, although it existed in DNS, was not defined on the host on which the error occurred.  The “cannot assign requested address” was the clue.

Enhanced by Zemanta

May 14

SSL Joys

The nice thing about standards is that there are so many of them to choose from. Andrew S. Tanenbaum

I’ve been working with a Apache proxy to force SSL and https.  Well, I haven’t had any control over the certificates.  And they can come in so many versions, especially given that Microsoft wants to do things its own way and the Apache web server instance is sitting on a windows virtual instance.

I’ve gotten the private key in two different formats, .pfx and .pvk.

.pfx can be converted to the pem file format which Apache is expecting via the following:

openssl pkcs12 -nodes -in infile.pfx -out out.pem

You then need to edit it, stripping out everything but the private key.  Once that’s accomplished you’re good to go.

.pvk, however, isn’t supported in openssl until version 1.0.  Joy!

Enhanced by Zemanta

Apr 10

After long silence

The hiatus has been due to me having been really sick with a weird neurological disorder.  I didn’t do any coding at all for over 2 months.  I’m starting to feel better, but I still have my good days and bad.  So, there will be updates.  Hopefully before not too much longer.

Feb 13

New Ruby Blog

I’ve started a new ruby blog.  Whereas this one tends to longer posts (and not just ruby), the other is intended for short, tight pieces which focus on a single idea.  In general they will be in the format of “mini sagas“.  I’m shooting for daily updates on it.

Ruby Blender

Feb 11

Javascript with CSS Sprites Animation

One of the issues with gif animations is being able to stop and start them at will.  This post examines a method of using javascript to control CSS Sprites for Animation.

We’re going to show how one can create the following animation using javascript and sprites and what benefits you might receive:

Animated Gif

Animated Gif

The gist of this method is to use css background images, which are swapped out via javascript to show and control the animation.  In a filesize test using an animation with 9 frames, the sprites actually require less memory than a comparable animated gif:

File Size Description
Individual frames as separate PNG’s 95421 Baseline — this is the sum of the sizes of the 9 frame files.
anim.gif 43463 Animated gif version
knot.png 81701 24 bit PNG, sprites. Notice that this is smaller than the sum of the 9 files, but quite larger than the animated gif.
knot-grey.png 49708 Greyscale version of the png sprites. This is much smaller and approaches the size of the gif animation.
knot.gif 40853 Gif version of the sprites. This is smaller than the anmated version.
knot-idx.png 38281 Indexed version of the png sprites. Smallest yet.

I think that between the added control, decreased number of files to download (a single file containing sprites can be used in many places), and the potential for reduced file size, that this is a viable method for producing animations.

The javascript code is library agnostic.  Had I tied it to one library or another, I could have made it shorter, but I think that the benefits of being agnostic outweigh the potential byte savings.

Sample CSS looks like this:

Here’s the javascript source file:
sprite-animator

Feb 06

Chibi gets an upgrade

I’m going to have to send my “big” laptop off for servicing, so I upgraded chibi, or as my daughter calls it, “Baby yaptop”.  I upgraded the ram to 2gb — it was only $27 with tax.  I had held off on this because I didn’t want to “void the warranty”.  I found out today that increasing the ram wouldn’t do so, which was good because I was going to do it anyway.  I also replaced the 2gb sd card with an 8gb one.  I’d recently put eeebuntu on it — I’ve really been enjoying it.

However, since I added the extra ram, it’s running a *lot* faster.  I’m thinking that Linux is doing a lot less behind the scenes in terms of juggling memory & is able to cache a lot better than it had.  Things that might take a second or more previously take almost no time at all.

I should have done this a long time ago.

The end result is that I’ve got a very usable system now, even if it’s “only” got a 900mhz processor.

Feb 05

Web Based Portable mysql tool suite

Are you limited in what software you can use at work?  This article details how to have a web based tool suite for mysql.  It currently has the following tools:

So you’ve noticed that both a php and a ruby application are included.  Pretty spiffy, eh?

The magick partly lies in the container — I’m using GlassFish v3 prelude.  Another piece is Quercus, a Java implementation of PHP 5. JRuby is used for ruby.
Read the rest of this entry »

Older posts «

» Newer posts