gqgnet@gmail.com

 

Tax Incidence formulas in the view of producer and consumer

My daughter attends her first college class, Micro economy, at the summer of her junior year. So, it is time to go over some economy concepts that I learnt before to prepare questions from daughter. Get the textbook from Prof. Jeffrey M. Perloff – Microeconomics_ Theory and Applications with Calculus (Pearson, 4th) Of course, this textbook full of math formula is different than my daughter’s economy class. But I always prefer math formula than the description. When reading the tax incidence formula in the textbook, it is different than the formulaRead More

......

Java bitCount algorithm explanation

It is not strange to have bit wise operator and Left/Right Shift in a function. But it is definitely weird to have all statements with them in a function.  Yeah, maybe you think it is not true in the real production. You are wrong then. It exists in the Java SDK.  Below is copied of Long.bitCount function. public static int bitCount(long i){          i = i – ((i  > > > 1) & 0x5555555555555555L);          i = (i & 0x3333333333333333L) + ((i  > > > 2) & 0x3333333333333333L);      Read More

......

How to get a good score in SAT/PSAT: a Journey from ELD to SAT 1580

It has been 2 months since the official SAT/PSAT score is published. I have two kids in high school.  Both two kids got wonderful result for their first SAT and first PSAT. I am wondering how it happens and would like to introspect so that it may help parents to prepare for it. Let’s view the score result first. My elder grader got 1580 in SAT on the test of November, 2018, and 1500 in PSAT at October 2018. My younger grader took PSAT only and got 1480. The backgroundRead More

......

A note on BNF Parser to verify valid number: a problem from leetcode

BNF Parser is one of the step in the compiler theory to analyze the syntax validity of number, program sentence, variable, etc. It is also a perfect recursive algorithm sample when you plan to study and implement this algorithm. I got the question from leetcode.com. It is the hardest question listed in the problem list. That attracts me to study the parser implementation for the problem. I read a compiler theory textbook also two decades ago. I have to go over the first half of a compiler theory book andRead More

......

The unit test mock and related terms (Test Double): a note and examples to martin old article

Ref: https://www.martinfowler.com/articles/mocksArentStubs.html http://xunitpatterns.com/Test%20Double.html https://github.com/kensipe/spock-mocks-nfjs http://nilhcem.com/FakeSMTP/. It is hard to not write unit test for your programmer job. Of course, you can quit if you do not like to write and your boss requests. But, anyway, it is better to write to ensure your code is safe to run, and your job is safe to stay. Most of your unit test main object, i.e. system under test (SUT), are relied on dependency object.  For example, you have Order class and Warehouse class. When you fill the order in Order.fill method, youRead More

......

Docker Container deployment with multi layers

That is a SJSU lecture course project. You need to deploy a list of service via Docker approach. That is not difficult if just one or two. However, if it is a list of Docker containers with several layers, you will feel headache. Anyway, you need to finish it to avoid score F in the course. The request deploy diagram The explanation )1st layer, the Front End GUI Layer with Node.Js app )2nd layer, API Gateway to dispatch call to the right service with Kong GateWay )3rd layer, EC2 ELB Application Layer toRead More

......

Text Sentiment Analysis Project with LSTM, CNN

This is a supervised learning project. The Text Sentiment Analysis is combined with three parts, the text data preprocess, the text data representation, three models (CNN, KNN,LSTM). This is an SJSU course project. I use the python to implement those model and generate the result. Here is the detail. the data preprocess Here is the sample data. The left side number is the target sentiment label, the right side text is the input text. From the text sample, more likely, those data is got from tweeter-similar samples by the professorRead More

......

Association Rule Analysis for Criminal data

This is a SJSU course project.  We need to generate rule from Criminal data to see any criminal activity cause issue. The data It is got from the official website DataSf. The features It only has several useful features for the association rule generation. Those are Category, Descript, DayOfWeek, Data/Time, PDDistrict, Resolution and Address. Below is some sample data. The data Preprocess As some of the features in the above are similar, or not yet good higher extract, we should pre-process the data before we go into next algorithm step.Read More

......

VS 2017 C Sharp and PDF Generator

 VS 2017 C# with PDF generator In a real application system, most of time, you have to generate pdf for your users. For example, in the ERP, you may create invoice pdf and sales report pdf.  This tutorial will instruct you how to create a pdf with MVC framework in VS 2017 C# platform. I will illustrate on implementation from simple pdf to complex pdf Create the PDF generate Environment: Add the ITextSharp package into your project You have to install the iTextSharp-LGPL 4.1.6 version to avoid the license issue.Read More

......

Sentence cluster with Kmeans algorithm

  This is unsupervised learning project in the SJSU data mining course. Students need to classify the sentences (already numerized by the SJSU course Prof) into clusters using Kmeans algorithm. Below is the performance of students in the class. Seems not so bad.   The whole project includes 3 parts: data preprocess, Bisec Kmeans and the basic Kmeans algorithm. 1. Data preprocess The clustering documents have 27673 terms in total. That is said number of features are 27673. Here is an excerpt of the sample data.  First, we will buildRead More

......