Ramble On

Rambles of a University Systems Manager

Archive for March, 2005

Rambles (now with Audio!)

without comments

I have posted the text of the speech that I'll be giving to students and parents at our 2005 College of Engineering Open House

It's very similar to the one that I gave last year

As a bonus - here's a .mp3/podcast (7.2 MB) of the speech.

Written by admin

March 31st, 2005 at 9:42 pm

Posted in rambles

It should be noted…

without comments

It should be noted that:

$catstring = preg_replace("#[^a-zA-Z0-9\s/-_]#",'',$catstring);

does not equal:

$catstring = preg_replace("#[^a-zA-Z0-9\s/\-_]#",'',$catstring);

especially if it's important to maintain the "-" character in a string.

Funny how a single unescaped pattern match can break all kinds of navigation in one's web application.

Written by admin

March 31st, 2005 at 3:03 pm

Posted in rambles

Frustramigation

without comments

Frustramigation is a rather endearing word-that's-not-a-word My gf uses it, and she's a copy editor, so I figure I can get away with it. It rather describes the day. Although, I think it's more frustramigation with myself than anything else.

I have been on a mini-crusade to educate the masses against the use of FTP for some time. And today on the campus System Admin/Support list (appropriately named the "nag") - I had an opening from one of my colleagues who suggested the use of an FTP client for some kind of file transfer (in lieu of emailing the files). An opening to put out my $1.02 about the problems with FTP (usernames, passwords, and data transferred in the clear) again, and a plea to my colleagues to stop recommending its use (that didn't mean kill the existing service, it meant start recommending alternatives - which we've been doing for a while ).

Go ahead - search ncsu.edu for "FTP". A whole lot of implicit recommendations to use it. Search engr.ncsu.edu or eos.ncsu.edu. (hopefully you won't find much there encouraging its use).

What followed was a somewhat devolving exchange where all I did was likely come across as a raving idealist (at best). I tend to carry out complaints in public forums, mostly as an involvement activity - because as I said:

I was holding this discussion in public view because it deserves at least a modicum of public attention, not some backroom one on one or few on few discussion between a small part of two of several dozen computing groups on campus.

But I think that just serves to confuse the issue, because all it devolves too is me and some other group arguing semantics on tangential items - mostly because I start waxing philosophic and causing the tangential threads - and given my sometime deserved track record for causing stirs - I think I just again sound like a raving madman. Or as I mentioned a few days ago in a rather prescient moment, - like I'm just against something, rather than for something.

The real underlying reason I try to have those conversations in public was along the lines of what I wrote in one of the notes:

There is a significant and ongoing vicious cycle of (at least some of) our service offerings on campus - created by a disconnect between those creating/managing/maintaining a service, those supporting the service, and those using a service. The service providers think we still have to keep offering the service because "the users depend on it". The service supporters keep telling users to use the service because "that's what our providers told us we have" and the users keep using it because that's what the "support staff told them to use." Given enough time and distance and the lack of a ongoing feedback loop between those three? Eventually "the users depend on it" and "that's what we were told we provide" and "that's what we are told to use" become self-referential - the discussions aren't actually taking place, but each little group keeps telling each other that because their peer in the same group said it, and of course it's bad form to ask any questions - like "why the heck are we still doing that?" or "where exactly did you hear that at?"

Which of courses has nothing to do with FTP.

Oh well, I keep telling myself that I'll eventually learn.

We'll just kill off FTP in Engineering. The rest of campus will eventually catch up (or we'll be burned at the stake for cutting off the service).

But at least those NCAA brackets will be encrypted.

Written by admin

March 31st, 2005 at 5:01 am

Posted in rambles

The Day in Rewind

without comments

Herewith a collection of random bits and comments from today.

Web development is hard

I have to echo Jeremy Zawodny's post about having respect for web developers. I have done my fair share of php, php+mysql, and perl, but none of what I (or we) do comes close to the kind of stuff that's going on at Google Maps, Flickr and other sites using advanced javascript and DHTML. I have written a few javascript routines, and honestly hated it. Almost as much as batch file programming or programming in Unix shell languages.

Even the simple stuff is hard to get correct. Today, while taking a survey about why/how we run our own mail server in my group for a campus subcommittee looking into a campus-wide email/calendaring solution - it turns out that it was broken in Firefox. I was able to complete the survey in Safari, but in an effort to figure out what was causing the problem (and share that with the survey developers) - there was this snippet of html in the source:

  <p>
    <label>3. Is this resource comprised of a single person or a group of people?<br>
    <input name="staffing_numbers" type="radio" value="single">
    Single<br>
    <input name="staffing_numbers" type="radio" value="multiple">
    Multiple</label>
  </p>

Hey - it works fine in IE! and it works fine in Safari! However, it's not up to spec:

"The LABEL element may be used to attach information to controls. Each LABEL element is associated with exactly one form control."

The whole validation/specification/works here/doesn't work here is maddening - and this is just the simple stuff. This isn't "Ajax"


Man it's hard to keep good people

So our systems part-timer today came in to tell me he has a job at SAS for the summer. Converting some vbscript to C#. He's good, really good, one of a rare breed of very competent, but-doesn't-they-they-know-everything and willing-to-try-fail-and-learn students. But he'll get good experience at SAS and make way more money. My group is a hard group to recruit for, not because the work we do isn't really interesting (it definitely is) - and not because I can't sell a position (I can make our group sound like the greatest IT position ever) - but doing either brings a whole lot of people out of the woodwork, and not many of them the kinds of personalities you want in a student-based system administrator position. Good system administrators have good "IT genes" and are grown - rarely found. Oh well, back to the drawing board for the summer.

(one day I'll have to tell the story of how the very first day I started as a manager, I had someone turn in their resignation, and another employee barely show up to work for my first month, before resigning too. After that trial-by-fire, dealing with part-timer turnover has been relatively easier ;-)


Where in the World is Page Hall

After reading Robert Scoble's post about BlogMap - I decided to add mine. That led me to read up a little on ICBM / geo.position tags (which I decided not to add to EWE) - and led this evening to playing with TerraServer

After looking for Page Hall on the aerial map:

"binarypage

I was reminded again of my ongoing theory that the reason Bragaw Hall is shaped as an "X" is a University-Governmental conspiratorial decree to have a reference point at NCSU for satellite/aerial photography.

"binarypage

Try it - you look at the aerial image for raleigh closely - and see if Bragaw doesn't show up rather easily.

[update: - just in case it isn't clear from how I write - the idea that this is conspiratorial is largely tongue-in-cheek on my part. Stranger things have happened, but I wouldn't care one way or the other]


And all this is why this website is aptly named "Rambles of a University System Administrator" ;-)

Written by admin

March 29th, 2005 at 5:09 am

Posted in rambles

Updates

without comments

Long time no say nothing.

A big chunk of my time in last two weeks has been spent putting together a Priorities and Practices list and a Projects list for my staff for the next year.

One of the best things to come out of that, I believe, is an increased transparency that I’ve asked out of my staff. We started publishing our group’s Staff Notes in our wiki/weblog site the week before last. I have high hopes for that.

I’d link directly to the Keynote (version 2, which was my first try out of the program) - but I decided to pull in some movie captures from Field of Dreams and Contact that I thought were relevant to the themes within the presentation. So the resultant file is pretty big, not to mention that likely copyright thing.

In case you are wondering, the Field of Dreams scene was this one:

Ray, people will come Ray. They’ll come to Iowa for reasons they can’t even fathom. They’ll turn up your driveway not knowing for sure why they’re doing it. They’ll arrive at your door as innocent as children, longing for the past. Of course, we won’t mind if you look around, you’ll say. It’s only $20 per person. They’ll pass over the money without even thinking about it: for it is money they have and peace they lack. And they’ll walk out to the bleachers; sit in shirtsleeves on a perfect afternoon. They’ll find they have reserved seats somewhere along one of the baselines, where they sat when they were children and cheered their heroes. And they’ll watch the game and it’ll be as if they dipped themselves in magic waters. The memories will be so thick they’ll have to brush them away from their faces. People will come Ray. The one constant through all the years, Ray, has been baseball. America has rolled by like an army of steamrollers. It has been erased like a blackboard, rebuilt and erased again. But baseball has marked the time. This field, this game: it’s a part of our past, Ray. It reminds of us of all that once was good and it could be again. Oh… people will come Ray. People will most definitely come.

I included it as an analogy that our constant is our people. And when we stay the course and stick with the fundamentals and priorities, we will best serve our faculty/staff/students.

And along the way, last week I was reminded again about how much easier it is to be against something, rather than for something. But all the innovation comes from being for things.

More on that, well, sometime.

Written by admin

March 28th, 2005 at 6:18 am

Posted in rambles

Maybe some good can come of this…

without comments

So recently when I wrote of being contacted by a lawyer about RAID and AFS?. I did get a response from the lawyer.

He is trying to:

"overcome a patent that alleges to be novel and unobvious in claiming a system that includes RAID on AFS…What we are trying to find out is if anyone published an article or spoke about or developed a product that included RAID on AFS prior to 1990.

If what I wrote somehow jogs something else into mind, please do not hesitate to let me know. Otherwise, I hope that this reply shows that some inquisitive intellectual property lawyers represent good guys too!"

I'm afraid our use probably wasn't much help, but hopefully someone will be able to help him.

I will say, after being curious enough to search the Patent Database ( the ugliest web page known to man) for "AFS AND RAID" (to see if I might figure out the one the lawyer is trying to overcome) that I came away exceedingly depressed at some of the patent grants the USPTO hands out.

Written by admin

March 16th, 2005 at 4:19 pm

Posted in rambles

Inequity

without comments

There are 2000+ software projects at sourceforge.net in the category of "Editors"

There are two, TWO!, open source tournament bracket management tools suitable for the NCAA basketball tourney that I've managed to find.

Clearly the priorities of the open source programmers are out of whack.

Written by admin

March 11th, 2005 at 4:58 pm

Posted in Uncategorized

Tagged with

Apple Memory Upgrades

without comments

According to AppleInsider, Apple is expected to take their standard memory installation from 256MB to 512MB (hmmm… corresponding with the Tiger release…. hmmmm…..)

All I can say, if this is true.

About darn time.

Written by admin

March 10th, 2005 at 8:33 pm

Posted in rambles

Well, it is true is it not?

without comments

Today’s selected email.

To: [steering group members]
Subject: (fwd) Sysadm meeting

We won’t be meeting this month prior to the sysadm meeting unless you have
a burning desire to do so.

And if you do have a burning desire to do so, you may want to have that
checked out by a doctor.

Jason

Of course we are also quoting 2001: A Space Odyssey in the Jabber chat room.

12:35:31 [sysadm]: ok, who tripped over the Internet plug?
12:36:33 [sysadm]: from the overwhelming response I’m guessing
it was only the Flex building that just lost connectivity
12:38:31 [sysadm]: or maybe just everyone’s a lunch and I’m in
here all alone
12:40:13 jayoung@jabber.eos.ncsu.edu: Affirmative, Dave, I read you.
12:40:29 [sysadm]: ack!
12:40:41 [sysadm]: and I didn’t even know you knew how to read lips
12:41:21 jayoung@jabber.eos.ncsu.edu: Yes, Dave, although you
took thorough precautions against my hearing you
12:41:37 [sysadm]: ok, you can stop now, you’re creeping me out
12:42:07 [sysadm]: (expects your next line to be, "I’m sorry
Dave, I’m afraid I can’t do that.")
12:42:32 jayoung@jabber.eos.ncsu.edu: Look I can see you’re really
upset about this. I honestly think you ought to sit down calmly,
take a stress pill, and think things over.
12:43:10 [sysadm]: Open the pod bay doors Hal!

Written by admin

March 9th, 2005 at 5:57 pm

Posted in rambles

Engineering IT

with one comment

Are programmers Engineers? About every few months this is usually something I bring up because I’m part of an IT group for the College of Engineering, and because I manage a group of IT staff/system administrators. It’s probably largely out of guilt - my own background is entirely IT/System Administration and my degree is Computer Science - and most of the staff has an IT background (with ECE or Math degrees) - and I sometimes feel like we understand far more about the academic needs of the CSC and/or ECE departments. I usually end up saying that I feel like I really don’t understand Engineering, because I’m not sure I’m an Engineer.

I’m thinking about it again, because Brad Abrams wrote about Software Development and Engineering Design in his weblog last night, based of a conversation with his dad (Dr. Frank Abrams, an NCSU BAE Faculty Member). Brad links to a great handout that Dr. Abrams has put together about the Engineering Design process.

(Interestingly enough, the courses links above will be dead in a few months, an unfortunate by-product from perhaps our own campus design choices for course management solutions).

Brad offers:

my hope is that software is just in a maturing state.   These principles apply equally well to software and will play out more as the field develops more deeply but what I can’t tell is are we on track?  Are engineering fields as young as software in the same state of flux?  What is your take?

And this is a place that I wish I had more exposure to professional software development practices. I know a bit of the theory and I know the terminology - but I don’t know the real world of what’s happening there. I do think that the current security situation with operating systems and service software is probably the Software discipline’s equivalent to the famous Engineering design failures (Tacoma-Narrows is always a fun example)

I’m not sure Computer Science was teaching this 9 years ago when I went through it. I think they very much did teach problem solving methods, but not so much in the context of an Engineering process (I think computer science - in general, not specifically at NCSU - is still figuring out where it fits between Engineering and the Mathematical sciences).

I think they are doing quite a bit better for today’s students - as a syllabus for our Software Engineering course shows (however, I think I should point Dr. Iyer to a color design document - that black on red interweaved with black on yellow on blue is pretty hard to read).

What I can say is that the IT part of software is definitely not anywhere near an Engineering process. And the way we have built on IT as a service tends to have our customers, even the Engineers that use our service (and the product of the Software Developers) definitely do not approach the use of computing technology using any kind of Engineering methodology (but I’ve complained before about people turning their brains off when they use computers, and it’s probably our fault)

Far too often, we are reacting to a problem, and implementing a fix. We aren’t defining the problem, we aren’t effectively generating or analyzing anything that even resembles a solution - and forget about testing or documentation

There is tremendous pressure to just fix problems in IT. Mostly because our customers don’t know enough about the computers to frame their own problems, and we barely know enough to help them through framing their problem.

I think this customer angle is key. And key to helping Software along a more mature path as an Engineering discipline.

What will change that is education. I wrote about the educational component of our "Next Generation Eos" project before:

Do you know that we brought 300 students in this semester and did *not* provide them an NC State-customized "image" - which is what most IT people will tell you has to be done to be able to "support" something. We have a few Macs, and a number of Windows machines, installed as they were from the vendor…

…We had no observable increase in the support required from the IT helpdesk. Initial assessment is that the students also got a lot out of E115 and were excited about it. (it also has some of the best TA’s, and like anything, good people make the projects). Our assessment director is conducting the assessment, and the results aren’t yet completed - but the initial feedback is very positive.

This is revolutionary

Computing is a new fundamental for Engineering (I spoke about that at our Faculty Seminar last year) . I think by doing more to remove that "magic" that is computing. By getting our students, especially our Engineering students to approach computing with an Engineering mindset, we’ll get them asking more focused questions, and making more intelligent demands on the Software Designers (and not to mention the IT staff) to create better products.

That’s my hope anyway.

But until then, the IT staff would be well served in doing more to adopt the ideals and Design Process that Dr. Abrams highlighted for his Engineering Design students.

Written by admin

March 9th, 2005 at 3:14 am

Posted in rambles

Firefox? Let me count the ways

without comments

So love is a strong word for technology or land masses - but in addition to loving OS X and this state I call home - I'm rather fond of Firefox too.

Because Firefox already includes a setting for blocking Plugin (e.g. Flash)-initiated popups

Excellent.

Written by admin

March 7th, 2005 at 3:26 pm

Posted in Uncategorized

Tagged with

I Like Calling North Carolina Home

without comments

From Paul Jones ( via Ed Cone) a list of 8 “North Carolina Wonders” from a 1956 Newspaper report:

  1. Dorton Arena
  2. Old Fort Ridgecrest Southern Railway [Andrews Geyser/Loops.]
  3. Blue Ridge Parkway
  4. Any mammoth textile mill especially those such as Cone Mills (thanks for the reference, Ed)
  5. Duke Tower [on Duke Chapel]
  6. [Old] Playmakers Theater at UNC-Chapel Hill
  7. [Old] State Capitol Building
  8. Wright Memorial at Kill Devil Hills

Heh, I’ve got pictures of the capitol, Duke Tower, (although I have better pictures of Duke Chapel), [new] Playmakers Theater, lots of pictures ,from the parkway (but none of the parkway), Dorton Arena and the [new] fountain. Even, a railway (okay, so it is the kiddie train tracks in Pullen Park).

Still to do, a gigantic Mill, the Wright Memorial, and too many places I haven't been in a long time.

I love this State.

Written by admin

March 7th, 2005 at 5:21 am

Posted in Uncategorized

Tagged with

Say, Say, Say

without comments

No, not the song (which thankfully isn't in the iTunes Music Store, but sadly I do own a copy of via a Paul McCartney greatest hits CD) - but the OS X command

I mentioned my little baseball drafting application earlier, but what I didn't mention was that it was made possible by OS X and Fink - which let me run Apache, PHP, and MySQL pretty easily on a laptop. (okay, okay, I've done this on Windows too).

Well, on a lark, I added a simple exec('/usr/bin/say') call to the "Draft this Player" feature of my application.

Say is a command line interface into the OS X speech engine. Allowing you to speak or output to a .aiff file whatever string or input you pass to it.

And draft day was spent with the computer generated echoes of "The Cleveland Indians select…"

What a great little feature. I love OS X.

(bonus for the Macintosh using readers - for grins and giggles try "say Ricky Bottalico" from your shell and explain that one to me)

Written by admin

March 7th, 2005 at 5:00 am

Posted in Uncategorized

Tagged with

The next generation

without comments

From the mouths of children comes Wisdom. From Jenny Levine @ The Shifted Librarian (via Deb Coates):

Brent: "So Yahoo is only 10 years old? I thought it was more like 20."
Jenny: "No, it's almost as old as you are." (Brent is nine years old.)
Brent: "Wow. So there was no Yahoo before I was born?"
Jenny: "That's right. Before you were born, there wasn't really an internet or the web or email. There was a very basic form for people in the military and at universities, but there were no web sites to visit and no web games to play."
Brent: "So Runescape didn't exist?"
Jenny: "Nope. You're older than Runescape."
Brent: "So computers were worthless ten years ago?"

The Universities should take heed.

Written by admin

March 7th, 2005 at 4:35 am

Posted in Uncategorized

Tagged with

Nothing Good Can Come of This

without comments

So I received both a phone call and an email from an Intellectual Property Lawyer asking me about the first time that AFS and a RAID were used together. And if I didn't know that, what was the first time that one was used at NC State?

It also looks like I wasn't the only one he asked.

My response:

Admittedly, I'm not completely comfortable responding to an Intellectual Property Lawyer that both calls and emails me out of the blue ;-) But I'll tell you what I know - which isn't much.

If you Google for AFS and RAID, you're likely to find an info-afs mailing list thread that seems to indicate that SAS was running an AFS server with a RAID array attached to it in 1992.

There was a lot of misinformation regarding AFS and RAID arrays for some time - since most hardware-based RAIDs look just like a single big disk (or set of disks) - the AFS file server doesn't care - it's just writing to the Unix filesystem. If the host OS can use/see/read/write the RAID array, then the AFS processes can. There's no special support, no unique software, no magical incantations needed (beyond the standard rubber chicken needed for system administration). Once the OS drivers for the RAID controllers for the various operating systems became stable (early 90's I guess) - then it just worked.

The reason people ended up asking questions on mailing lists is that most quality RAID arrays cost a lot of money at the time the question was asked - and everyone was hedging their bets. A better question would have been "what RAID controllers do you like with Solaris/HPUX/whatever". AFS turned out to be an irrelevant part of that question.

I don't know when NC State started using RAID arrays with our AFS servers. Whenever University groups started being able to afford them - it was after 1997. The College of Engineering didn't do it until 2001/2002 - when we bought a SUN Raid Array that we knew worked fine with Solaris.

I do have to ask, to what purpose is this question being posed?

He didn't respond to my question.

So one thing that stands out is the fact that I really am a little nervous giving any kind of answer to a lawyer. Pretty sad state of affairs huh?

One thing is for sure, I'd bet that he made far more money asking the question than I did answering it.

One part of the story that I didn't say (mostly because I had forgotten until now) that I saw first hand the the very first "burn-in" tests of several RAID units back in 1997. In my first week on the job, since I had an MCSE and was supposed to be a "Windows person" - I stayed after work to help Bobby Pham with some kind of Windows problem. Bobby had several demo units in of RAID arrays that the then Computing Center systems group was going to purchase.

I still haven't figured out what the big deal was.

Written by admin

March 7th, 2005 at 4:24 am

Posted in rambles

Followup: A Programming Puzzle

without comments

I was actually pleasantly surprised by the followups that I received to my "Programming Puzzle" query the other day.

It's a simple problem, but it does take a little bit of thinking.

My original answer that I did was:

function calculateDraftRoundAndTeamNum($numTeams,$draftPosition,&$round,&$teamNumber) {
   $round = ceil(($draftPosition / $numTeams));

   if($round % 2) {
      $teamNumber = ($draftPosition % $numTeams);
      if($teamNumber == 0) $teamNumber = $numTeams;
   }
   else {
      $relativePosition = ( $draftPosition % $numTeams);
      if($relativePosition == 0) $teamNumber = 1;
      else {
          $teamNumber = ($numTeams+1-$relativePosition);
      }
   }
}

Basically, reverse the index into one's array by determining which round you were in, handling the edge cases of a "0" remainder from using the MODulus operator to be the last team or the first team. Like most of my emails, my answer is a little verbose I think.

Which is why I really liked Charles Brabec's Perl-based answer. By kicking up the number of teams internal within the logic, you obviate having to test for the edge cases. Nice.

He also did a Postscript answer. I told him he was just showing off :-). But it's really interesting, and interesting to remember that Postscript is actually a programming language.

Charles also provided a test case with his code, which is important to help verify the results. One of the folks that submitted a PHP example would have benefited by running through their function through a test suite. It looked good until you got around the picks that rolled back around.

Professor Jeff Joines did the following in Matlab:

function [rnd, teamindex]=jeff(numteam,draftpos)
rnd=ceil(draftpos/numteam);
re = draftpos-(rnd-1)*numteam;
if mod(rnd,2) == 0
    teamindex = numteam+1-re;
else
    teamindex = re;
end
end

Getting around the edge case check by not using a modulus to compute the relative position.

Doug Goodall did the following in Python

def draft(draftPosition, draftOrder):
    numberOfTeams = len(draftOrder)
    currentTeam = ""
    draftRound = ( (draftPosition - 1) / numberOfTeams) + 1
    if draftRound % 2:
        pick = draftPosition - ( (draftRound - 1) * numberOfTeams)
    else:
        pick = numberOfTeams - (draftPosition - ( (draftRound - 1) * numberOfTeams) ) + 1

    for team in draftOrder:
        if team[1] == pick:
            currentTeam = team[0]
        break

    return [str(draftRound), currentTeam]

Doug also calculated the pick position like Jeff did.

One interesting difference between Python and PHP shows up in the round calculation, PHP returns a float value with division and Python does an integer division.

Billy Beaudoin mixed his languages and provided a PHP example that would work only in Perl. It was unique because it raised -1 to the power of the round within an array reference, basically:

(Remainder - 1) * (-1)^Round)

The subscripts are off - but it takes advantage of a neat feature in Perl, negative array indexes index back from the end of the array.

Billy also found the gmp_div_qr() function - providing quotient and remainder in one fell swoop.

Troy Hurteau also did php:

$round = ceil($position / $totalTeams);
$order = $position % $totalTeams;
if($order == 0) $order = $totalTeams;
//if the round is odd
if($round % 2 != 0) $teamNumber = $position - (($round - 1) * $totalTeams);
//if the round is even
else    $teamNumber = ($round * $totalTeams) + 1 - $position;

one thing Troy did (not shown) was provide lots of error checking for the number of teams against the provided team array, and checking for silly values like 0 teams (which the rest of us really forgot to do).

While I would have loved more responses, having so many different code examples was great.

Written by admin

March 7th, 2005 at 2:49 am

Posted in Uncategorized

Tagged with

Coding Music

without comments

Believe it or not, of all things, I'm writing PHP code tonight to the The Rocky Story

It makes me run faster, but I'm not sure that it makes me type faster.

Smokestack, fatback,
many miles of railroad track
All night radio, keep on runnin'
through your rock 'n' roll soul
All night diners keep you awake,
hey, on black coffee and a hard roll

You might have to walk the fine line,
you might take the hard line
But everybody's working overtime

Living in America - eye to eye, station to station
Living in America - hand to hand, across the nation
Living in America - got to have a celebration

I'm resisting the urge to do the Numa Numa Dance.

Written by admin

March 3rd, 2005 at 4:37 am

Posted in Uncategorized

Tagged with

A programming puzzle

without comments

One of the things I do outside of work is participate in a baseball simulation league. Part of the pre-season activities for the league is conducting a draft of all of the available players to fill out the rosters for the teams in the league. I'm building a web tool (using PHP and MySQL) to help me keep track of the drafted players (it's something that helps me keep up with my programming skills and stay up with a few technologies that we offer to folks in the College of Engineering).

Our draft works like most baseball drafts, by reversing the order in each successive rounds. e.g. if our league had three teams:

Round Team Position in Round Overall Draft Position
1 Yankees 1 1
1 Cardinals 2 2
1 Red Sox 3 3
2 Red Sox 1 4
2 Cardinals 2 5
2 Yankees 3 6
3 Yankees 1 7
3 Cardinals 2 8
3 Red Sox 3 9

(we don't allow for trading draft picks)

One of the programming tasks I had to figure out tonight was:

given an overall draft position, figure out the:

  • Round (e.g. for a 3 team league, draft position 8 is in Round 3)
  • The Team whose pick that is

While our league has a fixed number of teams (20) - I wanted a generic function that returned this information for me, whether the league had 20 teams or only 3 teams.

So I offer that challenge to you - write a function or set of functions that given a draft position, a number of teams in the league, and the first-round draft order for those teams, returns the round of the given draft position, and the team that should be drafting at that time. The function(s) should allow for any arbitrary number of teams in the league.

Here's an example PHP array for a 20 team league, with team names and their draft position (intentionally alphabetized by team name, feel free to manipulate the array however you want to make it easier to work with - the built-in PHP array functions make this easy ):


$teamArray = array('Atlanta Braves' => 18,
'Baltimore Orioles' => 6,
'Boston Red Sox' => 16,
'Chicago Cubs' => 1,
'Chicago White Sox' => 9,
'Cincinatti Reds' => 20,
'Cleveland Indians' => 10,
'Detroit Tigers' => 12,
'Houston Astros' => 14,
'Kansas City Royals' => 2,
'Los Angeles Dodgers' => 13,
'New York Mets' => 15,
'New York Yankees' => 19,
'Oakland Athletics' => 5,
'Philadelphia Phillies' => 3,
'Pittsburgh Pirates' => 11,
'Saint Louis Cardinals' => 8,
'San Francisco Giants' => 4,
'Seattle Mariners' => 17,
'Texas Rangers' => 7 );

(this challenge is initially meant for our Engineering PHP Developer's group and my reference implementation is done in PHP, but feel free to use any language you like, and convert the array into the language you are using)

For those non-programmers that might be interested in the math of this ( and as a hint to the programmers) - - what algebraic expression(s) could you write to figure this out?

I'll post what I came up with in the next few days.

([update]: I will temporarily screen comments that have solutions in them - just to give folks taking a look at the page some opportunity to work through the problem themselves without an answer right in front of them ;-) )

Written by admin

March 2nd, 2005 at 3:30 am

Posted in Uncategorized

Tagged with

So, Jay, Did you really mean…?

without comments

So did I really mean:

I hope we do everything we can do to get rid of every last Microsoft product we use.

No, I really don't mean that. My aversion to platform mandates and making sure we have an open environment where students can use, experiment with, and make use of Linux, Solaris, Macintosh OS, Windows, Longhorn, XINU, whatever also precludes acting out my reactionary frustations to Microsoft licensing.

I'm just extremely frustrated with the byzantine software licensing model that Microsoft has.

I honestly think we are covered under our MSDN Academic Alliance licensing, but this still, ahem, burns my biscuits.

( which you can obviously tell because I keep going on and on about it :-) )

Written by admin

March 1st, 2005 at 3:06 pm

Posted in Uncategorized

Tagged with

Ditto

without comments

Written by admin

March 1st, 2005 at 2:35 pm

Posted in Uncategorized

Tagged with