Size conversion filter using AngularJS


Following code should give you a clean and simple example of custom filter using AngularJS.

HTML code:
———————

<!doctype html>
<html >
<head>
<script src=”src=”http://code.angularjs.org/angular-1.0.0rc6.min.js”></script >
<script src=”filter.js“></script>
</head>
<body>
<div ng-app=”testFilterApp“>
<label>Size in Byte:</label>
<input type=”text” ng-model=”sizeInB” placeholder=”Enter a name here”>
<hr>
<h2>Human Readable Size (precision:3) {{sizeInB | sizeConverter:3}}!</h2>
<h2>Human Readable Size (precision: not defined) {{sizeInB | sizeConverter}}!</h2>
</div>
</body>
</html>

Continue reading

Funny JSP parser!


OK have a look:

JSP code:

<%  if(thisCodeIsOK){ %>

I am a genius !

<% }%>

<% else { %>

JSP parser is genius !

<% } %>

 

Tell me are you a genius?

Internet-Troll

I don’t think so. To be genius you have to write this code as following

<%  if(thisCodeIsOK){ %>

I am a genius !

<% }else { %>

JSP parser is genius !

<% } %>