jQuery Image Resize

Let me start off by saying, I LOVE jQuery! It’s the greatest thing since sliced bread! Now that I have that out of the way, I’ve been working on developing some WordPress themes for work. We are going to be launching a blogs site (using WordPress MU) fairly soon for faculty, staff, and eventually students. So, in the process we are building a blog that will be used as an online newsletter. On the blog page, they want the top story to take precedence, and for the image to be larger. So to accomplish this, I wanted to scale down the other images and keep the aspect ratio. Enter jQuery…

I was looking out there at some of the solutions already completed. I didn’t see anything that quite did what I was looking for. So I made my own function:

The 2nd line of code says to grab every image with a class of ‘story-small’. The block for the height is just a safety net. I have it there in case the height is still larger than the max. There are a hundred ways to skin a cat, so I’m sure there are plenty of other ways to do this.

HttpWebRequest and Multiple Files

I’m working on a project at work right now to pull inventory data from the bookstore’s point-of-sale system into the e-commerce site I’m setting up for them. One of the parts in the process is to check the web server for any new/updated images for the items on the website. I am doing a web request for each image on the server to see if I really does exist. After doing so many, I noticed that all of the files kept coming back saying they weren’t there, when I know darn well they are! So after a little research online, I noticed that you need to close your Response object when you are finished with it.

Here’s my code:

private static bool _FileExists(string filename) {
    try {
        HttpWebRequest req = (HttpWebRequest)WebRequest.Create(filename);
        req.Timeout = 5000;
        req.Method = "HEAD";
        HttpWebResponse response = (HttpWebResponse)req.GetResponse();

        if (response.StatusCode == HttpStatusCode.OK) {
            response.Close();    // IMPORTANT
            return true;
        } else {
            response.Close();    // IMPORTANT
            return false;
        }
    } catch(Exception ex) {
        return false;
    }
}

The big thing to note here is when I’m calling response.Close(), as that closes out the connection. So if you are experiencing issues where you keep getting time out errors, give this a try. Here’s the original article that helped me.

Core Values

So I’ve been doing some reflecting recently. A blog that I frequently visit, The Art of Manliness, has started a 30 day challenge to becoming a better man. For the first day’s post, they talked about building a list of core values to keep yourself from drifting through life. So, I’ve decided to share my 5 core values with the world (in alphabetical order):

Confidence

This is definitely one of the values that I need to work on. I feel confident in my current work abilities, but there is always room for improvement and the web is always changing. I think I could have more confidence in my role as a father…sometimes I wonder if I’m doing the right things. I would like to have more confidence toward my understanding of church and religion. Also, I would like to have more confidence in my decision making. If I decide on something, stick with it; I obviously chose it for a reason.

Family

Family comes first, what else can I really say on this. I’m sure almost everyone feels the same way I do on this subject.

Honesty

If you are getting an answer from me or seeking my opinion, it will be the honest truth. This is one thing that really bothers me. If you are responsible for something and it is your fault that it fails, own up to it. Rest assured, I always will, no matter the consequences.

Humor

Life can’t always be serious, you’ve got to inject some fun and humor into it.

Trustworthy

I think this one kind of dove-tails into honesty. I am, and always will be a person you can trust.

So, did you think about it? What are your core values?

Achieving Your Childhood Dreams

This is an excellent video that everyone should watch on achieving your childhood dreams. It is very inspirational and makes you think about how you are using your life. Grab some popcorn, because it’s about an hour and 15 minutes long.

[youtube]http://www.youtube.com/watch?v=ji5_MqicxSo[/youtube]

New Site

Hey everyone, hang tight for a little bit while I get the cobwebs out. I’m going to try and get my old blog posts back in here too. It’ll only be a matter of time.

FLV 404 Error on Windows Server 2003

Wow! That was a wierd problem. I haven’t done much with embedding videos online before, so I’m learning a lot about the nuances. I was getting a 404 error from a .flv file that I was using with a flash .swf file. Luckily, there’s been other people with the same problem (I love google).

  1. On the Windows 2003 server, open the Internet Information Services Manager.
  2. Expand the Local Computer Server.
  3. Right-click the local computer server and select Properties.
  4. Select the MIME Types tab.
  5. Click New and enter the following information:
    • Associated Extension box: .FLV
    • MIME Type box:flv-application/octet-stream
  6. Click OK.
  7. Restart the World Wide Web Publishing service.

The original article I found is here

Windows Mobile Event Viewer – First Release

Alright troops…who’s gonna be first to test out the latest and greatest Event Viewer for Windows Mobile?

I’m not going to say its perfect, because the only person to test it has been me! If you don’t like it, then just don’t tell your friends about it. If you do like it, by all means get your developer friends to use it in their Windows Mobile applications.

You can download the files here.

Windows Mobile Event Viewer

Well, I started in on a new project last night. This project will essentially be an event viewer for windows mobile devices. One of my concerns is that it won’t log events from the device…I’m not exactly sure how to hook in to device events yet. I can’t guarantee that this application will be running all the time to record device events, so I am thinking mainly of using it for application developers that want to use it to record events from their programs. They will be able to call a
method and pass all the information to create a new event in the event log.

I’ll post something worthwhile when it gets a little farther.