basically tech

23 command-line calculations using bc

Sunday 26th November, 2006

If like me, you do most of your work from the command-line, using vim to edit files, mutt for e-mails, cd/ls/mv/find/etc instead of a file manager, then you may get annoyed by having to fire up a GUI calculator to make (what may sometimes be) a single calculation.

One useful feature of calculating on the command-line is that you can see what you've typed. For instance, sometimes when I'm entering a long, complex calculation on a calculator (either the GUI or the solid, hold-in-your-hand type), I sometimes forget if I've actually typed in all those numbers or made the calculations in the right order. Maybe it's just me ... :)

This article shows how to quickly perform standard calculations on the command line including addition, subtraction, multiplication, division, square root, powers, conversion from decimal to hex, decimal to binary, hex to decimal, and binary to decimal. It also briefly introduces using bc in interactive mode and how to write files for use with bc for frequently repeated operations. There is a mention of using Google for performing calulations. It finishes with a little challenge to test the power of your CPU.

Other advantages of using bc include:

  • bc is included with (almost?) all Linux distros as standard, as well as (again, almost?) all Unices.
  • Results from calculations in some proprietary flavours of bc have up to 99 decimal digits before and after the decimal point. This limit has been greatly surpassed in GNU bc. I don't know what that limit is, but it's at least many, many tens of thousands. Certainly it's more than any GUI-based calculators (I've used) could accomodate.
  • You may also find yourself working in an environment where you simply don't have access to a GUI.
  • The syntax for basic sums is almost identical to Google's calculator function, so you can learn how to use two utilities in one go!

22 More Vista EULA insanity

Friday 24th November, 2006

Following from two earlier posts I made about Microsoft's EULA for the forthcoming Vista, here is another very interesting analysis of the product activation component of the EULA which will be a required agreement before members of the public can use the new OS.

Some choice quotes from the article:

The terms of the Vista EULA, like the current EULA related to the 'Windows Genuine Advantage,' allows Microsoft to unilaterally decide that you have breached the terms of the agreement, and they can essentially disable the software, and possibly deny you access to critical files on your computer without benefit of proof, hearing, testimony or judicial intervention.

(Emphasis added.)

... if you buy a license to the software from a reputable dealer, but choose not to transmit information to Microsoft, you forfeit your ability to use the licensed software
But the contract doesn't limit Microsoft to these disabling attributes. It just says that they have the right to limit your ability to use features - pretty much any features they decide to at any date. And guess what. You agreed to it.

The sad thing is that so many people are so apathetic about the whole that they'll just click on the "I agree" button without reading the EULA, or even caring what's in it.


21 Microsoft claims Linux has stolen it's "intellectual property"

Sunday 19th November, 2006

Just a few of the more interesting links related to these sordid claims. It's something that Ballmer has claimed before, but that was back in the heyday of the SCO debacle which is now nearly over. It's typical FUD, possibly the actions of a desperate man? Who knows how these people think, except others like them.


20 Samba Team Asks Novell to Reconsider

Monday 13th November, 2006

The Samba team has issued a statement asking Novell to reconsider its recent deal with Microsoft.

If historical precedence is anything to go by, Microsoft tends to strike deals which either buys them some time to regroup, or hinder their "partners". Novell has been here before. They should know better.


19 The war is over and Linux won?

Friday 10th November, 2006

According to this ZDNet Blog entry, an IBM-sponsored study claims that 83% of companies expect to support new workloads on Linux next year, against 23% for Windows.

It cites the recent moves by Oracle and Microsoft with regard to Linux as evidence of this trend.

I would never rule Microsoft out any race it wishes to take part in, until the race is truly over. One particular comment to this blog entry raises the interesting assertion:

Microsoft has obtained the expertise and assistance of SuSE in creating the migration tools that will ease the Linux to Windows transition. The path was already marked out.

Linux to Windows will soon be far easier than Unix to Windows has ever been. And companies can't wait for their chance to leap into the future.

I must admit, I find it hard to trust Novell's recent actions. I'm not the only one.


18 Four-second attention span?

Thursday 9th November, 2006

It seems that shoppers will abandon a website if it takes longer than four seconds to load, according to a survey reported on by the BBC news website.

I thought it was only children which were impatient. My sons wait far longer than that for Playstation games to load!

The four-second threshold is half the time previous research, conducted during the early days of the web-shopping boom, suggested that shoppers would wait for a site to finish loading.

This general impatience is getting worse. What if your connection is poor?


17 Dell customer gets Windows refund

Thursday 9th November, 2006

A Linux-using Dell customer has managed to get a refund for the unused copy of Microsoft Windows XP Home SP2 bundled with his new laptop.

Mitchell was careful to document that he did not run the Microsoft product or accept the EULA. "I booted the laptop, then photographed every step of the boot process up to and including clicking on the XP 'no I don't accept' button. I also scrolled through each page of the EULA, taking a photo of each page," he wrote in an e-mail interview.


16 Slash'EM on Linux: configure, install, setup and play

Tuesday 7th November, 2006

When I tell my World of Warcraft/EverQuest-playing friends that I play Slash'EM, they usually raise their eyebrows and give me a slightly condescending smile before going on to explain how they prefer 3D graphics, interaction, etc. The fact is that comparing WoW/EQ to Slash'EM is like comparing movies to books. Did you read the Harry Potter books? Did you then go and see the movies? Slightly disappointed? Not quite what you expected? Then you'll have an inkling of what I'm on about.

As with reading, some imagination is required. Compared to it's more modern peers, Slash'EM and its relatives are extremely challenging. If you get it wrong, your character dies. Sometimes your character will die in seemingly grossly unfair circumstances. And it's permanent, unlike in certain other games. C'est la vie. This game hasn't been designed to pander to the requirements of the "I want it all and I want it now" crew.

It's a bit sad that such a fine open source game is easier to install on Windows than it is to install onto many Linux systems. So, hopefully this article will address that issue.

15 Microsoft backs down over one aspect of Vista EULA

Saturday 4th November, 2006

Microsoft have backed down over the proposed limit of one re-installation for Vista license holders. The previous limit allowed users to transfer their copy of MS Vista to one other PC, after which the license would have been rendered invalid, requiring the purchase of another (full) license.


14 Microsoft Vista's new EULA

Tuesday 31st October, 2006

The Register has an interesting analysis of the Microsoft Vista End-User License Agreement.

Among the gems in this agreement, which virtually everyone agrees to without reading it, are:

  • If you use Vista, you may run performance benchmarks on the operating system, but you may not disclose the results of the benchmarks without permission. Censorship - that's one way to prevent bad news getting out!
  • You may not run the software on a virtual system (such as the Windows XP honeypot PC I mentioned in an earlier post) unless you have purchased the more expensive Business, Enterprise, or Ultimate "editions". The differences between the "editions" is going to be interesting. Aside from the cost that is. One wonders what has been disabled, and how soon "fixes" to enable the disabled funtionality appears.
  • You may not use the license on more than two PCs. So, build one PC, install Vista. Build another, transfer Vista to the new PC. And that's your lot. If you want to legitimately transfer the license to a third PC, you can't; you must shell out for another full license. I imagine that corporate customers will have a special dispensation to get around this one, but Joe Public can forget it.

It won't affect me. :)

There's a lively comments section about this very subject on