Full Screen Slideshow in Javascript

Photography, Programming 1 Comment »

So I now have a full screen slideshow in Javascript, without using flash, and I wanted to tell you how I did it, and how you can do it too. I will talk a bit about Javascript here, but you will be able to download the jQuery plugin I have without needing to know much, if all you want is to implement the gallery.

I got the idea for this plugin after looking at a flash version of Scott Kelby’s portfolio. I just wanted to give it a try in Javascript.

I have created a permanent page for bgStretcher2, so it is easier to find from the side bar, so look here.

Upgrading Wordpress and MySql on 1and1

Programming, Site News No Comments »

Upgrading Wordpress is trivial now. I wanted to upgrade from 2.8 to 2.9, so I went to my dashboard and pressed the “Please update now” link. I got a few warnings, a message to make sure I did a backup first, and then finally a button I could press to do the upgrade.

Only it didn’t work. Wordpress 2.9 needs MySql 5.0 or higher. Crap. I had a 4.something MySql version. I went to the 1and1 control panel. No way to upgrade. No way migrate. S.O.L. When I had created my blog and the database for it, which didn’t seem like all that long ago, the default on 1and1 was to create a 4.x database. Now I was in trouble.

Hey, no problem I thought. I was told to do a backup before the upgrade, and I had done that. I used the phpMyAdmin tool to do the backup, I could do a restore to a new 5.x table the same way, right? Not exactly. I had a LOT of data in my database. 1and1 will only let you import 2meg. I had 4 times that. I needed to reduce some data.

I know, compression! First I tried to do the data dump with zip compression. Then I found out that the import tool didn’t support it. Sheesh. Then I tried the gzip compression. For me, this resulted in exactly the same file size. This wasn’t working at all. I just need to get rid of some data. Read the rest of this entry »

I hate pair programming

Computers, Programming, Software No Comments »

Hand in Hand 

First, to clarify, I don’t hate the two lovely girls in this picture, but they can be quite the pair. Second, my mother told me never to say hate, so maybe that was not a good title. How about “I detest pair programming.”

Don’t get me wrong, I don’t want to be stuck in a cave for a couple of months and then crawl out bleary eyed and pronounce that I have created the perfect piece of code. I love collaboration. I go to others for help, input, guidance,¬†or to reciprocate for someone else.

What I¬†don’t like, is sitting¬†in a cube with two people where one person types and the¬†other looks over their shoulder all day.¬†Maybe I haven’t had the right person to do this with. Maybe¬†that is why the pair of kids in the picture works. They have their issues, but they get along well, and have similar goals most of the time.

When I am paired with someone, and they have the keyboard, I just feel like one of two things occurs. I am sitting there bored wondering why they just don’t let me type, or they are whipping through some material I have never worked with, and I am lost when I don’t get to “drive”. When I have the keyboard, I just find it annoying to have someone asking if the code could be done differently every 5 minutes. I don’t mind getting feedback, and code reviews are great. I have no problem working on a task, checking for ideas, implementing my approach, then getting feedback, and maybe refactoring. I just don’t like it in real time.

I don’t see the benefit. Luckily it only looks like we are doing this while several of us are new. It won’t last forever. Have you ever had to work for an extended time period in a pair? Did it work?

Space Needle Reflections

Photo Shoot, Programming 1 Comment »

This post is all about the space needle, and reflections. Annie and I were out walking through the Seattle Center area when I noticed the reflections on the side of the Music Experience building. Annie had the idea to sit on the wall and get her with her reflection.

The Annie Experience

I also noticed that the reflection of the Space Needle was coming in really clear, so I posed her to get the best reflection.

Annie and the Needle

I had actually been here earlier and was looking for reflection shots, but this was later in the day and the light was a bit better. It was a better angle for the reflection.

Read the rest of this entry »

Intro to Java Observer Pattern

Programming, Tutorial No Comments »

We are well into this whole patterns thing now, picking up lots of new lingo, and becoming better at communicating with other developers. Next on the list: the observer pattern. This is an important pattern to use to help prevent tight coupling and keep code separated into discrete objects. This pattern allows communication between two objects at particular times without each object needing to be too tightly coupled to the other.

The Observer in the Physical World

The idea behind the observer is like a subscription. Do you have a newspaper or magazine subscription? Have you signed up for cell phone texts from your favorite band when they have new tour dates? The act of you signing up with the newspaper, the magazine, or the band, is you saying you want a subscription, or that you want to become an observer. When the subject (newspaper, magazine, band) has something new to share (on a schedule or not) they run down their subscriber list, and notify the observers by mail, or text.

The Observer in the Software World

On the software side, the idea is the same. Your subject needs to provide a way to take subscriptions, hold a list of observers, and when a particular state changes, notify them. There is usually a couple of methods on the subject that takes in an interface that is used for getting on or off the subscription list. On this interface is also the “call back” method. This is the method that the subject will execute when it wants to inform the observers of state changes.
Read the rest of this entry »

Intro to Java Decorator Pattern

Programming, Tutorial No Comments »
This entry is part 13 of 13 in the series Intro to Java

We have looked at the Factory, the Adapter, and the Singleton patterns. Now we look at the Decorator. The Decorator is similar to the Adapter, but with a subtle difference. With our ReptileAdapter, we wrapped the Reptile class to map the interface methods of Animal to the appropriate methods on Reptile. With the Decorator we also wrap a class, but to add functionality, not to map it or replace the functionality.

The Decorator in the Physical World

The idea behind decorating things in the real world is pretty much how it sounds. We wrap an object with new functionality, while keeping the old functionality. How about a camera in a waterproof housing? When closed up, we have added the functionality of waterproofing, but we still provide a way to press the buttons and turn the dials so that the camera can be operated.

The Decorator in the Software World

On the software side, the idea is the same. It is usually used when we have one object that we like how it functions, but we want to augment the behavior for a different situation. Done correctly, we can keep inserting one object inside another adding functionality at every step.
Read the rest of this entry »

Intro to Java Singleton Pattern

Programming, Tutorial No Comments »
This entry is part 12 of 13 in the series Intro to Java

The last pattern we looked at was the Adapter pattern. It was a good pattern to start with as it maps well to the physical world and is fairly simple. Now we will look at the Singleton pattern. In some respects it is the simplest of patterns, but there are some things to think about.

The Singleton in the Physical World

The idea behind the Singleton is to ensure that there can be only one (insert Highlander jokes here). If you had a factory that made widgets, you would want a widget to be created many many times. But there is only one factory. If you were modeling the US government, you would only want one president. Only one senate.

The Singleton in the Software World

On the software side, the idea is the same. It is usually used when we only want one set of configuration variables, one controller, one data base connection pool, that kind of thing.
Read the rest of this entry »

Intro to Java Annotations

Programming, Tutorial No Comments »
This entry is part 9 of 13 in the series Intro to Java

Annotations allow you to attach metadata to a field, class, or method. Metadata is data that describes something else. For example, metadata about a song in mp3 format could be the artists name or the bit rate it was encoded at. A jpeg image could have metadata that described the image height or the number of colors in the image.

What do they look like?

1
2
3
4
@Override
public String getName() {
	return "no name";
}

The word after the ‘@’ is the Annotation. It precedes a method or class name. The Override annotation is built into Java. It is used to indicate that a method overrides a parents method. These are used for compiler hinds, for documentation, and to apply meta data.
Read the rest of this entry »

Intro to Java Generics

Programming, Tutorial No Comments »
This entry is part 8 of 13 in the series Intro to Java

To me it seems a better word would be Specifics. The use of Generics is applying a specific type to a class that can be used in a generic way. One of the most common generic classes is List. A list allows you to put any type of Object in to it. In fact, you can put several different types of Objects into a List. But, there is a way to create a specific List type that can only take one type of Object.

What do they look like?

Since we are talking about Lists, lets look at what a ArrayList would look like that could only take Strings.

1
List aList = new ArrayList();

What goes between the <> is the type that you want to specify for the List. You need to do it in the left side declaration, and on the right side where you are creating the Object.
Read the rest of this entry »

Intro to Java Collections

Programming, Tutorial No Comments »
This entry is part 7 of 13 in the series Intro to Java

I don’t want to get too deep into every little thing in the collections classes here. In fact, you already know a fair bit about them, because we have used them with some of our Animal class examples. This is more an overview of some of the basic Collections classes.

What do they look like?

There are three main types of collections: Lists, Maps, and Sets. Technically you could try to argue that Map doesn’t extend Collection, so therefore it is not a Collection, but I think of it as part of the group.
They are used for groups of objects, or exactly as its name would imply, collections of objects.

List

A List is just that, a list of objects. The List interface provides a way to add, remove and get objects from a list. It however is just an interface. ArrayList is one of the more popular concrete collections that implements the List interface. Each implementation of the List interface may behave slightly different, but once you understand how a List works, you have a good start on understanding any List.
Read the rest of this entry »

Powered by Wordpress
Entries RSS Comments RSS Log in