architecture, coding

Open sourcing my lottery server

2007 project involving Message Driven Beans (EJB) running on Enterprise Java container (Jboss or Glassfish) where games are processed and “played” as they come in through the Queue allowing scalability and consistency.

 

Source code for both game logic and EJB server can be found on github:

Github to Lottery Server

Share This:

javascript

Add async to script tag and enjoy 10% performance in page load

Chrome 41+ supports

 

<script async src="app.min.js">

 

Which allows script(s) to be parsed in parallel to other scripts therefore end user will experience slightly faster page load.

Share This:

bigdata

Creating Real Time topology in Apache Storm is amazing

Hiding away all the complexities of running nodes (hidden by zookeeper) and providing parallelism for Bolts (units of work in Storm) , as well as creating new Spouts (units of data steam, e.g. redis data, twitter stream or anything you want) allows you to focus on your real time product.

Once the bolt processes a string , adding a counter to it and pushing it to redis topic (using pub/sub).

On the other end, Web app is using d3 to grab all the content coming from a stream (simple python client connected to redis emits data)

 

That’s amazing.

 

 

Share This:

coding, mongodb, nodejs, Uncategorized

Recently open sourced project – toronto open data

The motivation behind this project is

 

  • Building a very capable api with geo lookups
  • Toronto Open Data api -specifically city services is very slow
  • User interface as a proof of concept which exploits the use of new API
  • Open sourced for others to use and improve

Technology stack:

 

  • MongoDB
  • NodeJS, rest api, mongoose
  • AngularJS (bootstrap, routes)

 

GiHub link

Share This:

Uncategorized

Async javascript lib for node and browsers has a better version

https://github.com/suguru03/neo-async

 

Great replacement for current users of async.js which hasn’t been updated for a while.

In a large pharma oriented app, i’ve noticed speedup where async.parallel happens.

 

 

Share This:

architecture, bigdata, mongodb

MongoDB 3.0 worth the upgrade

MongoDB 3.0 (dev version of 2.8) has been almost a year in the making and there are several prominent changes that are worth mentioning:

 

  1. Document level locking – changes to those large json documents (aka rows ) will work similarly to regular RDBMS. Previously you had to either queue or create a custom way of handling inconsistencies.
  2. Document has a hard limit of 16megs (reasonable) and that allows your app to create massive amount of data that will require sharding your servers. A new storage engine WiredTiger will provide better compression for storage, allegedly up to 80% , shed those Gigs of data Foursquare!
  3. Besides other significant improvements, a new tool is introduced named Ops Manager, uncertain if it would be available to all or MMS subscribers.
  4. Looking into MongoDB Jira , there is a large set of bugs that have been fixed, better error handling in GEO lookups, syncing issues between nodes and others.

 

 

A few notes:

 

In order to take advantage of a new pluggable storage engine wiredTiger you need to explicitly configure it as such:

 

mongod --storageEngine wiredTiger

Overall great job!

 

 

Share This:

coding, Uncategorized

GO lang is getting unofficial support from GCC compiler

Support for the Go programming language has been added to GCC. It is not enabled by default when you build GCC; use the –enable-languages configure option to build it. The driver program for compiling Go code is gccgo.

Go is currently known to work on GNU/Linux and RTEMS. Solaris support is in progress. It may or may not work on other platforms.

Reference: https://gcc.gnu.org/gcc-4.6/changes.html#go

Share This:

javascript, Uncategorized

AngularJS Pluralize – build a friendly message, good ui practice

Have you noticed that some web apps creators absolutely ignore common grammar in message or labels?

Well it is common.

You have 1 messages.

Or it might be cooler and human like but still:

You have one messages.

 

What you’d want to do in your AngularJS application is use a wonderful directive that is baked in and helps you avoid such mishaps.

 

<ng-pluralize count="report.CriteriaSelected.length"
                 when="{'0': 'No criterion is selected',
                     'one': '1 Criterion is selected',
                     'other': '{} Criteria selected’}"

What this will nicely take care for you are the conditions when Nothing is selected or you have 1 or many conditions where a different text is used.

Thereby avoiding using “message(s)”.

 

Going further, i would suggest using internationalization i18n for your labels in such cases so that it makes sense in other languages.

 

This feature exists for a while now.

 

Enjoy

Share This:

architecture, javascript, nodejs

Official nodejs.org is dead?, long live IOJS

It appears that IOJS (io.js, a form of node.js ) has gained an incredible momentum and credibility. As a seasoned nodeJS engineer i would be strongly swayed towards iojs give that it has all the important committee members (committers to nodejs).

My recent observation of this fork is that they release every 4 days ! That’s an impressive frequency.

Although some are uncertain about this fork in hopes that official (rather original) nodejs may all of a sudden resolve their differences and release 0.12 or perhaps even Nodejs 1.0, we shall see what happens in the next few months.
At one point a plan was to release NodeJS 0.12 in March 2014 , prediction is that it could be this year.

Meanwhile , Strongloop is gaining ground as a promenant NodeJS consulting firm with an array of tools (from monitoring , web ide generating rest apis, etc).

 

To add to this note, folks are realizing that NPM INSTALL may be something devops have missed and insecure (or plain old malware) modules can be installed ( might be even root).

 

 

Feb 11 UPDATE: Official NodeJS 0.12 was released just few days ago albeit without mention of generators. Great news!

 

Share This:

coding, javascript

Creating great looking UI with bootstrap – wizard

Creating friendly and intuitive UI is paramount in web development.

Here is a tip for an angular App that uses bootstrap.ui (angular directives for bootstrap) and bootstrap:

 

Accordion

 

The above UI uses this easy CSS for styling that number:

 

.number {
    background: #69C8C7;
    display: inline-block;
    width: 25px;
    height: 25px;
    border-radius: 30px;
    text-align: center;
    color: #fff;
    line-height: 25px;
    margin-right: 8px;
}

 

And html for the controller and a route contains this markup:

 

<accordion >
	<accordion-group >
	<accordion-heading>
	<p><span class="number">1</span>
		<span class="fa fa-check-circle" ng-show='false'></span> Headline</p>

	</accordion-heading>
	Fill out some information
</accordion-group>

<accordion-group >
<accordion-heading>
<p><span class="number">2</span>
	<span class="fa fa-check-circle" ng-show='false'></span> More options</p>

</accordion-heading>
Fill out some information and select options.
</accordion-group>

</accordion>

 

Notice the check circle can be replaced  when for example you’ve filled out all the data indicating to the user they are done with that section. Implemention and logic is up to you.

 

For more information on Bootstrap UI (these are directives for your angular app)

 

 

 

 

 

Share This: