As some of you may be aware, I have just bought a new 2009 Lotus Elise.
I also spent 2 days gutting a garage that has been used for storage of building materials for the last 20 years and making it ready to hold a car.
As some of you may be aware, I have just bought a new 2009 Lotus Elise.
I also spent 2 days gutting a garage that has been used for storage of building materials for the last 20 years and making it ready to hold a car.
A while back on one of my posts on the Tekzilla forum, I was amazed that a certain country started using the word “analyzation”. This is clearly not a word. If you analyse something, you make an analysis not an analyzation but to my disbelief, it managed to get into a dictionary.
Even in my own country, so many people can’t pronounce the word “slippery” that the word “slippy” has found its way into dictionaries. Even “slippier” is there. If that word loses any more random syllables because of stupid people, it’s going to be “sly”.
It turns out that if enough people are wrong, they just change what is right.
While I’m talking about this, it should be “10 items or fewer” not “10 items or less”. If you can count it, it’s “fewer”. This assumes that you can count from 0 to 10, though for the people that make these mistakes, that’s quite a wild assumption.
If you are going to speak English, speak English. If you are not going to speak English, call it something else. I suggest saying that you speak “stoopid”.
Just how stupid do you have to be to buy low calorie water? How many calories do they think water has in the first place?!
As a bit of a revision to a previous entry, I have converted the combination bash/python scripts I gave earlier into a single large python script.
This can now be used without editing any files to set sizes. An example of use is:
$ ./enc.py -s 700 -a 192 -o '-deinterlace' da_*.VOB
All of these flags are optional except the file list, where at least 1 file must be specified.
#!/usr/bin/python from getopt import getopt, GetoptError from sys import argv, exit from subprocess import Popen, PIPE from re import search def secs(h, m, s): return (((h*60)+m)*60)+s def calc_video_bitrate(target_bytes, ab, time): audio_bytes = (ab * 1000 / 8) * time return (target_bytes - audio_bytes) / time * 8 def get_duration(file): ffmpeg = Popen(("ffmpeg", "-i", file), stderr=PIPE) match = search("(\\d+):(\\d+):(\\d+)\\.\\d+", ffmpeg.communicate()[1]) ffmpeg.stderr.close() if match == None: return 0 dur = match.groups() return secs(int(dur[0]), int(dur[1]), int(dur[2])) def encode(source, dest, opts, vbr, abr=128): command1 = "ffmpeg -i %s -pass 1 -an -vcodec libx264 -vpre fastfirstpass -b %d -bt %d -threads 0 %s -y pass1.mp4" % (source, vbr, vbr, opts) command2 = "ffmpeg -i %s -pass 2 -acodec libfaac -ac 2 -ab %dk -vcodec libx264 -vpre hq -b %d -bt %d -threads 0 %s -y %s" % (source, abr, vbr, vbr, opts, dest) pass1 = Popen(command1.split()) pass1.wait() pass2 = Popen(command2.split()) pass2.wait() target_size = 350 #MiB ab = 128 #kbps extra_options = "" # Parse args try: opts, args = getopt(argv[1:], "s:a:o:", ["size=", "ab=", "opts="]) except GetoptError, err: print str(err) exit(2) for o, a in opts: if o in ("-s", "--size"): target_size = int(a) * 1024 * 1024 elif o in ("-a", "--ab"): ab = int(a) elif o in ("-o", "--opts"): extra_options = a if len(args) < 1: print "Usage: " + argv[0] + \ " [-s <size (MiB)>] [-a <audio bit rate (kbps)>] [-o <additional options>] <file list>" exit(2) # Loop through files for file in args: duration = get_duration(file) if duration <= 0: print "Unable to get length of", file continue bitrate = calc_video_bitrate(target_size, ab, duration) encode(file, file + ".mp4", extra_options, bitrate, ab)
I currently have the need to test the connection speed between two remote machines, so that I know when it is safe to transfer a large file from one to the other without significantly affecting service by causing long periods of downtime. I couldn’t find any software that did this easily, ran as a single executable (no installation) and was free, so I made one.
This currently only tests speed in one direction (upload from the client to the server) because I have symmetric connections on both machines, so either way should be exactly the same, and so that I can just write a client program and use netcat as a server to accept the packets and dump them to /dev/null. It is simple enough to convert this client into a server so that netcat becomes a client or so that they can be used together. Using netcat as a client probably requires quite a large pre-generated random file and may introduce a bottleneck of the hard drive read speed.
This could also be used in the home for something like testing the effect of wifi strength.
The client takes the command line arguments, connects to the server, generates some random data and sends that data repeatedly until the timer expires. It then prints out the results.
The command to use netcat to listen and ignore any data it receives is nc -lp 9000 > /dev/null though the -p isn’t always needed (it was needed on my Debian box but not my ESX 4 box).
An example of use of this program as a client is:
C:\>SpeedTestClient.exe 192.168.1.157 9000 Uploaded 1181614080 bytes in 10.015 seconds. 943875.45 kbps (943.88 mbps) 115219.17 kB/s (112.52 MB/s)
The results are given in kilobits per second and megabits per second (standard measurements for network speed), kilobytes per second and megabytes per second (more useful for knowing how long a file will take to transfer). In this example, a gigabit ethernet connection is getting roughly 944 mbps.
A few seconds later, VLC 1.0 is opened and paused, so nothing is playing and the test is run again. The results are quite interesting:
Uploaded 225083392 bytes in 10.015 seconds. 179797.02 kbps (179.80 mbps) 21947.88 kB/s ( 21.43 MB/s)
It says it is using next to no system resources when paused but it slows data transfer dramatically and this is with 8GiB of RAM, an otherwise idle CPU and no hard drives being used. When hard drives enter the equation this drops down to about 8MB/s (while VLC is still paused – I have particularly fast hard drives so I still get about 110MB/s when hard drives are used and VLC is turned off).
The code listing is as follows:
using System; using System.IO; using System.Net; using System.Net.Sockets; using System.Security.Cryptography; namespace SpeedTest { class SpeedTestClient { static int Main(string[] args) { if (args.Length < 2) { Console.WriteLine("Usage: SpeedTestClient <ip> <port> [<seconds>]"); return 1; } try { ulong bytes = 0; int startTime = Environment.TickCount; bool started = false; int timeout = 10; // Get the optional number of seconds argument if (args.Length > 2) timeout = int.Parse(args[2]); // Connect to the server via TCP TcpClient client = new TcpClient(); client.Connect(IPAddress.Parse(args[0]), int.Parse(args[1])); NetworkStream stream = client.GetStream(); // Generate some random data. Buffers too small will bottleneck. RandomNumberGenerator rng = RandomNumberGenerator.Create(); byte[] buffer = new byte[32768]; rng.GetBytes(buffer); while (true) { // Write the data stream.Write(buffer, 0, buffer.Length); // Start the timer only after some data has been sent if (!started) { startTime = Environment.TickCount; started = true; } // Add to the bytes counter bytes += (ulong)buffer.LongLength; if (Environment.TickCount - startTime >= timeout * 1000) break; } PrintFinalStats(startTime, Environment.TickCount, bytes); try { client.Close(); } catch (IOException) { /* Do nothing */ } } catch (Exception ex) { Console.Error.WriteLine(ex); return 1; } return 0; } static void PrintFinalStats(int start, int end, ulong bytes) { double seconds = (end - start) / 1000.0; ulong bits = bytes * 8; double bitsPerSecond = bits / seconds; double bytesPerSecond = bytes / seconds; string kbps = string.Format("{0:0.00}", bitsPerSecond / 1000); string mbps = string.Format("{0:0.00}", bitsPerSecond / 1000 / 1000); string kibs = string.Format("{0:0.00}", bytesPerSecond / 1024); string mibs = string.Format("{0:0.00}", bytesPerSecond / 1024 / 1024); int kPad = Math.Max(kbps.Length, kibs.Length); int mPad = Math.Max(mbps.Length, mibs.Length); Console.WriteLine("Uploaded {0} bytes in {1} seconds.", bytes, seconds); Console.WriteLine("{0} kbps ({1} mbps)", kbps.PadLeft(kPad), mbps.PadLeft(mPad)); Console.WriteLine("{0} kB/s ({1} MB/s)", kibs.PadLeft(kPad), mibs.PadLeft(mPad)); } } }
A compiled .net executable is available here.
P.S. always remember to turn off VLC before transferring files over the network.
One of many things that annoy me is when people say things like “not uncommon”. If it isn’t uncommon then it is common, isn’t it? It has to be either common or uncommon. If it is anywhere between those two, then how rare it is isn’t worth mentioning in the first place.
On a related note, people should stop saying “it’s not unheard of” and start saying “it’s heard of”.
Play me off, Tom Jones!
“It’s usual …”
I decided to replace my ageing Dell 400 SC mini tower server with something slightly meatier that would fit in a 19″ rack.
This machine was already sitting in the rack but because it is a tower server, it was taking up almost 5U. I was using it as a pfSense hardware firewall.
A hardware firewall has very few requirements. At least two network interfaces are a must and some kind of visual output is probably needed for first time installation (assuming you cannot just use an embedded disk image install, as it did not work for me at all). Because it is 1U, as much as possible must be on the motherboard as there is only a single riser card expansion slot. Having an optical drive at hand may be useful but hopefully not necessary – I borrowed one from another machine for first time installation again because I couldn’t get any kind of embedded install to actually boot. You may be able to get a board with no VGA output and just use a temporary graphics card in the same way but some machines may not boot after the graphics card has been removed.
The motherboard I used was an Asus M3N WS. Asus are the best motherboard manufacturer by far and have been for quite a few years. Every time I use something else I immediately regret it. A few years ago, there were a lot of motherboards with two network interfaces but now there seem to be almost none. Desktop users just don’t need them (even though I’m using the second NIC on an Asus Striker Extreme in my main desktop computer to bridge my Xbox 360 to the Internet, as my dirt cheap but excellent ZyXEL GS-105A 5-port gigabit switch is in use by another server for now). This is an AM2+ motherboard but performance isn’t an issue so I went for the cheapest Athlon 64 I could find, a LE-1640 2.7GHz single core.
For a case, I went with an X-Case RM 100S. This is a rack mount (RM) case, 1U (100) and is the short version (S). I had previously used a RM 206LP as an excellent 2U MythTV server with space for 5 to 7 low-profile expansion cards. However, as always with X-Case, they are relatively cheap and have excellent ideas but they are executed incredibly poorly. Drills and drill-bits that can cut through metal will be required, as will screws and screw drivers of various sizes.
The good idea, with the 206LP is to offer many low-profile expansion card slots rather than just 2 riser cards. In something like a MythTV server which may require many expansion cards for TV tuners, this is a must and very few other companies offer low profile 2U servers at all. Other ones I could find were archaic and expensive, based around things like old AT motherboards. The problem for the 206LP was that fitting an ATX power supply into it that feeds air in from one end and blows it out the other is very difficult. I managed to find a decent PSU but immediately had to void its warranty to turn the fans around inside and also had to move the 4 internal case fans further back to fit it in. Luckily, I wasn’t using a full size ATX motherboard at the time (I was using an ATX board that only used 6 screws, not a micro ATX).
The 100S, however, has some different problems. Firstly, it is designed around a different PSU to the one that ships with it. This new PSU does not actually screw into the case properly. Secondly, the airflow is complete nonsense. They have 3 40mm fans where the PSU should be and a PSU where the fans should be. In a rack, all air should flow from the front, over the components and to the back. They claimed that the PSU didn’t fit at the back but as soon as those fans were removed, it had plenty of space. The PSU does not come with an 8-pin 12V supply like the video shows but to be honest I wouldn’t expect that from a 250W power supply in the first place and I’m surprised the one in the video had one. More of an issue is that the main 20/24 pin power supply is incredibly short and will probably not reach wherever it needs to get to on your motherboard regardless of placement, particularly as in a 1U case it cannot actually go over anything and must go around. I used a 20 to 24 pin adapter that I just happened to have (from some previous false advertising where a PSU was labelled as 20 but was actually 24, so I bought it for nothing).
X-Case also seems to delight in telling you that your case needs no rails but then not providing any screws that will hold it in place, so it is currently just sitting at the bottom of my rack not actually attached.
These fans could have been placed near the CPU on this particular motherboard and a passive cooler used. Just make sure the fins face the right way, which means moving the fans anyway in this case. However, I did not know this when I bought the thing, so I got an active cooler. The Dynatron A48G did blow out very nicely over the northbridge though and lined up perfectly.
For storage, had intended to use the Lycom UB-109 but I grossly overestimated the size of a 1U server so I could have cut this in half but instead I decided to just use the rear USB bracket that came with the motherboard instead. A 256MB thumb drive is fine for pfSense but other servers may need more. I bought an 8GiB just because it was almost the same price. Either way, just remember to disable swap space in the installation to avoid frequent writes. Swap is not needed if you have enough memory and the 1GiB of corsair 800 MHz DDR2 I had lying around was plenty.
If you are going to use a USB drive to boot an operating system, you should probably get a drive with a high read speed. The drive I am using currently takes several minutes just to load the ramdisk of FreeBSD 7 (pfSense is based on FreeBSD).
Total cost:
X-Case RM 100S – £79.00
AMD Athlon 64 LE-1640 – £23.38
Asus M3N WS – £54.70
Dynatron A48G – £30.00
Add in the cost of the USB thumb drive and cheap stick of memory to round it up to £200.
In this particular case, it would probably be better to cut off the metal by the fans entirely and drill a new hole so that the fans can be mounted closer to the CPU and memory. However, I am lazy.
wget is a command line utility found on many UNIX like operating systems, particularly Linux, used to download files from the command line.
It is available from gnuwin32 but I had major problems trying to get all of its dependencies and in the end gave up with that. As I already have cygwin installed and wget installed on that, I decided to just take it from there as these files will run as long as cygwin1.dll and any other dll dependencies are present.
I zipped these files up here (2 MB) for those who do not have Cygwin. All you have to do is extract them to somewhere on your system path environment variable (e.g. C:\Windows\System32) and you should be able to use wget from the command prompt as follows:
C:\Users\George\Desktop>wget --version GNU Wget 1.11.4 Copyright (C) 2008 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://www.gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Originally written by Hrvoje Niksic <hniksic@xemacs.org>. Currently maintained by Micah Cowan <micah@cowan.name>.
And the award for the most ridiculously over packaged piece of hardware goes to … *drum roll*
The Lycom UB-109 internal to external USB adapter (scan).
And no, nothing else was in the box. Just this, cardboard and bubble wrap.
The main purpose of the box seems not to be to protect the contents but rather to repeatedly post random branding such as the logos for eSATA, SATA, SAS, PCI-X, PCI-Express, FireWire, etc even though they clearly have nothing to do with this product whatsoever.
I am no photographer but I have a Sony A200 camera – an entry level digital SLR. After seeing some examples of HDR photography, I gave it a go.
This consists of using several photographs of the same image at different exposures (in my case, by adjusting the shutter speed in manual mode) and passing them through software. The software I used was the free qtpfsgui.