Archive for the 'computers' Category

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…

REPOST: A Tale of Two Icons: Resources and How I Learned to Use Them In Visual Studio 2005

[Note] Co-worker wanted to see this, so I’m reposting to make it more readily available.

For the past couple months I have been working on a small suite of WinForms applications written in C#, one targetting Tablet PC. This was my first project using Visual Studio 2005, and C# 2.0. For the most part, I like what Microsoft has done. In the IDE, I don’t notice that many breakthrough changes. Snaplines are nice, and the new data grid was a breeze to use. The TableLayoutPanel helped me out a great deal. <Rant>I was a little apprehensive at first, since I avoid using tables for layout in HTML, but the TableLayoutPanel is designed for layout, it is semantically correct. Tables are a natural fit for layout in many cases, but html tables semantically represent tabular data, not a method of layout.</Rant>

Anyway, I was chugging along trying to make halfway usable applications and setup packages. Sorry Rob, no WiX yet, but I hope to look into that soon. I decided that I had files worthy of their own Windows file type — you know, you double-click on one and it opens in the appropriate application, they have a uniquely identifying icon, etc. I already had a program icon, so I thought I would just add another icon to my resources and be done with it, my documents could point at the icon using the “program.exe,2” syntax (where program.exe contains multiple icon resources and the number after the comma is the icon index). This is what almost all Microsoft applications do, and seemed like the way to go. For example, if you create a shortcut, and browse to say, winword.exe for the icon, you will be presented with about 15 icons all contained in that file. Anyone that has changed the icon for a shortcut is familiar with what I am talking about. Well, I browsed to my program, and it had one icon. I did about everything imaginable in my resx file, and it had one icon. I googled and googled, and it had one icon. From managed code, I could access all the icons in the resx, but Windows refused to see but the one icon.

As it turns out, Microsoft decided to eschew the established resource methodology to make things more easily accessible in managed code. That is all well and good, but having multiple icons in an EXE or DLL is a VERY common thing to see in Windows applications. After a few more hours of googling, I found a few pages that basically said it’s not possible with resx files to have multiple icons (or other resources) that Windows can see via Win32 API calls. Resources in resx files are managed resources, anything Windows is aware of are unmanaged Win32 resources, and ne’er the twain shall meet. I didn’t find any information out there with a satisfactory answer to the question of “How do I add multiple icons to a .net assembly?”, so here for you now is my solution. Note, I had trouble then and I’m having trouble now finding any references to this problem. I know I found some MSDN articles indicating that resx resources aren’t available in unmanaged contexts, but I can’t find much now. Here is an article suggesting a messy post-build solution and an MSDN article on command line csc.exe options (specifically /win32res). Sorry for the lack of references, though.

While trolling around in the project settings for a C# project, I realized that whatever you select for the Icon on the Application tab is the one icon that is visible via the Win32 API. I also noticed the “Resource File” setting right below that. Turns out, you can either pick a single .ico icon file, or provide a .res compiled Win32 resource file for the application. You want the second option, but how to get a compiled .res file? You can’t accomplish this with a C# project, you have to create a new C++ project. Set the “Configuration Type” under “Configuration Properties | General” to Makefile, otherwise you will get all kinds of build errors. Apply that and the available configuration will completely chagne. Now, back in your C# project, I suggest you add all of your icons and other resources to your resx file just as good practice. Visual Studio tends to put these in a Resources folder under the main project folder. This is where your .ico files will live, this is where you will edit the icons if you need to make changes, etc. Back in your C++ Makefile project, add a new item to your project, pick the Resources category, and then “Resource File (.rc)”. This is the non-compiled version of a .res file. If you double-click on the .rc file in Solution Explorer, you will find the Resource View tool window, which you can dock with the Solution Explorer. If you have multiple .rc files in your project, you will get a node per .rc file in the Resource View; right-click on one and “Add Resource…”, pick Icon and hit the Import button. Browse to your C# project, then into the Resources folder, change the file type to Icon Files so they show up, and pick your files (I think multi-select works here). You will get an Icon node under the .rc node in Resource View, and an item for each icon under that. The names will be pretty cryptic, and the order DOES matter a little bit. My suggestion is that you pick the primary program icon first, all by itself, and let that be IDI_ICON1 (I said they were cryptic). Then go back and add any additional icons you want. Pop open the resource.h header file that was created and you will understand how the icons are indexed. You can make changes here, but it is best to get them right from the get go.

Now you have some resource files with resources, but what you need is a .res file. Open up the properties window for your C++ project and find the NMake settings. Edit the “Build Command Line” and add something like rc.exe /r /fo file.res file.rc for each .rc file in your project (each command on a separate line). Save that, and copy it to the “Rebuild All Command Line”. In “Clean Command Line” add del *.res and Ok out of the properties. Build the C++ project and you should find some .res files. Back in the properties for your C# application, find the “Resource File” setting I mentioned earlier and browse to the .res file you just built. That’s basically it. Fiddle with the project dependencies on the Solution settings to make sure your .res files always build before the C# projects that use them and you should be good to go. That should be SOOO much easier than it is, but I’m glad it’s at least possible.

[2006.09.27] Update: Alert reader Matt Murphy points out that this won’t work so well for those using C# Express, since C++ projects can’t be used. He recommendsGoRC or ResourceHacker as workarounds. Not sure if you can use those in a way that automatically incorporates the resource building in a post-build event, though. I’ve not used either of these, so I can’t make any recommendations.


May 2017
« Jun    


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