Computing, Cycling, horticulture, other stuff

Beardy weighs in on Old School programming methods

June 13th, 2009 Beardy

by guestblogger “Beardy”

Ok, I’m “old school” and proud of it, and yes the author of the article linked at the bottom of the page makes some excellent points.

  • Yes, I do NOT miss having to write convoluted, upside-down and inside-out self-modifying code just to save a few miserable bytes* ! (*and yes, I know there are still a few bare-metal scenarios where that is still the order of the day…)
  • Yes, I do NOT miss having to do all my coding of OO GUI systems using hand-built text objects in CLI text editors!
  • Yes, I most certainly am grateful that “GOTO” has been relegated to the dustbin of history in all but hardcore bare-metal work.
  • And OH how I do NOT miss writing multithreaded applications with languages and OSes that did not support it inherently.

However…

As onerous is it was to get a handle on initially and hideous to be a support programmer for when the original developer adopted a variation on the more commonly accepted (ie: M$ Win32 API…), Hungarian notation certainly does have advantages, especially when the code has to be viewed in multiple scenarios with various tools, most of which have no concept of the language or types.

(…rant warning…)
More importantly, I take major issue with the blanket statements about memory management. Yes, it has improved a LOT and yes, modern languages, compilers and OSes have far more of it available and *can* use it very efficiently, BUT, many programmers seem to view memory as an inexhaustible resource and rather than just not focussing on being memory misers, they ignore good design templates to reinvent the wheel or worse reinvent a square wheel!!! So rather than take a minute to consider the implications of collecting a massive dataset into a local list or collection “just because it is easier for them” when they could write a more efficient algorithm in the first place and only collect a fraction of the data for the same outcome and let the memory manager worry about dealing with the load. Talk about backward progress…

“Old-school programming techniques you probably don’t miss”
http://www.computerworld.com/action/article.do?command=viewArticleBasic&articleId=9132061

A new twist on “security through obscurity” ?

June 13th, 2009 Beardy

By Beardy.

Photo by Henning

Photo by Henning

Ok, anyone who knows anything about security in IT systems knows that “security through obscurity” is akin to “the road to Hell is paved with good intentions”. It just does not really provide the desired outcome in the long term.

So, let’s examine the history of this approach. M$ products, getting better, tend to still depend on M$-specific proprietary APIs and protocols, that inevitably lead to “critical” security patch after “critical” security patch ad infinitum, sound familiar?

On the hardware and network design side, many people (some of whom should know better!) think that just because they have what is termed a “NAT firewall”, that their precious LAN is secured from the kiddiots and other nasty denizens of the world-wide-whackfest. WRONG!

First of all, while NAT does provide at least some level of protection (certainly better than the twits who connect their USB ADSL MODEMs directly to the ‘net without even enabling Winblows firewall, nuff sed on that one.), it only really obfuscates things, it is not true protection. Consider the annual C and Perl code obfuscation contests, the result is code that is nearly impossible to read without getting a headache, but it is decipherable in the end. This will eventually become largely academic as IPV6 becomes more pervasive. Remember that NAT was originally created to provide an artificial extension of the internet’s IPV4 address space (well, that combined with non-routable IP address ranges).

All the gurus of internet hacking agree on one thing about NAT as a “firewall” technology; it is limited but fine provided the machines on the inside NEVER open a connection OUT and no ports are forwarded IN. All a potential attacker needs is the details of who and where you came from and they can (in theory at least) use that against you, kinda like identity theft.

So where am I going with this?

Read the rest of this entry »

Buying Blu-Ray discs from overseas

June 12th, 2009 Beardy

by guestblogger “Beardy”

Before you read on, I strongly recommend BUY AUSTRALIAN (whenever possible).
If you buy overseas, you send money and jobs with the purchase, unless of course the product is manufactured exclusively overseas in the first place. In that case, shop “smart”.

Ok, we all know that DVD region encoding is an artificial block to enforce regional pricing. We also know that many DVD players can be made region-free to avoid the problem of having to own multiple DVD players to cover the regions that our DVDs come from.

So with the hassle, why buy overseas? Availability of titles, release dates, optional extras, etc, etc…

While NTSC region-1 disks (USA and Canada) tend to have the widest list of available titles and features, NTSC is not PAL (the Oz video standard). Ignoring the whole digital thing, there are still reasons to stick with PAL disks. Enter the UK as PAL and region-2. Makes a nice source for movies, not to mention frequently faster delivery than the USA.

Blu-Ray players that can be made region-free tend to be somewhat rare still, but mercifully they did not break the regions up as much (see first link). Even better, of the 3 regions, Oz and NZ are in the same region as the EU/UK! So no problem playing UK-sourced blu-ray disks in local players.

Still, why buy from the UK rather than locally ? As much as supporting your local industry is laudable, there are some serious discrepancies in pricing of these foreign-created disks. Since they are imported anyway, how come the local release is so slow and so expensive? Add to that the major annoyance that frequently the Oz importers do not being in everything or large quantities, eg: Van Helsing soundtrack CD, of which how many were brought into the country? According to one major retailer, only 100 physical disks were imported and fewer were ever distributed to stores.

So, the message is simple: Buy Australian (if possible), otherwise have a look at UK-based online sellers.

Oz/NZ/EU/UK all in region B for blu-ray
<http://en.wikipedia.org/wiki/Blu-ray_Disc>
Example of price differential (delivered prices):

<http://www.amazon.co.uk/Van-Helsing-Blu-ray-Hugh-Jackman/dp/B001TDKLHO/ref=sr_1_1?ie=UTF8&s=dvd&qid=1242603022&sr=8-1>
£12.98 (+shipping, GBP£3.58)
TTL: AUD$32.96  (GBP£16.56)

<http://www.bigwentertainment.com.au/product/van_helsing_3847516_188284.html>
AUD$35.96 (+shipping, AUD$4.50)
TTL: AUD$40.46

<http://www.ezydvd.com.au/item.zml/805834>
AU$39.97 (+shipping, AUD$1.50)
TTL: AUD$41.47

Go faster with the same CPU…just throw the work to the GPU

June 10th, 2009 Beardy

by guestblogger “Beardy”

Most of you will be aware of nVidia’s CUDA technology. Essentially nVidia is making a play for the hearts and minds of the HPC community by giving them a more bang for their buck without buying mainframes.

If you recognise the following, Opteron, UltraSPARC, EMT64, POWER, CBE or Cell, then you are probably in the market for the PC-universe equivalent of a turbocharger, enter nVidia’s CUDA technology. If you have PCI-E bus available and can cope with C, then have we got a deal for you! Have a read of the links at the end of the article for more details.

As always, the reviewers at Toms Hardware focus on the raw processing capabilities (which are impressive), but also as usual, because of the limited time for testing they didn’t encounter (or at least report on any encounter) with the downsides of using CUDA. Aside from the need to ensure better cooling for the GPU than its maker probably supplied, there are some other little considerations that need to be accommodated.

There is no such thing as a free lunch. From personal experience I can say that while CUDA-enabled code churns massive maths functions in a fraction of the time as the system CPU (nVidia 8600GT with 512MB in a Pentium IV H/T 3.2GHz with 3GB) for BOINC work, there is a noticeable trade-off. When the system is grinding away on some intensive function, the graphics display refresh is mind numbingly slow…. think back to old EGA-era ISA-bus cards in max res….ouch!

There is also an interesting problem with coding for CUDA-enabled cards. Ignoring the fact that only nVidia make ‘em, there are some unusual scenarios that arise. Those of us who loathe programming using try-catch-exception paradigm would rarely encounter it, but if your compiler still builds on an underlying function library that employs it, you will still hit it.

Specifically, consider the following scenario;  application is written as multi-threaded, multi-processor for grid-enabled operation. Bleeding-edge stuff for most developers. Now break from the SMP architecture and depend on DMA or some other memory block handover technique for moving datasets in and out of the modules.  What happens if an exception is thrown in a CPU (or GPU) that is not within the same OS or system management processor ?  Unless the code is written to specifically handle these cases, death spirals occur…. you know the kind, “Dialog *this* has thrown an exception and need to terminate. Press Ok to abort”… wash, rinse, repeat… oops… um, sorry, how did you plan to handle the exception if the exception handler is the bit going *boom*. Uh oh.

The above scenario occurs rather regularly in a FORTRAN program module (running in the host CPU) that links to a C module (that runs in the GPU), with the unfortunate outcome that the CPU-side module keeps expecting a result block from the C block that never arrives (because the process has terminated unexpectedly), leaving memory invalid and throwing a termination code that “looks” ok, but in fact is not. The root cause in this case derives from a complex math divide-by-zero error that does not have a denominator-check. No biggie *IF* the system were operating under an SMP architecture, but oops, no we ain’t.

“Your mileage may vary” is an understatement. CUDA is truly amazing for certain areas of endeavour, but like all solutions, there is no such thing as a magic bullet. More importantly, on the back of Microsoft’s missive banishing “memcpy()” to the bin, the QUALITY of code is critical to delivering any improvement.

“CUDA-Enabled Apps: Measuring Mainstream GPU Performance”
<http://www.tomshardware.com/reviews/nvidia-cuda-gpgpu,2299.html>

“Use your NVIDIA GPU for scientific computing”  (BOINC)
<http://boinc.berkeley.edu/cuda.php>

“NVIDIA CUDA Compute Unified Device Architecture”
<http://developer.download.nvidia.com/compute/cuda/1_1/NVIDIA_CUDA_Programming_Guide_1.1.pdf>

You have the right to have your money spent for you…

June 2nd, 2009 Beardy

by guestblogger “Beardy”

I can’t help but wonder whether the US tax payer would have voted for a rescue package for “the largest industrial company (and fourth-largest overall) to seek bankruptcy protection in the history of American business” ?

So the US government (ie: the US tax payer) will own 60% of GM after the deal completes. As for Canadians buying into this, it seems “odd” even factoring in the close economic/industrial ties between the 2 countries.

The rescue of GM in the United States is being led by an unlikely coalition of the U.S. and Canadian governments and the company’s employees and creditors.

So as Chrysler emerges from a major restructuring and sell-off (mostly to Fiat) and GM are entering a major fire sale. Toyota has made the first loss in 70 years… BMW, Mercedes, VW, Ford, Peugeot, Saab, Fiat, Mitsubishi, Nissan and Kia ALL posted losses… Volvo, Lamborghini, Ferrari, Maserati, Jaguar, Rover have all gone the way of the dodo and been absorbed by bigger corporations. The only major standouts are Audi and Hyundai which posted a (reduced) profits in the first quarter of 2009 !??!?

GM’s Australian operations in the Holden division look to survive the blood-letting in their US parent (for now).

The obvious question to ask is, with all the flow-on effects of losses in so many large industrial corporations, how long will the effects of this economic crisis be felt… 10 years, 20 years, more ?   If you think that is extreme, consider the following:

  1. US financial sector in chaos (still) despite USD$ billions being pumped into propping them up by the Fed (US govt federal reserve).
  2. Major global corporations being bailed out with massive loans of USD$ billions to aid restructuring.
  3. Governments from Australia, America, Japan, Britain, Germany, Italy, India, Russia, etc. have all ploughed billions of money into their economies to soften the hit on their local industries and populaces.
  4. ALL the above money is being borrowed… from somewhere….

Basic economics says if you borrow money, it always comes with strings and/or interest…. eventually you have to pay the piper. With such large percentages of GDP being leveraged into these “stimulus packages” and bail-outs, how far into our future have we mortgaged ourselves through the decisions of our governments ?  Note that it does not matter whether the current parties in power are left-wing (extreme=Communist) or right-wing (extreme=Fascist), the decisions have been the same. That only goes to prove that no matter what your political persuasion, your pet politicians are mortgaging your future…. So how does it feel to be deeper in debt without having spent any money yourself ?

“Europe jobs at risk as GM files for bankruptcy”
http://edition.cnn.com/2009/BUSINESS/06/01/gm.europe/index.html

“Holden ‘strong’ despite GM bankruptcy”
http://news.brisbanetimes.com.au/breaking-news-national/holden-strong-despite-gm-bankruptcy-20090602-btc3.html

-Beardy