Skip to main content

Posts

SQL Server Always Encrypted - At a high level how does it works?

One of the excellent feature introduced in SQL Server 2016 is "Always Encrypted". This gives an extra layer of protection as no one (including the production DBA's) will be able to access the actual data without having the appropriate key. A high-level overview of how SQL Server 2016 Always Encrypted work: 1. Always Encrypted is a client-side encryption technology in which a SQL Server client driver (In our case, it would be ADO.NET) plays the key role. The driver encrypts the data which application sends as plaintext, and it then sends encrypted data to SQL Server. So, the data is encrypted on the fly as well as at rest. 2. Now when the application retrieves the encrypted data from the database the DRIVER transparently decrypts returning plaintext to the client app. Consequently, SQL Server never sees a sensitive information in plaintext. The keys, in fact, are managed entirely on the client side & the server doesn't have access to the keys either. 3. Th...

Quickly removing spam images from WhatsApp

One of the major issues with Whatsapp is in no time it produces numerous "spam images" which would eat up our smartphone's memory. Initially tackled it by exiting out of many groups and mostly used it for direct one-on-one conversations alone. It helped in cutting down on those useless images (memes, screenshots, quotes, images with good morning/evening messages etc.,) but it didn't completely solve the problem. Many of them were either close friends/relatives whom I don't want to block in Whatsapp but at the same time wanted a solution to quickly get rid of those spam images. After some analysis narrowed down on  Magic Cleaner App (Artificial Intelligence powered image recognition system) which seems to do the trick for me. This App does a decent job in identifying the spam images found the accuracy level to be around 75% - which is pretty good. It identifies and lists all images which it considers to be spam/duplicates. Review & if satisfied...

Universal Basic Income

"Universal Basic Income" - Heard about this only recently via an Elon Musk interview in November 2016 since then been reading about it. Understood it being discussed for many decades now and certainly not a new idea. What does it mean? A government would guarantee citizens a regular fixed sum of enough money to cover a basic standard of living, they can spend however they want, no questions asked. Majorly critics where saying something on this lines: 1. If we give money for free people will become more lazier 2. People would use it only for drinking / drugs / unhealthy things! etc., "Maybe 90 % of people will go smoke pot and play video games. But if 10 percent of the people go create new products and services and new wealth, that’s still a huge net win." - Sam Altman, President of Y Combinator, California Experiments: 1. Finland this week started it on a 2-year trial basis (2000 randomly picked unemployed citizens to get Euro 560 per month) ...

Is your SQL Server Database backup good enough? Can it save you during a disaster?

Met a DBA from a company who are in business for ~2 years. During the conversation came to know they have never tested their backup file - not even once. Also, they have very rarely used DBCC CheckDB command. Should I call it as surprised or shocked? It has become common to see Database Administrators to have fancy DB Backup plan, automate it and that's it. Their idea is whenever the need arises (read as disaster strikes) they can make use of it and restore the database. Although theoretically sounds like a good plan it actually isn't. Why? All those efforts to take regular backups would become completely useless if those files can't be used to recover the database. One important question missed by many companies to whom I have consulted for - "Do we regularly make sure that we are able to restore a database from our backups?". Despite backup process has succeeded how do we know it isn't corrupted (or) has some issues which don't allow it to be rest...

Positives of Cyclone Vardah - Unity, Humanity, Self-help

Chennai, Cyclone Vardah (Dec 12, 2016) - In person, have never witnessed anything as close to this in my life. The winds were so powerful it has uprooted close to 15 trees in our colony, the howling sound of the winds blowing was so scary which gives me goosebumps even thinking of it now. It was a complete carnage by "Vardah" on that day. Our colony had ~50 trees and out of which we lost 15 odd trees now. Minimum of 2 trees has fallen in each street. Colony compound wall has collapsed as one tree had fallen straight over it. Everywhere we were able to see only leaves, fallen branches, fallen trees, cut cables and not an inch of the actual road was clearly visible. Bad things do happen in the world, like war, natural disasters, disease. But out of those situations always arise stories of ordinary people doing extraordinary things - Daryn Kagan The positive side of it was from each street at least 2 members automatically volunteered and in no time we were a solid team ...

How I got billed even though I had registered as an AWS Free Tier user

Amazon AWS offers 12 months free tier to get started with their services. At a high level went through this link and created a free tier account to play around. Approximately after a month checked the Billing dashboard and was surprised to see that I am getting billed $0.81 for some usage under the heading "Elastic Cloud Compute" (EC2). Points mentioned about EC2 in AWS Free tier - 12 Months Introductory Period So I was mindful of those numbers mentioned there alone. But only after seeing the detailed bill understood that there are few items which are getting billed on an hourly basis even within Free Tier. Billing Dashboard: Billing Summary Billing Details Looks like NAT Gateway & Elastic IP address usage are charged even in Free Tier. $0.056 per GB Data Processed by NAT Gateways $0.056 per NAT Gateway Hour (I had used it for 6 hrs) $0.005 per Elastic IP address not attached to a running instance per hour on a pro rata basis (I had use...

From a Windows Machine - Connect (ssh) to Linux Instances running in a Private Amazon VPC

To start with the following tools need to be downloaded : 1. PuTTY 2. PuTTYGen 3. Pageant If you are a Windows user & trying to connect to (SSH into) an AWS EC2 instance then you need to use PuTTY. During the process of provisioning an EC2 instance, you would have created/downloaded a key pair file which would be in a .pem format. But PuTTY doesn't support the .pem format and it needs the key pair file to be in .ppk file format. That's where PuTTYGen comes into play. PuTTYGen helps in converting a .pem file into a .ppk file with a click of a button. Connecting to an EC2 instance in a public subnet: 1. Open PuTTyGen 2. Load >> Choose the .pem which you want to convert 2.1 [Optional] Provide a key passphrase & confirm passphrase. For simplicity sake, I skip it for now. 3. Click on "Save private key" 4. Open Putty 5. Enter the hostname / IP - For ex: ec2-user@35.154.74.77 6. Copy paste that into Saved Sessions textbox as well 7. ...

AWS fatal error: An error occurred (400) when calling the HeadObject operation: Bad Request

While using AWS and trying to copy a file from a S3 bucket to my EC2 instance ended up with this error message. Command Used: aws s3 cp s3://mybucketname/myfilename.html /var/www/html/ Error: fatal error: An error occurred (400) when calling the HeadObject operation: Bad Request The error goes off if we add the region information to the command statement. I am using Asia Pacific (Mumbai) so used ap-south-1 as the region name. Modified Command: aws s3 cp s3://mybucketname/myfilename.html /var/www/html/ --region ap-south-1

Is Auto Close Enabled in your SQL Server database?

In SQL Server, one of the Database Properties options is Auto Close . This is an option to be used (auto close = True) if our intention is to shut down cleanly and free the resources once the last user accessing that database exits. If after the last user exits we still want to keep the database alive without shutting down then set auto close as FALSE. But having this setting enabled in a Production environment will end up with performance issues majority of the times. Why? Because once the DB is closed all cached items (data / procedure cache, execution plans) will be flushed out as well. So it has to work from the scratch again when the next user connects in. How to know what is it set to? Option 1: Try this query which will return all databases in that server where Auto Close is set to TRUE. SELECT [name] AS [DatabaseName] FROM SYS.databases  WHERE is_auto_close_on = 1 --To change AUTO CLOSE option to FALSE USE [master] GO ALTER DATABASE [TEST]...

Creating & Executing SQL Queries in Visual Studio Code

Visual Studio Code is a modern, lightweight (but powerful) source code editor which runs on your desktop and is available for Windows, Mac, and Linux. A new extension has been announced which would support creating and executing SQL queries from within Visual Studio code editor. Setting up the environment: 1. Download and install Visual Studio code from here -  https://code.visualstudio.com/Download 2. Next you need to install the extension "mssql" on it. Refer the steps here in GitHub  or Microsoft Documentation As explained in the above link bare minimum these steps should have been completed: Installation of Visual studio code and mssql extension Creating the SQL Server Connection Profile Changing the language of the file to "SQL" Executing the query: 1. It's simple, just type the query you want and to execute it press "CTRL + SHIFT + e" 2. Results can also be saved as a .csv, .json file Sample output:

Enable thumbnail preview in Windows 10

By default "Always show icons, never thumbnails" option would be enabled in Windows 10. Just follow these two steps to change that setting. 1. Go to windows explorer and click on "Options" 2. Uncheck the "Always show icons, never thumbnails" option That's it just click on OK and you should be able to see the thumbnail of images.

To run dex in process, the Gradle daemon needs a larger heap. It currently has approximately 910 MB

Warning / Error: To run dex in process, the Gradle daemon needs a larger heap. It currently has approximately 910 MB Solution which worked for me : Android Studio 2.1.* has a feature named Dex In Process. To make use of it we need to update our gradle.properties file and increase the amount of memory allocated to the Gradle Daemon VM to a minimum of 2 GB. So just added the below line in my project gradle.properties org.gradle.jvmargs=-Xmx2048m

List all stored procedures which are modified recently in a SQL Server database

In SQL Server Management Studio: Navigate to your database > Programmability  Press F7 (or) View > Object Explorer Details In the Object Explorer Details window right click anywhere on the header row and select "Date Last Modified" field (in case it isn't selected already) T-SQL Script to achieve the same result: Option 1: SELECT     name,     create_date,     modify_date FROM sys.procedures WHERE modify_date > '2016-08-09' ORDER BY modify_date DESC ; Option 2: SELECT specific_name, created, last_altered FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_type = N'PROCEDURE' and last_altered > '2016-08-09'  ORDER BY last_altered DESC ;

Transform your fear to success

During my days as an MVP (Microsoft Most Valuable Professional), I used to mentor few juniors from the community. One of them used to be very low on confidence and fear of failure was hurting him more than anything. Recently while cleaning up my mailbox found few of the old emails which I have sent him - cleaned it up a bit and just compiled all those into this  article .

#ComeBackHome - Join hands to find missing children

In continuation to my earlier post Finding Missing Children in India I have been looking out for more ways by which we can help track and find a missing child. In that process came to know from my friend about comebackhome.org On the first look it definitely sounded like a great idea. The concept of this plugin is by just adding one single line of code in all websites we can get the entire internet search for the missing children. When the visitor click on the banner it will show the missing children in their geographical region. This plugin is integrated with multiple missing persons databases including Interpol , NCMEC  (The National Center for Missing & Exploited Children) and NAMUS (National Missing and Unidentified Persons System). That said, if we know of any other countries authentic databases the code can be integrated with that too. If a user of a website navigates to a page that does not exist, either because the user has mistyped an URL or trying to open an ...

Finding missing children in India

Recently I come across at least one missing child information shared by my contacts in social media every week. The thought of what might their near and dear one's be going through in those period until they find the child is very disturbing. How on earth somebody is able to kidnap a child? Has money become so important in life that we lost all our moral values? Few days back came to know that my cousins friends son was missing. I don't know for some reason it has been so disturbing that i haven't come out of that yet. During that period, came across couple of sites relating to this and I believe those weren't well advertised among the public. So thought I would do my share by writing a blog post and spreading the word around.   These where important websites launched by government of India (Ministry of Women's and Child development) where one can register the details about the missing child. Since its government of India initiative hoping required focus w...

My Second Brevet - 300 BRM Freedom Ride

After completing 200 BRM on June 21st 2013 (ECR Classic 200 BRM) was enjoying the success for too long that I didn't practice for quiet sometime. Even registered for 400 BRM for July but dropped out on last minute as I wasn't feeling well. During that period Kandappa Sir posted in Madras Randonneurs about a crash course he is willing to take for folks who are interested in attempting 200 / 300 BRM. Didn't think twice before requesting him to consider me as well and from then on no looking back.  Took the practice rides seriously and followed it religiously.  Me and my worries! Couple of things I was worried about were: I have never rode during night time on highway and was little worried on whether my headlight would be powerful enough to show me the way.  Never during a ride I had ate anything apart from energy bar, tender coconut, Gatorade or Juices. But for a 20 hours ride one can't survive like that alone. To overcome this fear I decided to face it and...

Type of Bike / Cycle to buy

Since lately I have been posting my cycling adventures in my Facebook account many of my friends have been asking suggestions on "What types of cycle should I buy?", "Tell me the best Brand of cycle to buy" etc., Though I am not an expert on this yet thought of sharing what I understood till now and leave for the experts to comment and help me correct any content which they feel might be misleading for the readers. My Top 4 Learning as of now 1. DON'T just go by Brand 2. Fix your Budget - Because there are bikes from few thousands to 2+ Lakhs :) 3. Be clear on what sort of terrain you plan to ride / Major purpose of this investment 4. Test as many cycles, brands as possible and see which one YOU are comfortable with. Majorly these are the 3 types of bikes I tested: Road Bikes, Mountain Bikes (MTB) and Hybrid Bikes. I had always loved the Brand Cannondale and Bianchi a lot. So I had made up my mind to buy only one of these brands. But after t...