Monday, April 28, 2014

Common Allergies and Medications

A summary of common medication for treating allergies grouped by their purpose:

Expectorant
Active ingredient: Guaifenesin (400-600 mg)
Thins and loosens mucus, making it easier to be coughed out. [1]

(Nasal) Decongestant
Active ingredient: Phenylephrine (10 mg), Pseudoephedrine (part of Decondine)
Relieves nasal congestion in the upper respiratory tract by constricting blood vessels and reducing the blood supply to nasal mucous membranes. This reduces nasal congestion, stuffiness, and runny noses. [1]

Antihistamine
Active ingredient: Loratadine (10 mg), Triprolidine (part of Decondine)
Reduce or block histamines. Histamine is an organic compound produced by local immune responses. It results in running nose and sneezing. [1] [2] [3]

Suppressants
Active ingredient: Dextromethorphan (20 mg)
Used for temporarily cough relief; suppresses cough reflex. [1]

Pain Reliever
Active ingredient: Acetaminophen (650 mg)
Main purpose is to treat headaches and minor body pain. Also reduces fever.

Note: This blog post is not an accurate source of medical information. Consult a doctor if you have a medical concern.

Sunday, April 27, 2014

ASP MVC

I have been trying out ASP MVC recently. Naturally, I hit a few roadblocks and found some solutions.

Init
Make sure you update your nuget packages after initializing the project.

Logging
I settled on using NLog. Darren has an entire series of blog posts on MVC logging.

Custom Model Binding and Validation
This is a great introduction, but I settled on the solution on Stack Overflow. Always use DefaultModelBinder over IModelBinder.

Passing Multiple Models into a View
Again, great article on SO. There are two main methods I considered: PartialViewResults and passing into a Tuple. The "tuple" method is very much a hack, and results in a bunch of issues if you need to display validation messages from the ModelState.

Routing
Article. Routing is ugly. Do the web a favor and set routes.LowercaseUrls = true; 

Custom Error Pages
After many hours of trying out different solutions, I am still stuck on this one.

Finally, stuff I liked:
- Script bundling and compression out of the box
- CSRF token and validation
- Model validation using data annotation attributes
- Nuget packages: MVC HTML5 Toolkit

Monday, April 14, 2014

Robert Schiller's Financial Markets

I enjoyed Robert Schiller's Coursera class on Financial Markets. Robert gives his students a broad overview of the principles behind finance, touching on a wide range of topics in contemporary finance such as stock markets, monetary policy and behavioral finance.

His course is more philosophical than it is technical, the pace is easy, and is well-suited for the man-on-the-street. His weekly introduction sets the learning expectations and as a bonus, gives us a window into the beautiful Yale campus. Robert Schiller is the 2013 winner of the Nobel Prize in Economics, and he puts his stature to good use -- inviting eminent weekly guest speakers such as Maurice Greenberg, Larry Summers and Carl Icahn. 

Robert is a keen proponent of finance, and he tries to dispel conventional myths popularized by the Occupy Wall Street movement. He argues that finance is a instrument of good, that both greed and selfishness are problems with society, not finance. The course gave me a more appreciative understanding of finance, and convinced me that finance is a creative invention of goodness and opportunity.

Monday, April 07, 2014

.NET and the Unification of Languages

I was looking back at Steve Yegge's EE380 GROK talk. Steve is as usual both entertaining and provocative.

It is difficult to describe GROK, but it is a compiler toolchain at a high level. As polygot programmers, we have used different IDEs and editors for different languages, but there is no one text editor or IDE to rule-them-all -- simply because each language has its own idiocracies and what not. Grok tries to solve the toolchain parity problem:
My project is accomplishing this lofty and almost insanely ambitious goal through the (A) normative, language-neutral, cross-language definitions of, and (B) subsequent standardization of, several distinct parts of the toolchain: (I) compiler and interpreter Intermediate Representations and metadata, (II) editor-client-to-server protocols, (III) source code indexing, analysis and query languages, and (IV) fine-grained dependency specifications at the level of build systems, source files, and code symbols.
-- Steve Yegge, Notes from the Mystery Machine Bus
It is interesting to note that in the Microsoft .NET world, the toolchain problem is less pervasive. In .NET, all languages share a common library (.NET framework), compile to one CIL (common intermediate language) standard, runs on a single CLR (common language runtime), and development is driven by a single Visual Studio IDE. This unification of languages resulting in a standard toolchain showcases the beauty of .NET.

In other news, the .NET foundation open sources significant part of the .NET platform, including the .NET compiler platform (Roslyn). (However, language differences are still tricky -- Roslyn provides two distinct compiler APIs for C# and VB.) Microsoft also released CTP3 (Community Technical Preview) of RyuJIT (a .NET JIT compiler).

Sunday, April 06, 2014

Back to Windows

I recently switched back to using Windows 8.1 after several years of *nix-based operating systems (Ubuntu, OS X). Windows 8.1 has some "design flaws". Here are my recommend installs to fix them:

  • Google Chrome (64 bit)
  • Cygwin (64 bit)
  • Clover 3: multi-tab functionality in Windows Explorer
  • Pokki: brings back the start menu on Windows 8
  • Launchy: nothing close to Alfred for Mac, but sometimes does the job
  • f.lux
  • Spotify
  • Notepad++, Sublime Text, GVim
  • Git with Git Bash
  • Java
  • Adobe Reader
PS: First blog post in quite a while, maybe I am back from my blogging hiatus!