aws

Wednesday, December 26, 2012

office email for communication not for cursing

     Office email is just for communication and for business use, but some of the so called leads in the team misuse their email and send foolish content in their email.
     In the year 2006 we were working in an office in Augusta, Bangalore. One of the so called lead use to irritate every team member in the team by cursing individuals in the team and using harsh words in his email above all he will copy the entire distribution list and the client people as well.
     Once he sent an  email to the whole distribution list copying the System Out logs, using Times New Roman, with size 18, bold, he has typed "System.out.println()" in Red color and saying "i am tired of telling this to you guys don't put System.out.println in the java code, you guys are doing it again, remove them asap",  this mail was copied to the client manager as well, seeing this email the whole team was stressed and depressed. On the other hand what the client manager will think about the team? this guy went to onsite from our company and degrading the team in front of the client from onsite. How come client will have confidence in the team?
     On another occasion, he want to save his friend staying with him in Charlotte, NC, so he sent a list of concerns with me in his email, putting false blame on me for which his friend was responsible for, and copying the whole group. Later i came to know the issue was caused by his friend staying with him.
    This guy is a classic example for poisonous team member, he used his office mail mostly for cursing the team and never used for constructive purpose. This sort of guys in the team are poisonous to the team and they kill the morale of the team instead of boosting it, because of him so many team members left the job and moved to other companies.  
     This guy lacked the basic culture and doesn't know the email etiquette, even though he can code in java, he can't do and deliver the whole project by himself, he thinks he is the one doing everything in the team, but its not the case, each and every member in the team is responsible for the success of the project and contributed from their part, he never understood the feelings of the individuals, he treated every member in the team as a bonded labor.
     The HR team in the company should take strong action against such poisonous team members in the team and save the organization from this foolish people.
     Lets use office email for the purpose its meant for, every member in the team is valuable lets not hurt or offend the team members by using harsh words. Words once uttered can never be taken back and they will leave a lasting scar on the person who received it.





Saturday, December 8, 2012

CSEDWeek.org

CSEDWeek.org Learn Computer science transform the future. The only field where you are getting paid for your learning. Only field which is ever changing, never boring and keep you agile both in and out!

Wednesday, May 16, 2012

How to connect MySQL with Mojito


Mojito is a open source MVC framework from Yahoo! This framework is a cocktail of HTML5, CSS, JQuery, YUI and build on top of Node.js, the unique feature of Mojito application is, it works in the browsers, even if they doesn't support JavaScript, the server and client application can be written in the same language JavaScript. The framework support multiple devices, there is no need to create a separate application for Android or iPhone,  single application works on the web browser and also on the smart phone web browsers.

Mojito libraries does not ship with MySQL libraries, we need to install the node modules for MySQL and include them with Mojito.

Below command installs the node modules for MySQL. (assuming Node.js is already installed in the system).

$ npm install mysql

Once the node modules for MySQL is installed, just copy the mysql folder in the node_modules to the mojito node_modules folder. (bit hacky ).

cp -Rp /home/umatg/node/node_modules/mysql  /home/y/lib/node_modules/mojito/node_modules

Since Mojito is a MVC framework written in JavaScript, we need to write the model, view and controller code in JavaScript.  The folder structure for a Mojito application looks like below.  Please refer the Mojito documentation (http://developer.yahoo.com/cocktails/mojito)  for creating a Mojito project and your Mojit.

 

To establish the connection with MySQL, we need to create the MySQL client object and invoke the query method.  The methods to create the client and execute the query are in the mysql.js library file.

The MySQL client object has to be created in the model and the methods in the model can be invoked from the controller and data sent to view in the form of a JSON.

The code below, establishes the connection and query the product table in the ads database in MySQL.

/* models/foo.server.js */
YUI.add('DashboardModel', function(Y) {
    var mysqlCli =require('mysql');
    var mysqlClient = mysqlCli.createClient({
        'host' : 'localhost',
        'port' : 3306,
        'user' : 'root',
        'password' : 'root'
    });

/**
 * The DashboardModel module.
 *
 * @module Dashboard
 */

    /**
     * Constructor for the DashboardModel class.
     *
     * @class DashboardModel
     * @constructor
     */
    Y.mojito.models.DashboardModel = {

        init: function(config) {
            this.config = config;
        },

        /**
         * Method that will be invoked by the mojit controller to obtain data.
         *
         * @param callback {Function} The callback function to call when the
         *        data has been retrieved.
         */
        getProduct: function(callback){
          mysqlClient.query(
            'SELECT * FROM ads.product',
            function selectCb(error, results, fields) {
              if (error) {
                  console.log('getProduct Error: ' + error.message);
                  mysqlClient.end();
                  return;
              }
              var result ={
                      meta:{
                          totalRecords: results.length
                      }
                };
              result.results = results;
              callback(result);
          });
        } 

    };

}, '0.0.1', {requires: []});

We are creating the MySQL client object by invoking the createClient() method from the mysql reference object, by passing the connection details.  Here the password is hard-coded, we can also encrypt the password and retrieve it from a file.

The query to select the products from the table executed by invoking the query method by passing the SQL Select statement and invoking the selectCb callback function.  The result of the query is sent back to the callback in the form of JSON.

Reference: