Human Resource Management

Human, living beings is why the world is. Human Resources is the why the Business is. Human are the major input of a Business towards achieving the goals of the Organization. The Success of a Business depends on how success is it’s employees. It is the reason why it should be done by a highly qualified person. The employees of a company should be matched to their abilities and specialization and the suitable person at the most needed time need to be there at the correct place to carry out the work. Therefore recruitment places an important role in an organization.


Recruitment –Recruitment is a process which gives an opportunity for interested people to apply for the vacancies in an Organization. This Process has many steps such as Announcing the vacancy to internal Staff and the external parties selecting the most appropriate person and inducing the person to the job responsibilities and working environment. The most important thing in this process is to make the selected person to work effectively with Job satisfaction and to make him/her to serve the Company for a long period of time.

Put the correct or wrong mark for these statement based on the text on Human Resource Management

  1. The Success of a business depends on its Employees.
  2. If you hire the wrong person it will not affect the Company.
  3. Simply Recruitment is advertising the Job Vacancy Only.
  4. Recruitment process becomes a success if the hired person stayed with the company for long period of time.
  5. Recruitment can be conducted by any person in the Organization using any methods.

How to Plan for an Effective Training

In Today’s Context most of the Organizations has identified that training is an important function which enhances the quality of work force. Immediate improvements in people can be seen after an effective training program as it is well structured and targeted.
The Training Cycle
This is a sequence of steps which need to be followed in order to do proper training

  • A training Policy need to be developed - Each Organization has its own Training Policies depending on the Business they do, the resources it has and the need. This can be weather to get external resource personal or to get the help from experienced managers of the Organization. The training methods to be used one day or residential. Seminar type or Group discussions.
  •  Training Needs- The training need can be arise in different times at different aspects; the most appropriate thing is to identify what type of training is necessary for immediate improvement among the staff. The type of training which need to be conducted can be identified by doing surveys, observing how they perform their and having discussion with the managers about the weaknesses of the staff.
  • Planning the Training Program-   This need to be done very carefully in a cost effective manner in order to get the maximum benefits.
  • Carry out the Training- The training need to be carried out for all the staff that is in need of the training.
  • Evaluate Training-Evaluation of the training program plays an important role as it helps to reduce the gaps arose in the last training program held.

Commonly Used Training Methods
  1. Lecture Method
  2. Coaching
  3. Role Plays
  4. Case Study Method
  5. Seminar Method
  6. Residential Method

Get street,town and country from google api

In this tutorial, I am going to show you how to get street,town and country values of given postal code.

$postcode = "your postal code goes here";

// Sanitize their postcode:
$search_code = urlencode($postcode);
$url = 'http://maps.googleapis.com/maps/api/geocode/json?address=' . $search_code . '&sensor=false';
$json = json_decode(file_get_contents($url));



$lat = $json->results[0]->geometry->location->lat;
$lng = $json->results[0]->geometry->location->lng;



echo "Latitude :".$lat ;
echo "Longitude :".  $lng ;



// Now build the lookup:
$address_url = 'http://maps.googleapis.com/maps/api/geocode/json?latlng=' . $lat . ',' . $lng . '&sensor=false';
$address_json = json_decode(file_get_contents($address_url));
$address_data = $address_json->results[0]->address_components;


$street = str_replace('Dr', 'Drive', $address_data[1]->long_name);
$town = $address_data[2]->long_name;
$county = $address_data[3]->long_name;



$array = array('street' => $street, 'town' => $town, 'county' => $county);
echo json_encode($array);
?>

I have entered "45 Belsize Avenue, London, NW3 4BN" as $postcode and I could get below output.

$postcode = "45 Belsize Avenue, London, NW3 4BN";


Have Something to clear ? Drop me a comment or drop me a email. !!!
etutionlk@gmail.com

Get Longitude and Latitude from Postal Code

I have a requirement to get Longitude and Latitude from google api. I need to get these details from postal code. So I need to call google api functions to get this details.
$postcode = "your Postal Code";



// Sanitize their postcode:
$search_code = urlencode($postcode);
$url = 'http://maps.googleapis.com/maps/api/geocode/json?address=' . $search_code . '&sensor=false';
$json = json_decode(file_get_contents($url));


$lat = $json->results[0]->geometry->location->lat;
$lng = $json->results[0]->geometry->location->lng;


echo "Latitude :".$lat";
echo "Longitude :".  $lng";


Type your postal code above in the code. See the demo below.
$postcode = "HA27DY";



// Sanitize their postcode:

$search_code = urlencode($postcode);
$url = 'http://maps.googleapis.com/maps/api/geocode/json?address=' . $search_code . '&sensor=false';
$json = json_decode(file_get_contents($url));


$lat = $json->results[0]->geometry->location->lat;
$lng = $json->results[0]->geometry->location->lng;


echo "Latitude :".$lat";
echo "Longitude :".  $lng";

I got Following Data from my code.
Latitude :51.5797504
Longitude :-0.3640929 

How to get SUM of Select Data according to Month and Year

I have following table in mysql database. My task was I need to get the sum of the paid_amount and the month and year.
See below Image

I used following sql command to get sum of the paid amount accourding to month and the year. See below result in the image.


SELECT 
        Sum(paid_amount)       AS paid_amount
        Year(`paid_time`)      AS paid_year,
        Monthname(`paid_time`) AS paid_month 
FROM   
    `customer_payment_table` 
WHERE  `paid` = 1 
GROUP  BY 
    Year(paid_time),
        Month(paid_time)  
Some are without date, That's why I got Null in first result statement. :)

Java Lesson 02 - Algorithms and Peudo Codes

What is an algorithm ?

Algorithm is a step by step procedure which solves the problem.

Characteristics of an Algorithm.

1. Definiteness
All steps are accurate.

2. Input
Algorithm has one or more inputs,or else there cannot be any.

3.Outputs
There are several outputs in one Algorithm.

4.Effectiveness
Is the basis to write a program.


5. Finiteness
It terminates after finite number of steps.

Pseudo-Codes

Pseudo stands for nearly and pseudo-codes means nearly the code.The Pseudo-Codes can be converted to programming codes easily.

SEQUENCE is a linear progression where one task is performed sequentially after another

WHILE is a loop (repetition) with a simple conditional test at its beginning

IF‐THEN‐ELSE is a decision (selection) in which a choice is made between two alternative courses of action.

REPEAT‐UNTIL is a loop with a simple conditional test at the bottom

CASE is a multi‐way branch (decision) based on the value of an expression. CASE is a generalization of IF‐THEN‐ELSE

FOR is a "counting" loop

------------------ See you in next tutorial -----------------

Form Validation using jquery Validation Engine

This simple tutorial demonstrate how to use jquery validation engine to validate your form fields.

I have simple form with two fields.

<input id="first_name" name="first_name" class="" type="text" value="">
<input id="last_name" name="last_name" class="" type="text" value="">  

Note that, These input fileds have no any validation classes. I have to includ several files to add validation.

Include following files.

<link rel="stylesheet" href="../css/validationEngine.jquery.css" type="text/css" />
<script src="../js/jquery-1.8.2.min.js" type="text/javascript">
</script>
<script src="../js/languages/jquery.validationEngine-en.js" type="text/javascript" charset="utf-8">
</script>
<script src="../js/jquery.validationEngine.js" type="text/javascript" charset="utf-8">
</script>
Remember that, Include jquery file first ! Otherwise your validation may not work !

Now I Can add validation Classes to my input fields. See following code snippets. I need these two fields with 100 letters and could not be used some numeric values. So I have added following validation rules.

Disable autocomplete in google chrome

I had to work with html form. When I tried to fill Email address it autofills with yellow coloured boxes.
(See the Image below.)

I need to get avoid from this issue. I have added following code snippet. but it does not work for me.

<input id="email" name="email" value="" autocomplete="off"

So I have to find another solution. I have added autocomplete property to form and added following jquery.


$('form[autocomplete="off"] input, input[autocomplete="off"]').each(function() {
var input = this;

var name = $(input).attr('name');
var id = $(input).attr('id');

$(input).removeAttr('name');
$(input).removeAttr('id');

setTimeout(function() {
$(input).attr('name', name);
$(input).attr('id', id);
}, 1);
});


After that, It worked for me ! Cheers !

Java Lesson 01 - Programming Languages Basic

Why we use programming languages ?

I will take the entrance to give an answer to above question. We are working all the with problems. We have to face many problems. Hardware problems, hardware communication problems, problems regarding on user interaction with system, etc. So wee need some kind of language to deal with this issues with our computer. Computer cannot unserstand human languages. So wee need to give an instruction in Computer understandable language. That's why We need computing languages.

Problem Solving methodologies

There are few types of problem solving methodologies.

1. Hill‐climbing strategy
In this Step We attempt to be closed to the goal. Every Steps are taken to be closed to our goal.
2. Means‐end analysis
In this method, start and end of the goal are identified and Some sub goals are defined. Achieving sub goals is getting closer to the main goal.
3. Divide and conquer
We can devide our main task into solvable sub tasks and solve these sub tasks.
4. Trial  and Error
 Try it and if there is an error, fix it.
5. Brainstorming

How to pass data from controller to view in codeignitor?

In this tutorial,I am going to show you pass data from codeignitor controller to codeignitor view.

Here is My Controller class.

<?php 



if ( ! defined('BASEPATH')) 

    exit('No direct script access allowed');

class test_controller extends CI_Controller {

    public function __construct()

       {

            parent::__construct();

       }



    public function index()

    {

        $data['user_id'] ="user" ;

        $data['display_data'] ="user data" ;

        $this->load->view('test_view',$data);

    }



   

}


Add Mouse Following Text in Flash Actionscript

Add following Actionscript code inside your flash action scripting codes.

Text = "Type Your Text Here";
letters = Text.split("");
letterformat = new TextFormat();
letterformat.font = "Verdana";
letterformat.align = "center";
letterformat.size = "10";
spacing = 8;
speed = 3;

for (var LTR = 0; LTR
mc = _root.createEmptyMovieClip(LTR+"l", LTR);
mc.createTextField(letters[LTR]+"t", LTR, LTR*spacing, 10, 20, 20);
with (mc[letters[LTR]+"t"]) {
text = letters[LTR];
setTextFormat(letterformat);
selectable = false;
}

if (LTR) {
mc.prevClip = _root[(LTR-1)+"l"];
mc.onEnterFrame = function() {
this._x += (this.prevClip._x-this._x+5)/speed;
this._y += (this.prevClip._y-this._y)/speed;
};
} else {
mc.onEnterFrame = function() {
this._x += (_root._xmouse-this._x+10)/speed;
this._y += (_root._ymouse-this._y)/speed;
};
}
}

Change "Type Your Text Here" text in this code.

Q1: What problem you identify with Kamal’s job?

See this post for Whole Question.

Answer for Question No: 1

According to World Health Organization the "Job Stress" is the “The response people may have when presented with work demands and pressures that are not matched to their knowledge and abilities and which challenge their ability to Cope up”.In other Words Job Stress is a response given by persons when he/she faces pressure in the Workplace. There are many Factors which cause Job Stress some of them are:

  • Poor Working Conditions – The environment which the employees work may cause health hazards or discomfort able to work. Eg: No Proper Ventilation, High Heat, Not having adequate lightning 
  • Late hours of Work – Some workers are entitled to do night shifts and some had to work late hours beyond the capacity of them. 
  • Lack of Knowledge – The employees face the difficulty of performing their responsibilities. If he/she does not have the necessary knowledge to work with or a senior person to get the advice. 
  • Strict Rules and Regulations – The rules and regulations of the organizations may be in a negative approach or may not be compatible to the workers. The management have taken their own decisions without any involvement of the employees, So that the employees face the difficulty of fulfilling their responsibilities along with the rules and regulations. Eg: If the management decides to make Saturday working half day, for some employees who come to work from outstation areas will have no time to go to their homes.
  •  Unbearable Workload – The work can be more than a person can perform by himself within a certain period of time. 
  • Lack of Training – When time passes new technologies have conquers the world and for some people it is hard to get used to the new technologies or else new employees are not used to the machinery or technology of the Company they have newly joined. 
  • External Pressure – The pressure from external factors differ from individual to individual. Working house wives will have to do their household works at the same time and it will create a Pressure especially those who have children they have to Perform the responsibilities in the Organization as well as the household.
  •  Difficulty in enhancing Career – When the employees cannot meet their own goals and objectives or to achieve the vision of them. Eg: Lack of opportunity to get the position which they prefer or a promotion which he/she look for a long time. The stress in the Job will cause Behavioral, Physical, Economical Psychological and Social problems among individuals. 

 Behavioral Problems 
  •  Absenteeism – Frequently getting absent to work to avoid a stressful working day. 
  • Lack of Motivation – Not working willingly but due to work which is to be performed working forcibly by themselves. 
  • Not Efficient or Effective – The work done by employees with Job Stress are not efficient and effective on their responsibilities which in turn affect the productivity pf the Company. Sexual Harassment – The Employee especially females can be harassed sexually by another employee. If the person who gets harassed has no way of leaving the job due to her/his economical situation. She/he has to carry out the work stressfully along with the harassment. Also this can form Social Problems of not being able to face the society. 
 Eg: Unskilled Labor – Those who work as sewing girls in Garment Factories. As they lack skills and Qualifications they have the difficulty of finding another Company.

  •  Not Interested – Lack of interest to perform the duties and responsibilities.
  •  Hesitate to work – When he/she is reluctant to perform the duties it will affect the other employees. The others have to perform his/her duties or else the productivity as a team will get slow down. 
Eg: If the person has to finish making the products to be delivered on time. If the person is reluctant to do it the delivery team and invoicing team has to wait until it gets finished or either they had to involve in finishing the products. It will not be good for the image of the Company.

  •  Carelessness – The work done may be with errors which will cause problems to the Company as a whole. Another person had to involve in checking his/her work again which will increase the work load for that person. 

How to prevent from form submission on Enter

I need to prevent from form submission on pressing Enter key. I have added used following code snippets.

$('.form-submit-css').on("submit", function(e) {
 if (e.keyCode == 13) { 
 e.preventDefault(); 
 return false; 
 } 
 }); 

Or you can add following code.

$('myform').submit(function() {
  return false;
});

Or this snippet.

$('form').keyup(function(e) {
  return e.which !== 13 
});

Or this html.

<form onsubmit="return false;">

Should work for you. Have a fun with your coding !

CASE 02: JOB STRESS


Mr. Kamal heard the alarm is ringing in the morning but he did not want to get up. The thought of facing a stressful work day was irritating him "I will call the boss and tell I am sick-he thought lying on the bed, the same time he thought otherwise, last week also I was absent for a couple of days saying sick, and if I stay today also, my job at risk. Just then his wife walked into the room and said “Come on Kamal it’s a nice day! Have your breakfast with children before you leave for work! I hate to see you missing at the table every day.

Kamal (with annoyed) - “What difference does the breakfast make? I hate to go to work! The work is so stressful and boring now!”

Wife - oh come on dear!Things can’t be that bad, see the positive side! The pay is good and you are a quite senior now after 20 years of service in the large company.

Kamal - Yeah! Still the work is hard and boredom. I feel like I am wasting my stage of life. I think of looking for another job.

Wife - well I don’t tell you what to do it’s up to you but don’t forget the children are getting older now and we will have to pay extra fees for the tuition classes and other expenses are also rising up. Why don’t you think of another job next year?

Kamal - (Thinks) she is probably right! We need money and it’s a risk to get off the job right now, I’ll think of it little later (He gets off the bed and gets ready to go to work with little late to work)

Questions.
1.What problem you identify with Kamal’s job?
2.How it (1 above) affects Kamal’s Job Satisfaction and his decision?
3.What is the impact of Kamal’s thinking and behaviour on his family and children?
4.What is the impact of Kamal’s thinking and behaviour on the productivity of the company he serve?
5. How will the company react on Kamal’s behaviour?
6. If you are the HRM of this company how can you prevent such scenarios?

Answers are in next posts !

Answer For Q1 | Answer For Q2 | Answer For Q3 | Answer For Q4 | Answer For Q5 | Answer For Q6

create/delete groups in CentOS

You can create/ delete your own user groups in CentOS. To create a group, Use following command.

groupadd groupname

Example
groupadd tutorial_users

To add users to your newly created group, use following command. but you can add existing users to group using following command.

useradd -G group_name user_name

Example
useradd -G tutorial_users etutionlk

To add existing users to a group, use following command.

usermod -G group_name user_name

Example
usermod -G tutorial_users etutionlk

Use following command to delete group.

groupdel group_name

Example
groupdel tutorial_users

That's All !

create/delete users in CentOS

This tutorial demostrates how to create/delete users in Centos.
Use following command to create user in CentOS. before creating an users, you should be logged into the CentOS using your root account. Otherwise you can not create user accounts.

useradd username

Example :
useradd etutionlk

Use following linux command to delete existing user in CentOS.

userdel username

Example
userdel etutionlk

Install dhcp server in centos 6

DHCP stands for Dynamic Host Control Protocol (DHCP). It used to dynamically allow ip adderess to computers.
Before configure  dhcp server, you should install dhcp packages. Use following command to install dhcp package.

yum install dhcp


go to /etc/sysconfig/ directory and open dhcpd file. Add interface.

Copy sample dhcp.conf to /etc/dhcp/ directory. User Following command.

crontab in Linux

crontab is used to run scheduled tasks like get backup of your project frequently, clear temp file frequently,etc... If you have some scheduled tasks to be executed automatically, crontab is the best place to fulfil your requirement.

Use Following command to see scheduled crontab list.
crontab -l

Use following command to add/delete crontab processes
crontab -e 

use Following Command to stop/start/status/restart crontab prosesses.
/etc/init.d/crontab start
/etc/init.d/crontab stop
/etc/init.d/crontab status
/etc/init.d/crontab restart


min         hour         day_of_month      month          day_of_week        Process
(0-59)      (0-24)             (1-31)             (1-12)                 (0-6)              process
                                                             (jan-dec)

Examples:
To run cd /home/etutionlk command in every minute. Add following crontab statement.
*/1 * * * * cd /home/etutionlk
Run test.sh file in every hour
* */1 * * * sh test.sh
Run xmas_greeting.sh file in 25th of December in every year at 8.00 am
0 8 25 12 * sh xmas_greeting.sh
Have a Nice Experience with crontab !


How To Disable Browser Cache in Codeignitor

In my Project, I had a big issue about cache. I want to remove browser cache because some web pages takes browser cache to load. Therefore I wrote a library script for codeignitor to disable browser cache.

Create cache_lib.php in application/libraries and paste below code in it.

<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class cache_lib extends CI_Output {

    function nocache()
    {
        $this->set_header('Last-Modified: ' . gmdate("D, d M Y H:i:s") . ' GMT');
        $this->set_header('Cache-Control: no-cache, no-store, must-revalidate, max-age=0');
        $this->set_header('Cache-Control: post-check=0, pre-check=0', FALSE);
        $this->set_header('Pragma: no-cache');
    }

}
Now You Can Import nocache method using following line of code.

$this->output->nocache();

Happy Coding !

Error Parsing XML in Facebook Page Plugin

I got an error message during the  template XML Saving Process. See the Below Error Message.
My Error Was Error Parsing XML !

I tried to add facebook page widget to my blogspot blog. So I had to add following code snippet.

<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.3";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
I copied the code to blogger template and Saved it. Error Occured.... !

Change the Following Line to avoid the XML Parsing Error.
 js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.3";
Replace the above line with the following Line.
 js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&amp;version=v2.3";
Now you can Save the template without any error. Save the template and add html/javascript widget.
Copy the following code inside the Widget.

<div class="fb-page" data-href="https://www.facebook.com/etutionlk" data-hide-cover="false" data-show-facepile="true" data-show-posts="false">
<div class="fb-xfbml-parse-ignore">
<blockquote cite="https://www.facebook.com/etutionlk">
<a href="https://www.facebook.com/etutionlk">Etution</a>
</blockquote>
</div>
</div>


Save it. !

Get Followers Gadget in blogger

To get the missing Followers Gadget.

Goto Dashboard > Layout  and click on add gadget link.

Click on Add Html/javascript gadget. Copy the link (Highlighted Link)

https://www.blogger.com/rearrange?blogID=296825920078443946&sectionId=sidebar&action=editWidget&widgetType=HTML&referrer=directory


Find the widgetType text and Change the HTML part of the text. See the Following link

https://www.blogger.com/rearrange?blogID=296825920078443946&sectionId=sidebar&action=editWidget&widgetType=Followers&referrer=directory

Paste the changed link in a different tab of your web browser. Press Enter !

Now You Can add Followers Gadget to your blogspot blog.
Hit The Save Button.!

That's it !

Syntax Highlighting for blogspot blog

Before All, Take a backup of your blogspot template. Now Goto Dashboard > Template > Edit HTML.

Search for </b:skin> tag of your blogspot template. Paste below css code before the  </b:skin> Tag.

How to get data from json in amchart

I have Created pie chart using javascript amchart plugin. So I need to get data from json object. These data
stored in database.I am working in codeignitor framework. It is a php framework.

I have written code to get data from database.

function getCountJSON($first_tbl, $first_tbl_field, $second_tbl, $second_tbl_field) {
        $result = $this->gm->getQueryCount($first_tbl, $first_tbl_field, $second_tbl, $second_tbl_field);
        $result_array = array();

        foreach ($result as $r) {
            $result_array[] = array('country' => $r['country_name'], 'count' => $r['query_count']);
        }
        echo json_encode($result_array);
    }
Now I need to get my JSON Object by using ajax request. I used following code snippet to get data from ajax request.
AmCharts.loadJSON = function (url) {

                // create the request
                if (window.XMLHttpRequest) {
                    // IE7+, Firefox, Chrome, Opera, Safari
                    var request = new XMLHttpRequest();
                } else {
                    // code for IE6, IE5
                    var request = new ActiveXObject('Microsoft.XMLHTTP');
                }

                // load it
                // the last "false" parameter ensures that our code will wait before the
                // data is loaded
                request.open('POST', url, false);
                request.send();

                // parse and return the output
                return eval(request.responseText);
 />            };
I have taken the JSON object to javascript variable.
var chartData1 = AmCharts.loadJSON("ajax/getCountJSON/countries/country_name/customers/country_id");
I Got following Result in amchart.
Thank you !

How to import mysql database using commandline

Sometimes you have to import large databases to mysql. So you are normally using phpmyadmin to import these databases. but issue is that it takes much time to be imported to mysql. On behalf of this time taken, you have to face phpmyadmin timeout error.

So you can not import large databases using phpmyadmin. In this tutorial, I am going to show you how to use windows/Linux Commandline to import large databases to mysql.

Another app is currently holding the yum lock

I tried to install some packages on Centos by issuing yum commands. When I am trying yum command, I got an error message. Another app is currently holding the yum lock See the below Image.
I could not run the yum commands due to yum lock error. So I went to the /var/run directory and there was a file called yum.pid.  I opened it and remove the Number of pids inside the file.Saved it and issued youm commands !

It Works !

Second one is you can grep process that hold the yum lock. Issues following command.

ps aux | grep yum

Get the process id and kill them by using following command.

kill -9 process_id

It really Works to kill yum lock !

Count of duplicate values in mysql table

I had to join two different mysql tables to get data. My first table is customers table. It has a field called "country_id". See the Below Image

My Second Table is countries table. It also has a fields called "country_id" and "Country_name". See the Below Image.

My Task was that join two tables according to their country_id s and display distinct country_names and their count. See the Following Output.
So I have to Add Following mysql query to my code.

SELECT DISTINCT( `countries`.`country_name` )  AS country_name,                
Count(`customers`.`country_id`) AS country_count FROM   `customers`        
INNER JOIN `countries`                
ON `customers`.`country_id` = `countries`.`country_id` 
GROUP  BY `countries`.`country_name` 
HAVING `country_count` > 1 
ORDER  BY country_count DESC  

Above sql query works for me to get above output.