Saturday 12 March 2011

This is UNIX!

0 comments
matt@stanley:/proc$ find /proc -maxdepth 1 -mindepth 1 ! -regex '^.*?/?\([0-9]+\|self\)' | xargs grep -R 'wlan0' 2>/dev/null | less

Monday 24 January 2011

Windows is appalling

0 comments
Take a look at the installation method from USB stick using Windows XP. Why the hell do people keep using this crap?

THERE'S NO MICROSOFT-ENDORSED WAY TO INSTALL XP FROM USB?!

All the third-party utilities mash together the same core set of utilities using batch files. None of them are aware of Vista and later's administrator requirements. None of them work, and they're all excessively complicated.

Compare this to Ubuntu, which provides USB image files, and ISOs for installation from USB or CD/DVD. There are "single-click" applications that prepare your installation media for all operating systems.

I never made it this far, but it appears Microsoft acknowledges USB installs or install-froms for Windows 7, I can't tell. Won't this require a USB stick with OVER 4GB capacity? Ubuntu requires 700MB. There are smaller Linux installers (with full USB compatibility again), that only require 40-80MB.

Saturday 4 December 2010

Installing linux 2.6.35 in Lucid

0 comments
You can install Linux 2.6.35 (the default is 2.6.32) in Lucid from the Ubuntu repositories by installing the following packages:

linux-image-X-lts-backport-maverick
linux-headers-X-lts-backport-maverick

Where X is one {generic, generic-pae, server, virtual, ...} per your platform. The headers are required for recompiling of kernel modules. I also required a reinstallation of nvidia-current to trigger the rebuild.

Saturday 27 November 2010

Golang review

3 comments
Go is a new systems programming language driven by Google.

Disclaimer: All performance claims are from a combination of personal experimentation in several projects, and from the Ubuntu x64 quad-core benchmarks, which I believe to be the best indication of future performance contrasts.

The Good
The Bad
  • Uses the := operator.
  • Syntax not similar to Python. For a new language I'm not sure there is any reason to continue using C-syntax such as braces. Providing gofmt, and requiring leading braces were excellent decisions, and a large step towards whitespace formatting anyway.
  • Preference for custom compiler bars adoption and integration with existing technologies.
  • Limited support for Windows. Despite the pain of developing for Windows, this blocks mass adoption.
  • Standard library is still evolving.
  • Won't replace C in its current state. Some of the syntax and interface advances would be most welcome however.
The Ugly
  • Performance is nowhere near C, or C++. The standard library is severely under-optimized.
  • The LLVM toolchain was not chosen to build upon.
  • Several years of tool chain development and optimization are required before Go will be a contender.
  • Documentation of the toolchain is lacking.
Language Comparison
  • Go is much faster and has superior concurrency to Python. Retains many of strengths of Python's typing system but without dynamic typing. Python has easier syntax, and a much better standard library implementation.
  • Go has better type safety than C. It also supports interfaces, closures, containers and many modern features that C lacks. Go is garbage collected, and has safe pointers. C is much faster, and has much better platform support.
  • Go is much simpler than C++, and supports many modern features that are clunky and difficult to use in C++. There is far less boilerplate. C++ is faster and has better platform support.
  • Go is faster than Java, and has less boilerplate. Its compilation speed, runtime size, and similarity to C will allow it to compete with Java's claim to portability.

    Sunday 14 November 2010

    Levels of strictness

    0 comments
    Google Heap Leak Checker Levels of strictness:

    1. minimal
    2. normal
    3. strict
    4. draconian

    Thursday 11 November 2010

    Sneaky use of sequence points in c++

    1 comments
    i've found a very interesting corner case where fiddly knowledge of
    sequence points and STL are used.
    apparently it's not possible to use remove_if on associate arrays but
    this didn't stop me trying for a good 30 mins before i discovered this
    workaround:

    for(; iter != endIter; )
    {
    if(Some Condition)
    {
    // is it safe ?
    aMap.erase(iter++);
    }
    else
    {
    ++iter;
    }
    }


    There's no evidence in the answer, but it's apparent after digging
    through the numerous overloads and associated nastiness that its
    apparently excusable simplicity comes down to sneaky use of sequence
    points.

    http://www.cplusplus.com/reference/algorithm/remove_if/
    http://stackoverflow.com/questions/800955/remove-if-equivalent-for-stdmap/800984#800984