Saturday, December 29, 2012

Lessons Learned: Media Center PC


A few years ago I built a media center PC. Yesterday I replaced it with a new one, and in the time between I made notes.

The biggest mistake, and the root of almost every issue with the first media PC, was buying into the small form factor hype. I will say it is interesting, a little fun, and in some geeky way ITX is cute (those little DC-DC power supplies mashed into the 24-pin ATX plug get me every time). Like everyone else building a media PC I wanted small, powerful, and quiet--and maybe cheap. For some unknown reason the VCR set the standard for media appliance size.

I believe the focus on a small form factor misses the spirit of do-it-yourself. It limits options, and standard size parts yield standard size repair costs. If I was really focusing on size I'd get a Roku or buy a smart TV. I'll list component by component my frustrations with my old media PC and how it affected the parts chosen for version 2.0.

Part List for Media Center PC 2.0

Case: SILVERSTONE Grandia Series GD05B-USB3.0
Power Supply: PC Power and Cooling Silencer MK III
Motherboard: ASUS Maximus V Gene
Memory: 2x CORSAIR Vengeance 8GB (2 x 4GB)
Storage Drive: Western Digital WD Green WD20EARX 2TB*
Optical Drive: LITE-ON Black 4X BD-ROM
Tuner: SiliconDust HDHomeRun DUAL HDHR3-US

These parts worked well for me, and they were chosen after many years and many frustrations  Hope this helps someone. Details and reasonings below.

*not new, from old media center pc
**network device, also not new


Monday, November 12, 2012

Isotope Photo Gallery Example

I'm not sure if school projects inspire me to do new things, or if they are so boring I try new things (at the risk of sound egotistical I lean towards the latter). I volunteered to make the website bit. It was a small part of a larger project, and I decided to take on the pseudo-business website from scratch and code it all in notepad++.

It's nothing special, but I am quite happy with the picture gallery. It makes use of the jQuery plug in Isotope, and an old PHP photo trick* I had laying around. Here is a link to the actual project. It's pink because I'm the only guy in the group.

http://morepie.geekwagon.net/desserts.php

Isotope is easy enough to figure out. Okay, it took me a few hours, but for a real programmer it's probably stupid easy. My problem was that I had pictures with random file names all in the same directory that I wanted to use as objects for Isotope work its eye candy magic on.

This bit of PHP grabs all the files in a directory and turns them into div's Isotope can use. The first few lines are the Isotope buttons that make it sortable. It distinguishes between cake, pie, and other types of desserts by the first letter in the file name. I did have to go through and add a character to the beginning of each file name manually, but this was a one time simple project.

In the end I was pleased with the results. I am able to add and categorize pictures with a rename and an upload.

1:  <ul id="sort-by">  
2:   <p>Filter images by type -></p>  
3:   <li><a href="#" data-filter="*">all</a></li>  
4:   <li><a href="#" data-filter=".b">brownie</a></li>  
5:   <li><a href="#" data-filter=".c">cake</a></li>  
6:   <li><a href="#" data-filter=".p">pie</a></li>  
7:   <li><a href="#" data-filter=".o">other</a></li>  
8:  </ul>  
9:  <div id="gallery">  
10:  <?php //adapted from Nathaniel Sabanski's comment on 15-Mar-2009 12:49 at http://php.net/manual/en/function.opendir.php  
11:   $dir = "./gallery/"; //relative path to picture directory  
12:   if($handle = opendir($dir)) {   
13:    while($file = readdir($handle)) {   
14:     clearstatcache();  
15:     if ($file != '.' && $file != '..') {  
16:      $cata = $file[0];  
17:      $size = getimagesize($dir.$file);  
18:      echo '<div class="picItem '.$cata.'">  
19:      <img src="'.$dir.$file.'" height="'.$size[1].'" width="'.$size[0].'" alt="gallery image">  
20:      </div>';   
21:     }  
22:    }  
23:    closedir($handle);   
24:   }  
25:  ?>  
26:  </div>  
The code has some comments, mostly for me to remember how to use it. There is a URL link to where I got it in the first place.. which is always nice.

Also, thanks codeformatter.blogspot.com.

*The term trick to be used loosely.

Sunday, November 11, 2012

The Map

My part of a school project was about the cost of living in the United States. It was a simple project (like compare two cities) where I only had to write a few sentences. I wanted a map too. I was sure somewhere on the whole of the Internet someone had made a United States cost of living map. There were some, most of them were broken down by state. I wanted something more granular (for the record I found one after I went through all this trouble--was similar to mine except it's by county).

I started with military BAH data because I found too many ways to break down cost of living. This simplified the process, moreover it's a real world application. People in the military really get a housing allowance if you live off base (I know from experience), and the amount given is different based on where you are. The BAH data is also available in CVS format, which makes it easy to work with.

Obviously I chose zipcode over country because the BAH data was already broken down by zipcode; also the zipcode boundary data is available on the census website. There are plenty of places that will tell you how to retrieve this and insert it into a KML (which is just an XML file Google Earth uses to store user created information) file. I found this guy's blog post to be the most useful of those search results. He doesn't tell you how to do it, he just has the KML file available. Props to Fil.

The BAH data required a little beating (the term "massaging data" irks me) to be useful. Eventually, I had a text file full of zipcodes and a number for how much BAH received relative to one another, and a KML file full of zipcode shaped polygons. That's where the real work started.

There are a lot of details I'm going to skip here. Most of them would just point out how dumb I am. Let's just say there was a fair bit of trial and error. In the end I used an over complicated while loop (I'm new to C++ but it's fun). It went through the 170 some-odd MB KML file line by line and wrote it to a new file. When it found a zipcode that matched the BAH data it would add a style to that polygon that was a shade of red based on the cost of living number I associated with it. Took about an hour to run, but in the end I am pleased with the results.

I've posted the code on github. No doubt the program could be better, but for a first year CS student it's not horrible. Who knows it could be useful in other school projects. All you need is a list of zipcodes and some other random bit of data separated by a tab.


If this turns out to be helpful to anyone drop me a comment; I'd love to hear about it.

Friday, October 26, 2012

Clean and Thrifty 0.9: A Scouting WordPress Theme

I am now an assistant scoutmaster at my old troop. It's considered volunteer work where I get to go camping and have fun. How can you lose? Helping them is also yields opportunities for me, in this case I have a chance to hone my--still developing--web design skills.

Troop 1865's Web Page
To be honest, they don't have a huge need for a web page. I believe the calendar is the only thing that might get looked at. I opted to use WordPress because it is easy to maintain, make changes, and it's a platform I'm familiar with. The first thing I noticed was a lack of "Scouting" themes. After the basic page was up and running I started working on my first WordPress theme.

I am ecstatic with the end result. It turned out much better than I imagined (I did not set my sights high). One of the parts I'm particularly proud of is the footer. It makes use of the code tidbits from CSS Sticky Footer, a little JavaScript (in the form of jQuery), and some minor MSPaint skills. The theme uses the official Scouting stationary image, and because it is so large (2636px wide) the JavaScript randomly changes it's CSS background x position. The only bummer was the ends of the image didn't line up to form a nice loop. I fudged some mountains together that turned out pretty good, but I'm not thrilled with the rope. Maybe I'll do something about that in the next version, but I am no artist.

After some code clean up I'll call it version 1.0, but for now it's good enough to use. I hope to add some interesting features to it in the future.

It is available on github and open to the public domain.

You can see it in action at troop1865.org.

Wednesday, October 24, 2012

$141 Million a Night Cruise

I have never seriously looked at cruises, but I was curious just what one actually costs. After a quick search I saw this. I think I'll just keep saving for my sky scraper.



Seven nights would could save us $710 Million!

Wednesday, October 10, 2012

Traffic Lights

Occasionally I come up with ideas for how to improve existing products or procedures. For a long time, like many others, I’ve sat at intersections and contemplated traffic lights and intersections in general. Clearly I’m not the only one. Here are three things I believe make intersections better (at least until everyone has a driver-less car and then they'll be to scary to watch)

Incoming Traffic Monitoring

My first complaint is not how long I have to wait, but the fact they don’t take “incoming” traffic into account; only traffic sitting and waiting at the light.

This scenario happens to me regularly. I am sitting at a red light with to no cross traffic. A vehicle begins to approach the intersection (figure 1). The light turns red and they have to stop.
figure 1

Now I get to go, and the other car sits there with no cross traffic (figure 2). Had the light stayed green in the other direction two more seconds, that car would have never had to stop. By the same token, with no cross traffic I’d have never been sitting at a red light in the first place. If we could make lights account for incoming traffic, anecdotal evidence suggest there would be savings in terms of gasoline usage.

figure 2


Lights with Feedback

Now let's address wait times. I have been assured by a civil engineer the longest you’ll ever have to wait is 2 minutes. That may be true, but what about lights that get so backed up have to wait two or three cycles.

Perception is reality, and with that in mind red lights are red for a long time. I believe this is a combination of  stopping sucks after you've been going fast, and not knowing when the light will change.  You can see lights in the cross direction and have a good idea, but what if lights gave more immediate feedback?

I propose making all traffic lights work like load bars. The picture below is an example of a green light. The dark green outline represents green light that stays on the whole time the light is green. The brighter green represents light moving right to left, it’s intuitive. Someone who’s never seen this will know something is going to happen when the green runs out.

Logically, it goes to yellow, and has a similar load bar motif. Yellow would move faster because the light is yellow for less time. The point is that at a glance a driver can get an idea when the light is going to change.

The system is not perfect. A gander at the next image may point out why rather quick.
Assuming red lights work the same way, true the feedback is nice, but apprehensive drivers may jump the gun. I don’t have a great plan for that, but my initial thoughts would be to change to green before the red timer runs out completely.

This system does have the added benefit of having more light. The surface area of the border can be thick enough to be greater than the surface area than current lights. Led panels can be made to support a variety of colors and have other information built into it them like turn arrows and yield symbols. Another added bonus is they can all be made the same since their display is programmable; no need for special turn signal lights.

Point of no Return Line

Finally, an intersection idea that needs no figures and can be put into place right now with a can of paint, “Point of no Return” lines. I’d guess they’d be yellow lines painted on the road perpendicular to the direction of traffic a ways back from the intersection (I guess I could include a figure here). If you are going to speed limit, and you are still behind the line when the light turns yellow, you should come to a stop. By the same token, if you are across the line when the light turns yellow you should be able to continue at the speed limit without any problems.

The “Point of no Return” line shouldn't be attached to any laws, though it could be useful for prosecuting someone who has caused an accident by running a red light. “The video clearly shows the plaintiff was beyond the line when the light turned yellow (and there would be a video if cameras took incoming traffic into account like the first idea).

For me there are times I’m not sure how long the light will be yellow. Perhaps I’m just not good at judging the distance. There have been times I've come to a quick halt because a light turned yellow, and there have been times I've caught the first half-second of a red light as I flew through the intersection. A line could put some of those concerns to rest.

I’m not saying these will happen. I’m not even saying they should happen. I’m just sharing the things I think about while waiting at a red light.


Wednesday, September 26, 2012

An Amature's Experience with github

I have a few--not great--projects I threw on github, but what is most surprising to me is which one generates interest. Brief description after the jump break.

First, I like github. It took me a little while to get the command lines down, but once I did I have to admit the over all experience is enjoyable. Seeing line by line changes is a wonderful thing, and someday I hope to work collaboratively on a project. As a former IT guy for a software development company, most of my experiences with revision control has not been fun (it might have had something to do with being an all .NET development place--couldn't say I had no development experience at the time).

Some quick advice for anyone who wants to learn git, go to try.github.com. That could have saved me at least 6 hours--I'm a slow learner. It could save a real developer at least 30 minutes.


Friday, August 31, 2012

I made a button!

It has always been interesting to me how web design and web development are so closely related yet so different. Usually if someone is good at one, they are not so hot at the other. Maybe it's a left brain/right brain issue. Maybe it's something vastly more complex. Personally I believe it is a matter of time. If I focus all my energy in development, my knowledge of design diminishes; and vice versa. Granted people will always find one easier than the other, but like with all things the more you do it the better you get (even if it doesn't come to you naturally).

I leave a lot to be desired on both design and development. I like the programming side more, but the more I learn the dumber I feel. The design side is pleasing because the results come so quick, though my color picking skills are still at a kindergarten level. All that being said; I made a button!


Edit: I know it doesn't work right in IE. Tough.

Buttons should be simple. This one is done all in HTML and CSS. There are millions of tutorials already on the web about how to make a button. Mine follows my thought process, and it just might be the key to help someone make their own button.

Thursday, August 02, 2012

Beyond Spell Check

It's no secret my spelling is down right atrocious. I could argue the heavy use of spell checkers in most programs these days have made it easy for me to not focus on learning how to spell. I could argue that, but I'm not because there is no good excuse. An interesting development I have picked up on is I can almost create a complete list of words I can't spell because I've seen them with the red squiggly so often. In fact here is a short list of some in their raw form (yeah let's just totally point out how dumb I am):

excersice
expereince
squigly
articel
preceds
reserach
aparently

The point of this post is not to point out how dumb I am. The point is I was typing in Google Docs and I needed the phrase "desert cave" which I of course typed "dessert cave". This is interesting because in Google Docs dessert comes up with a red squiggly when it precedes cave (not here though so it's clearly not Chrome checking this spelling).

The real question: How does Google Docs know I want a cave in the desert and not a cave filled with cake, pie, and ice cream?

Normally I'll do a little research before I throw things up on the old blog, but this one was an interesting enough observation to get out there.

Update: I'm just behind the times apparently.
http://googledocs.blogspot.com/2012/03/spell-checking-powered-by-web.html
http://lifehacker.com/5895252/googles-new-spell-check-is-crazy-awesome

Friday, June 29, 2012

one hundred push-ups program

They gave me a gif!
I have to begin this post by stating that I don't like to exercise. I don't even like the word because every time I type it spell check never gives me the right word as a replacement option. I'm not a fitness nut. I never exercised a day in my life until I joined the military.

Even though I am not a fan of it, I do it because I want to live. Like most, I look for new and exciting things to maintain what little interest I can in fitness. Enter hundredpushups.com. Despite what it sounds like, make no mistake, this is a program anyone can do. Even if you've never done a push-up in your life.

A detailed experience of the hundred push ups training program past the jump...


Initial push-up test: 36
Final push-up test: 62

Friday, June 15, 2012

Clarion database date and time

Clarion databases, so far I'm not a fan. Here is just one of the reasons.

Clarion Date

This is the easy one, the date is stored as the number of days since December 28, 1800. Where that date comes from, who knows, but that's the date. Add whatever number is in the database--as days--to that date and you'll get the date you're looking for (pun intended because we all know if you think this is cool you don't have a date).

It should also be noted one of the things I read while looking into Clarion dates said even though the date is December 28, 1800 you still can't use numbers lower than 4. Which puts you at January 1, 1801... and is a date that makes only slightly more since except now you have to worry about subtracting. For the purposes of programming or spreadsheets, I found it easier just to pretend this problem doesn't exist because all the dates I am working with are in the 20th and 21st century.

Clarion Time

Here is the can of worms, and the reason I'm writing this down. I couldn't find squat on the Internet about how Clarion stores time. I'm sure it's out there, I'm just saying the search results leave a lot to be desired. Here is what I would have wanted after mashing "How the heck does Clarion database store time?" into Google.
  • It's in centiseconds.
  • It starts at Midnight
  • It rounds down (that part might just be my program)
Centiseconds, you know, 1/100th of a regular second. That's a perfectly sensible measurement of time no one really uses. Why even spell check wants to change it to secondments. Doesn't really matter, as long as we know what it is we can worth some mathgic on it and make it make since.

Clarion's Time Field / 100 = Seconds from Midnight
Clarion's Time Field / 100 / 60 = Minutes from Midnight
Clarion's Time Field / 100 / 60 / 60 = Hours from Midnight

These work, but they give you a decimal number. For example if I have a time field with "2861193" and I convert it to hours I get 7.94775833 (and that's 7.94775833 in the morning). From that it's just normal convert decimal hours into useful time (drop the 7 and multiply by 60), which in this case is 7:56.87.

We use a proprietary ERP with a Clarion database at work, which is why all this is happening in the first place. When I take my result, rounded to the nearest minute it does not match. My result from the above example rounding to 7:57 and the program showing 7:56. Results that should round down work as expected, so I think it's one of two things. Either the start time is not exactly at midnight, or the program just rounds everything down. I assumed the later and will wait and see if people who use my program see a difference between the proprietary one. I figure if I am wrong, the problem will be very minor, and for the most part it's just not worth the time to troubleshoot any farther than I have--I checked like 8 of them! That's pretty good right?

Most importantly, I wanted to share this info with other who have found this frustrating. Probably not many, but you never know.

Conclusion

I made a calculator to figure this out for my project. I've also made the source available.

The Calculators accept user input, but the code was also used as a function for my project. In the future I may make a post about my solution to connecting to a Clarion database. It's a pain, it's not elegant, but it works. It was also one of those things I had a hard time finding help with.

Thursday, May 24, 2012

Aliens, man I hope they're reading this.

A friend of mine has posted some interesting stuff on Facebook about aliens, conspiracy theories, and some of my favorite topics of discussion. The weird thing, most of my views on these have changed dramatically over the past few years. To say the least I've taken a more realistic approach to the topics, and to say the most I've almost done a complete flip flop on my beliefs. For fun, I thought I'd throw down what I believe on the topic of extraterrestrial life. Warning: long and opinionated, mostly irrelevant post past jump.

Friday, May 11, 2012

Quick update

I also wanted to post a quick update to a previous post about Cisco Clean and my unnamed university. While my opinions have not changed, as of the other day I no longer need to use a virtual machine to access the university network. They now allow Linux clients to connect using the web authentication tool.

Suddenly my netbook has more memory.

DD-WRT for fun

Recently I set up a wifi hotspot for a local coffee shop using my old router and the open source dd-wrt software. While setting it up I made many notes, not only because I need notes, but in an effort to help the owner make changes and troubleshoot future problems. It was my intention to post my notes on the dd-wrt wiki (should be easy since I use a wiki to keep notes), but to my dismay there doesn't seem to be any way to create a user account. I am also confronted with the possibility I simply can't figure it out. This is a common phenomenon I experience. On the one hand, I have my own wiki setup on a virtual machine for notes and such, yet I can't figure out how to log into someone else's. I have a similar problem with Facebook.

Personal problems aside, I feel I should share these notes somewhere (←PDF of notes). Setting up a free public wifi hotspot turned out to not be a strait forward as I thought. Here are some lessons learned.


  • Depending on hardware DD-WRT allows for multiple virtual wireless networks. This was utilized to create an unsecured hotspot, and a secure private wireless.
  • iptables is flipping awesome (the DD_WRT uses this as it's firewall). It's worth figuring out.
  • There are a lot of ways to make a public hotspot, I chose nocatsplash mostly because it was already installed. It turned out to be able to do what we wanted; take the used to a "splash" screen to let them know they are using this network, and when they agree to use that network it takes them to the coffee shop's events page.
Over all this turned out to be a fun project I was glad worked out well for the folks that use it. I also got to learn a few new things about networking and Linux. I recommend it for people who like to piddle with such things.

Friday, March 23, 2012

Analog Optical Disc Extraction Tool

Yes it's in a plastic bag.
Some time ago, and my "some time" I mean years, I made a blog post about analog CD extraction devices. It was neither rioting or ground breaking, but it was one of my more commented posts. Looking back I see the images no longer work (and I have a flicker account?). I'll get that fixed sometime.

Recently I discovered an Emergency Eject Pin (pictured), clearly a knock of off the more clever Analog CD Extraction Device. Admittedly it may be time to change the name, before the cloud and streaming media makes optical discs obsolete. I'm thinking Analog Optical Disc Extraction Tool.

Analog for all the obvious reasons. It could be dropped all together, but come on that makes the whole thing work. Optical Disc so it can apply to a broader range of whatever happens to be a disc shape. The change to "Tool" over "Device" was a difficult decision, but I think it better illustrates functionality. Wikipedia tells me a device and tool are pretty much the same thing, but personally I think of tools as simple objects like screw drivers and pliers. Where a device would be something designed for a specific task like a cable tester.


Monday, March 19, 2012

Cisco Clean

Screen shot of  Cisco Clean Agent running on a guest
Windows XP and sharing the Internet with Linux host.
As far as I can tell, and this should be considered a biased opinion, Cisco Clean is kind of useless. Granted, I am not a big network administrator, but I have experience with small public and private networks. I've never felt the need for anything that resembles Cisco Clean.

Just to simplify, Cisco Clean is a program that runs on potentially hostel client computers; to be specific, student laptops. The program's job is to make sure Windows updates have been applied and there is some kind of anti-virus software running.

My misunderstanding comes from why this is even necessary when the only reason to connect is to access the Internet? What am I missing here?

My problem comes from the University not allowing Linux clients on their network. From Cisco's FAQ:
Q: How Does Validation Work for Linux Users?
A: Linux users must authenticate by logging in via a web page. There is no client which is downloaded to Linux systems. The network connection timer is set for Linux systems; however, there is no icon that can be right-clicked to logout and subsequently login again.

What if the university has the web authentication disabled? That's the story here.

There is an open source project called freecca that looks very promising, but it is limited to Gnome last time I tried it (my old under-powered netbook runs Lubuntu). I have yet to attempt compiling the latest source which promises to run on any GUI. Until I get a chance to really delve into this I've come up with a temporary solution that surprised me it worked so well (In fact I'm using it as I write this post).

I ended up using VirtualBox. First I installed it right from the repositories, then installed Windows XP as a virtual machine. I mean the licence was just stuck there to the bottom of my netbook anyway, so why not? I was hesitant it wouldn't run well because the atom processor doesn't support virtulization extensions. And to be fair, Windows XP does run like crap, even when I allocate 1GB of the 2GB's available on my netbook (more than half after subtracting video memory). Even running like crap, it only has to boot up, and run the Cisco Clean agent. Once the connection is established I switch back to Lubuntu... which runs great on older hardware.

The trick, let the virtual Windows environment use the wireless adapter as NAT, and set up a second host only adapter. In Windows run the "Share Internet" wizard, chose the NAT network adapter as the Internet, and the other as the one to use for sharing. After connecting with Cisco Clean (assuming all the updates and anti-virus is ready) the guest Windows machine will share it's Internet with the Linux host.

It's not the ideal solution. It's not a simple solution. But it was one I understood and could work with. My only complaint is having to wait for the VM to boot up and shut down. Fortunately when I do need it, it is for long periods of time. Otherwise I'd spend more time getting the freecca to work.


Friday, January 13, 2012

My First Open Source Contribution

It's no secret I am a fan of open source software, but I am not a developer. I use many open source programs. Donated a little to a few. I recommend some to others. Gave what feed back I could. Even still I never felt like I've contributed.

For the first time in my life I ran into a problem with an open source project that I was able to fix, and of course I made those change available to everyone. In the past few months I've been playing with MediaWiki, and have gotten to the point I enjoy using it for different projects. I've added a few simple extensions to my personal and work wiki that have made life easier. Specifically, Tasks Extension and Data. I like them because they are simple enough for me to use, I can actually look at the code and have a clue what is going on, and they do exactly what I want with no extra foo foo. All was great until I went to play with MediaWiki 1.18, and discovered neither one worked.

It took me some time, because I'm am not even an amateur developer, but I did eventually finagle both of these extension until they worked. I even rigged Tasks to work from a single directory (with some help of comments from another user on it's discussion page) like an extension should. All in all I am kind of proud of myself. The only bummer is I am probably the only person on Earth who uses these extensions. On the off chance anyone stumbles here and needs to make either of those extensions work in MediaWiki 1.18, you'll see my changes on their discussion page under the heading "Working in 1.18" (or follow the links I just made below).