Tuesday, April 24, 2012

Blog Currents – 25-04-2012

It’s been a quiet week for me but I did attend a one day SQL seminar that covered some of the new bits to be found in SQLServer 2012 and some useful things that came with the 2008 version. Apart from the notes on the MERGE statement below I did learn some other interesting things.

The SQL optimiser processing has been refined over a number of years and is probably one of the best optimisation systems, based on the Cascade approach, of all the database implementations available today. The optimiser makes a very good job of removing any problems, poor SQL coding and works out the best, most of the time, way to execute the statement. I also learned that unless you really know the internals of what is happening then it is best to let it do its own thing. You can selectively disable certain rules if you want to play or are an expert but that is something I do not plan an tampering with.

SQL Server looks like it will be a very nice product to play with and use but it is not perfect. The dynamic help we all use and love in say 2008 has been ‘removed’ and the replacement is not as good. The new Analysis Functions are also a mixed bag. Don’t try to find the help entry for them; it doesn’t exist in the index. It is there however and can be found via the OVER clause description and navigating from the links at the bottom of that entry. They do allow for an easier way to find the median of a set of values and running totals have finally been catered for. Many of the functions do not seem that useful but then again it is not the kind of result sets that I have ever been interested in, I suspect there are those that will love them and there is a whole new book dedicated to just these new additions.

Also interesting this week was the release of the notes from Alan Turing that lead to the breaking of the Nazi Enigma codes that brought World War 2 to a close a couple of years earlier. The info is not available online as yet but public access is available to those who ask at the UK National Archive. A couple of typed pages with handwritten formulae outlined the code breaking techniques. A bright man Mr Turing.

SQL Notes

One command I had never used before, but one that would have been very useful a few months ago, is the MERGE command. It turns out not only to be quite powerful but quite versatile.

A sample command looks something like the following:

MERGE Customers T
USING CustUpdates S
ON C.CustCode = S.CCode
WHEN MATCHED THEN
Update
WHEN NOT MATCHED THE
Insert . . ..

The example above has the Customers master file as the target with a Customers Update table that may or may not have a record for every existing member and perhaps a few new ones.

If the source file finds a match in the target file based on the assigned customer number then the Update command is applied. If it is a new code then an Insert is processed adding the new entry to the Customers table. The command works in a kind of batch mode instead of a line by line process that an alternative would do using say SELECT statements, i.e. the way I used to do it.

If the Insert statement say adds a incrementing ID and you want to see them then adding:

OUTPUT action$, deleted.*, inserted.* will list the action (update, insert) along with the before and after fields for each record. Unlike other examples of the OUTPUT command you can have it provide fields from the tables.

Imagine the above command surrounded by brackets as a sub-select and an INSERT added outside based on some conditions to say implement versioning or an audit trail of the MERGE results. It gets quite powerful and is more efficient than other options.

The lesson I took away is that the SQL Microsoft team is adding new functionality at the SQL level in every new version and it is worth spending some time to learn what the new functionality gives or saves the programmer.

Industry News

It’s semi-official, Windows 8 will be signed off on by Microsoft and released to OEMs in June with an expected public launch in either September or October. Windows chief Steven Sinofsky made the announcement at Windows 8 Dev Days in Japan. Tweets promptly followed. This release is normally called the Windows release to manufacturing (RTM) code and signifies the ‘final’ version but now known as now a "release preview". Microsoft loves changing the names of things to keep the punters guessing. Of course by not calling it the RTM then they technically have the option to delay the final release if there are too many bugs found by the gamma testing done by the PC manufacturers.

Apple’s shiny new tablets are made in China. The reason for this may seem obvious, cheap labour and no safety or worker concerns. There is however an even better reason, rare earths. China has implemented a set of new policies on the export of rare earth minerals, vital for new electronics devices from phones to tablets. China has an apparent monopoly on rare earths at the moment. Apple’s devices need them so the company is now essentially trapped in China for manufacturing.

Apple is not telling but experts suggest they need lanthanum for the lithium-ion polymer battery. Neodymium alloy for magnets and a number of other rare earths to make the wide range of display colours. SO making them in China means access to the materials and a nice cut in costs. Until there are viable alternatives China is king.

Finally some nanotechnology I can get behind. Scientists in University of California and in Taiwan are suggesting that nanosized CMOS memory based on nanodots are not that far away. The dots work at 10 to 100 times faster than current RAM and use current technology compatible manufacturing techniques.

One of the more interesting mathematical problems is how to generate random numbers. To date there has not really been a true random number generator. Enter the real of the quantum level. Take a laser and find a way to measure the fluctuations in the vacuum field contained in the radio-frequency sidebands. Or put another way find a way to take readings of the vacuum fluctuations at the quantum level. Then turn these into a series of random numbers. Next post a real time feed on a site, http://150.203.48.55/index.php#. All this from the Australian National University. Who knew that they could actually do real science there? The data stream is robust, immune to environmental fluctuations, and they can support up to 2 Gbps of real time random number generation. Pretty cool actually.

Tuesday, April 17, 2012

Blog Currents – 2012, Apr 17

I created my first virtual machine this week. No I didn’t use the Windows version, nor did I use VM Ware. A friend put me onto Oracle VM Virtualbox. He’d spent some time testing the various products and told me that not only was this one freeware but also had one of the lowest signatures or impact on the host operating system. Or put more simply sucked less resources. Oracle VM Virtualbox is available here: http://www.oracle.com/technetwork/server-storage/virtualbox/downloads/index.html. The first thing you should notice is the large, no huge number of operating systems supported. Just about every Linux version is supported in addition to Mac OS X and of course Windows.

I installed under Windows 7 and when it had finished I had the option of building an instance from Win 3.1 to Windows 8 with everything in between. Before you get too excited you will of course need the original operating system install disks or the nearest equivalent. I had an XP SP2 version I had on my old computer so I selected XP and ran through the installation process. Since it was XP about 30 minutes later I had a basic XP instance running in a window on my Windows 7 desktop. 

For those that have done this before this is hardly news but it now allows me to use my old scanner that does not have any drivers for Windows 7, Epson, because the instance has full access to any devices connected to my computer, Epson, thus allowing me to reuse my perfectly functional but perhaps deliberately made obsolete scanner from, yes you guessed it Epson.

I was reminded this week how users can come up with some very creative ways to test applications. They have the ability to think up test scenarios that are quite different than the normal processing options. Remember that there is a limit to just how far off normal you should try and support. There is a point of diminishing returns that when reached should not be crossed.

There is a Java based lawsuit going on at the moment between Oracle and Google. New lawsuit, big deal you may say but there are ramifications. If Oracle wins, and particularly in the US environment, the logical extension is that software interfaces and computer languages could fall under copywrong protection. Imagine the cost of development applications if the underlying languages fall under copyright.

Until now only the source code is subject to copyright but not the underlying language and interface. There are treaties and everything. There are also legal decisions (Advocate General Yves Bot - European Court of Justice) that have conformed this e.g. that the functionalities of a program, and the programming language, cannot be protected by copyright. He also said that the source code of a program "may be reproduced in order to ensure interoperability with another program", but only if "certain conditions are met". Fairly clear and not coincidentally forms part of Google’s defence.

The court case is based on Oracle’s claim that Google is infringing copyright by embedding Java into its Android platform. Oracle also suggests that there’s no clear precedent to exclude computer languages from copyright. Oracle argues a lot of other things including using Tolkein’s Elvish language as an example. I started to get a bit fuzzy at that point because their logic stopped making any real sense.

Google’s example made a bit more sense to me. According to the US's Copyright Act of 1976 an “idea, procedure, process, system, method of operation, concept, principle, or discovery” is not copyrightable, even if it is in an "original work of authorship". A language is something that is used to express a thought, an idea, and application, and so on. Stay with me.

Say someone built a set of APIs that looked like Oracles but did not return the same results. Instead they always returned -1, for everything. They may have the same structure, selection and organization as the Oracle APIs but they would hardly be expressing the combination as Oracle’s product. Oracle’s argument is that the structure alone is enough to provide infringement. If Oracle wins then if someone comes out with a system then copyright will be allowed on the descriptions and implementations of the system (APIs and expressions) enough to stop others from using the same system.

When Java belonged to Sun they didn’t have an issue with Java implementations that did not threaten Sun. The copyrighting process allows for the ignoring of trivial infringements. If Oracle wins then this flexibility vanishes. Of course Google should have licensed Java when they used it and there would have been no issue. Or Google could develop their own language and virtual machine. Since they decided to take the easy, and not quite so legal, approach the losses could be, well everyone. If the copyright system is expanded by this case it will end up in places it really has no right to be in.

Industry News

So Windows 8 will be coming out in three versions. There will be 32 and 64-bit versions of both Windows 8 and Windows 8 Pro. Yes, boring. There will also be Windows 8 RT a.k.a. Windows on ARM or WOA. I’ve mentioned this version before. It will come preinstalled on ARM based tablets and PCs with touch screens. No idea on why it’s called RT, but people are guessing things like “real time” and “run time.”

RT will come with touch optimised versions of the new Microsoft Word, Excel, PowerPoint, and OneNote. It will also form the basis of “a new generation of cloud-enabled, touch-enabled, web-connected apps of all kinds.” If it fails I can think if a few other options for what RT might stand for.

So everyone uses the Internet these days right? We would expect a super user country like the US should be right up there in the high 90’s. Nope according to a recent Pew and American Life survey about twenty per cent of Americans don’t use the Internet and don’t want to. Since 1995 Internet usage is up ten per cent from about 78 per cent. This indicates not only a very mature marketplace but also that the remainder are highly unlikely to move, that is at least until they are replaced by a newer generation.

About half of the remainder do not see any relevance in the Internet. Of the rest some find it still too expensive, six per cent are too remote for access and a couple of per cent cannot use it due to physical limitations. The demographic breakdown is not surprising. People earning under $30K, the elderly, those who didn’t finish high school and non-English speakers. Now for the surprise this same group led the way in those who access the Internet with their phone instead of a computer.

Interestingly about 88 per cent of Americans own a mobile phone, 56 per cent own a lap top, 19 per cent own an e-Book reader.

Tuesday, April 10, 2012

Blog Currents – 2012, 11 Apr

It has been a quiet week computer wise. I gave up on Dragon Age 2 and started Fallout 3 which is made by the same people who did The Elder Scrolls. Basic story line is that in 1950 everyone went into bunkers due to a nuclear war with China and this is some time later when the landscape is post-apocalyptic. Not many colours, everything is brown or grey but there are some cool weapons. Decent sized worlds and some interesting add-on packs.

Some readers will recognise this title as being over three years old. Yes. I currently live in Australia where computer games are the most expensive in the world. We pay on average three times the price in the US most recent games cost $90 here and remember the A$ is stronger than the US$ at the moment. Three year old games are almost ancient and as a direct consequence a lot less expensive, i.e. in the US these are disposal bin prices by here in Oz still closer to $40, i.e. still more expensive that when it came out in the US. To be fair it was banned for a while but the prices are just plain stupid here.

I guess most of you saw the story about the Chinese student, last name Wang, who sold a kidney so he could get an iPhone and an iPad. The kidney fetched a bit under $34,000 of which Wang received a tenth. He is now suffering from renal failure that could be fatal. I guess some Apple lovers will do anything to get the latest products. The iPhone, compared to alternatives, is just not that good.

The iPad 3 is not doing so well in the forums. The main claim is that the 3G and 4G connectivity doesn’t work properly. There is a mountain of complaints from Apple lovers, from all over the world. The second problem is the responses from Apple e.g. “Just avoid using it or holding that way” and “It's normal” according to the posters at least. This reminds me of the iPhone antenna issues.

According to the Russian anti-virus firm Dr Web a Mac-specific Flashback Trojan created a zombie army of 550,000 Mac machines by exploiting a Java hole that Apple. This was finally patched six weeks after Microsoft had fixed it for Windows based machines. The infected machines were mostly in the US, Canada and the UK. This says something about the demographics that make up Apple Mac owners and their belief that no virus can ever infect a Mac.  

Other Industry News

It is official support for Windows XP will end in two years on April 8th, 2014. It first shipped to users, well OEMs, on August 24th, with real users getting it on October 25th. Gartner estimates it ran on 144 million machines as of July 2011. In a later survey, March 2012, they found that 79% of business desktops and 45% of notebooks ran XP. Gartner recommends upgrading ASAP but if it is still working so well how many people really contact Microsoft with problems? I thought so, no need to rush then.

Sony has not been doing so well in recent years and it may have never really recovered from strange decisions like removing MP3 as a supported format earlier in the Millennium. The forecasted loss in 2001 for example was recently doubled. No not because someone forgot to carry a one but because they had more taxes to pay than anticipated. The culprit here was their US concerns; it seems that the US has been putting up taxes, probably to cover their 15 trillion of debt.

This will make it four years in a row with a loss. I have an idea Sony how about bringing out a Media box like those from A.C. Ryan but with better features and no copyright controls built in. It would be an Instant best seller. My predicted change of this happening 0%. Of course having someone from the US leading their organisation for a couple of years was probably not a very smart thing to do either. Looks like about 10K workers will be losing their jobs within Sony as well.

I saw this headline recently “Toshiba's NPEngine hardware directly streams video from SSDs to IP networks without using host server CPU cycles or memory.” My response was a very big yawn as anyone else familiar with the Commodore Amiga will understand. About three decades ago Commodore brought out a new computer that had a dedicated chip for graphics and I watched a demo of a panther walking back and forwards across the screen. The CPU usage counter showed zero as well. At the time it was a very cool demonstration. Since then no one else has had the guts to come out with a similar product hence my yawn at the Toshiba announcement.

In related and sad news the founder of Commodore, Jacek Trzmiel, has died at the age of 83. This guy spent time in Auschwitz concentration camp during WW2 and after being rescued by the US Army moved to the US and started up Commodore Business Machines, selling typewriters. From here it went to calculators, its own chip making business (MOS). Turning down an offer to build the Apple II they came out with the Commodore PET in 1977. This had a whopping 1 MHz processor and your choice of 4 or 8 KB of RAM. It used a cassette player to load programs with disks coming later. One of the best sellers was the Commodore 64.

That report about Iran cutting off the Internet in August? It was an April Fool’s day story.

According to Gartner India is starting to soak up the world’s chip supply. The biggest driver is mobile phones followed by LCD TVs and the PC manufacturing industry. As the Indian middle class grows so do the sales to the tune of $9.2 B out of the world’s $313 B. Manufacturers are also starting to expand production facilities in India to soak up the low paid but better educated worker that the alternatives. OK obviously I mean China here. The other big users are Brazil and China. At the current rate of growth India will pass the UK, currently in third place, sometime during this year.

Amazon’s Simple Storage Service (S3), the object storage companion to the Elastic Compute Cloud (EC2) compute cloud currently holds around 905 billion objects and processing requests at 650,000 requests per second.

So did you feel that? Every minute or so a WIMP (Weakly Interacting Massive Particles) hits you. Well according to a recent paper titled Dark Matter collisions with the Human Body. WIMPS are one candidate for Dark Matter and they are “electrically neutral and do not participate in strong interactions, yet have weak inter-actions with ordinary matter.”

Tuesday, April 3, 2012

Blog Currents – 2012, Apr 4

It is interesting to see how different organisations respond to new technology. Some eagerly adopt the latest and greatest releases and ironically advertise for people with experience, sometime far beyond the times since the release date. If you ever see such a requirement don’t do business with that organisation it could be a fastest way to lose your time and money and it indicates that management are basically clueless.

Bleeding edge technology is fine for the development teams to play with but rarely smart for your productions systems. As a general rule of thumb for Microsoft products wait until the first service pack or 12-18 months before upgrading and adopting the newest Office, operating system or database technologies. They may work fine and then again they may not. There other common problem is lack of support by your third party vendors. Some still run only on SQL Server 2000 for example, yes even in 2012 some vendors have yet to move. If this is the case it may be time to switch vendors and move to another compatible application. In March 2013 Microsoft will cease all support for 2000 so if you haven’t planned for the move, and some need 12 months for this kind of thing, then if it goes bad you only have yourself to blame, or your management.

I finally got sick of Dragon Age 2 not enough playing and too many cut scenes. So I fired up Fallout 3. Have not started playing it yet but I hear and read good things.

Industry News

Running out of space in your organisation? Hitachi has a new hard drive for you. They already have a 4TB drive but the new one is enterprise ready the Thunderbolt. It has 5 platters and spins at 7200 rpm. Supports SATA 6GB (as it should) and has 64MB of cache. The data transfer rate is speced at 171 MB/s. This gives Hitachi a brief jump on the competition who are left back at the 3TB mark. Expect Seagate and Western Digital to respond soon but don’t hold your breath on Toshiba and Samsung, they are still back in 2TB territory. The Hitachi uses less power and has 5 power management modes using less than a watt in sleep and standby.

It has been long enough since I bought my new PC that the following news doesn’t surprise me. Intel has a new budget 330-series solid-state drive (SSD) coming out on Friday, 13 April. The new units run at about double the performance. The SATA 3 devices will come in 60GB, 120GB and 180GB and clock up to 500MB/s on sequential reads and 450MB/s on sequential writes. Or in layman’s terms damn fast. The highest capacity will sell for around $240 in the US. At this price I expect to see a lot of these babies move and will make a nice new C: drive for a lot of people in the near future.

“There is an app for that!” This used to be said with a little humour but these days there really seems to be an app for everyone and if you have an Android phone then there is probably a free version. I downloaded angry birds space a couple of days ago for free. If you own an iPhone that will be a small charge please. I still surprised when I see people with an iPhone especially if they just bought one. There are simply no advantages compared to say the Samsung Galaxy S2. I just grabbed a push up app that detects your head either using the proximity sensor or when you touch your nose to the screen. The app claims to have me doing 100 push-ups in the near future, we’ll see 

Technical Stuff

With my DBA stint coming to an end I di d find out a few interesting tricks. First off if you have SQLServer 2008 Enterprise or SQLServer 2008 R8 Standard or better then you have access to a compression option when making a backup. Now you may think that compressing a database would take extra time and then on the other side when you are restoring but some testing I did turned up different results.

I started with a 42 GB database backup, yes that is quite large and the backup is always a little smaller than the main data MDF file. I created a Database backup Maintenance plan and set the compression option to compress. The following morning I had a 5 GB file (did I mention this was in a production environment?) The older backup job took 14 minutes and the new one 12. So step one saved time and a whole lot of space.

Since the database concerned was also being copied to three others servers one of which was a disaster recovery server offsite the transfer time was significantly reduced, quite a lot given the reduction in size. Performing a test restore on the disaster recovery box I found the restore time shortened by about a half, 8 minutes compared with a bit over 15 minutes for the restore.

So my conclusion is to use compression in any environment where space is an issue and where you are copying the backups to other servers. I had expected to have some disadvantage somewhere in the process but for the testing I did the results were good at every stage of the process.

The other little tit bit I’d like to pass along is the process of replacing one server with and upgraded one. In the production world this is a common one. You decide the Prod1 has outlived its maintenance life and you want to upgrade your SQL Server version at the same time.

The normal process is to set up a new server box, say Prod1New and do some installation and testing to make sure the new configuration works perfectly. At some predetermined time you retire Prod1 by taking it offline or renaming the server and then change the new box’s name to Prod1 so that all the external networking links are happily preserved. This would be such a common practice that you also expect that Microsoft has this process in mind and has a nice set of procedures for performing this task. You would be wrong.

The recommended process is to rename the server and reboot. Then rename the SQL Server instance using a couple of sp_ SQL procedures and reboot again. The problem is that you lose your maintenance plans and access to your user databases.

The latter part is fairly easy, you copy across the MDF and LDF files and attach them or you make sure you have a very recent backup and restore it. The maintenance plans you can get back by restoring msdb from the original system. You will also need to redo some permissions on the logins. This will leave a few bits and pieces of the original SQL Server and MS Server instance names sitting in a few places but the result is workable. If you really want to be sure uninstall SQL Server after the Server name change and reinstall it then copy across and restore your user databases and the msdb. You can look up how to restore msdb because is it not a simple as a user database.