URL Rewrite For A Page Manager

November 26th, 2009

Let’s pretend you have a web page where you want to use a URL rewrite to load content from a db where you have specified a guid with a year and month from a date. For example, you want to visit /2010/01/page-name/. Behold the solution below to add to your .htaccess file.

RewriteRule ^([0-9]+)/([0-9]+)/([A-Za-z0-9-]+)/$ ?y=$1&m=$2&g=$3 [L]

Macro Sorting In Excel 2007

November 25th, 2009

Say you want to sort in Excel by columns W, V, S, M & L in a spreadsheet and the actual data starts at row 6 from columns A to Z. This script sorts any number of rows by those columns starting at row 6 in the Excel spreadsheet. Sorting in Excel with macros is not always well documented. Hopefully, this post will pop up in search results in the future to help others with their macro sorting woes.

Sub derpurtSortColumns()
'
' derpurtSortColumns Macro
'
    Dim mySheet As Worksheet
    Dim myRange As Range
    Dim LastRow As Long

    Set mySheet = ActiveWorkbook.Worksheets(1)

    mySheet.Activate

    'Determine Last Row
    LastRow = ActiveSheet.UsedRange.Rows.Count

    mySheet.Sort.SortFields.Clear

    'Sort Data
    mySheet.Sort.SortFields.Add Key:=Range("W6"), _
        SortOn:=xlSortOnValues, _
        Order:=xlAscending, _
        DataOption:=xlSortNormal
    mySheet.Sort.SortFields.Add Key:=Range("V6"), _
        SortOn:=xlSortOnValues, _
        Order:=xlAscending, _
        DataOption:=xlSortNormal
    mySheet.Sort.SortFields.Add Key:=Range("S6"), _
        SortOn:=xlSortOnValues, _
        Order:=xlAscending, _
        DataOption:=xlSortNormal
    mySheet.Sort.SortFields.Add Key:=Range("M6"), _
        SortOn:=xlSortOnValues, _
        Order:=xlAscending, _
        DataOption:=xlSortNormal
    mySheet.Sort.SortFields.Add Key:=Range("L6") _
        SortOn:=xlSortOnValues, _
        Order:=xlAscending, _
        DataOption:=xlSortNormal

    With mySheet.Sort
        .SetRange Range("A6:Z" & LastRow)
        .Header = xlGuess
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
    End With

    Range("A1").Select
End Sub

Firebug & FCK Editor

November 23rd, 2009

Let’s pretend an IT department has hidden the button that allows you to edit in html mode when using FCKEditor on a website. No problems there. Just install Firebug and run the following code to toggle between html source and rich text edit modes. Firebug allows users extra control when that control has been taken away from them.

Note: “editor” is the id of the FCKEditor instance. You can navigate the DOM to discover the ids for the instances of the FCKEditor that are currently in the page.

FCKeditorAPI.GetInstance("editor").SwitchEditMode();

Overseas Address Handling

December 18th, 2008

Overseas Addressing

Lets just say that credit card companies haven’t figured out how to handle international addresses in a very clean way. I just changed my mailing address for my American Credit Card to send replacement cards over here, and the above is pretty much what you can expect from the big names. How lame can it get. Seriously, all it takes is a tiny little db table we call countries. Or maybe just some, get it right the first time you bogens. I’m guessing the code that runs the site was written so poorly that changing it would be a nightmare. That’s the typical conundrum these days. I’m pretty amused at the zip code though. Apparently, it’s not used in the mailing address label when it has that value. So all the people living in Wood-Tikchik State Park, Alaska are out.

Video Player Added

December 18th, 2007

2007 Apple Insomnia Film Contest

In addition to putting the video player up as planned, I added permanent links so you can easily load any of the videos stored in the player. The animation is currently the default film, but I will put up more films soon. I also have currently added a test cut of the hummingbirds I filmed in slow motion last summer. There is plenty more of that stuff in my archive, and I’ll have something cut together before my big journey off the grid. The image above is from the Apple Insomnia contest entry. It ended up being a musical with an new song written specifically for the project. I should have it on Untold Voyage soon. In the mean time, I need to study for my last final which I have on Thursday. Merry Christmas!

Here is the permanent link to my animation.

October? How did that happen?

October 4th, 2007

I’m not sure how half a month went by so fast. We reviewed regular expressions and went over context free grammars in compilers class. The traditional animation class has us designing characters this week. I have decided to work on a character from Doomination, and perhaps animate him in my final project. His name is Timmy. He’s a tiny little kid who is obsessed with coffee. More to come on that.

I’m getting together with some film friends, and we are entering the 24 hour competition that Apple is sponsoring. If you aren’t familiar, it is called Insomnia.

One more semester

September 13th, 2007

As I’m learning Python, it is rather interesting to also have just written an interpreter for a made up language in my compilers class. Python is a pretty awesome language. I hope I can learn how to make it a “scripting” language for c++ apps. I could then implement a basic game editor with scripts. However, this sort of thing would be one more task to the pile of work I’m already trying to complete.

I’m having my best semester ever because I have been focusing on things I’ve always wanted to spend time doing. I’m drawing, starting to animate traditionally, working on compilers, and studying Scandinavia for my final general requirement. To sum up, art, art, computers, and vikings! Now that’s pretty awesome.

Pirate Town

December 21st, 2006
Pirate Town Ship

Well, I’ve come back from the dead once more. Here are screenshots of my final project for the semester. We had to write a town using openGL, from scratch. Obviously we only had about one week to actually work on the project. I made all the models in maya, except for the zombie. Thank you psionic 3d. I also found out the limitations of milkshape. For example, forget about importing any animation or rigging into milkshape.

I had my last two finals of the semester yesterday. So, I’m going to go see a movie. I think I’ll try out The Pursuit of Happyness. Should be good to see Will Smith play a different role from his normal comic style.

Roller Coaster

November 15th, 2006
High Noon GL Coaster

Howdy. You’re probably wondering where I’ve been for the last month. Well, I survived those three midterms I mentioned. I received a good grade on the image editor I had to write. Also, I was assigned a project to create a roller coaster that could be built in “real-time.” I used OpenGL and fltk to build the program. I had to do everything from scratch. So, I had to define a curve for the track and figure out how to orient cars of the roller coaster to the track. I spent over 90 hours in about a week’s time. It was a ton of work, and I guess I don’t mind the punishment because I’m signing up for a games class next semester.

My final project for this semester will be to build a city. It’s meant to be an experiment with both texturing and modeling. However, we are supposed to have multiple “entities” moving about. The professor will hopefully be nice and provide the base code that was given the last time the class was taught. It already has some very simple cars moving about on the roads of a little residential district. Although, the texturing sucks for the base code.