Wednesday, April 15, 2015

My Quest for the perfect (windows) clone and backup solution!

> = <

With 2015 (almost) halfway gone, can you imagine my pain when I am simply looking for a solution to -

1. Create a [LIVE!] clone of my Laptop’s 500GB HDD and
2. Let me update it on schedule…

and able to find none… yes…NONE AT ALL!

I just want something to -

1. Provide me a fool-proof backup strategy AS WELL AS HELPS

2. In advent of any catastrophic failure in my current HDD or similar situation, to just pop the faulty bugger out and replace with the last backup; and pronto! loads up the Windows O.S. … again!

WTF Microsoft!!

Is it that difficult?? In 2015? A job which Carbon Copy Cloner has been doing for more than a couple of years (sadly Mac only, sigh!)?

I mean, Seriously? Come on!

So my friends and fellow nerds out there… Anyone has any Ideas?

Please share.

Note: I will surely update this IFF I find a viable solution. I know about the options available (almost all provide live clone, but none does the backups on schedule), so I need something which works as I want it to!

Update#1: I found this - https://www.fssdev.com/products/casper/
Let’s try and check shall we, I will updtae here for more findings.?

Tuesday, March 10, 2015

How To: Perform an unattended MySQL DB dump restore

MySQL_database

Say you have the following setup -

  1. A MySQL DB on which you have to restore a previously taken DB DUMP;
  2. A *INX based O.S. / Server (could be RHEL etc.)
  3. An SSH connection / session to the same

In a normal scenario, you either access your DB via a DB client (like SQLYog) or via a remote SSH (using putty).

When you need to restore a DB DUMP on an existing DB instance, you use the mysql command as -

[ssh@xyz]# mysql mydb < /dbdumps/mydb_dump.sql

This will start the restore process. For a small DB this should be done quickly. But considering a realistic live scenario with your DB in GBs of data, you will need at least upwards of 30 minutes.

Now what if you need to disconnect your SSH for any reason? Maybe step out for a meeting, or pack-up your rig for your drive home?

The reason may be anything but the considering the fact that the restore process is launched specifically under the SSH shell process, if the SSH disconnects during the restore, it would kill the restore too.

So the only logical choice is to leave the terminal open until the dump is completely restored, with the normal termination of the process.

Here-in comes the nohup.

Quoting from Wikipedia,

Nohup is a Unix command, used to start another program, in such a way that it does not terminate when the parent process is terminated. This is accomplished by ignoring the signal 'SIGHUP'. This is what distinguishes nohup from simply running the command in the background with '&'.

So in essence, the nohup allows the restore process to continue running even if the remote SSH session is terminated when the SSH client disconnects.

Also, since we may want to use the SSH session after the process to restore is started (via nohup), we use the nohup in conjunction with the ‘&’ command.

The ampersand as a suffix ensures the command is started as a background daemon (under the system process). It will leave the command line and proceed to run in the background.

The entire goal above is thus achieved via the following command -

[ssh@xyz]# nohup mysql mydb < /dbdumps/mydb_dump.sql &

Running this gives you the below as a feedback result on prompt -

[1] 5624
[ssh@xyz]# nohup: appending output to `nohup.out'

Let’s decrypt the above.

Meet the Process-id - 5624

Any process running on a Unix system is always having a PID or a process-id. This is a unique identifiable unit with which a process is associated and can be manipulated.

For example, the kill command (which is used to terminate a process) uses the following format -

$ kill <process_id>

Thus the process id for the background is printed for convenience.

The nohup.out file

Also, as it is a background process, the standard I/O is not used for any prompts or error communication, Instead the same is redirected to the nohup.out file, created at the location where the process is launched (this can be located by the $ pwd – which will give the present working directory)

Status of nohup

All this is good, now that the restore is running merrily in the background.

But how to know if and when this completes? How to know the status?

The answer is using $ jobs.

[ssh@xyz]# jobs
[1]+  Running nohup mysql mydb < /dbdumps/mydb_dump.sql &

So the current process is shows to be still running. If it would have completed, the status is changed from Running to Done.

That’s it! Hope it helps someone out there!

Let me know your comments and suggestion too.

Note: I will be covering the DB DUMP command later in detail, with its usage in conjunction with the CRON scheduler script.

Technorati Tags: ,,,,,,,

Sunday, March 8, 2015

To help save a life…

image

(The below post is replicated in entirety from my Facebook page dated February 28. It is an actual incident.)

Something happened today evening on my way back from the office. An accident.

Not mine. A random guy on his bike. Going back home like everyone else.

This happened around 8:00 PM on the Noida extension route, just 200 meters before the Gaur roundabout.

The guy (whom I don’t want to disclose) going back home in Crossings Republic from his IT firm, was driving fine but unluckily could not see and slow down in time for the dirt rubble on the road (probably left behind by one of the many callous trucks and tractors which ply on that route).

End result a bad skid, hit with the pavement and countless injuries. By the time I stopped and reached him, he was lying all covered in blood, with tattered clothes and desperate cries of pain.

Lots of people stopped to help, some to watch but many slowed down, looked but chose to drive off.

Back to their destination, their homes and back to their comfortable lives.

Do you know how real blood looks on the asphalt? It's so red; bloody frightening red. And it was everywhere.

I was there with the others. We helped lift him up and got him in a car for the nearest hospital (bless that driver for having the sense of responsibility and courage).

The bike was a wreck. Me and another random guy (who was on his bike) stayed behind and waited for the cops to turn up. Someone had taken the onus to inform them down the road so that they could come and take care of the vehicle.

So we waited to hand over the same to the cops, who as expected, didn't turn up. In the end, we had to park his bike on the roadside and decided to hand the keys over to the guy himself (whom we expected to have reached the hospital by that time).

This way, we hoped to check on the guy's well-being too. Reaching the nursing home, we found him all clothes torn, swollen up and unable to speak (due to the bandages around his face) and nursing some broken bones. but he was able to identify and acknowledge us.

It seems he would survive an recover, thankfully.

I just reached home a few minutes back. And all along the way back I had but only one thought.

How sudden and unpredictable life is.. and how much dependent we all are for our survival on the virtues of our society, on the mood and courage of our fellow beings!

An incident like this puts many things in perspective. Seeing what is known to all, and happens time and again, I wondered why people don’t have the courage and the heart to stop and help someone in need?

And what was most disheartening was that many of those who moved on, they were those my age, the youth!

We, the ones, who on one hand are responsible for changing conventional mind-sets of our society, who bring in waves of change in politics and what not; and on the other, we still follow the pretend play of closing our eyes and moving on! Such double standards, I ask?

I have never stepped back from my social responsibility and will continue to do so till I can, but will someone stop by for me in my time of need?

With so many instances all around us daily, I cannot help but think that if even 20 people stop to help someone in need daily, 20 lives can be saved in a day!

Think about them, those who can be helped, their families, their future, their lives which would follow thereafter!

I have nothing more to say but this, only if I have the courage today to be selfless, to stop and save someone in need, will someone tomorrow do the same for me.

Think about it.
(sorry for the long rant, but I had to do it)
-----------------------------------------------------------------------------------------------------------------

Friday, December 5, 2014

The Cause and effect of Google’s driverless cars.

image

In case you haven’t been living under a rock, you must be aware of the Google’s Self-Driving Cars.

What was a starter project by Google for developing autonomous cars, the concept is now beyond the experimental stages and nearing its implementation.

In the US, these "self-driving” cars were first introduced in Nevada followed by Florida, the second state to allow autonomous cars on state roads, followed up by California.

Now UK is planning to allow driverless cars on public roads from 2015.

So all this seems like a pretty cool implementation of technology which is even publically accessible! But what are the effects of this cause?

‘Effects’ you may ask? Yes, there are effects here too.

Since safety is a prime focus and problem area these cars are aimed to tackle, there is the statistics of low mortality which will slowly be prevalent.

The MakerBot founder Bre Pettis said in his recent interview with Fortune, that

“…the take off of self-driving cars could lead us to more organ shortages than ever, since a major source of organ donations come from car accident victims.

We have this huge problem that we sort of don't talk about, that people die all the time from car accidents, Right now, our best supply of organs comes from car accidents. So, if you need an organ you just wait for somebody to have an accident, and then you get their organ and you're better."

Sounds gross? Yes, but sadly, that is the reality.

As per the current statistics - 

“30,000 people die in traffic collisions in the U.S. and 90% of U.S. auto collisions are blamed on human error, and 40% are the result of factors such as alcohol, drugs or fatigue. Therefore robotic cars, such as Google driverless Car, are designed to navigate roads and keep passengers safe.”

“So if there is less car deaths, organ donations would be adversely impacted. Then the 3D printed organ might be a solution. Although this is a dark way of looking at it, Griffith also agrees that Pettis has a point. Pettis pointed out that 3D printing organs will not be the focus of development until the self-driving technology causes the shortages.”

So here is the cause, and the effect, all clearly defined.

And unless the 3D organ printing becomes a viable and an effective solution, sadly the statistics for death by accidents and death due to lack of organ donations would eventually even out.

References: http://fortune.com/2014/08/15/if-driverless-cars-save-lives-where-will-we-get-organs/

Tuesday, August 19, 2014

The Cause and effect of Google’s driverless cars.

image

In case you haven’t been living under a rock, you must be aware of the Google’s Self-Driving Cars.

What was a starter project by Google for developing autonomous cars, the concept is now beyond the experimental stages and nearing its implementation.

In the US, these "self-driving” cars were first introduced in Nevada followed by Florida, the second state to allow autonomous cars on state roads, followed up by California.

Now UK is planning will allow driverless cars on public roads from 2015.

So all this seems like a pretty cool implementation of technology which is even publically accessible! But what are the effects of this cause?

‘Effects’ you may ask? Yes, there are effects here too.

Since safety is a prime focus and problem area these cars are aimed to tackle, there is the statistics of low mortality which will slowly be prevalent.

The MakerBot founder Bre Pettis said in his recent interview with Fortune, that

“…the take off of self-driving cars could lead us to more organ shortages than ever, since a major source of organ donations come from car accident victims.

We have this huge problem that we sort of don't talk about, that people die all the time from car accidents, Right now, our best supply of organs comes from car accidents. So, if you need an organ you just wait for somebody to have an accident, and then you get their organ and you're better."

Sounds gross? Yes, but sadly, that is the reality.

As per the current statistics - 

“30,000 people die in traffic collisions in the U.S. and 90% of U.S. auto collisions are blamed on human error, and 40% are the result of factors such as alcohol, drugs or fatigue. Therefore robotic cars, such as Google driverless Car, are designed to navigate roads and keep passengers safe.”

“So if there is less car deaths, organ donations would be adversely impacted. Then the 3D printed organ might be a solution. Although this is a dark way of looking at it, Griffith also agrees that Pettis has a point. Pettis pointed out that 3D printing organs will not be the focus of development until the self-driving technology causes the shortages.”

So here is the cause, and the effect, all clearly defined.

And unless the 3D organ printing becomes a viable and an effective solution, sadly the statistics for death by accidents and death due to lack of organ donations would eventually even out.

References: http://fortune.com/2014/08/15/if-driverless-cars-save-lives-where-will-we-get-organs/

Thursday, July 17, 2014

Askme.com–Quite safely, the Wikipedia of desi-deals !

These are the days, when we do more stuff online than physically. Gone are the days when the only way to get fun from a shopping spree involved bearing the heat in overcrowded parking lots, and overstuffed malls! 
Complementing this lifestyle and ongoing trends, are various price comparison sites, which help us nail down that too good to be true deals and schemes. And quite literary, they make the best of stuff just a merry click away!
Facilitating this are now the never-ending mobile apps and websites. One of this, is a new contender, which is slowly going the popular way – AskMeBazaar.
This online portal will help you…
- Nail that perfect deal!
- Get that relevant and real review!
- Compare real time prices and get the best deals from the best stores!

and much much more!
And complementing this excellent portal is the fresh from the oven app – AskMe.Com!
Get it from the Google play store, and use it to do what the site does, but one step better!
Some screen shots follow -
The home screenimage
Search for Pizza deals!image
and much more!
So go ahead, install and enjoy the bargains!


Wednesday, May 14, 2014

Using MySQL / Java and getting the noAccessToProcedureBodies issue? Read on..

java_logo
If you use much the MySQL + Java setup, you may have faced the ‘noAccessToProcedureBodies’ error while accessing stored procedures (mostly remotely).
The chances are that the procedure was created by another user (i.e. the DEFINER attribute), and the calling user is different.
I recently faced this issue in one of my projects, where-in we were trying to execute a remote DB’s stored procedure from a java application.
A common solution on the internet is to use the “noAccessToProcedureBodies=true” option in the JDBC connection string.
This seems to work for most of the people out there, but sadly didn’t work for us. What we tried then is another option called the “useInformationSchema=true”.
We removed the earlier option ‘noAccessToProcedureBodies’ option and added this in the JDBC string. This solution too eluded us, but then I tried upgrading the mysql-connector. We were using the mysql-connector-java-5.1.9 version which ideally should have worked (as we just needed a > 5.0.4 version for the solution)
But then I upgraded this to the mysql_connector_java_5.1.30 and this functionality started behaving as expected!
So, the end solution was to use the ‘useInformationSchema’ in the JDBC conn string and have the latest connector in place!
Technorati Tags: ,,,,,,,,,,,,,,,,,

Thursday, March 13, 2014

Rapid Environment Editor – A must have for every developer using Windows OS!

If your development environment is Windows, Rapid Environment Editor is going to be your new favorite power user application.

Rapid Environment Editor screenshot

This nifty little application is helpful in readily accessing the obscure to change OS environment variables.

It provides an easy to use GUI where-in you can boss around your Windows Environment with ease and with much more power than the small and “hard to understand” default environment editor.

The home URL is here.

The latest version RapidEE 8.x supports all versions of Windows, XP, 2003, Vista, 2008, Windows 7 & 8 and both 32 and 64-bit versions. It is also available as a portable download!

Tuesday, January 21, 2014

Modernizr - Detecting HTML5 and CSS3 features in client browser easily! <Part 2>

modernizr[1]

Continuing with the Modernizr series, we now start with the implementation.

So how to go about implementing these compatibility checks?

Until recently, we have been using many techniques for Browser Detection, the most common of which is to use JavaScript for getting information from the user-agent header.

Listing 1 provides us an idea about implementing the user-agent header check (a.k.a. UA sniffing).

   1: <script type="text/javascript">
   2: ieDetectionFunction(){
   3:   if ( navigator.userAgent.indexOf("MSIE") > 0 ) {
   4:     // Yes, we have IE, now do IE related stuff!
   5:   }
   6: }
   7: </script>

Listing 1: Function with user-agent header check

Though UA sniffing has been a standard practice, nevertheless it poses some issues. Considering the above example, we are faced with the inability to ascertain the exact ‘MSIE’ version in this case. Moreover, it also doesn’t provide any function specific checking.

For checking versions, the workaround is to use the navigator object in combination with regular expressions to detect the various browsers and their exact versions.

Specifically, we would query the navigator.appName and navigator.userAgent properties. However, using this approach again won’t solve the feature detection handicap mentioned above.

It would be both faster and more reliable to have the ability of using probing functions which can confirm the availability of objects, methods, attributes and so on (i.e. catering to the 4 points mentioned in the previous section)

We can always create these probing functions which then query for the required stuff, and if not found return null. But the overheads for these custom monitor functions increase if we are having a big web based project, intended to run on multitude browsers.

Enter the JavaScript library, Modernizr.