Monday, March 30, 2015

How An Apple a Day Keeps the Anger Away

I am not an Apple fanboy.  I DO enjoy their hardware - the time they put into the fit and finish makes it almost worth the cost of getting around their stupid "come to us for everything" mentality.  Don't get me wrong, OS X has been a great system, but I absolutely love the mechanics of the open source world.  Give me a nice XFCE interface any day of the week, and I will be a happy camper.  I view it this way - yes, you can re-compile most applications to run on Mac (macports, etc), but that can be a REAL pain.

A few weeks ago, I had the thought of getting rid of the Mac, and going with a cheaper Toshiba with Linux running on it.  It would be just as effective, plus I'd be completely back in the open source world.  There was just one problem.

I also own an iPod.

Reality set in when I thought, "I haven't synced this iPod in two years!  I should update the songs on it, and this is a good chance at doing this completely open source."

I have a large music collection running on a server.  It's not a Windows server, nor is it a Mac.  It's Linux.  That has the majority of my music on it, not the Mac, or the Windows desktop that my wife uses.  My problem is that I had certain criteria I needed to meet :
  • I didn't want to copy music files all over the place to do it - so the iPod sync had to be done on the server.
  • I wasn't going to install Mac OS X onto the server, as it doesn't even run a graphical interface.
  • It HAD to be compatible with my iPod.
This set me off on a rather long, laborious search.  I started off with rhythmbox (everyone pointed that way).  Unfortunately, it requires a GUI.  That was nixed fairly quickly.

I then looked for Banshee - which wasn't available in the specific CentOS instance I used.  That one was out.

There was a software package called "gtkgpod".  It required a GUI.  But that triggered a look at a library the same group released, called "libgpod".  A library.  How nice.  Just a note for anyone looking at using that library, their API document was terrible.  It was great at showing minor python plugins.  That was about it.  I searched for examples all over the place, and after hours of not finding anyone who had implemented the API but gtkpod, I threw my hands in the air in frustration (trust me, all five fingers were up), and installed the required graphical binaries.  I didn't fire up the GUI on it (no monitor hooked up), but I did use X Forwarding..... and it didn't do much for me.

I went back to the source for libgpod, and built some software examples from their test code.  I had things that could finally do what I needed (or so I thought).  I altered my code to fit my needs, and fired it off.  It took four hours to sync some songs to the iPod.  But, it finished!

I ran over to the server, disconnected the iPod, and.....

.... it said "0 songs".

What?  I plugged it back in, and ran my test cases against the iPod again.... it said I had 783 songs on it, and identified all of them.

Thoroughly frustrated, I started searching for firmware hacks.... nothing for mine (iPod Nano 4G) that was considered "ready" for the world.  I didn't want to play with "bleeding edge" code right now, I have too many other irons in the fire.

Then, I saw a random post somewhere about a software package called "rePear".  It was actually kind of tough to find the "source" for it.  I finally found their home page (download links were not up to snuff, but I was desperate at this point).  I kept poking around and finally found the source on SourceForge.  I had to ignore the links that said "win32" - even though I was working with Linux.  All the way down in there, in code from 25 February 2009, I found a tar ball.  I quickly grabbed it, downloaded it, and read the usage.  Ugh!  I had to copy python scripts to the iPod root device!

At this point, I thought, "what can it hurt?"  I dropped the python files into there, and ran "repear.py config" (first setup requires this), manually cp'd the music (and play lists) onto the iPod, and then ran "repear.py freeze".  I waited for it to finish, synced the filesystems (sync;sync;sync), and ejected the iPod.  I ran over with my fingers crossed.

And I finish typing this listening to music from the iPod I synced music to without iTunes.  Hallelujah!

Monday, March 16, 2015

Paint Reproduction

Well, here we go again.  It's all about that base.  (Painter time!)  As an FYI, for the uninformed, here are the criteria for reproducing a paint color if there is transparency involved.

  • Air pressure and the nozzle size - these variables control how much paint and how quickly it's thrown onto whatever you are painting
  • Viscosity of the paint - viscosity is how "thick" the paint is - it's a result of how much paint thinner you are using, and if you get it too thick, you get blobs of paint, which is BAD, but not enough and you don't get any coverage
  • Primer - if you are using the candy paints or tri-coat systems, your paint is going to be transparent, and in that case, the color of the primer underneath it all has a direct impact on the resulting look
  • Base Color - when you buy the paint, you must be aware that the brand of the paint is critical - if it's not the same, the base coat is going to be a different color, resulting in a different finish
  • Top and Clear Coats - you should probably be aware that "clear" coats are not always "clear" - they can come with color tints, which do effect the end look, and a top coat is designed to change the end look through tinting

With so many variables, it's hard to reproduce a paint color without knowing a few variables.

So, when I heard back that the new painter couldn't reproduce the paint color, that was some bad news.  He couldn't make the color work right.

Let me translate that.

I have to take the headlight units back to the original painter.  He hasn't taken my phone calls, yet.  I could be doing this on my own, and it could be an expensive learning curve.  Here's hoping.

Saturday, February 7, 2015

SSH Over HTTPS While Serving HTTPS WebSite

Hey, folks! I use this blog also as a placeholder for little tidbits of info I find out on the net.  I stumbled across the following information for setting up an HTTPS proxy using Apache that allows a connection to a second port (e.g. for an SSH connection), while still allowing Apache to serve HTTPS requests on the same port  :

http://blog.chmd.fr/ssh-over-ssl-a-quick-and-minimal-config.html

Since most who visit here are already familiar with Apache's HTTPD server, I won't go into all the gory details.  If there is an unanswered question, visit the above link.

First, make sure you have the proxy module loaded!  This is a must, or you will receive errors when starting.  Next, open your SSL configuration that you want to allow the proxy on, and add the following :
    
    ProxyRequests On
    AllowConnect 139
    <Proxy *>
        Order deny,allow
        Deny from all
    </Proxy>
    <Proxy 127.0.0.1>
        Order deny,allow
        Allow from all
    </Proxy>
    
This essentially allows the proxy headers to tell Apache what you want to connect to, but limits it to only the localhost connection on port 139.  All other proxy requests (unless you've added more) will be denied.  Make sure you test it.  If it's failing to fire up for you, try doing it over the unencrypted (HTTP) connections instead (you will have to change the Apache configs for that), and watch what it is doing.

For the client side, you can connect to the proxy tunnel by installing the proxytunnel package, then using the command :
    proxytunnel -E -p example.com:443 -d 127.0.0.1:139 -q
    
If you are having problems connecting to the tunnel, change the -q to a -v (quiet to verbose), and try it again. If you are not doing Samba access, but sending it to SSH, you can connect to the tunnel, add the following stanza to your $HOME/.ssh/config file :
    Host example.com
        ProxyCommand proxytunnel -q -E -p example.com:443 -d 127.0.0.1:139
        DynamicForward 1080
        ServerAliveInterval 60
    
This should allow you to run the ssh command where it sets up the connection for you.  Try it out!  Again, I'm not the expert here, I simply pilfered this information from http://blog.chmd.fr/ssh-over-ssl-a-quick-and-minimal-config.html (and there is much, much more available from that link!

Friday, January 2, 2015

Sometimes I Miss My Colleagues

When I left my old company, the one thing I knew I would miss were my colleagues.  They were the creme of the crop - and not just because they knew a little bash.  They were smart, and they weren't jerks about it (probably unlike me).

One of the big things was that they liked to cause others to question their mental stability through various pranks.

Yeah, I really miss that.

However, along the new team, the same kinds of camaraderie exists, albeit one or two don't want to play that way.  We're in a cube farm at the new place.  I really didn't like that at first, because I couldn't turn around and ask a colleague a question.  But then I finally found a use for the cube farm :





Yeah, that's where the entrance to someones cubicle USED to be.  Gonna be tough to find their way in.  I really do miss those guys.

Friday, December 26, 2014

Countdown Clock - Stratum 1 Not Required

Well, someone has tasked me with building a "Christmas Countdown" clock.  A couple of blocks away from our house are a few houses that have been referred to as "Yards in which Walmart threw up" - meaning they had so many "cheap" decorations that they essentially didn't have a yard.  One of these homes has a countdown clock in the front window.  We'll call this "The House" in this post.

A neighbor of mine loves Christmas (he is a good friend of mine).... to the extent that the family has to drive past The House every day just so he can see the clock.  He doesn't work a soldering iron at all, but he has requested that I build him a custom countdown clock.

First, I needed a good way to count down to a target date/time.  I didn't want something attached to a network (e.g. using "NTP), and I didn't want some fancy clock that had Stratum 0/1/2 (which, incidentally, are all NTP - I know this, but I'm simply using that as a reference point so that you can understand that I don't need accuracy over a long period).

There are a number of ways to create a clock.  They are broken into two categories - analog and digital.  An analog clock is (usually) simply a motor and gearing to move the hands on the dial.  The digital requires a signal input - often referred to as a "clock" (go figure).

Because he wants a days/hours/minutes until Christmas clock, it should probably be digital.  I can go the highly-accurate way and procure a crystal oscillator and design a circuit around that, or I can simply use an inaccurate oscillator - the infamous 555 timer. For the purpose of this, expecting it will be used once a year for only a couple of months, I'm settling on the 555 timer.

With that settled, I needed a circuit.  I really needed something fairly accurate to the 1/1000th of a second.  Here's a circuit that should give you pretty good results :



The thing I see wrong with the circuit above is it is about a 66% duty cycle, meaning that the output will be "high" 2/3rds of the time.  I'd rather have it closer to a 50% high, 50% low duty cycle.  But it also has to have that accuracy.  Let's tackle the accuracy first.

There are 86400 seconds in a day.  If we are slightly off by 0.004 seconds, over one day, we lose almost 346 seconds.  That's 5 minutes we lose (or gain) every day.  Let's say we are only using the clock from Thanksgiving until Christmas.  We'll round it to 30 days just for the sake of simplicity.  That turns out to be 10368.0 seconds over the 30 days, or 172 minutes, or nearly 3 hours over the course of 30 days!  Probably unacceptable.  Even if we are at 0.001 seconds off every second, it still comes out to about 43 minutes over the 30 day period.

That means I have to get this pretty close (unless I have to procure a crystal).  With that out of the day, here's the formula for figuring out the resister/capacitor combination :

f =1.44
(R1 + R2) x C


So, now we have to do some math.  We want the frequency (f) to be 1 Hertz, or 1 cycle per second.  To get this, we have to have the capacitor times the sum of both resistors equal to 1.44 .  I wanted at least the R1 to be a standard value, and I found that I can put R1 to a 1k Ohm resistor - that's common enough.  Also, a common capacitor is 47 uf, or micro farads.    I can plug that in where the "C" is in the formula.  It means I now have a formula that looks like :

r2 =1.44 - (r1 x C)
C

So, what is the result of the math?  Unfortunately, it came out to just under a 1k Ohm resistor (969.361 Ohms).  But looking at some 555 timer calculator sites, it says I need a 14.855k Ohm resistor (or a combination that adds up since they don't make a 14.855k Ohm resistor).  I must have done my math wrong.  Back to the drawing board!

Thursday, November 27, 2014

The Roof WAS on Fire

Well, we replaced our roof.  Luckily, I changed jobs, and the vacation time I had accrued essentially covered the materials.  My family is awesome!  They came up (or down, depending on which family it was) to help out.  They did amazing work!  The old roof looked pretty old :


With all of that cracking, one would think it's really old.  Unfortunately, when we tore the shingles off, we found some surprising stuff :




Yes, underneath it, we found green tar paper nails, and ice and water shield!  That means the roof was less than 15 years old.  A single layer of shingles, 15 years old, curling like that... it means that there was too much heat in the attic.  We cut a few more holes for vents, removed the vent that was in place for the wood burning stove in the basement, and dropped some new OSB over the top.  Then we put a new roof on.  Hooray!

Saturday, November 15, 2014

Headlight Wiring - Plan, Participate, Prevail

So, after perusing the Internet trying to figure out how to implement electrical headlights, I finally knuckled under.  I had seen a few people use full actuators, and others who used some old Mazda Miata or Ford Probe headlight motors.  With the costs of actuators running to $200 a piece for a 4" movement (and needing one for each side), I realized I was too cheap.  I had to do the Probe conversion.

I ran to the closest junk yard, and found a mid-90's Ford Probe.  I pulled the motors and arms attached to the motors and paid about $30.  I ran home and tested them against the battery.  Woohoo! They both worked!


Next, I had to wire them up.  I didn't want to cut into the old harness at all in case I wanted to back this out some day.  So, I grabbed three spade connectors - these would plug into the current 3-prong headlight connector (the one for brights AND regular beam).  I also bought a new 3-prong connector. These would be soldered together with three wires coming off as "taps".  These three wires (one is battery negative, the other two are battery positive when the high beams are on, or the low beams) feed (via two 1 amp diodes to prevent both lights from coming on) into a 12 relay (SPDT, or Single Pole Double Throw, where when on, one is connected, but when off, another terminal is connected).  This is wired to a fuse and to a battery connection.  When the high beams or the low beams are on, it triggers the relay to power one line, and when neither are on, the relay switches back to the other.  These two feed the motor trigger signals.  A second "power" is also run to the motors, and a negative battery connection.  I tested this (test often is vital to make sure it works) via a breadboard first, with LED's to make sure I had things connected right (e.g. when one light was on, the signal light was on, and when the other light was on, the same signal light was on, but one light did not cause the third light to come on).

Once I knew I had the circuit right, I had to implement it. I grabbed a solder "bread board", and soldered everything into place.

Then, I tested it against the real lights and motors.  Success!  I threw on electrical tape to protect things, and applied epoxy to the bread board to seal it in.  When the epoxy had set, I applied more electrical duct tape to ensure it wouldn't cause other problems.






Once it was all wrapped up, I installed it, and tested it once more just to make sure it was good.  Congratulations!  Now I just need the headlight units back from the painter, and I can finish the front end of the car!  Here's my shopping list.


  • 2x Ford Probe headlight motor
  • Brackets (had to make these out of porch 4" post end caps from Home Depot)
  • 3x Spade Connectors
  • 1 3-Prong Headlight Connector
  • 2x 1 Amp Diodes
  • 1 solder board from Radio Shack
  • Wire (red and black)
  • Epoxy


If anyone wants to convert, it's not too difficult!