Finn's Ramblings & Random Curiosities

Ideas that pop into my head.

Some time for myself

I realized that the only time during the day when I have time for my own thoughts is when I lay in bed before falling asleep, and when I’m walking.

When I’m sitting at the computer I consume media or chat with other people. 

When I’m sitting in the bus I listen to other people and think about their lives.

I have decided that I should just sit down and think about myself more often. And I will do just that.

Same old story

The usual story. Twins/brothers move out to a remote mining town for hard work and good money. The houses are new, the pool is nice, but everything is half-empty. The instructor goes crazy on them and tries to kill the brothers. He ends up falling to his own death. It’s time for the brothers to leave. The younger brother has fallen in love with a coffee shop worker and wants to take her with them. Turns out the older brother loves her too, and there’s much jeallosy and fighting. All three of them decide to take the money and run away together.

7Zip batch compression

Since the 7Zip does not have a native batch utility to make multiple archives, I decided to find out how to accomplish this with a simple *.bat file and the 7Zip command line utility.

There’s a great tutorial at wikiHow how to compress multiple directories.

To compress separate directories to their own archives, the bat file should contain

for /d %%X in (*) do “c:\Program Files\7-Zip\7z.exe” a “%%X.7z” “%%X\”

Let’s have a small runthrough of what we have here, since you might want to modify the script for your own needs.

  • /d is the switch that specifies that we are dealing with directories
  • %%X is the internal variable used to identify the string which is the name of the directory
  • (*) refers to the current working directory
  • a is the first 7Zip switch, which will tell the program to compress
  • “%%X.7z” is the resulting file
  • “%%X\” are the directories it will read as a source for each archive.

This batch file will then create archives of each directory, with the same name as the original directory.

But I wanted to compress individual files, not directories.

For this I had to use the command forfile, as follows:

forfiles /m *.pdf /c “cmd /c 7z.exe a @fname.7z @file -mx9”

Here we have the following:

  • /m is a switch which will tell that we are only selecting some of the files for processing
  • *.pdf will select all pdf-files. Check forfiles /? for more filter options.
  • /c indicates a command to process, you must put the command in double quotes
  • cmd invokes command line, and /c another command
  • you might need to have 7z.exe in the same directory as the batch to avoid too many quotes messing it all up.
  • a is used to archive/add/compress files
  • @fname is the forfiles variable for the filename to be processed, without the extension
  • @file refers to the whole filename, which we use for the source of the archive
  • -mx9 defines the compression level, from 0 to 9, where 9 is maximum and 0 is none.

Now go have fun and compress some files!

A Day Off

Am I having a day off or just an off day?

Wiping an entire drive in Windows using TrueCrypt

I had to wipe an entire drive clean of data, and didn’t want to shut down Windows for several hours as scrambled data was overwritten on the drive. I did a quick search on the internet and found a program called Disk Wipe, but it turns out that it’s more like “Partition Wipe” in the sense that it only recognizes disk partitions that Windows recognizes, and does not wipe the entire disk. In most cases, this would be enough, but I wanted to remove all history, including the dates when partitions were created on the drive, etc.

So, without further ado, here’s what you need to do:

Warning: Following this process will remove all data on the drive, so be careful!

1) Run diskmgmt.msc

 

2) Make sure you don’t have an active page file on the drive you want to wipe (or any data you don’t want to delete, obviously), right click on the disk, and delete all the partitions on the drive.

3) Once the disk drive is free of any partitions, launch TrueCrypt and select “Create Volume”

4) Select “Encrypt a non-system partition/drive” and click Next.

5) Standard TrueCrypt volume is fine for our purposes.

6) Select the device you want to wipe, it should not have any partitions listed because you just deleted them.

7) We do not need to encrypt any existing data, so select “Create encrypted volume and format it”. This will overwrite the whole drive. The other option will achieve the same effective result, but will be slower, and less safe.

8) You might want to Benchmark the different algorithms and select the fastest one, since we are not concerned with the cryptographic strength here. I found Twofish to be the fastest on my computer.

9) Verify that the disk drive you are about to wipe is the correct one and provide a password for the new encrypted volume. It does not matter what this password is, because even if someone manages to guess the password, the volume will be empty anyway.

10) Disregard the question about large files, we will not be storing any files on the volume. Just click Next.

11) Finally, select a file system (or select “None”) and start the creation of the new encrypted volume, thus overwriting all the previous partitions and data traces that might have remained on the drive.

And you’re done! Now whoever wants to examine the drive, will not find any partitions on the drive, no old data, and they won’t be even able to know there is a TrueCrypt volume on the drive, unless they try to mount the drive on TrueCrypt AND they guess the password correctly. And even if they do, it does not matter, because all the old data has been overwritten and the TrueCrypt volume is empty.

VMware Tools ISO files

I realize that for some it can be difficult to obtain the VMware Tools iso files if the Player software is unable to download them. My previous guide is not suitable for all situations, so I’m experimentally offering the iso files for download. If someone objects to this, please contact me and state your reasons. I will take down the links if you have a legitimate issue with me providing some customer service this way.

VMware Tools iso files download links:

VMware Tools for Linux guest operating system

VMware Tools for Windows (2000 or later) guest operating system

VMware Tools for Solaris guest operating system

VMware Tools for Netware guest operating system

VMware Tools for FreeBSD guest operating system

VMware Tools for Windows (pre-2000) guest operating system

On OS vendors and slipstreaming

Every time I have installed a Windows operating system, I have had to spend hours installing possibly hundreds of updates which have been released after the initial OS release. Given that it is possible to slipstream the updates directly on the disc (and there are new unofficial releases of the install discs every month), why doesn’t Microsoft offer an up-to-date version of its operating system for download? They do offer an ISO image of Windows 7 and 8, but they don’t necessarily have even the latest service pack installed.

As this is a service to customers, I can see why Microsoft doesn’t do this. But the same applies to Linux releases as well, Canonical could just as well offer an up-to-date version of their Ubuntu operating system, while maintaining a “static” image for those who need one. I do understand that their update cycle is a lot different than Microsoft’s, but generating a new disc image even monthly would be a great improvement on the current 6-month release cycle.

Does it ultimately come down to reliability? Does slipstreaming somehow fundamentally differ from applying the updates on an installed system? Are they afraid of associating their brand with a product which has not been as rigorously tested as the LTS/RTM versions?

Even if there were some minor risks involved, I’d be happy to have all the updates preinstalled on my system, not having to download several hundreds of additional megabytes immediately after a clean install.

Incidentally, this also applies to antivirus vendors. After downloading the 60 MB installer file and installing my internet security package, I’m prompted to download an additional 104 MB update to the virus definitions. This is madness. The internet is a dynamic place and you do not have to serve static files as if delivered by physical media. For Pete’s sake, you can generate a new installer package for every person automatically, so they always get the latest version.

Yes, this does take some work on the server end, and yes, it costs the provider a little bit extra. But think of it from the customer service point of view: “Latest and greatest protection out of the box!” If I buy and install a product, I don’t want to spend any additional time fixing it before it’s ready to be used. It should be ready immediately. Because it can be done.

Installing VMware Tools to a virtual machine created by VMware Player on linux

I decided to move from mainly using Windows 7 to Ubuntu, and wanted to create a virtual Windows 7 machine inside my Ubuntu installation, for those times I absolutely had to use some Windows program. I chose VMware Player for this job, because there were still some problems with the Oneiric version of VirtualBox, and the Oracle repositories didn’t quite work.

I encountered some problems and will tell you how I solved them, in the hopes that this will help you, the reader.

You will need a VMware account to download the Player from their website. This is rather annoying, but I complied. Since the files are renamed with every version, I will not direct link to any files on their servers, but encourage you to register with a throwaway email account and get the latest version of the software you need. Notice that you will need to select either 32bit or 64bit version of the Player software, depending on your system setup. But you knew this already, didn’t you?

VMware distributes their linux software in *.bundle files, and I downloaded the file VMware-Player-4.0.2-591240.x86_64.bundle. Bundle files are self contained bash installation scripts, and you install the software with the command

sudo sh VMware-Player-4.0.2-591240.x86_64.bundle

Remember to replace the filename with the file you downloaded, of course.

The installation procedure is quite straightforward, so I won’t spend time with that.

After starting the program and creating your first virtual machine, make sure that you again select the right type of virtual machine for the operating system you plan to install. Again, 32bit and 64bit makes a difference, so if you want to install a 64bit Win7, select the x64 option in the wizard.

Avoiding noise and saving time, I just copied the Windows 7 disc image onto a USB drive and let the Player mount the image as a virtual DVD-drive for the virtual machine installation.

Once the Windows installation was finished, it was time to install the VMware Tools on the virtual operating system, to improve the virtual machine performance. VMware Tools allows for fullscreen operation and Unity, where you can launch the virtual machine programs (like Office) straight from the Ubuntu start menu. (Unfortunately Unity was not yet available for 64bit Win7 running inside 64bit Ubuntu Oneiric with Player 4.0.2. Fullscreen mode and other performance increases work fine though.)

Now we get to business. Normally one would simply select “Install VMware Tools” from the virtual machine dropdown menu, but all I got was an error message stating that the file could not be found on server. It also seems that the Tools installation files are not shipped with the Player. The files are not available for direct download from the VMware website either, so this is a bit of a problem.

So here’s what you need to do:

Using your linux computer, download VMware Workstation for linux from the VMware website. This is not free software but you don’t need to pay anything to download it, and you don’t have to install it. We are going to extract the Tools from the Workstation package.

Once the download is finished, go back to terminal and type

sudo vmware-installer –install-bundle VMware-Workstation-Full-8.0.2-591240.x86_64.bundle –extract /tmp/vmware

This allows you to extract the contents of the Workstation installation bundle in /tmp/vmware, without actually installing the software. Browsing the directory you should easily locate the *.iso files which contain the VMware Tools for each guest operating system. Now all you need to do is go to your virtual machine settings and mount the appropriate iso file as a virtual CD-drive on your virtual machine. Complete the installation inside the virtual machine and you’re done!

If you want Windows inside Windows using Player, and you cannot download the Tools from inside the Player, I guess you have to install the evaluation version of Workstation to find the iso files, since the installation exe cannot be extracted quite as easily as in linux.

If you have any questions, post them in the comments below and I will update the article.

Science Fiction? (A dream)

I had a dream last night.

I was at my father’s place down south, and we were getting ready to catch a plane back north. I was doing the last few dishes but the house was otherwise clean and ready to be left alone for a few months.

A travelling salesman comes in. He’s a devout christian and has written a textbook where he redefines all of science to conform to his christian beliefs. My father takes a look through the book and says that it’s complete bullshit. He gives it to me (as I’m a physicist) and I start to look through the book.

Neutrinos are explained as god’s spirit, gravity is all wrong and electricity and electronics are taught via some example he describes as the “UN Box” (standing for United Nations Box). It’s a rectangular wireframe box, about 40cm tall, with some basic components inside. I guess the students would have to calculate resistances and voltages in the box, or something like that.

I explain to the man that this book is complete hogwash, and that he should be ashamed to write this in all seriousness and try to sell it to others. He denies my accusations and remains adamant that he is right. Moreover, that everything he has written in the book is right.

“But isn’t it exciting?” he says. “It’s a completely new take on the subject, you could learn so much.” I try to explain to him that it’s like reading a novel where the relationships of people change inexplicably, falling in love means sadness, and everything is upside down and incoherent.

Finally he gives up, takes his book and leaves.

I wake up.

Light Pollution

There is a lot of light pollution in my city. And it’s a small city by global standards, less than a million people, spread over quite a large area. But everything is lit up like a Christmas tree. And it’s not even Christmas anymore!

All the roads, streets, alleys, stairways, yards and doorways are lit up, usually with sodium (public) or incandescent (private) lights.

And for who? The few dozen people who work at night, delivering newspapers, or driving trucks? Is it for security? Deterring burglars by saying “we see you, you are not in the dark” even if there aren’t any video surveillance. Surely there are stretches of road where nobody goes during the night, ever, but they are still lit up just in case. Surely we could install some kind of motion detection, at least. In the low-use areas it could pay itself off in a year or two. There’s no need to bother with such things in downtown, but maybe we could only light up only every other, or every third lamp?

I can read in the night. With all my lights turned off. With curtains in front of my windows. The cloudy sky glows yellow from all the sodium lights and I can hardly sleep.

They even light up the allotment garden patches with huge halogen lights, in the middle of the night. Who goes there in the middle of the night? Burglars? Well, there are some sheds in there, with lights on, maybe there is something of value there to steal. Wait, who keeps anything of value in an allotment garden shed, possibly kilometers from your home? Who rigs up electricity to the sheds?

On a clear night, I can see the Moon, the Jupiter and Venus, and maybe 5 to 10 stars. How am I How are the kids supposed to understand the cosmos when they have to travel over 50 kilometers to a place where they can even see it? (Think about the kids!)

The light pollution must stop.

The insanity must stop.

The money wasting must stop.