This would be the last post on how to add AWS IAM users sign-in link for signin to console. If you wish to read the other post please check them out below. How to add AWS IAM users sign-in link for signin to console Summary This concludes our AWS IAM part of securing your AWS […]
Jade Node.js Template Engine, Conditional Logic Statements In my previous post I have talked about databinding with jade, i.e. feeding data to your template. In this post I will write about how one can use conditional and logical statements (for, if, while statements) in jade template engine. Ternary Operation The conditional ternary operator can be […]
Jade Node.js Template Engine is a templating language for node.js, it provides an alternative syntax to write your HTML, some may say more pythonic or haml style. Jade by default comes with express web application framework for node.js, it is designed primarily for server side templating in node.js, and last but not least it is […]
Here is a quick little tutorial of using Twitter Bootstrap with Node.js express in Visual Studio. First we will create a ExpressBootstrap solution, select New Project and select JavaScript -> Blank Express Application. I will name my solution ExpressBootstrap, in my app.js I have also add the app.locals.appname = ‘Express Bootstrap’ so that I can […]
The ?? operator is called the null coalescing operator. It is used for providing a default value for Nullable types or reference types. Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
int? age = null; //what ?? implies is possiblyNullValue ?? valueIfNull int myAge = x ?? 100; //if x is not null then assign x else 100 string? person = null; string? localDefault = null; string globalDefault = "abc"; string anybody = person ?? localDefault ?? globalDefault; //chaining ?? //lazy loading/populating private SomeObj _lazyField = null; public SomeObj MyProperty { get { return _lazyField ?? (_lazyField = new SomeObj()); } } |
One of the disadvantage of ?? is it can create code that is not that readable. e.g a ?? b ?? c ?? d ?? e