Wednesday, January 6, 2016

How to Create a Free Windows EC2 Instance on Amazon EC2

Want to setup a free Windows EC2 instance on Amazon? Following the following step-by-step guides for doing it.


1.      Go to https://aws.amazon.com/ec2/Click on Sign in to the Console and login


2.       Click on EC2




3.       Click on Launch Instance to create a new instance


4.       Click on the Windows Server instance and click Select




5.       Select an instance that is free tier eligible and click Review and Launch


6.       Click Launch





7.       When prompt to create key file, create a new one, give a proper name, and download it (by selecting download key pair). Store it properly, we may need to key file in future like for the purpose of enabling remote desktop. Click on Launch Instances, that’s it.


That's it, enjoy your Amazon EC2 Windows instance!

Monday, January 4, 2016

How to move Amazon EC2 instance to new region/availability zone

Say if you have setup your Amazon EC2 instance on US West (Oregon), and you want to move it to Asia Pacific (Singapore)? No problem, follow the following step-by-step guides:

Stop the instance, then right click on the instance and select create image

After the AMI image is created, right click on it and select Copy AMI


Select the Region you want to copy to, give a name and description, and click Copy AMI

After the AMI is copied to new region, click on the Launch button to launch it.


That's it :)

Friday, January 1, 2016

Khan Academy Payment Storing Services

To donate to Khan Academy
https://www.khanacademy.org/donate?amount=3&week=23&treatment=11&utm_source=Sailthru&utm_medium=email&utm_campaign=Blast%204:%20Users%20%28Forward%29&utm_term=all_users_12_3_15

Khan Academy uses Stripe to accept payment.
https://stripe.com/checkout/info



Thursday, December 24, 2015

C# vs TypeScript in Visual Studio 2015

Recently, I have coded JavaScript Analysis projects of equivalent functions in both C# and TypeScript in Visual Studio 2015. C Sharp is definitely the winner. Let me explain.


Shortcoming of Typescript compare to C#


1. When usage of myStatement is detected but not imported, Visual Studio will help you import: 
var myStatement1=require("ast/myStatement")
it is incorrect, and need to manually correct back to
var myStatement=require("./ast/myStatement")
C# does not have this problem.

2. Refactoring of class won't affect the naming of usage of class in the other files
e.g., by refactoring the naming myStatement to myStatement1,
it will change from
var myStatement=require("./ast/myStatement")
to
var myStatement=require("./ast/myStatement1")
in classes uses myStatement1, still myStatement is using, C# does not have this problem

3. The Test Explorer needs to parse for a long time, C# is fast.

4. The compiler scanning each typescript file takes quite for a while during starting while C# is very fast

5. C# has windows form for fast UI prototype

6. The Typescript UI sometimes just hang, C# does not have this problem

7. The solution Explorer sometimes left with a big gap after cleaning the js and js.map file, C# does not have this problem

8. Many datastructure are lack off, and difficult to see the contents like Dictionary (from https://github.com/basarat/typescript-collections) in debugging mode. C# does not have this problem

9. The typing in typescript is lazy type, and there is no real class constraint. When you want to use it as a class for OO language like C#, you might create some hidden bugs that you might not aware. You can use C# without such problems.

Shortcoming of C# compare to TypeScript


1. Need to go through Edge.js for running node.js indirectly.

2. Lack of understanding of JavaScript by always coding in C# (Fortunately I have coded quite sometimes in typescript).

3. Actually there is no real shortcoming of C#, it enables fast development without concerning on those superficial stuff, and put real concern in logic.

Monday, November 9, 2015

Meteor Install Path on Windows

It is on
<Your User folder>/AppData/Local/.meteor

But if your problem is you cannot start meteor on Windows in Command Prompt, holds on. You do not need to set the environment with that path. Just RESTART your windows will do. Trust me.

Friday, October 30, 2015

Parsing JavaScript with Esprima vs ANTLR

My original thought is that, the compilation for ANTLR 4 Esmascript (I am using C# target)
(https://github.com/antlr/grammars-v4/blob/master/ecmascript/ECMAScript.g4)
should be faster than Esprima
(http://esprima.org/)

It turns out that it is not.

I use jQuery.Mobile 1.4.2 to experiment:
ANTLR 4 makes use of 1 minute,
while
Esprima only makes use of 100 milliseconds.

Esprima is much faster than ANTLR 4.

Not only I have observed this, I have found some complaints of the speed of ANTLR 4 for JavaScript by other people:
https://groups.google.com/forum/#!msg/antlr-discussion/AUN7BLSDIzo/KG5MQ95Us9gJ

If you are gonna decide which to use, I am here to save your time: choose Esprima.

Saturday, August 22, 2015

Produce problems for yourself

Netflix has moving their application to the cloud, leveraging the hardwards in Amazon EC2.
They adopt an architecture call micro service architecture, which breaks normal components in to microservices. These microservices work together to achieve a task.

Microservice could be failed - maybe due to network congestion or simply unavailable. To proactively deal with failure of microservices, they make use of Chaos Monkey in Amazon EC2 that could purposely turn off the microservices. This helps them to see their resilients against failure.

I feel this is a good approach. Rather than waiting for problems, PRODUCE problems for yourself. This allows yourself to have time for fixing or preparing it. Nicely done!