Just another site

Monthly Archives: April 2015

Conditional operator in concatenated string

"Hazard Class changed from '" + hazardChangeTracker.getHealthSafetyClass()!=null?hazardChangeTracker.getHealthSafetyClass().getLabel():"Not Set"

The above code throws PNE because conditional operator has lower precedence level than addition operator. To make the code work, we need to add parentheses.

"Hazard Class changed from '" + (hazardChangeTracker.getHealthSafetyClass()!=null?hazardChangeTracker.getHealthSafetyClass().getLabel():"Not Set")


Position An awesomefont background Relative to its Container Using CSS

<div id="container">
   <div id="box"> </div>
#container {
  position: relative;

#box:after {
  content: "\f154"; 
  font-family: FontAwesome;
  font-size: 100px;
  position: absolute;
  top: 40px;
  z-index: 1;

ref :