Friday, October 19, 2012

What is MVC (Model View Controller): Defination and Advantages

Model–View–Controller (MVC) is a design pattern for user-facing software that separates the representation of information from the user's interaction with it. It has following 3 components:

Model: The Model is the part of the application that handles the logic for the application data. Often model objects retrieve data (and store data) from a database.

View: The View is the parts of the application that handles the display of the data. Most often the views are created from the model data.

Controller: The Controller is the part of the application that handles user interaction. Typically controllers read data from a view, control user input, and send input data to the
model.


Advantages of MVC

1. The MVC separation helps you manage complex applications, because you can focus
on one aspect a time.

For example, you can focus on the view without depending on the business logic. It also
makes it easier to test an application.

2. The MVC separation also simplifies group development. Different developers can
work on the view, the controller logic, and the business logic in parallel.

Thursday, October 18, 2012

HTML5: List of New Features

HTML5: List of New Features

1. In HTML5, there is only one <!doctype> declaration: <!DOCTYPE html>

2. HTML5 is totally based on HTML, CSS, DOM, and JavaScript.

3. HTML5 includes new elements for better structure, better form handling, drawing, and for media content.

4. HTML5 has much more markups to replace scripting.

5. HTML5 has new form controls, like calendar, date, time, email, url, search.

6. HTML5 has new content-specific elements, like <article>, <aside>, <footer>, <header>, <nav>, <section>, <details>, <summary>, <figure>, <progress> etc.

7. Media Elements: HTML5 eliminates the need of Flash. HTML5 has added new media elements like <video>, <audio>, <source>, <embed>, <track> for media playback.
  
   <video width="320" height="240" controls="controls" autoplay="autoplay">
      <source src="movie.mp4" type="video/mp4">
      Your browser does not support the video tag.
   </video>
  

   <audio controls="controls">
       <source src="horse.ogg" type="audio/ogg">
      <source src="horse.mp3" type="audio/mpeg">
      Your browser does not support the audio element.
   </audio>

The control attribute adds audio controls, like play, pause, and volume.

You should also insert text content between the <audio> and </audio> tags for browsers that do not support the <audio> element.

The <audio> element allows multiple <source> elements. <source> elements can link to different audio files. The browser will use the first recognized format.

8. Canvas Element: HTML5 has <canvas> element for 2D drawing. The HTML5 <canvas> element is used to draw graphics, on the fly, via scripting (usually JavaScript).
The <canvas> element is only a container for graphics. You must use a script to actually draw the graphics. Canvas has several methods for drawing paths, boxes, circles, characters, and adding images. A canvas is a rectangular area on an HTML page, and it is specified with the <canvas> element. 
 
<canvas id="myCanvas" width="200" height="100" style="border:1px solid #000000;"></canvas>

You can use following javascript code to draw a 2 dimensional rectange and fill it with red color:
 
<script>
   var c=document.getElementById("myCanvas");
   var ctx=c.getContext("2d");
   ctx.fillStyle="#FF0000";
   ctx.fillRect(0,0,150,75);
</script> 
The default fillStyle is #000000 (black).

9. Local Storage: HTML5 supports local storage and replaces the need of cookies. With HTML5, web pages can store data locally within the user's browser.

Earlier, this was done with cookies. However, Web Storage is more secure and faster. The data is not included with every server request, but used ONLY when asked for. It is also possible to store large amounts of data, without affecting the website's performance. The data is stored in key/value pairs, and a web page can only access data stored by itself.
 
10. HTML5 Web Worker Feature: A web worker is a javaScript running in the background, without affecting the performance of the page. When executing scripts in an HTML page, the page becomes unresponsive until the script is finished. A web worker is a javaScript that runs in the background, independently of other scripts, without affecting the performance of the page. You can continue to do whatever you want: clicking, selecting things, etc., while the web worker runs in the background.

11. HTML Server-Sent Events(SSE) Feature(One Way Messages): A server-sent event is when a web page automatically gets updates from a server. This was also possible before, but the web page would have to ask if any updates were available. With server-sent events, the updates come automatically.

Examples: Facebook/Twitter updates, stock price updates, news feeds, sport results, etc.
 
12. HTML5 Application Cache Feature: HTML5 introduces application cache, which means that a web application is cached, and accessible without an internet connection.

Application cache gives an application three advantages:
  • Offline browsing - users can use the application when they're offline
  • Speed - cached resources load faster
  • Reduced server load - the browser will only download updated/changed resources from the server

13. Geolocation: HTML5 supports Geolocation API which is used to get the geographical position of a user.

14. Drag and Drop: HTML5 supports Drag and Drop feature.

15. SVG: HTML5 has support for inline SVG(Scalable Vector Graphics).

16. HTML5 is device independent.

17. HTML5 has better error handling.

18. Removed Elements: HTML5 has removed <acronym>, <applet>, <basefont>, <big>, <center>, <dir>, <font>, <frame>, <frameset>, <noframes>, <strike> and <tt> elements.

Wednesday, October 17, 2012

7 Points of arrogance you should avoid at your workplace

Whether you’ve snagged your first job or shifted to a new one recently, you need to follow work etiquette. Here are the habits, attitudes and behaviour patterns that are a strict no-no at the workplace.

1. I don’t need to be punctual

Timing is essential. You’re a professional now and a ’sorry, my brother spilt milk over my homework’ excuse isn’t going to work. Your assignment should be finished before the deadline, with enough time to spare, so that you can polish it. Unlike college, a ‘C’ grade-even once-does matter. If you disappoint your seniors, getting another chance is going to be tough. If your office doesn’t run on a 9-to-5 schedule, ensure that you have a fixed time for coming in and leaving, so that your colleagues can rely on you to be available during those hours.

2. I want everything, now

Instant gratification may be your buzzword, but it’s not going to work at office. You cannot accumulate five years worth of experience in one year, nor can you get the hefty salaries your senior colleagues do. You will only get what your employers believe you’re worth. “A mistake often made by freshers is that they run after high-paying jobs. In the initial stages, don’t mix career and money.

Your priority should be the job profile based on your capabilities, which will help you hone your skills and grow. Once you’re established, the money will come. Just putting in your best may not be enough. Your efforts will also have to be fruitful. If you expect more compensation, remember that the worth of the individual should increase along with the cost.

3. This is all I’m going to do

If you stick rigidly to your job description, you may miss out on opportunities to be noticed. Take up tasks beyond the routine ones, especially those that can demonstrate your untapped talents. This also proves that you’re willing to take initiative.

If you are new, you may get saddled with jobs that others don’t want or hours nobody else is willing to put in. If you grumble at being given extra work, it may put off your superiors. Accept projects on the basis of where you want to be after three years. If you want to replace your boss, you will have to work more than you would to justify your salary.

4. I’m the only one who made it a success

No man is an island, especially not in crowded cubicles. In an office, you need to work as a team. If you do well, give credit where it’s due, especially to your juniors. Even if you don’t get along with someone, be polite. There’s no place for anger or tantrums at the workplace.
Remember, your electronic mails are being sent through your employer’s server, so bad-mouthing someone on mail or chats in the office could lead to an embarrassing fiasco. Don’t crib about your colleagues’ work profile or the fact that they are favoured. Your talent cannot remain hidden for long, neither can other people’s incompetency. You’ll look like a fool if your own work falls short of the mark.

5. What’s a network?

You may be a genius, but there will be times when you hit a roadblock. This is when your network of peers will come to your rescue as you can take their advice. It also helps you stay abreast of the latest issues in your field. Keep in touch with college mates, mingle during conferences and functions, and join a professional networking site.

However, ensure that you don’t mix personal and professional lives. Avoid adding colleagues and bosses to your friends’ list on social networking sites. Even if you don’t post an inappropriate message about your workplace , there’s no way of ensuring that your friends won’t.

6. I know everything there is to know

No job is secure forever. The business landscape is changing constantly and if you don’t want to be a dinosaur, you’ll have to upgrade your skills regularly. You need to stay on a par with colleagues and others vying for your job. Don’t expect past accomplishments to suffice. Learn constantly, especially from your mistakes. If a senior corrects you, don’t sulk or complain. You’ll not only exasperate your boss, but end up repeating your mistake and never learn.

7. I’m the best, I’m irreplaceable, I deserve that promotion

If you believe you are the only one who can do the job right, back your conviction with accomplishments. There’s a difference between boasting and delivering. This doesn’t mean that you shouldn’t promote yourself, but do it subtly. Before you jump at the chance to be promoted, ask yourself: am I prepared for it?

A promotion not only means more professional responsibilities, but also changes in personal life. Make sure you are ready to shoulder these.

If you aren’t, the step may backfire and destroy chances of future promotions. Don’t promise to get something done without ensuring that it is achievable. In the early stages of your career, there are more options as there are more jobs, but these reduce as you move up.

At a senior position, you need to be stable in a job for 2-3 years and learn everything about the company before you opt for a promotion. Jumping too soon may set your career back by 4-5 years.

5 ways to deal with negetive energy in the workplace

Negative energy can make the workplace environment unpleasantly heavy, and affect employee and organisational productivity. Here are some tips to counter negative energy.

1. Approach the source of energy

It is important to identify and approach the source of negative energy, especially if an individual is creating problems for a larger set of people.

It is important to approach such individuals and find out why such negative energy is getting generated.

Once you have identified the source and approached him, communicate well to understand where the problem lies.

2. Communicate Well

It is not necessary that just one individual is at fault.

You need to make a new employee understand the culture of your organisation. Things work differently in different places and people need this. Keep the communication lines open.

3. Take feedback in a positive spirit

Listen to both the parties who feel the the negative energy and take their feedback positively. It is important to understand here that everyone is hoping to be heard.

The first step towards creating positive energy would be to make everyone feel special, as someone who is adding value to the organisation.

Say something positive to your employees.

4. Get some exercise

Negative energy in organisations happens for various reasons, but one big cause is when growth is slow and employees feel the pinch.

Such negative energy needs to be tackled at two levels — individual and organisational.

5. Create an ecosystem

Organisations can create a formal ecosystem that provides for dealing with negative energy. This could include phone-based or face-to-face third party counselling, meetings conducted on a periodic basis and ensuring that employees have a formal channel of communication.

This allows for sharing fundamental issues that could give rise to negative energy. Other than that, a leader has to be sensitive and perceptive to sense the build-up of such energy to begin with.

Tuesday, October 16, 2012

Importance of Employee Referral Programs in an organization

There are several pros of an Employee Referral Program at any organization.

1. Make the complete Recruitment process more effective by increasing the sources of good credential candidates.

2. To, motivate the current employees to partner in Talent Acquisition through attractive referral incentives.

3. Provide the employer a pool of Qualified and potential candidates.

4. Candidates referred by employees also tend to be of higher quality because the referring employee usually screens his or her referrals closely.

Every Organization is highly conscious and affirmative on the quality of Manpower / Talent Acquisition. You can perhaps do a comparative analysis on the quality of Management time spent on Hiring through other conventional channels vis-à-vis a sound Employee Referral program to see the difference. Employee Referral programs are not only a strong tool of cost optimization but also make the complete Recruitment process more effective by increasing the possibilities of good credential candidates.

The basic objective of any Employee Referral program is to make the complete Recruitment process more effective by increasing the sources of good credential candidates. And motivate the current employees to partner in Talent Acquisition through attractive referral incentives. However, following aspects need to be considered on utmost top priority while managing / implementing a Referral program at your organization.

You must communicate the precise job descriptions with Assessment / Qualification process with complete visibility to all the Employees with suitable rewards / incentives on closures within the stipulated time frame. The process of reviewing every job application needs to be transparent with feedback sharing sessions on time, and formal communication on results. Also, the organization must emphasize on formal communication while rewarding the referees.

How to set background image and color at runtime in Delphi XE2?

Sometimes we need to change the background image and background color of our delphi
from at runtime. In this article, I have tried to cover this topic.

I have stored 2 images in a folder 'Images'. I have stored the path and name of the image in a table and also the background color of the form (like clSkyBlue, clOlive). I will just pick the
path / name of the image and the background color at runtime from database and assign it to the delphi form.

Note: Background image occupies half height of the delphi form and rest background color is visible.

I will have to create 2 variables like:

FormImage : TImage;
FormPicture : TPicture;

Now I will use FormShow procedure to load image and background color at runtime.

procedure TMyClass.FormShow(Sender: TObject);
var
  ImagePath, BackColor: string;
begin
  try
     //ImagePath := Fetch from database and assign to it.
     //BackColor := Fetch from database and assign to it.
     FormPicture := TPicture.Create;
     FormPicture .LoadFromFile('.\Images\' + ImagePath);
     FormImage.Picture.Assign(FormPicture);
     myForm.Color := StringToColor(BackColor);
  except
    on E : Exception do
    begin
      ShowMessage('Some error occured in procedure FormShow: ' + E.Message);
    end;
  end;
end;

Explanation

First of all, create constructor of TPicture.
Then, use LoadFromFile to load the image to TPicture object.
Then, assign that TPicture to TImage object.
Then, assign back ground color to the delphi form.
 

10 Ways to get a stress-free salary-hike

The question is not how to change jobs often enough so that you can get a hike in your salary package. The question you should be asking yourself is, now that I’m in this job, how can I plan to get a raise? Plan to get a raise? Yep. That’s my point exactly! For the most part, getting a raise is in your hands.

Of course there will be times in your career, where you will be offered fabulous job opportunities out of the blue, with even more fabulous pay packages. In times like that, you are able to see what a company thinks you are worth and the value they attach to your talent and skill-sets. That is certainly a stress-free raise, but this article will not cover times like that.

When you are in a good job, and the only thing that needs changing is the maximum limit of your salary package, here are some methods you can use to help you achieve that hike.

1. Become more compatible/ friendly with your boss, thereby ensuring a good raise.

2. Don’t beg. Begging is for beggars who don’t have a job. You’ve got one, so don’t do it.

3. Don’t underestimate yourself. Your employers will value you only as much as you value yourself. Even if you are going through a low patch in self-confidence, use your acting skills and portray a calm, collected and confident you.

4. Make sure you are aware of the company’s financial standing. If the company is sinking ship and completely broke, your best salary option may be to just leave rather than to look like a hawk preying on the company when they are at their weakest.

5. Keep a track of the work you do. When it comes time for an appraisal and salary hike request, you’ll be glad you did. Keeping these ensures you can always refer back to them if or when you’re asked what you contribute to the company. Even if you just make or take calls, keep a log of how many you successfully did, how many you did in total, satisfied customers, etc.

6. Find out the market norms for someone with your work experience and your level. If you are a fresher, it’d be pretty pointless to request the salary package of a CEO.

7. If your suggested salary doesn’t fly, have another alternative to offer. This doesn’t mean bargaining like you would at the fish market either.
Ex: “10 dollars?”
“No can do.”
“Okay, 9.5 then?”
That is pointless. Instead offer a different alternative such as: “Then could you do this by the end of next month?”

8. Pick a sensible time to make your salary hike suggestion. When the boss calls in sick from home, that is NOT the right time to ask for one. Similarly, if he or she is rushing out for an important appointment with a client…clearly, that’s not the right time.

9. Don’t make it personal. That just gets on people’s nerves since no one likes to feel inferior. Example: “Well you never appreciate my work. It’s as if you don’t care about little ol’ me.” Instead try asking after your boss has complimented you on your top performance at work.

10. If your boss says the classic ‘not now’ don’t go bitching behind their back to the rest of the team. That will not earn you a raise…not even after a year.