Being legal is frustrating

Four years ago I bought a laptop on a student special with the local universities. Pinnacle were the local distributors and the laptop came pre-installed with Windows 7 and Office professional. Wonderful. But it didn’t come with installation DVDs. I queried this with Pinnacle and they said I should use the Lenovo software (OneKey Backup) to create a backup install which would then have everything ready to go. Fine.

A few months later I buy myself an SSD and now want to install Windows on it. Do everything necessary but the 36GB original install complains that my 120GB SSD is too small to install Windows on… So I repartition my original HDD to have an 80GB windows install. Create new backup install, and successfully install on my SSD.

Fast forward to 2016 and for several reasons I haven’t once reformatted my hard drive since original install. But now it’s time. Backup everything I need. Boot up my backup DVD and try and install onto the same SSD. It complains the drive is too small. This is the same drive I installed on four years prior. No other hardware changes have taken place. I spend the next several hours rebooting trying different types of things; use an Ubuntu live CD to format the drive and remove the extra 100MB partition that Windows makes. All efforts are unsuccessful.

I give up and decide to use a legit Windows 7 install DVD I have to just do a plain install. Alas after installation it doesn’t like my key (the one stuck under my laptop), as the DVD is for Windows Ultimate, and my licence is for Windows Premium… Windows used to have their install DVDs freely available through Digital River. But discontinued this service a few years ago. After some extended searching I get hold of an ISO that, after installing, seems legit and is happy with my key. Yay.

I spent more time trying to get an audible.com audio book playing than it took to listen to the book. I have lost every other piece of DRM-locked music I have paid for.

source: https://xkcd.com/488/

But now I don’t have Office. So I begin the same search for an install for Office. I had earlier run a program to extract the CD-Key from my installed software. Again the Digital River ISOs had been discontinued. MS does offer install files for download on their website, but you have to input a valid CD-Key, and the licence for my CD-Key apparently didn’t match any of the versions they had for download. I get hold of some ISOs through different sources, but none of them are playing ball with my CD-Key…

So what eventually happens? I break down and buy Office. Through all my searching, I kept on getting adverts for MS’s Home Use Program. Basically, if your employer has some deal with MS, you can get Office 2016 Pro for like R150. My employer had never advertised this to us (that I recall), but I typed in my work email address and the next day there was an e-mail at work stating that I am eligible. So R150 later I have Office 2016 installed. My biggest gripe (besides having to pay for something I kinda already had) is that it installs everything! Skype for business (which you can’t use a normal Skype account with), MS Access, OneNote and Publisher which I don’t use. There is no option to only install specific software. And no option afterwards to remove some of the software.

But at least I have a working computer again. And I’ve made copies of all the CDs and installs I used. Stuff knows what use the Lenovo OneKey backup DVDs are to be used for.

All of this boils down to DRM, and how difficult it makes people’s lives. Those who try to do the right thing get blocked at every corner. Whereas I could easily have downloaded a cracked copy and be done with all these hassles. Argh!

Restoring Windows to a smaller drive

I recently invested in a 120GB OCZ Vertex 4 SSD drive. I bought it to replace my 750GB HDD in my laptop. Although it’s quite a knock in space, I was only sitting at about 110GB usage at the time, so figured 120GB limit wouldn’t be an issue, and I’d have a 750GB portable drive to carry around for anything extra.

I was planning on doing a fresh install. When I purchased my laptop it didn’t come with an install disk, so I used Lenovo’s OneKey Backup program to make a set of 4 install DVDs which would pretty much take me back to original state.

I got the SSD, easily swapped it out with the HDD and booted from the backup DVDs. I went through a few menu steps only to be greeted by a box telling me that the drive was too small for the install. The install was less than 30GB, but apparently because the partition the install was on was 750GB, you can only restore to a drive of the same size or larger.

I then decided to give the Windows 7 backup system a try. It would mean I’d be back up and running without any extra installs, but after making the backup onto a portable HDD and then booting with a Windows 7 DVD I had on hand, I experienced the same problem.

Reading up a bit, people suggested shrinking the partition on the 750GB to less than 120GB. When trying to do this, Windows told me, that due to “Immovable Files” I would not be able to shrink the partition to less than 320GB. Didn’t help much, made a new backup but still got the same error.

After some consulting, I booted up in Kubuntu and used the linux drive manager to shrink the partition to a round 80GB. Trying to reboot into Windows resulted in a failure to launch. Fortunately this was solved by running a Windows Repair from the boot DVD. I was then able to boot into Windows, create a backup which successfully installed on my SSD.

tl;dr

  • A backup that you wish to restore must be of a partition that is smaller than or equal to the size of the drive you wish to install onto. The rest of the space must be unclaimed.
  • Use Window’s Disk management to shrink your main partition to less than your new drive’s size. Format the rest of the drive and ensure it is un-allocated.
  • If Windows can’t make it small enough, boot using a linux live boot CD. Freely available. Use the applicable distro’s management software to shrink the partition to the desired size. If on reboot Windows fails to launch, boot with a Windows install DVD and run the repair software. Note: I place no guarantee on this solving any issues that messing with partitions from linux may cause
  • After booting into Windows, create a backup of the installation onto a network drive or portable HDD.
  • Switch out your new HDD/SSD
  • Reboot with the Windows DVD and follow the repair process to backup from an image.
  • Select the appropriate backup and follow the steps.
  • Once installed you can go to Window’s file management again and expand your partition to consume the entire drive.

Python & MySQLdb queries not executing

As part of my master’s project, I’m implementing a very simple monitoring system. Logs are continuously stored in a mySQL database, and one can get an overview of the system by viewing a website. This means one can monitor the system wherever you are, and there are no software costs. Important for my sponsors.

My database needs to get data from a serial connection, and having successfully established a connection from Python in a previous project, I figured I’d stick with this, meaning the only difficulty would be communicating with the mySQL database from python. A bit of research revealed this should be quite simple, as there’s a very convenient MySQLdb library to aid communication.

FYI: I’m running Windows 7 64bit. Python 2.7.3 32bit. MySQLdb-python 1.2.3.

A little while later I had it all up and running and successfully executed the test examples with a simple:

cur.execute(“SELECT VERSION()”)

This revealed I was running

Database version : 5.5.24-log

All fine and dandy. I then setup a simple Insert query, which although it didn’t result in any error messages, failed to successfully update the database. Executing the exact same query from phpmyadmin resulted in the record appearing in the database. This was several months ago and I struggled for a few hours each day, making small changes to the code which might possibly affect the way it’s executed. I also shifted through pages of appropriate Google searches, all to no avail.

I gave up on the problem for a while, and today decided to give it another go. I tried it on a different computer, installing everything from scratch. Yet still I encountered the same problem. After some more time spent sifting through stackoverflow problem pages I came across someone with a problem kinda like mine. The solution to the problem was that the database was set to not auto commit exectued queries. Fine, I check mySQL, but autocommit = 1, so I assume that’s not the problem. Sifting through a few more pages and someone links to an FAQ mentioning the same commit problem. I add the line

connection.commit()

to my python code, and voilà, it works. Hours of frustration, hidden away in an FAQ.

Window’s network sharing

On the university network here, we’re only allowed to plug one computer into the network points in our rooms. If you try plug a hub in, or bridge connections to other computers the network detects this and blocks all the computers on your network point until the problem is rectified. I’m sure the varsity has several reasons for doing this, one of which being that they assign every computer a unique IP address, and there list of addresses is limited, as well as it being a way to keep track of what computer’s are on the network, as one is required to register your computer’s mac address, so they can assign the same IP address.

In any case, this makes life difficult for people with more than one computer, or with a computer and a console. One way to get around this is to setup a NAT. You plug your registered computer into the network, and then plug other devices into that computer. By setting it up correctly, those devices are hidden from the network, and all traffic is just routed via your main computer. I made use of this last year, but this year invested in a MikroTik Router Board 750 which effectively does the same thing.

In any case, from Windows, the easiest way to do NATing is to make use of Windows built in Network Sharing. It’s a fairly straightforward setup. All that’s required is two network cards. And you can plug a hub into the 2nd network card if you require more devices. I recently put together a step by step guide to setting it up which can be downloaded at the bottom of this page.

It gives instructions for setting up Windows Network Sharing in both Windows 7 and Windows XP. One example is with sharing an internet connection from a WiFi network to a LAN network, and the other is LAN to LAN setup.

If you are wanting to setup a wireless AP, that is use a WiFi card to share a network connection, I advise making use of a program such as Connectify, which I have used on several occasions to great success. It allows one to easily setup a wireless AP, and automatically allows password encryption.

You can download my step by step guide here (592 kB).