Archive for the 'computers' Category

ASP.NET GlobalFilters, except this one page

If you are an ASP.NET web dev, you probably know about GlobalFilters.  You can apply an ActionFilter attribute globally.  It’s super useful for things like RequireHttps.  Unless you have one page that you want to exclude from that requirement.  Maybe you have AuthorizeAttribute sprinkled around because everything on your site is secure except, obviously, the login page.  Maybe, like me, you have a health check page that you want accessible via HTTP, while everything else is forced to HTTPS, or maybe there is some other use case.  At any rate, I found a good solution, implemented it, and then had to remove it because things took a different direction.  So, I am writing this mostly so I don’t forget about it, because it’s a pattern that I’ve wondered about before and never found a good answer.

Searching for what others have done in this case is actually a little difficult.  The terms for what you want to accomplish – filter, exclude, except – are all pretty generic.  The specific ASP.NET classes and fields are subjects of many unrelated articles, so that doesn’t really help.  Phil Haack has an interesting approach, but ultimately, I prefer declaring rules or exceptions inline as attributes. What I had adapted, before pulling it back out, was a nice approach outlined by Ori Calvo.

If you need to implement a similar setup, check out both approaches, and see if one of them will work for you!

Rockbox and playlist loading times

This is more for my own reference.  Rockbox, if you aren’t familiar, is a WONDERFUL open-source firmware replacement available for several MP3/media players.  I have a SanDisk Sansa Clip+ that, with Rockbox, supports at least 64gb MicroSD cards and likely beyond, which is way more than the stock firmware will support.  It also supports FLAC, Vorbis, and a cadre of other codecs.  I’ve been using this tiny player with near 70gb of storage as my main portable player since the day I installed Rockbox a couple years ago.  Recently, something happened after I dropped the player a couple times – it got stuck in a strange loop.  I thought I was hearing a song I heard before, but with about 9000 songs on the player, which I listen to in one big shuffled playlist, I have several remixes of some songs, so it took me a while to notice the same three songs in a row over a number of days.

In the course of looking into the problem, I recreated my playlist several times.  I did this mostly using Rockbox’s Database functionality.  I would find a top-level node in the Database (Artists, for instance) and long-press the select button to bring up the context menu, then choose Play Next.  This does insert them into the playlist.  The problem, though, was that it took like 2-3 minutes every single time I turned it on to resume playing.  This was new, it was instantaneous before.  I also tried saving the dynamic playlist to a file and loading it via the Playlist Catalog, but same delay.  Worse, when I plugged it in to a computer, it would take 2-3 minutes upon unplugging it, AND 2-3 minutes to resume playing.  The issue felt vaguely familiar, so I scoured the internet and found articles about database loading issues with the original Sansa firmware… lots of them.  I tried twiddling settings.  I created playlists in different ways.  I used crazy tricks regarding how the player is turned off and disconnected.  None of this made any difference.

Then, after really just a couple days of minor annoyance, I created the playlist in a very subtly different way.  In the Database, instead of using the context menu on a top-level node, I browsed into Artists and just selected the first item – incidentally, “<Untagged>” – which I assumed would open another “folder.”  Instead, it asked if I wanted to clear the playlist (I selected yes) and watched it load everything.  At that moment, I remembered having figured this all out before.  Instantaneous resumes once more.  I really don’t see why this is different from the other method, and the playlist it creates seems identical.  However, I’m glad to have a very snappy player once more.

Seldom annoying playlist issues aside, I do heartily recommend using Rockbox if you have one of the many supported players.  And the Sansa Clip+ is a very nice little media player that, with Rockbox and a large memory card, makes a good main portable.

Personal Websites

I just re-registered the domain after a few weeks of it being expired and nearly past the grace period. It got me thinking about what a personal website is for these days. We have several social websites for day-to-day thoughts, text messaging or maybe an IM for more immediate needs, flickr or other sites for pictures (though probably just on a social network), and LinkedIn for resumes. What is left?

Why do people have personal websites now? If you have code to share, put it on github or wherever. I guess there’s the about page, but static content is boring. I enjoyed maintaining my own webserver, but what’s the point? For that matter, why have a blog? Most of my posts, not that there are many, lately are just rants or screeds, and that gets old after maybe two.

So I’m honestly asking any friends still stopping by here or random passers-by — what are the reasons? What is interesting to read about? What content rises above just ego stroking?

Excel Graybar, with feeling!

Some four years ago, I posted on my old blog about making a nice alternating graybar in Excel with conditional formatting.  Once every 6 months or so, I need to do it again, and look up my old post on the Wayback Machine since my old blog isn’t all that accessible at the moment.  I decided that was crazy, plus I had the need for something a little more sophisticated.

Generalized, the formula is =MOD(INT((ROW()-1)/N),2) = 1, where N is the number of rows in each group. Standard graybar is strictly alternating, so the group size is one, but division by one is boring/pointless, so you can leave that out. The -1 assumes you are starting with Row 1 and want N non-formatted rows first, then N formatted rows, etc. If your range is in the middle of the spreadsheet, fiddle with this number, though anything outside the range -N to +N is the same as something in that range (-N and +N are always the same configuration).  To format the “base” rows use <formula> = 0.

I had remembered reading an article on ALA regarding zebra striping and the observed effectiveness for tables on the web. It may not be that useful according the article, but sometimes it feels right.

Bonus – the article mentioned two color single striping, so I deduced a formula for that. This probably isn’t the best way, but it works nicely… What I came up with is =MOD(ROW()-1,4) = 1 and =MOD(ROW()-1,4) = 3. For the base row formatting here, use =MOD(ROW()-1,2) = 0. Conditional Formatting is pretty powerful, so play around with it if the format you want doesn’t fit into these examples. Also, these formulas without the comparison at the end can be pasted directly into a spreadsheet to see how they evaluate. Enjoy.

Power Supply, Interrupted

Perhaps you remember my numerous computer problems.  My server died in 2007.  Shawn graciously replaced it with the donation of a freaking awesome machine that I honestly haven’t had the time to prep, but I will.  My latest build crapped out in like Feb 2008.  I replaced most every major component in the box, some twice, and eventually it rose as a Phoenix from the ashes of my desire to mess with it anymore (but, no, it wasn’t literally a bird on fire… or was it?).  Well, weekend before Christmas we trekked up to Carlinville for the Schuette family early Christmas and upon returning, the computer was off.  This actually happens relatively often… power outages generally overextend the capacity of my UPS, so I turned the UPS back on.  It’s nothing special, a CyberPower brick from Best Buy.  Well, after a few seconds, it started chirping, so I switched it to the other plug in the outlet (the non-battery surge strip that I swapped with worked fine in both), and no joy.  I figured the battery had completely discharged, so I let it charge up for a few hours.  Now when I turned it on, it would go about 5 seconds, chip, then turn back on.  Did that probably 10 times in a row before it turned itself off.

Now, I’m sure I’m crazy, but my thought is that a battery backup could certainly degrade into a simple power strip in the event of “battery no chargey”.  I mean, it gets power from the wall, it has six (or eight?) outlets… figure it out.  Oops, battery is out, let’s bypass that circuit and just send the juice through the line filter and to the plugs.  Nope, try as I might, I couldn’t get it to be any more or less than a hefty and super annoying outlet tester.  My guess is the battery is shot.  My guess is the battery is the single most expensive component there… power strip – $5, UPS – $60, and UPS = power strip + battery.  My guess is I won’t be that interested in fixing a low-end UPS.  Found a simple, unassuming power strip and all is well.

So, if anyone reads this and cares… is it odd that a UPS sans battery can’t function as a power strip?  I suppose if you had servers attached to it you wouldn’t want it NOT complaining if the battery were shot.  It’s not like this is something a huge operations center would (should) use, though.  At least give me a “y’know what, I’m gonna chance it” switch to bypass the “without a battery I’m nothing” circuitry.  Anyone looking for an Interruptible Power Supply?  An Uninterruptible Lack-of-Power Supply?  A paperweight?  A flail?  A good time?  Wait, what?

It Lives!

My computer is a computer again.  Only two months and I think it’s back to its former self.  So, absolutely the power supply and motherboard were shot.  Not sure what happened.  Not sure if they were related.  Was pretty dusty, the mobo mabye just shorted out somewhere.  New power supply was a steal at Radio Shack, $35.  I bought a new CPU, which may or may not have been needed, but $35 later I have the fastest single core Socket 939 chip available (Athlon 64 4000+) – only 3 years old by now!  There are very few Socket 939 motherboards left for sale, mostly the higher end ones with SLI or Crossfire support, and mostly north of $150.  But, I was able to find a Tyan model for only $45.  Of course, there had to be a problem (I discovered after receiving it)… it needs an additional 8-pin ATX power connector.  The new power supply did not have one.  So, I dropped another $80 on a PSU that has one.

Get that all set up (replacing a motherboard is tantamount to building a new computer from scratch) and it won’t boot.  Well, it does POST and I can configure the BIOS, so the parts are all working.  And it does boot to the Windows boot menu, but will never get any further (not even safe mode).  So, I pray that the hard drive didn’t get hosed.  Start up the recovery console and I can see that things are still there where they should be, which was a relief.  Of course, I’ve never actually used the recovery console before, so I have no idea what to do to recover from an error that I can’t really describe.

So, I let it sit for a few weeks.  I figure I’ll find another hard drive to toss in, install windows on that and not lose data from the old drive.  When I got time, I slapped an old 30 gigger in, and nothing.  So, I grabbed the 80 GB drive from a computer that was marked for the dumpster (thanks Shawn!) and slightly more than nothing.  BIOS can read the manufacturer information from the drive, but Windows Setup can’t use it to install Windows.  So, I talked to a few people and arranged a couple loaners once they got cleaned off.

In the meantime, I was pleading with Google to tell me how to fix this and the great and powerful Google offered me a soupcon of hope.  I don’t really install Windows that often, but I had remembered something to recover or repair an installation.  I just assumed it was the recovery console, and forgot about it.  I forgot that Windows Setup could actually repair an installation.  I never had a drive or partition I even thought about sacraficing, so I never took that leap into “setup Windows XP now”.  Per the repair guide above, I did a repair installation, and boom, it’s all good.  Got XP Service Pack 3 set up and few other updates, and all seems to be well.  Windows Setup repair, gasp, just worked.  I don’t know what the problem was (I did try rebuilding the MBR before the repair), but it wasn’t beyond repair.  Total pricetag, $221.92 with all the shipping and thermal paste and whatnot.  My father-in-law just bought an eMachines system, dual core, 2gb, decent hard drive space, 19″ widescreen monitor, new printer… $500.  Why do I build computers again?

Computer updates

So my computer died.  That sucks, and so far, it really makes me want to give up building computers and really lots of other things to do with computers.  It’s just frustration, really not much more benefit anymore.

Anyway, right when it happened, I tried turning it on, no dice.  Just absolutely nothing, no lights, no fans.  So, I figured power supply and replaced it.  Hey, now lights come on and fans spin up.  I hear a little hard drive action, but the monitors never get signal.  No POST noises or anything but lights and constantly on fans.  Take the CPU out and I hear a diagnostic message about a missing CPU, so I guess that’s the problem.  Buy a new three-year-old CPU, heat sink, and good thermal interface material.  Drop the new chip in, grease it up, and lock the heat sink in place.  No change at all.  Same lights.  Same fans.  Same hard drive action.

So, at this point, I’m not sure what to do.  I don’t have the time or resources to fully test the components and see what the problem really is.  I’ve ordered a new mobo, which brings me up to about $170 on revamping an aging system.  I probably have two good single core socket 939 processors, but few people want those anymore.  If this new mobo doesn’t fix it, I may just try and sell the lot of it and take some (more) time off from computer ownership.

So many times computer geek type people want things to “just work”, but I find most often they just don’t.  I won’t delude myself into thinking that a computer built by someone else will work any better, it will just contain lower quality parts, but I guess I can get a warranty. And, if I wanted a Mac, I’d let you know…


July 2017
« Jun    


I would like to thank Mike Hellrich for hosting a couple redirects for me while I sort out my web server problems.