Software Manifesto

manifesto

Today I stumbled upon an interesting manifesto.  No not that one, the software one.  A call to arms for all professional software writers, as opposed to code monkeys.  Link for those who wish to skip my blabbering.  It isn’t very long, which is good because I don’t sign stuff I don’t read.  It is and I quote:

As aspiring Software Craftsmen we are raising the bar of professional software development by practicing it and helping others learn the craft. Through this work we have come to value:
Not only working software,
but also well-crafted software
Not only responding to change,
but also steadily adding value
Not only individuals and interactions,
but also a community of professionals
Not only customer collaboration,
but also productive partnerships

That is, in pursuit of the items on the left we have found the items on the right to be indispensable.

A noble and worthy goal, I signed.  I would also encourage anyone else who holds these to be true to sign as well.

DVD Ripping the Windows Way

I finally decided to digitize my dvd collection.  Two things prompted this, 1 the rack is running out of room (see below) and 2 they are all at my parents house.

dvdrack

This prompted research as how to break the annoying dvd decryption and obtain personal use backups of dvd’s I actually legally purchased (as opposed to many of my other collections).   Googling quickly showed a few programs that work and I find useful.  The first being the zombie program DVD Shrink.

While DVD Shrink is no longer being worked on,  you can still find it floating around the net.  The most recent version is 3.2.0.15, note it is freeware so avoid the sites that charge for it.  Or just download it here.

The next piece of software used is called Handbrake, which takes dvd formatted data and converts it to normal video files such as mp4, avi or ogm.  It is open source and therefore free.  The thing I am liking most about it is the ability to queue up multiple conversions and let it run overnight, which is important as it takes around 1.5 hours on my gaming machine per movie.

The two afore mentioned pieces of software work most of the time but since DVD Shrink is a few years old it can’t break some of the newest encryption methods (damn you Disney).  This is annoying because Wall-E is an awesome movie.  So to get around this I found AnyDVD HD.  It tears out the encryption on all dvd’s, the HD version even works on blue-ray and HD discs which is awesome.  The only not awesome part is the price, 79 euros = $104 real dollars.  There is no way I was dropping that kind of money on software for a single week long ripping party, luckily they have a 3 week trial version.  The only downside is it forgets your settings when it shuts down, which only matters if you turn off your computer (I don’t).

With my newly assembled arsenel of software tools I began tearing into the rack of disc’s like a rabit badger, or at least a wounded chipmunk.  Here is my method.

DVD Shrink makes fine backups but as they are huge (4+ gigs each, some over 8 ) I decided to convert them to the more portable and popular avi format.  Max quality avi’s of these work out to be around 1.6 gigs tops (Lord of the Rings), pretty close to 1.4 gigs on average though.  If space is an issue then they can be shrunk later on.  Let’s start making the MPAA cry.

First you insert the dvd in your machine and launch DVD Shrink.  Then choose open disk.  If you have it AnyDVD should be launched first as it intercepts dvds before you open them in DVD Shrink.  Closing or modifying AnyDVD settings while ripping with DVD Shrink causes it to lose connection to the disk and you have to start over.  When the fox icon is pink it is thinking, when it is red it is ready.

rip1

Wait while it analyzes the movie, this takes about 2 minutes.  Usually mine start off at a pretty slow speed, like 2,000 kbps then work up to 9,000 max.  The encoding phase does this as well.

rip2

If you want to back up the entire disk, menus extras etc, then just choose backup after the dvd is analyzed and skip the next step.  If like me you are only interested in the feature film go to re-author and drag the title from the “Main Movie” area over to the empty area on the left.  Now when you choose backup it will only save that one, cutting down on important disk space.  I have a 1 terabyte drive as the buffer for this but 7 gigs adds up pretty quickly.

rip3

Once you have the tracks to rip, let ‘er rip.  It takes anywhere from 7 minutes to an hour, depending on how much there is to work with and if you chose any other fancier options.  Generally get less than 10 minutes though.  Again it starts off slow and works up to a decent speed.

rip5

This is the message you are looking for, the a-ok to move on.  Congratulations, you are now out a large chunk of disk space.  If you are ripping multiple disks at once make you to switch back to “Full Disc” mode as otherwise it pops up an annoying message and beeps at you.  Also you can’t open a new disc until you change to full disc mode.  Note the discrepency in times between the previous picture and this one.

rip7

Next we can start converting the big honking mess of dot vob files into a usable format.   Start up Handbrake and choose Source in the upper left corner, then select the DVD / VIDEO_TS Folder.  Find the folder you want to convert on your hard drive and select it.  Sometimes you have to choose the VIDEO_TS folder itself, the immediate parent one won’t work.

rip8

Then you choose the file name, type and all the other settings I don’t mess with to create the actual file you wanted in the first place.  Normal has worked in all cases, I just change the file type.  Make sure to look at the title drop down and check that the file length is appropriate (seen here), some of them have multiple ones to screw you up.  Annoying to waste 2 hours to find out you chose the wrong chapter to burn.

rip9

Choose where you want to save the file and what to call it.  Also the file type, I went with avi as it is widely supported and ogm didn’t work on my machine (will figure that one out later).

rip11

Go over all the settings to make sure it looks good then start it going.  The start button makes it go right now, alternatively you can hit the “Add to Queue” and make a big list of them for your computer to work on while you sleep.  It is very cpu intensive so best to let it run alone on your machine if at all possible.  When you hit Start you get a friendly CMD.exe window that has an eta on it.  Don’t close this window.  It works in two stages, the first is encoding which is the fast phase.

rip12

Then there more encoding which eventually writes it to disk.  Takes over an hour for my machine per dvd so settle in.  This next picture is just to show what the second phase looks like.

rip13

The next to final stage is to verify the rip actually worked.  Choose your favorite media program (I highly recommend VLC) and load the file, make sure the sound is sync’d right and other such things.  Note the video did work, the screenshot capture method didn’t.

rip14

When you know the video ripped correctly go back and delete the raw dvd folder as it is just a waste of space.  Now you too in around 2 hours can make digital copies of stuff you already owned.  Sad fact of the day: with a fast internet connection it is  quicker to pirate the movies than convert the ones you own.  But piracy is wrong, and backing up dvds is mostly legal.

One final tip, you can run as many copies of DVD Shrink as you have dvd drives.  I crank on two at a time, tried to put in a third pulled from an old computer but my motherboard didn’t have a second ide cable.

rip151

Have fun backing up you movies!

Personal obsession

I was packing up things for the winter break and I realized that I have a lot of books.  And I do mean a lot, this is just the pile of them that are here, there are even more at home.

It is safe to say I am obsessed with paper more than any other programmer I know.  Which is probably a good thing as books are expensive.  The sad thing is this only amounts to about half of my Amazon wish list.  Sigh, I need more shelves.

Help Wikipedia

If you use Wikipedia 1/10 as much as I do, then you owe it to them to donate to the current fundraiser.  It costs a lot to be the 8th most popular website on Earth.  You can donate any amount via paypal, even a dollar can help despite them being not worth the cloth( not paper ) they are printed on.  To show my approval I added the support Wikipedia button on the siderbar even though I hate clutter on my blog.

And yes, I donated what I could.

How to Give Advice

In a startlingly high level of hypocrisy I am now going to tell people to not give advice.  Let me explain before you completely tune me out as being mad.

Say you’re at work and someone does something in a way that strikes you as odd.  Maybe the code is indented different than usual, or not at all.  Perhaps they use #defines in your C++ project.  Whatever it is, you have an opinion and want to tell them “the right way” to do things.  Even if you can step back far enough to realize yours may not be the best way, but is instead something based on years of practical experience, they will still interpret it as “your opinion”.  Which of course it is.

What’s the worst thing that could happen if you spread some helpful advice?  I used to think the worst thing was that they would ignore you.  Ideally they can look past their own ignorance and see your brilliant idea for what it is.  This is wrong, and highly optimistic as it turns out.

The worst case isn’t that they ignore you.  Sadly ignoring your unsolicited advice is the BEST CASE scenario.  They listen, nod, say “uh huh” while you are speaking; then once you are gone blank it from their memories.  It can go so much worse.  They can get offended.  How DARE you try and tell them you are right and they are wrong?!  How DARE you say that they are dumb and you are so much smarter and better that you will guide them out of the caves?  Exaggerating a bit?  Not as much as you might hope.

There are several reasons people do the things they do.

1) They aren’t conscious of it ( how much attention do you pay on your commute to work every day, honestly? ).

2) They are conscious of it and choose to do it that way.

If you are talking to someone in group one, you probably are trying to help them.  Spare them your mistakes as it were.  But they don’t care.  If they cared, they would probably think more about how they were doing it.  These are the people who will ignore your advice.

The group two’ers are the troublemakers of the advice realm.  If you tell them they are wrong, they will fight you tooth and nail.  No matter how polite you are, how genuinely helpful you are or how long you have been friends they will object.  Because when you give unsolicited advice you are saying, in no uncertain terms, that you know more than they do.  And people generally don’t like being called stupid.

Telling a two’er how to do things will often not result in being ignored.  It won’t result in them following your advice either.  What it will do is piss them off.  From their perspective it is an attack on their person and they will do things about it.  Relations may become strained, feelings hurt, tempers flared.

So if being ignored or hurting feelings are the results of giving advice, how do you give advice?

The answer is, you don’t.  You can’t.  And you sure as hell shouldn’t try.

This applies to the forms of advice most people give and receive every day.  Hey you should blank.  Or why don’t you x instead of y?  There is one, and only one, category of advice that works the way you want it to.  That is when someone asks for it.

If someone sincerely asks “how would you do this” what they are really saying is “I appreciate and acknowledge your understanding of this topic and would be interesting in your approach to this problem.”  They are pushing down their ego enough to say that you are more experienced and ask for help.  But now isn’t the time to get big-headed.  This is the time to teach.  This is the only time someone will actually listen to your advice and possibly carry it out.  Heck with enough time they may pass it on to someone else.  And that is what you wanted to do the whole time, spread your knowledge to help others.

People can seek help without expressly asking for it as well.  If someone is distressed and you may be able to help, see if they want it before throwing it out there.  Often times it is difficult for someone to put their ego out of the way, so you have to help with that too.  Saying something like “I had that same problem last year, would you care to hear some tips that really helped me out?” is a good icebreaker, but only if you actually had that problem last year.  Groups like Alcoholics Anonymous are founded on the principle of shared empathy, you know what they are going through because it happened to you and they can feel that.  If they don’t want the tips, don’t offer them regardless.  People only hear what they want to hear, repeating yourself won’t change that.

Based on my ( limited ) understanding of psychology and people this is the way things are.  Think of how much grief is caused by unwanted advice, which to the receiver feels sarcastic and insulting.  Before you advise, empathize ( nice huh? ).  Think how you would feel if someone came over to your desk and said “Your layout is all wrong, idiot”.

Hopefully you wanted to learn something about advice before reading this entry, or were at least open to it.  But the people who think I’m an idiot will either ignore what I’ve said or post responses saying how dumb I am.   I didn’t write this article for them, I wrote it for the people out there who really wanted to learn something.  Hopefully they did.

Boost Asio Serial_Port Demo

So I’ve recently started playing with hardware more.  This necessitated learning how to communicate my C++ with the actual hardware.  The de facto method for this for decades has been the RS232 serial port.  But how to actually use this to talk with code?

In Unix you can directly talk to dev/ttyS0 or wherever the device is located.  Windows gives you some com stuff to talk to it.  But is there a way to do it cross platform?

Of course there is, otherwise I wouldn’t write about it.  Enter Boost, the pivotal C++ library.  In Boost::Asio (ASynchronous Input/Output) there exists a serial_port class.  Seems to be good enough, all that is left is to get it to work.  Easier said than done.  There are basically no examples and the doc’s aren’t very helpful (weren’t to me at least).

So here is a small program that covers most of what a serial_port class needs to do.  You set the parameters before the program starts (certain os’s have limits built in, like you must set the baud rate beforehand etc).  The hardware this talks to takes a baud rate of 19200, 8 bits of data, no parity, and 1 stop bit.  My test board only read input so the example doesn’t take input yet.  Check the comments for more details, the license is at the top of the file.

Due to the stupidity of Wordpress the code format kept getting eaten so you have to download the file instead.

Link to file: boost_serial_port_demo.cpp

Reece’s Math

So I was enjoying some delicious Reece’s Pieces and noticed that while there were three colors (orange, yellow and brown) there seemed to be an awful lot of orange.  That got me thinking: exactly how many more orange are there?

The nutrition facts lists the bag at 13 servings of approximately 50 pieces per serving, which comes out to be 650 pieces total.  Yes I did actually sit down and count out each color, results below.  No I have no life.

Yellow – 140

Brown – 161

Orange – 368

Total – 669

Percentage wise that is:

Yellow – 20.9%

Brown – 24.0%

Orange – 55.0%

It looks like it is supposed to be a 1-1-2 ratio for yellow, brown orange.  Of course there is no way to be sure if that is the true ratio without a statistically meaningful sample size, but I am not going to count another bag.

Boot House 002

I actually made these drawing for a speech class to explain the difference between client-server and peer-to-peer download methods to non computer literate people.  Hopefully I didn’t go over any of their heads.  The only thing that frustrates me is the magicians hat looks nothing like a magicians hat.  It reminds me of a pilgrim each time I look at it.

Finally got them

I finally found some of the greatest toys ever, at Walmart of all places.  Been looking (not very hard mind you) for some plastic dinosaurs for some time.  Below is the reason they are so awesome.

Apologies to hardcore Firefly fans, I know they aren’t the right types of dino’s.  Still they make awesome monitor decorations.  Man Photoshop is fun.

Boot House 001

It took longer to draw the stupid parrot than the entire rest of the comic.  I put nearly two hours into it (those with Photoshop skills are free to laugh) and didn’t realize that nearly all the details would be lost when it was shrunk to fit.  Below is the full sized version of the parrot.