Wednesday, December 11, 2013

All the world's problems are solved

All the world's problems will be solved, if only people do only the things they are qualified to do.

In any area of interaction, one of the most frustrating experiences is when you encounter some idiot in a position of authority or power.  It is an unmovable roadblock.

Friday, August 2, 2013

What is the Easiest way to copy a database to/from SQL Azure?

The answer: use SQL Server 2012

Moving a SQL database to and from your PC to SQL Azure used to be a horrendous nightmare.  With the new functionality in SQL Server 2012 and the Azure portal, this is now a breeze with just a few clicks.  You are not required to learn or understand data-tier applications or BACPAC, the underlying method used in the import/export.

This article assumes you already have an Azure subscription up and running.

The functionality in SQL Server is actually the SQL Server Data Tools. However, it is totally invisible once it is installed. Download it here.

Deploying An On-Premise SQL Database to SQL Azure 


Let's start with moving a database from your PC to Azure.

First of all, your on-premise database can use only those features supported by SQL Azure.

To deploy a database in SQL Server 2012 is pretty easy and fast.  In SSMS Object Explorer, right click your database and select Deploy Database to Sql Azure... under Tasks:

Figure 1 - Deploy to SQL Azure

After skipping the first page of the deployment wizard, you come to Deployment Settings.  Click Connect... and you will see the standard SSMS database Connect to Server dialog.  Enter your Azure SQL Server name (somedatabaseserver.database.windows.net), the Login has to be master, and the New database name has to be a new database on your Azure server.

Figure 2 Connect to SQL Azure

Next, very importantly, you must go to the Connection Properties tab and ensure that the database connected to is MASTER.  If you have been using your SSMS to connect to other databases on the Azure server, this setting might have defaulted to something else.

Figure 3 Must connect to MASTER database

Unless you are a totally newbie using SQL Azure, you would already have configured your Azure firewall to allow connections from your PC's IP address.  If you don't know what this is, read this.

After connecting, the wizard then does everything for you, and gives you the typical SSMS report card on the successful (and failed) steps that have taken place.

Storage Account/Container


Copying a SQL Azure database to your PC requires you to first export the database to a location your PC can access.  This holding area used is Azure Storage, another of the growing list of Azure services.  If you are already familiar with Azure Storage, you can skip this section.

In the Azure Management Portal, click STORAGE on the left menu.

Figure 4 Azure Storage

If you don't have an existing Storage account, you have to click CREATE STORAGE ACCOUNT next. You have to supply a globally unique Url to identify your Storage account.

Figure 5 - Create a new Storage account
Azure Storage uses this organization hierarchy:
  1. An Azure subscription can have 0 or more Storage accounts.
  2. A Storage account can contain 0 or more Containers.
  3. A Container holds files.
With a Storage account, you can now select it and create a Container (if you don't already have one) to hold your SQL files needed for the transfer.  The Azure Portal provides intuitive menus and options for you to create your container.  You should use a Container that is located in the same data center as your SQL Azure database to avoid clocking traffic.

While at the portal in the Storage section, click Manage Access Keys at the bottom and copy the PRIMARY KEY.  Your local SQL Server will need this later to access the Storage container.

Figure 6 - Storage Account Keys

Copying a SQL Azure Database to Your PC


First you have to Export your database to a Storage Container.  The Container can be in any Storage Account of any subscription of which you are the administrator.

From the Azure Portal with your database in focus, click Export at the bottom of the screen.
Figure 7 Exporting a SQL Azure Database

Remember the bacpac file name to which you have exported.

Now, go to your PC's SSMS Object Explorer, and in the destination server's Databases node, right click and select Import Data-tier Application....

After the wizard introduction page, in the Import Settings dialog, select Import from Windows Azure and click Connect...
Figure 8 Importing a SQL Azure Database

If you paste in the correct Storage Account key (see previous section), you will be able to connect and select the Storage Container and the exported bacpac file by selecting from the drop down lists.

The wizard will then step you through to import the database into your on-premise SQL Server.

It's that easy!

Sunday, July 28, 2013

The Foundation of Science

The foundation of all science can be attributed to the assurance of things hoped for, the evidence of things not seen.

"The assurance of things hoped for", to borrow J MacArthur's explanation, is simply believing that God will do what He promised He would do. Exactly, 100%, totally consistent, no exceptions. In this regard, atheists put the majority of Christians to shame.

Followers of the Newtonian persuasion have an unshakable faith that F=ma holds true in the past, now, in the future, here, on the moon, and at some point a trillion trillion miles away. It explains the exact trajectory of a feather floating in the wind, or a billion-ton galactic object speeding at a 1,000 miles a second.

Based on this blind belief, we commoners dare to board a plane, take a train, cross a bridge, enter a building, or lean against a wall, knowing that we will not be harmed. With the same faith that this portion of God's law will still hold true 200,000 miles away, we put two man in a tin can hurtling at 17,000 mph into the moon's atmosphere, applying additional calculations based on that same belief to slow it bit by bit to land at 5 feet per second. No one doubted for a moment that F=ma wouldn't work on the moon.

(If an accident happens, it is not because of some fault or misunderstanding of F=ma. It is because of some unexpected and unaccounted for new event. Accidents can only happen precisely because of the unwavering belief in F=ma.)

This faithful assurance is not based on speculative conjecture. It is based on the solid evidence of things not seen. No one has seen gravity, no one has seen mass, no one has seen energy. But through indirect observation, scientists gathered plenty of evidence of things not seen to verify their hypotheses, so much so that you and I willingly stake our lives on the presumption that the evidence holds true.

We were not born with this in-built faith. I am absolutely certain Noah wouldn't dare step across the Golden Gate Bridge. Moses wouldn't walk into a one-story building. They didn't know much about F=ma.

I am highlighting that science is faith-based not to belittle science but to celebrate it.

Every time I read or learn about how something was discovered or invented, I am simply floored by the genius of those scientists and inventors. Bohr could derive the atomic structure without the remotest visibility of what he was postulating. The inventors of the transistor could figure out exactly how electrons move in doped germanium without the opportunity ever to see electrons. Others can concoct a viral antidote to save your life without the benefit of first seeing the virus. Higgs cooked up his boson entirely from the evidence of things not seen.

From this point forward, I will not call the systematic way scientific discoveries are made scientific methods. It is just common sense that appeals to intuition.

We owed the comfort of our earthly existence today to the many talented human beings who put pure blind faith in the assurance of things hoped for and the evidence of things not seen. Apart from their exceptional brilliance, they applied common sense.

Next: Scientific theories

Monday, May 20, 2013

Revenge of the Koel

Last week, we discovered a nest being constructed by a bulbul. It was located among some creepers just under the roof of the porch.

Nest when about half done.  See the yellow-vented bulbul?

The construction work was done solely by the female bulbul.  The male partner kept a distance, providing some form of air cover.  Hundreds of trips were made, each time with a little material.
Bulbul struggling with the construction material.  It took many attempts for it to get this piece of tissue off the barbed wire.

When about half done, the bulbuls caught the attention of a female koel.  This was about ten times the size of the bulbul.
Female koel gazed fixed at the bulbul's nest

And tagging along as consort was a male koel.  One day, I found the male koel pecking an object on the ground.  On closer look, it was an egg.  But it must belong to some other bird, perhaps a kingfisher, as the bulbul hadn't laid any yet.  And the egg was relatively large.
Do red eyes and evil go together?

The male koel came often.  Then I realized that it was searching but still failing to locate the nest.  The nest was an engineering marvel, done with no hands.  It was well hidden, and camouflaged.
Look ma, no hands!

The male koel came again.  This time I was prepared.  I had some stones on the ready.  The koel was in the middle of a bush.  I took a stone, aimed, and hurled it into the bush.  The stone cut through the leaves and branches and, by the determinate counsel and foreknowledge of God, made impact.  The bird dropped to the ground, grimaced for three seconds, curled up and lay still.
Dead!

I went indoors and pondered over dinner plans or burial rites.  After a few minutes, I came out and saw this:
Resurrection or reincarnation?

From then on, the bird took on a new demeanor.  It didn't fly away when approached.  It stood its ground.  In the evening, it came back.  When I went up to it, it didn't budge.  I went to take the camera and we faced off nose-to-nose in the twilight:

I had a broom stick half an inch away from it.  I was hesitating whether to invoke Gen 1:26, and in the end let it go.

However, it was plotting its revenge.  A couple of days later, when no one was at home for just one hour, the bulbul's nest was completely destroyed.

A day later, the male bulbul came back and cried:


[If viewing on full-size computer screen, you can click on pictures to see original details.]

Monday, April 15, 2013

"Messier" Marathon

[For a chronicled metamorphosis of the Painted Jezebel, see here.]

There is this crazy event where astronomy enthusiasts attempt to spot all 110 Messier objects in one night.

I can see about ten different types of butterflies flying around at the same time where I live.  I thought it would be interesting if all ten could be photographed in one day.  It looks impossible, especially with a cheap lousy camera, and the butterflies in constant motion, stopping for rarely a second each time.

So what you see here is just a lazy attempt over different days.  The only criteria is that I have to be no more than 30 feet from the external walls of my apartment.  All pictures taken at 3 Mpixels or less and not touched up.

If you know the names of any of these creatures do share the information.  Current ones identified with help from Commander, Raj and Simon.  Thanks.

#1 Leopard Lacewing (Cethosia cyane)

#2 Blue Pansy (Junonia orithya)

#3 Common Mime (Chilasa clytia)

#4 Lime Butterfly (Papilio demoleus)

#5 Common Tiger (Danaus genutia)

#6 Common Palmfly (Elymnias hypermnestra)

#7 Painted Jezebel (Delias hyparete)
#8 Common Grass Yellow (Eurema hecabe)
#9 ???
#10 Cycad Blue, Plains Cupid (Chilades pandava pandava)
#11 Striped Albatross (Appias libythea olferna)

#12 ??
#13 ???

#14 ? some swallow tail??


Monday, April 1, 2013

Missing second half phrases

Talking about quoting out of context, you don't have to do that. Just omit the second half of a verse and the meaning can be quite different. Here are some:

1. Let my people go, [click to unhide...]
Exo 7:16, Exo 8:1, Exo 8:8, Exo 9:1, Exo 9:13, Exo 10:3


2. And we know that all things work together for good to them that love God, [click to unhide...]
Rom 8:28




Sunday, February 3, 2013

Democracies

Coming from an uneducated person, but who is trying hard to be aware of some of the things I do not know, I think the whole idea of democracies has not run its full course. More surprises are in the offing.

At this time, it seems that all democracies will mature toward an equilibrium of two halves of the governed in the ratio of about 50:50.  The US appears to be in the lead.

Come to think of it, that is only the nature of man.  Who would want to be disadvantaged so that someone else can take the advantage?

This inward instinct is different from the rich paying more taxes.  The rich do not mind paying more taxes for a selfish reason: so that the system around them do not collapse and deny them the safe environment to spend their wealth.

It is a different thing altogether if, in order to preserve a happy orderly society, you are asked to surrender your right to own a car so that someone else might own a car, for example.

The fairest and best is still a democracy.  Let me know if you have found something better.

Monday, January 7, 2013

Pointing your own domain name to a (Blogger) blogspot.com site

Google's instructions on this subject are terribly misleading, and in an attempt to make them comprehensible to the layman make them worse.

Look at this screen shot by Google when you ask for instructions to set up spqr.mydomain.com to point to your own blogspot site:



It's incorrect. www.example.com is NOT a top-level domain. www.example.com is no different from foo.example.com as far as "levels" are concerned.

90% of the world have the impression that www is something special. "www.abc.com" (it should be "www.abc.com.") is a domain, just like "abc.com", or "com". Many people have difficulty understanding this, but that's how the Internet domain name system is defined, and works.  Do invest a minute to let this sink in.

The next error: you cannot add two CNAME records to a domain and still be meaningful.  A CNAME record is, like 99.99% of the time, used to create an alias for a domain name.  When we say, lazily, "add a CNAME record for abc.com and point it to def.net", we mean create an alias for abc.com that resolves to the canonical name def.net.  In other words, when someone requests for the IP address of abc.com, he is redirected to def.net instead.  He will then have to continue his query to find out the IP address of def.net.

After some testing, this is what I discovered.  If you want your domain spqr.mydomain.com to point to xyz.blogspot.com,what Google needs is as follows:

Go to the Settings page, Publishing, Switch to Advanced settings and enter spqr.mydomain.com in the http box.
Click Save and you will be given the name of two CNAME records that you must create.  The two CNAME records are (based on the example in the screenshot):


(Note: you must have the ability to create the domain Z3O5FRCOSL73.spqr.com.)


Alias spqr.com to the CNAME ghs.google.com
Alias Z3O5FRCOSL73.spqr.com to the CNAME gv-D5HHKMK....thatverylong name.domainverify.googlehosted.com.

If you must have www to cater to people who like to type another four characters to reach a web site, then alias www.spqr.mydomain.com to spqr.mydomain.com, ie add a CNAME record to www.spqr.mydomain.com.

If your domain registrar allows very long names, then your job is done.  Mine, 1and1.com, spits out that second entry.  I don't know why Google has to make it so long.  A GUID is only 30+ characters.  So I have to resort to another name server, like ClouDNS.net, to solve my problem.  You have to basically set the name servers for your domain name to the third party provider instead.  Detailed instructions for an 1and1 example can be found here.

A word of caution to those who are trying out a sub-domain of a domain name they already own and whose registrar cannot take long names.  For example spqr.mydomain.com is already your active name used by web site and email, and you want to use xyz.spqr.mydomain.com to point to a site in blogger.com.  If you change the name servers for spqr.mydomain.com to ClouDNS.net in order to add the aliases for xyz.spqr.mydomain.com and ZZZZZZ.spqr.mydomain.com, you will have to duplicate all your current DNS entries at ClouDNS.net.  Not a wise or productive task to do.

In this latest scenario, you should point www.xyz.spqr.mydomain.com instead to Blogger.