Surface Studio – A Computer With A Purpose

Are you excited? Because I’m excited. What I’m excited about is the new Surface Studio from Microsoft. Now, this isn’t your typical article about a new product because I’m not even interested in buying it. I have absolutely no artistic ability. I cannot draw well. I have no use for using super accurate pen on the display.

But here’s why I’m excited. Somebody finally designed a computer with a specific industry in mind. I don’t think I’ve ever seen that before. Apart from a few gaming machines, every computer I’ve ever seen has basically been very generic machine that isn’t really suited to one task more than the other. And even those gaming machines are not much more than mostly fancy colors and lights. They do have some interesting keyboards and mice, but they still don’t have as much innovation as we see in the Surface Studio.

I hope this starts a new trend of companies designing computers for specific tasks, instead of one-size-fits-all machines that just do a mediocre job. As a developer, I often think of what I would want in a perfect computer, built with the tasks that developers do day in and day out. Maybe what fits my view of the perfect machine doesn’t fit other people’s needs, even if they are really doing the same task. Perhaps this is why no other company tries to do this, and just ends up settling for a plain old box. Hopefully Microsoft will someday create a software developer centric machine. Something that fits our needs and gets rid of all the junk that we don’t need.

Here’s the video that made me so excited. Maybe it has something to do with the music from Charlie and the Chocolate Factory bringing back nostalgic memories, but this whole video gave me shivers. I don’t even want this computer because I simply have no use for this thing. Most of the great features would end up not getting used and it would just be a fancy $3000 monitor. But seeing a computer that was designed for a specific purpose, and seems to have just been really well thought out, just makes me really happy.

Unsave All Reddit Posts

I had a lot of saved posts built up in my Reddit account so I thought I would do a little house cleaning. Mainly by unsaving all the saved posts. Probably best to just get rid of them all and then try to only keep a list of the stuff I actually wanted, deleting stuff as I go. I had hundreds of saved posts, and going through them manually was taking way too long. So I came up with a little GreaseMonkey script to get rid of all the saved posts.  Here it is:

window.addEventListener("load", function(evt) {
var btn = document.createElement('input');
btn.type='button'
btn.value= 'Unsave All'

btn.addEventListener('click',gm_UnsaveAll)

document.body.insertBefore(btn, document.body.firstChild);
});

function gm_UnsaveAll(evt) {
$('.link-unsave-button a').each(function(i,e){setTimeout(function(){e.click();},1000)});
}

Set it up in GreaseMonkey with https://www.reddit.com/user/{USERNAME}/saved as the included page and you’re ready to go. Just navigate to that page and you should see a button at the top of the page. Don’t forget to replace {USERNAME} with your username. It only unsaves a single page at a time, but it’s better than clicking each post individually. And if you have Reddit Enhancement Suite (AKA RES) installed, then you can scroll down to load up a few pages worth of posts and unsave them all at once. This saved me quite a bit of time, and I now have a clean saved posts list, ready to be filled up again.

Don’t expect school to teach you everything

I find it amazing how many people seem to learn very little outside of what they were taught in their classes. We’ve been interviewing a few people at work over the past few months, and many people just seem to know very little beyond what they where taught in class.

To make matters worse, the kind of experience that you get in classes tends not be the kind of experience that would be very useful in the real world. It seems to be very uncommon that one would have to write something extensive for an assignment in university.  Most assignments consist of maybe 5-10 small functions strung together.  There’s no way to practice code that doesn’t repeat itself because there’s very little chance that you’d run into code that would be repeating.

I’m not saying that classes aren’t important. You can definitely learn a lot of useful things in class that will be very useful on the job. It’s just that you won’t learn the most important thing. That is, how to actually plan and complete a large project from beginning to end.

All the best experience that I got while in university was in co-op placements where I got to work on real projects.  If you are in university and there’s a co-op or internship program available make sure you take advantage of it.  This usually means it will take a little longer to graduate, but the experience you get will be very valuable.

I was also very lucky in that we had a two semester group project as one of our classes. In this class, we were required to find a customer who wanted an actual product (the professor had some people lined up, but we were free to find our own if we pleased) and do an entire project from beginning to end. We were required document what we were doing, write the code, write the test cases, and meet with the customer to discuss requirements and talk about how the project was progressing at regular intervals. This taught me not only about the technical side of software development but also how to actually work not only with other developers, but also the customer.

The other thing that I find is that a lot of students don’t have experience using real world tools. Very few students seem to know how to use a debugger coming out of university.  I don’t know how they get along without it. But I guess if you’re only doing very small projects, then they aren’t that necessary. But when you’re writing projects that are larger than you can fit in your head, it makes  the job a whole lot easier when you have a debugger and you can step through the code to see what’s going on.

My advice to anybody in college or university is to try to learn as much as you can before you graduate.  This is when you’ll have the most free time. You may think you are busy now with assignments, studying, and even a part time job,  But the truth is that now as a person with a job and a family, I find that I have much less time now than I did as a student.  I wasted a ton of time when I was a student and really wish I had spent my time more wisely.

So think of a project that interests you and go ahead and do it.  You’ll learn a lot more from doing an actual project than you will from just about any class.  And you’ll have something to showcase your skills when it comes time to interview for jobs.  You’ll definitely stand out from the rest of the applicants.

Of Bike Mechanics and Computer Repair Techs

As somewhat of a bike enthusiast, I came upon this presentation discussing bicycle mechanic salaries.  Long story short, they are depressingly low. At around $22,000, it’s pretty close to the minimum cost of living in most places.  In many places, this won’t even cover rent in a 1 bedroom apartment.

So, it seems there’s a problem in that it’s almost impossible to make a living being a bike mechanic.  Bike mechanics can be useful, and I’ve even taken my bike to a mechanic from time to time. The presentation (I use this word, because a simple 1 page article was turned into 39 slides), states that some bikes can cost $8000, and that people are unwilling to pay $80 for a tune up.

While a bike certainly could cost $8000, most do not.  I don’t have any actual data, but based on the bikes I see on the street, that the average price of bikes that are sold, is somewhere around $400.   Most people, even the enthusiasts that I know, will never spend more than $1500 on a bike.  For those that aren’t enthusiasts, and who only shop for bikes at Walmart, will probably think that $400 is way too much for a bike.  And bike prices are only coming down.  $1000 will get you a bike that’s better then what the pros were riding 10 years ago.

When you have a $400 bike, charging $80 for tune up sounds like a lot to ask.  It’s similar to a computer repair guy from the Geek Squad asking you for $80 to fix you $400 laptop.  For the price of a couple tune ups, you’re well on your way to purchasing a whole new bike, or laptop.

Fixing a bike is easy. You don’t even need many fancy tools.  About 95% of the work you will ever have to do on your bike could probably done with about $50 worth of tools.  There’s even this great site  where people will help you fix your bike for free.  And it’s also (at least in my opinion) quite invigorating, to know that you can do it yourself, when you’re 50 km from nowhere, and something breaks, it’s nice to know you could solve the problem yourself instead of having to hitch-hike home, or call someone for a ride.

This is very similar to computers, where most people could figure out how to fix their own computer if they just took some time. Actually, fixing a computer is probably more difficult than fixing most bike related problems, as actually diagnosing the problem, and fixing it without just formatting the machine and starting from scratch can actually be quite difficult.  A bike has way less parts than a computer.  And there’s very few things that actually go wrong with quality bikes

I admit, if you have an $8000 bike, and need it for racing, where seconds can mean the difference between winning and losing, then paying somebody big bucks to makes sure the wheels are perfectly true, and the gears and brakes are adjusted just so makes perfect sense.  At this point you should be spending your free time training, and not mucking around with wrenches and grease.  But if you just use your bike for transportation or recreational rides, then you really should be doing your own maintenance.

I don’t think we can solve the problem of the low paid bike mechanic.  If you want to make big bucks as a bike mechanic, you’d better start fixing bikes for people who really care about them. People who’s livelihood depends on their bike, like professional bike riders.  Just like computer techs who want to make more money have to end up going to fix computers for people who have rooms full of computers, and having a computer not working  means loosing money for every minute that computer isn’t running.

But I just don’t think there’s any money to be made in tuning brakes, tuning derailleurs, and switching out bottom brackets.  It’s too easy to learn to do these things yourself, and if you start asking for more money in the hopes of making more money, you’ll probably just drive potential customers away, who will figure out how to do it themselves, or get the local high-school bike enthusiast to do it for the price of a couple inner tubes.

Battery Powered Raspberry Pi

Since the Raspberry Pi is so small, and has a similar architechure to most phones, I was thinking it would be fun to see if I could run it from batteries. I wanted something that would give it a long run time, not something that would only run for half an hour. It would also have to utilize rechargeable batteries, otherwise, the
cost of the batteries would quickly outrun the cost of the Raspberry Pi. Also I have no abilities to build my own circuits, so it had to be something I could buy ready to use.

After doing a little searching, I was able to find this USB battery backup case. It uses 18650 lithium batteries. It’s meant for charging cell phones and other gadgets when they run out of power, so I figured it would work quite well for powering the Raspberry Pi. Most people in North America will probably be a little unfamiliar with these batteries. But I think they are great. They look like AA batteries, but are actually quite a bit bigger, are rechargeable, and run at a higher voltage. They are actually similar to the cells that are used in many laptop batteries. I had used them before for bike lights that I had purchased from that same site, and was really impressed with how much power they were able to hold. I don’t know why they don’t have batteries like this in North America. They kick the pants off anything you can find around here.

The battery backup case provides 5V at 1A and each of the batteries I purchased was rated at 2400 mAh and 3.7V. The battery backup case also doubles as a charger for the batteries. Plug into the USB Mini on the battery backup unit, and plug the other end into a phone charger (similar to what you use to power the Raspberry Pi, and it charges. The full size USB port is used for powering devices. Get a cable that is full sized USB on one end, and micro USB on the other end, and you can use it to power your Raspberry Pi. This is one of my main disappointments with the device. Had they used USB micro to charge the batteries then you could have used the same charger to recharge these batteries as you use to power your Pi, but the way it’s set up you need 2 different cables. This unit, like the Pi, comes without any cables. Luckily I had a few lying around.

My first use for the device was to test it for it’s intended purpose, to charge my phone. I charged the batteries in my old charger, as I was unaware that this device even had charge capabilities, and then put the batteries in the backup unit. Plugged it into my phone. Nothing. Pushed the button. Nothing. I really just thought the thing was completely dead. I decided to just Google for “dealextreme 129749” which is where I bought it and the SKU, and about 5 links down the page I found this page, which was somebody else who bought it and had the same problem. Of course, the page is in Polish, so what could I was stuck. Google Translate to the rescue. It did a fair job, good enough for me to figure out that if I hooked up USB mini port up to a charge or computer, that
the device would turn on, and start working. It did a pretty good job at charging my phone. It worked about as good as it does when plugging my phone into the wall. The batteries didn’t get hot at all, and there was a little bit of heat from the circuit part of the charger, but nothing worth worrying about.

Then it came time to try it out on my Raspberry Pi. I wrote a program in Python to record the current time to a file every minute, so I wouldn’t have to sit around watching and waiting for it to die. The program is as follows

import time
i = 0
print('START!')

while i >= 0:
        f = open('timelog.txt','a')
        nowstr = time.strftime('%Y-%m-%d %H:%M:%S')
        print(nowstr)
        f.write(nowstr)
        f.write('\n')
        f.close()
        time.sleep(60)
        i = i + 1

print('DONE!');

There’s obviously some testing code left in there, switch the condition of the while loop to “i < 5” if you just want to run a test and have it exit after 5 minutes. I opened an closed the file each iteration because I didn’t wanted to be reassured that the writes wouldn’t all disappear when the power cut out.

Now for the test. I started up my Pi, ran the time logging program in the background, and then let it run. I wanted to see how well it would do under minimal load. The results were pretty astounding. It ran for just under 5 and a half hours. Which once you count in the boot up time and me starting the test probably came in pretty close to exactly 5 and a half hours.

Being somewhat impressed, I wanted to now test it under full load. It would be easy enough to write a busy while loop to get it to use the CPU at 100%, but I wanted to stress out the GPU as well. So I posed a question on raspberrypi.stackexchange.com and one person suggested using Quake 3 to test it out. I figured that would use probably as many resources as possible, so I gave it a go. In the background I ran my python time logging program same as before, and in Quake 3 I ran a demo loop to max out the resources. I put the following in a file called demoloop.cfg located in the baseq3 folder for Quake 3.

set loop "vstr loop1"
set loop1 "set timedemo 1 ; demo four ; set nextdemo vstr loop2"
set loop2 "demo four ; set nextdemo vstr loop1"

Then I started Quake 3, and ran the demo loop by bringing up the console with “~” and typing:

exec demoloop.cfg
vstr loop

The demo began to loop. I had to use some commercial .pk3 files because the demo wouldn’t run with the freely available files because missing maps. I watched for a while, using my laptop on the side. I didn’t expect it to last very long with the CPU and GPU undergoing so much use. Eventually I got bored and went to bed. In the morning, I woke up and checked the results. The total run time was 4 hours 23 minutes before the log program stopped logging the time, and I presumed the Raspberry Pi lost power.

All in all I have to say that I’m pretty impressed that I got such good performance out of this battery pack. The batteries stayed cool, even when running my Quake 3 stress test. This battery pack did quite a good job, and would probably work quite well for anyone who wanted to power their Raspberry Pi off batteries.

Raspberry Pi – First Impressions

I got my Raspberry Pi a couple weeks ago, only a few short months after placing my order, and I’ve gotten a little bit of time to play with it. So far the experience has been pretty good. The speed is pretty much as I expected. I was able to get Quake 3 up and running on it. I spend countless hours playing that game in university, and it sure did bring back some memories.

I think the thing I like most about my experience so far is that I can get different SD cards set up, one for a media centre, one with a working desktop distribution, one to play around with and break, and more for whichever purpose I feel like. It’s nice having a computer you can just tinker with, where you can back up the whole system in a matter of minutes, and load on a whole new OS quickly if something goes wrong. I haven’t had a computer I can just tinker with in quite a while. It’s also nice that the Raspberry Pi doesn’t take up any space, and that I can just hook it up to my existing peripherals.

I have had a couple problems with it. My wireless keyboard that I use with my desktop doesn’t seem to work so well. Sometimes keys stick and repeat endlessly, and sometimes keystrokes don’t register. I’ll have to go and get a USB keyboard soon, but so far most of my experimenting has been connecting through SSH and VNC remotely, so I haven’t needed the keyboard for too many tasks.

I’ll be updating this blog with a few of the things I’ve figured out, just to pass on the knowledge. Most of the stuff has been pretty straight forward, but I’m pretty familiar with Debian, so most of it was the same as what I’m used to. I have to say, I’m really impressed with the way the distributions have been put together. Kudos to the people who are working on these. I expected things to be much more difficult to set up.

The root word of specification is specific

As a developer, I’ve seen a lot of specifications float across my desk. The quality differences between them is staggering. Sometimes you get a really nice specification document. Other times things are a complete mess. What bothers me most about some specifications, it that they aren’t “specific” at all. They leave way too much up to the imagination. They’ve left out way too many use cases.

The first thing I do when getting a spec is that I go over all the different use cases. I start coding the thing in my head, and start to think about all the different interactions the system will have. Most of the time, in the first 5 minutes I can come up with 2 or 3 use cases that the author of the spec didn’t even consider.

This is very frustrating, because, when the specification is a work in progress, it means that I must send back the spec to the person who wrote it up, and ask a whole bunch of questions to clarify or expand on the specification so that we don’t end up with a system that doesn’t do what it’s required to do.

When it’s not a work in progress, I just resort to slamming my head against the desk. Because what that means is that this specification has already gone across the desk of many other developers, and there’s probably very little I can do to get things changed, because then all the other implementations would have to be adjusted to fix the changing spec, and even if they all wanted to, the people in control of the spec think there’s nothing wrong with it, because everyone else has been using it for years and never come across a problem (or never bothered to complain).

Anyway, I think that the best thing you can do with a spec is to get as many people to read is as possible. Because other people reading it will find holes in the specification. They will find new ways of interpreting whatever it is you wrote, and they will make your specification more clear and more useful to other developers. Because nobody wants their project ending up like PHP.

Coding For Fun

Sometimes when I’m coding for work, I feel like it’s lost all it’s fun. At work, we sometimes have to work on boring projects. For me the boring projects are the ones where I don’t even have to think about what I’m doing. The tools, the framework, the existing libraries are enough that I can get the job done without even really thinking about it. The kind of project where you can just go straight for 2 hours of programming, compile once, run it, and it just works, no fixes needed.

Now when you can do this, you at least you know you are doing something right. Because not everything you have to do should be some kind of epic battle to get stuff done. Trudging into new territory. But that doesn’t mean it doesn’t drown your spirits when the only thing you’re doing it just going through the movements to get the code into the computer.

I really enjoy going out and exploring new tools, new languages, new language features, new anything, because it really makes me think. It opens up your mind to new possibilities. A developer who doesn’t code for fun is usually not a very good developer. If you can’t take pleasure in exploring programming, learning new techniques, discovering unexplored territory, then you’re going to have a lot of trouble staying on top of all the new technologies.

If you find yourself getting bored with coding, just go out and try something completely new. Program a type of application that you have never programmed before, in some language that you aren’t that familiar with. Exploring new avenues in development will take your mind off the day to day drudgery that your job is, and really help to bring the fun back into programming.

Don’t Fight The Tools

I’m a .Net developer by profession. So it’s only natural that I hate PHP. OK, I don’t hate it, but I find it quite frustrating. I think that the reason that this is, is because they are just so different. They take a completely different approach to accomplishing the same thing. So when I go to program something in PHP, which I don’t do that often, I try to write .Net code in PHP. This is very difficult. In the latest project I did, namely, this blog, I tried to do the exact opposite. I decided to write my PHP to make it look like PHP. To me, it seems a little unnatural. Mixing in logic and presentation. Mixing in database access code with presentation. Basically creating no layers between anything. Get some data from a database, output the data with HTML tags interspersed with the data.

PHP has added a lot of stuff to try to get away from it’s humble beginnings. They’ve added objects, namespaces, frameworks for doing MVC or other types of architectures. But I find that all of it is kind of done poorly. Without getting into too much of a rant, it seems like PHP is just trying to add features, just to be like the big boys. But in the end, it makes everything look inconsistent, and gives people a bad impression. Nobody complains that C doesn’t have classes, interfaces, and namespaces. If you want that, go find another language. PHP could have taken a lesson from that, but alas it’s too far gone.

It’s really similar to this Ask Slashdot article. The first post sums it up. Don’t try to write C++ or Java in Javascript. Similarly here. Don’t try to write .Net in PHP. And I wish PHP would just be happy being PHP.

The coming celebration of non-general purpose computing

This is a little bit inspired by The War on General Purpose Computing by one of my favourite authors, Cory Doctorow. I greatly respect his work, and see some very important ideas in his article. But I just can’t stop thinking, about how most people don’t really want a general purpose computer. Most people have no intention of writing programs to run on their computer. Don’t get me wrong, I’m a developer. I couldn’t imagine having a world without computers that I could write and run my own code on. But most people aren’t developers. For people who don’t write their own programs, the fact that a computer will do whatever you tell it to, is, well, problematic.

Think about the whole problem with viruses and malware. In some cases, there are bugs in programs that allow things to run without the user intending to run them in the first place. Open network ports with buffer overflow vulnerabilities allow things to come in over the internet, and just run on unsuspecting computers. While some viruses, many of the more prevalent ones, have infected machines over the years in this manner, there’s still a lot of viruses that infect computers from people just clicking on the file to run it. You can display warnings before running anything that comes from the internet, you can lock down user accounts, and display even more warnings when an application requires administrator privileges, but users will still let it execute anyway, because they were promised smiley icons, or a crack for some game they couldn’t be bothered to pay for. And so the general purpose computer runs said program, even it it’s a program that will cause no end of problems for this general purpose computer.

I think this is the reason why the iPhone is such a big hit. You constantly hear developers and technology enthusiasts whine about how the Apple walled garden is evil, and causes so many problems, with apps that can’t get approved, or apps that were approved, and then mysteriously removed afterwards for seemingly nonsensical reasons. But many people love the walled garden. There are a few things at play here. First, applications are reviewed by Apple employees before being placed on the App store. So there’s a good chance that a malicious program wouldn’t make it past the approval process. Second, you have to pay money to get your app on the app store. So if someone were to write a virus and it go through the approval process, then Apple might have a not so hard time tracking you down. Thirdly, even if the app did get published, and assuming the developer used false credentials so they couldn’t be caught, the app could still be quickly removed from the store as soon as it was found to be malicious. Before it could cause too much damage People love their iPhones because they don’t have to worry about malware anymore.

The other kind of non-general purpose computer is the game console. People love these too. Not counting hardware problems like the infamous red ring of death, people generally don’t experience any problems with these machines. You never hear about people having to format their Xbox or run a virus scan on their Wii. Again these machines have no problem with viruses because they only programs they run are the ones that are vetted for by MS, Sony, Nintendo, or whoever else makes the console.

I don’t think most people care if they can run any program, including ones they write themselves. As long as they can find applications that do what they need them to do, it doesn’t matter that they can’ write their own applications, because they have no desire to do that. I think that the desktop PC is headed this way too. Regular people just can’t handle general purpose computers. I don’t mean that in a negative way. In the same way I could care less about how my furnace, fridge, or oven works on the inside, and I care even less to tinker with them to work outside their original specified uses, most people don’t care how their computer works, and don’t care to be able to reprogram them. To these people, computers are just another appliance.

Now, I guess the final point. Does all this mean the end of general purpose computers. Not on your life. That boat has already sailed. The genie is out of the bottle. Computers are simply too ubiquitous and too well understood to ever get to a point where it is not easy to get a general purpose computers. Take a look at the Raspberry Pi project and you might see what a mean. A very small group of people, producing only 10,000 computers is able to sell a true general purpose computer for only $35. Now, it’s not the most powerful computer, but it’s fully internet capable, can play high def video, and has enough power to play Quake 3. There’s enough computer enthusiasts out there that general purpose computers will never be unavailable. But I don’t doubt there will be a day when most houses do not own a general purpose computer, but instead run some appliance type computer that the user can’t program, but which meets all their needs. And then the users will be happy. And so will the geeks, because it means we won’t have to fix their computers anymore, because they got yet another virus on their machine, even though they swear the didn’t run anything they shouldn’t have, again.