Mad, Beautiful Ideas


About this Archive

This page is an archive of recent entries in the Work category.

Weird Stuff is the previous category.

YUI is the next category.

Find recent content on the main index or look in the archives to find all content.

JS Array lastIndexOf


Recent Entries

Recently in Work Category

Maladapted Organizational Non-Standards

Washington State University has a marketing group who has put together a set of guidelines and templates for web site maintainers (I don’t use ‘developers’ here, because quite a few of the users aren’t developers). I’m not a huge fan of these templates, but I do completly support the idea of standardizing the web presence for the institution.

Unfortunately, it’s a non-standard. Marketing Communications has no real teeth to force the templates on anyone, and a lot of departments (the one I work for, for instance) haven’t updated. We’re in the process now, but we still haven’t finished it. However, if you follow the link to the University website at the top of the article, you’ll note that the homepage for the institution doesn’t look anything like the way a landing page is supposed to look.

Now, I don’t think anyone really thought too much of this. Frankly, the new homepage is really nice. So, when Information Technology chose to replicate it, or at least something like it, most developers thought it was pretty cool. So did the Vice President who asked for it.

Marketing Communications didn’t feel so good about it. They complained heavily, still are from what I can tell. Apparently, they feel they’re the only ones who should be able to have an interesting home page. Personally, I think it’s close enough to the home page to be reasonable, and that Marketing Communications should make the template guidelines more flexible. Hell, I’m pretty much tempted to write a similar widget in YUI3 and deploy it on at least one of our sites, just to stir the pot a bit.

Standards need to be flexible, and it doesn’t make sense to claim that a certain standard is perfectly okay for them to violate, but not others, when they could simply standardize a look and feel for this sort of landing page, and allow other people the sort of rich interaction they want to provide on the Institution’s. Standards are best when they offer the best parts of them to all the users, not just those you’ve decided to bless to break them.

Especially when the standard you’ve been tasked to create is viewed as little more than a suggestion by the people who are expected to follow it.

A Note About Perforce Triggers

At work we decided to go with Perforce for revision control. Now, I’m a well admitted git lover, so that I went along with this still kind of surprises me to an extent. Needless to say that we made the decision over six months ago when I believed:

  1. Git didn’t work well on Windows
  2. Git didn’t have good GUI tools for Windows
  3. PlasticSCM was lacking features that Perforce had (like triggers)

In the intervening months since we made that decision, all of those things turn out not to be true anymore. So, rather than having a flexible, easily-branched SCM, we’re using a very capable, but wholly boring, SCM system. Oh well, as I said, it works very well, but there are certainly things I prefer about git.

In an effort to better use the tools available to us, we’ve also gone one step further and implemented Continuous Integration using Hudson. I’ll talk more about Hudson at a later date, but I wanted to quickly cover an issue we’d had with the Perforce Integration with Hudson.

First, we’ve chosen to manage our own workspaces, simply because there are shared components between various projects. So, for a given project we may have:

//depot//ProjectRoot/... //workspace/ProjectRoot/...
//depot//SharedProjects/SubProject/... //workspace/SharedProjects/SubProject/...

This allows me to use the same Visual Studio SLN file on both our development workstations and the CI server, which is really convenient. Unfortunately, while the Hudson Perforce plugin should handle this sort of view situation cleanly, it didn’t seem to be for me. I went through the code, and while I suppose it’s possible the Perforce plugin for Hudson I installed wasn’t the same as the code I read, we decided to go a different route.

We chose to go the route of the Perforce Trigger, setting up a Python script to scan a changeset once it’s submitted, triggering a Hudson build if it determines it’s necessary. I’ll share the details of this script later, once I’ve had a chance to clean up a few things, there are a few potential performance issues, and while this works fine for our small installation, I can see issues with my current implementation if I were to try to use it on a larger installation.

However, I had a big problem when first setting up the trigger in Windows. I had set C:\Python25 in the System-level PATH. But when I set the following in my p4 triggers:

        startci change-commit //depot/... "d:\p4scripts\P4CIBuild\ %changelist%"

I would get an error on every submit, stating that the process could not be started. This was confusing, because that very command would work perfectly from a command terminal. Try as I might, I couldn’t find any documentation from Perforce, as almost all the Trigger documentation was clearly targeted toward UNIX servers.

It turns out, that in order to get the Trigger to work correctly when executing a script, you need to call the interpreter first, and you need to declare the full path. Replacing the above with this:

        startci change-commit //depot/... "c:\python25\python.exe d:\p4scripts\P4CIBuild\ %changelist%"

Works like a dream. I’ve sent an e-mail to Perforce, which will hopefully result in their documentation getting updated, but if you’re having trouble getting Python-based triggers to work on Windows Sever 2008, this is what it took for me.

Off to Code Camp

This weekend marks the Seattle Code Camp, which I’m lucky enough to be being sent to by my employer. I’ve talked about Code Camp last year when we went to Boise, which was a fun trip, but this time we’re going to be at the DigiPen campus in Redmond, WA, which is practically in the heart of the Microsoft Campus.

What I love about Code Camps, is that they are designed to be completely vendor agnostic. Admittedly, every code camp I’ve been to so far (read: almost two), has been centered heavily around Microsoft technologies, and Microsoft tends to sponsor these events, they are open to almost anything. There was a fair amount of Java stuff in Boise, there is a presentation on git in Seattle. I would love to see more Open Source stuff, but I’m not presenting, so my complaints aren’t quite as loud as they could be. Hopefully next year, my work schedule will be more conducive to preparing something like this (ie, not working 12+ hour days), but no luck this year.

Since I do work mostly with MS technologies, the way Code Camps are currently structured is much more relevant to my current line of work, which is nice, but I rarely derive a ton of enjoyment from using most Microsoft platforms. I’m growing to love ASP.NET MVC, but I tend to attribute that more to how unlike MVC is from most Microsoft frameworks.

Still, there is much to learn, and hopefully much to share. We’ll be recording the sessions we attend, so we’ll have video, which I’ll try to get some of posted. And I’ll just continue reminding myself, .NET is a platform with a rich Open Source tradition these days, I’ll just have to take solace in the .NET ;)

Short Hiatus

I know I’ve now missed two days worth of posts. At work we’re going to be launching our Schedule Proofing Application on next Monday, so we’re putting in long hours to get that done. I may still get some posts up later this week, but there are no guarantees at this point.

I want to thank my readership for bearing with me, and I guarantee, I’m getting some material that should make for some interesting posts.

MSDN Tech Session: VS 2008 and Silverlight

Today I journeyed up to Spokane with some guys from work to attend a
MSDN Tech Session about some of the new stuff in Visual Studio 2008,
.NET 3.5 and Silverlight. The talk was presented by Mithun Dhar; a Developer Evangelist for Microsoft, and Mark Michaelis, a Systems Architect from Spokane who seems to do a fair amount of this kind of thing for Microsoft.

was initially interested in attending for the talk on Silverlight. 
VS2008 doesn't run on Linux, and Mono doesn't quite have .NET 2.0
support done, so 3.5 seems like a little ways away.  While I wasn't
impressed enough to change my heathen ways, Microsoft has done some
very important things in VS2008, and some of the new features in .NET
3.5 really seem interesting.  Silverlight (or should I say Moonlight?) does stand to be one of the more revolutionary web technologies to be discussed in recent times.

let's start where todays talk did.  Visual Studio 2008.  As I said, I
wasn't overly interested in this talk, since I'm not going to use it at
home, and I'm not sure we'll be using it at work any time soon.  There
doesn't seem to be too much that's new in this version.  Improved
Intellisense, Intellisense for Javascript, a split-mode for web design
(I'm pretty sure Dreamweaver has done this for several versions), a slew of new modes, and of course support for all the fancy new .NET 3.5 features. 

none of these were really enough to make me interested.  It seems
Microsoft has finally decided that a good Javascript debugger is worth
having, and integrating it with a web browser is important.  So, Visual
Studio can now debug Javascript as if it were any other program.  It's
pretty cool.  Plus, Mithun said that it works with Firefox and Opera in
addition to Internet Explorer.  I'm not sure I believe that, but if
it's true, that's really impressive for Microsoft.  This is definitely
a place where Microsoft may have a win.  Venkman, the Firefox Javascript Debugger, is really not very user friendly, and neither it, nor Firebug

integrate well with any development environment I've ever seen.  I use
Venkman and Firebug regularly, but the VS2008 Javascript debugger looks
much, much easier to use. Of course, it won't work on Linux, so I'm
going to be sticking with Venkman and Firebug, but I do hope someone
can implement something like that feature in MonoDevelop or something

.NET 3.5 has some pretty interesting features slated for
it's release, or shortly afterward.  First up, is Extension Methods. 
Extension Methods allows a developer to tell the compiler to
functionally add a method to a class, without actually modifying the
class.  An example given was adding a Capitalize() method to the String
class, which would convert all the letters in a string to upper case. 
This is a technology that I can see being hugely useful, and the Syntax
is pretty clear, for instance, for the previous example:

static class MyExtensions {
    public static string Capitalize(this string input)
       // Modify Input in here to convert it all to uppercase.
key to this is the new "this <object>" where <object> is
the object or interface, you're adding the Extension Method to, in this
case, string.  Scott Guthrie has a lot more to say about this subject,
and this blog post

is probably much better reference than anything I could write right
now.  In .NET 3.5 Microsoft uses Extension Methods to extend classes if
certain features are enabled.  For instance, if you're using LINQ,
which I'll discuss next, several Extension Methods, such as Where, are
added to IEnumerable to extend it's functionality, without redeclaring

In some cases this makes a lot of sense.  If you
only need to add a method or two, and the changes have a limited
usefulness, they appear to be an invaluable tool.  I even suspect there
is almost no overhead, since the linking of the extension method could
simply occur at compile time.  However, I fear there will be times when
people will simply write a handful of extension methods, when it really
makes more sense to extend a class.  I'm afraid this may lead to more
confusion down the road for people maintaining software, as some people
will have needlessly and recklessly extended classes.  However, this
may be more of an issue of poor coding standards than ill-conceived

The next new language feature we discussed were .NET Language INtegrated Queries (LINQ).  The reason LINQ is so amazing, is because it always a user to execute SQL-like statements against any

collection.  Often times, it will be used when querying a database
object, but the really cool thing I saw was that it would allow you to
select a subset of any IEnumerable object based on selection criteria. 
As a trivial example, consider the following:

ArrayList data; // Initialized with random numbers

Foreach var number in (from data
                                      where value % 2 == 0
                                      select value)
    // Do something with even values in data
an example, this is pretty lame, I'll admit, but it demonstrates the
basic idea.  You actually put in SQL-like queries to get only the data
you really want from a collection.  Actually, the mashed-up SQL I
didn't much care for, since it's confusing to all us SQL developers,
but it's done to provide cues to Intellisense, so it can help prevent
programming errors.  Plus, you can use Lambda Expressions in the where
clause, to provide even more power in the selection. 

new feature I use above is the 'var' syntax.  No, C# does not have
VBScript style Variants.  It is still a strongly-typed language, but if
you don't know the type of a returned variable off the top of your
head, you can just use 'var', and the compiler takes care of it for
you.  I feel kind of strange about this feature, since it seems so
pointless.  At least in the Boo programming language, Duck Typing

is actually a variable type.  The use of the var keyword in this case
seems to encourage laziness.  One of the guys I traveled with did point
out one decent use, and that was when you were instantiating a class,
and the type was already on the right hand side of the statement.

last new Language Feature ties in with LINQ, but it's kind of an
extension.  Microsoft calls it LINQ for Entities (codename: Astoria). 
Basically, it's the LINQ interface I was talking about, except instead
of calling the Database directly, or another IEnumerable object, you
create an Entity-map of your data.  This is used by .NET to
automatically turn your relational-database rows into custom Objects,
where you can access and change your data through properties
(presumably this can be configured somewhat in the Entity definition). 
Plus, you build the relationships between objects.  For instance, in an
e-commerce application, you would have a list of Customers.  Each
Customer can have a list of Orders, and each Order would have a list of
Products on that Order.  All of this is managed in Objects, and
collections, allowing you, as the developer to abstract the data in a
way that is more logical for the programming language you're using. 

Pretty cool.  Still, I'd rather just have an Object-Relational
Database, but this is still a good step.  Unfortunately, it abstracts
the loading into many, many calls into the database, so there are some
potential performance issues a developer will need to keep in mind.

then there was Silverlight.  Silverlight is Microsoft's new Flash
competitor.  Unfortunately, Silverlight 1.0 is kind of lame.  That's
not completely fair, since XAML can be used to create some fairly
complex visual effects, and some Javascript-based interface tweaks that
can look pretty nice, but for the most part, it's pretty basic
effects.  Silverlight 1.1, which isn't due out until next year
sometime, adds the ability to embed .NET code into the package.  This
is going to be huge.  Microsoft has really been pushing the video
aspect of SIlverlight, and to be honest, it's nice.  It does 720p
natively, and does a good job of scaling it, if it isn't available.  It
has good support for SVG overlays, so you can easily add watermarks,
subtitles, etc. to playing video.  Plus, it just runs well.  One of the
demos was playing a video with a jigsaw pattern cut into it, and then
he could scramble the puzzle, so it could be reassembled.  The pieces
kept playing their part of the video.  It was just amazing.  I'm going
to have to look into helping Mono get Moonlight up and running.  It's
just going to be too cool.

Long Week

Well, it’s been another long week at work. My meeting with the Registrar’s of all four WSU Campuses went really well. All the work I’d been doing and the design I’d done was completely validated over the course of the discussion. This may not have been my first choice in Job, but it should be good for the next year. At least, once I get all this stuff for the posting in. All of the sudden, I need three letters of recommendation and an updated resume. The resume is easy enough, but I’m having the ask around quite a bit for those letters. Luckily, I’ve got several people who should be able to get me letters by mid of next week.

Microsoft Hates Bug Reporters

At work yesterday, a printing error on one of our Websites was brought to my attention through our Tech Support guy. Basically, a single page in our Schedules of Classes wasn't printing correctly in Internet Explorer 7 (though it worked fine in Firefox). The page only print the Header and the Footer blocks, leaving the actual content blank. It was strange, because it was working fine on my computer, but not on the one used by our tech support. So, I buckled down to try to figure out this bug.

I set up our testing server to output the page with the Printing style-sheet, which if it was a problem in the CSS should have reproduced the error. It didn't. We did some further testing in Print Preview on IE7, and noticed that the error was only occuring when the scaling was set to "Shrink to Fit". Again, I was confused why the error wasn't apparent on my screen, as I shared Printer drivers with a machine where the error was occuring, and our IE versions were exactly the same. We proved that it wasn't a Microsoft Vista issue, as the error still occured on one of the Windows XP boxes in our office. At this point, I felt I had pretty conclusive evidence that this was a Bug in Internet Explorer 7, which clearly wasn't triggered very often.

I began my search to determine if the bug was already reported. The Microsoft Support Knowledge Base only contained two issues related to Shrink to Fit and IE7, and they seemed to be pretty specific to printing e-mail from Outlook and Outlook Express, and weren't "fails to render" errors. So, I began searching for how to submit a bug. I tried Microsoft Support's Contact Us page. I tried the Contact a Support Professional page. Which might have let me submit a report, but would have cost me (or my organization) $59.00 to even talk to someone about the Bug. Not acceptable. I understand that Microsoft wants to keep down the number of bogus bug reports, but hiring a team of triagers to filter through and translate the reports (for language issues) can't possibly that cost inneffective for Microsoft, especially since a good traiger could probably close most faulty bug reports without spending a lot of time on them. If the bug database was searchable and viewable by the public, that would help cut down on the faulty bug reports.

Next, I turned to Google. Surely, I wasn't the only person who ever wanted to report a bug with a Microsoft Product. What do I find? Not one, but two blog posts about people being completely unable to submit a bug report to Microsoft without jumping through a ton of hoops! Now, for us, this is only occuring on one of a hundred or so pages, and there is an easy work-around, so I'm not in favor of paying Microsoft to do their bug searching for them. One of the comments on that second Blog post suggested that "Microsoft was looking into improving it's Bug reporting processes," but given the amount of IM-style english used, I really, really doubt that the comment was from anyone who worked with Mircrosoft and certainly wasn't from anyone with the power to affect policy.

I am immensely glad that I don't buy Microsoft software, and that I've convinced my finacee to get an Ubuntu Linux powered laptop from Dell. I've often recommended Dell laptops to friends, and while the Linux offerings they have today don't fulfill my wants or needs, they're absolutely perfect for Catherine and her Molecular Phylogenetic processing. Plus, it's cheaper by a significant margin (~$700) that an identical hardware MacBook Pro. And that's with Dell Support.

Life, lately

Well, it’s been 10 months since my last post, and about a year since my last post with anything about me in it, so, I guess it’s time for another update, while I contemplate becoming more active in my blogging.

My work for Cuda-Buffalo Apparel (now CB Apparel) eventually moved away from being an Accouting Clerk, and I became that companies IT Administrator. I left the Company in August to move to Pullman, WA to follow Catherine, who is now studying Zoology and Molecular Phylogenies at Washington State University.

As for my own work, during the day I work for Washington State University’s Office of the Registrar as a Programmer for their RONet, a collection of Applications to support Registrar Office functions. The platform is ASP and MSSQL, which I was unfamiliar with, the Language was VBScript, which I was not fond of. Actually, I really like my job. It’s a lot of work, but I’m programming and designing all day, and it’s really, really nice.

At night I am finally doing some consulting. I’ve registered as a Business in Washington State, doing business as “Craig Consulting”, I’m looking into a domain name for a company website. Currently my only client is CB Apparel, but I hope to push for expansion of that list.

Due to Catherine’s work in Bioinformatics, I’ve because interested in some of the programming side of it, as the field of Molecular Phyogenetics has an intense dependence on computer systems and software. Currently, I have merely been familiarizing myself with the BioPerl suite, and writing a general purpose format converter to change a datafiles format so that other software can use it.

In web work, I really like the look of Catalsyt for Perl, but I haven’t done much with it. After working with several large website that mix all their processing in with their formatting, I’m a strong believer in MVC for web applications now.