Posts

AWS warning unprotected private key file while connecting to EC2 instance

If you are trying to creating an ssh connection to AWS EC2 host from your .pem file, you may get the following error the first time you download the .pem file from AWS console. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @         WARNING: UNPROTECTED PRIVATE KEY FILE!          @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ Permissions 0644 for 'node.pem' are too open. It is required that your private key files are NOT accessible by others. This private key will be ignored. Load key "my-key-pair.pem": bad permissions Permission denied (publicly). This warning shows up if your .pem file does not have enough restriction for non-owners. Therefore, you need to change the permission on the local file. Use the following commend to set permission on file to be readable only by owners but no-one else. > chmod 400 /path/my-key-pair.pem After running the command above, you can connect to your EC...

Given four points, determine if it is a square, rectangle or none of them

Sunday fun day, here is a simple algorithm to find if given 4 points are forming up a square, rectangle or nothing! Sample input Result: Example square: [{"x":0, "y":2}, {"x":0, "y":4}, {"x":2, "y":2}, {"x":2, "y":4}] Example rectangle: [{"x":0, "y":2}, {"x":0, "y":4}, {"x":3, "y":2}, {"x":3, "y":4}] Example neither: [{"x":0, "y":3}, {"x":0, "y":5}, {"x":2, "y":2}, {"x":3, "y":4}] function printItIsRectangleOrSquareOrNeither (points) { var distances = []; //1. Calculating distances between points O((n*(n-1))/2) ~O(n2) distances = calculateDistances(points); //2. Sorting distances heapsort, introsort O(nlogn) distances = sortDistances (distances); //3. Go over the sorted lengths and apply rules O(n) printResul...

Failed? Never give up!!

Image
If you FAIL, never give up because F.A.I.L. means " F irst A ttempt I n L earning". After each attempt, you never lose either you win or you learn!

Don't forget the power of starting from scratch

Image
Paul Dubois used to say, "Don't get attached to your work". Never hesitate to throw away and start from scratch. This is how paradigm shifting products are being made! " Jeanne d'Arc buste " by Photo: VassilStatue: Paul Dubois (1829 - 1905) [1] - Own work . Licensed under Public Domain via Commons .

Performance improvements of SQL Server 2014 over SQL Server 2008

Image
Following is the list of performance and scalability differences between SQL Server 2014 and SQL Server 2008 ( ref.  Technet ). The most important feature is called in-memory OLTP. You can download and read the white paper (.pdf)  from here , which describes the internals of in-memory OLTP. PERFORMANCE and SCALE In-Memory OLTP Enhanced In-Memory ColumnStore for DW Support for 640 logical proc. & 4 TB memory Support to 15,000 partitions Resource Governor IO governance Buffer Pool Extension to SSDs Query optimization enhancements SysPrep at cluster level Predictable performance with tiering of compute, network, and storage with Windows Server 2012 R2 Data Compression with USC-2 Unicode support Backup Compression

How to increase VirtualBox disk size in 5 minutes?

Image
A few days ago, I realized that my VirtualBox instance's hard drive was almost full. I looked at the UI of VirtualBox management console but I could not find an easy way to expand the size of the hard disk. After a quick Google search, I found out that you can increase the size of the hard drive of your virtual pc with a console command. Step 1.  Turn off your virtual pc. Make sure you copy your .vmi file somewhere else for backup just in case. Step 2. Go to your console/terminal and run the following command. > VBoxManage modifyhd --resize For instance, in order to expand your .vmi to 128GB,  use the following. > VBoxManage modifyhd "/Volumes/Dev Ext/VirtualBox VMs/windows/windows.vdi" --resize 128000 Step 3. First step completes pretty fast but your virtual windows pc will not be able to see the extended hard drive as primary drive (in most cases C:\).  Therefore, you need to open "Computer Management > Disk Management" and then extend y...

Buying a car during holiday season

Image
It is holiday season and all the car manufacturers are advertising with their huge discounts. This is like a competition, because all the dealers and brands want to increase their annual sales with best incentives. November and December are the final sales for the year and best times to buy a new car! I created a simple spreadsheet to figure out which car trim should I choose and which financing option will be better for me. It is crucial to calculate the numbers before going to the dealer, by this way you will start the game one point a head! Just fill in the green fields and you will be able to see monthly payments and how much many you will be losing by owning that new car. First download the spreadsheet from here and then follow the steps to calculate the payments. 1. Learn and choose your car Before starting to calculate the costs, first choose the car you like and want to buy. Then look at the trim levels and find about incentives on their web site. 2. Find ...