31 May 2007

Generate Great Ideas at Work

Success at work is often a result of combining knowledge, skills and the ability to inject your work environment with fresh and breakthrough ideas.

Exercise your mind

Your mind, like your body, needs exercise and can get it through challenges and problem-solving. A good way to feed your mind is to read a lot and study the success stories of other businesses and entrepreneurs.

Read case studies related to your industry or biographies of successful people.

This will not only stimulate your grey cells but also provide you a dose of inspiration. Learn how other successful people generate breakthrough ideas.

Capture your thoughts

When the brilliant spells do come, make sure you capture them. Don't rely on mental notes, you'll surely forget them. Have a notepad, PDA or voice recorder ready at all times, even next to your bed at night (who knows, you may suddenly strike gold at 2 am). Once you've recorded your idea, use it as soon as you can. I read an advertisement for IT company Accenture, which said: "An idea is like a cup of coffee, it's not going to stay hot forever." So remember that ideas are best when they're fresh.

Change your setting

Your mind reacts to its surroundings and has an uncanny ability to generate new ideas when the physical setting changes. You may be thinking in a very linear and academic way while you are at your workstation, so take your laptop/PDA and sit by in your office garden/park or cafeteria and you may see some fresh perspectives. Take a walk or hit the gym. The mind is agile when the body is indulging in a disciplined and rhythmic physical activity like a jog or workout. For all you know, a change of setting may bring you the inspiration you need.

Go out of your way to help others

Step out of your job description once in a while and help others with their tasks. Do this without having to be asked. Saying, "Need a hand there?" has a two-fold effect. First, you encourage others to give of themselves, creating a more positive workplace.

Second, you buy yourself a future favour, since kindness always comes back. The people you have helped will become soundboards for your ideas and will be able to give you new ideas and suggestions that may get you thinking on a new track.

Know your organisation's and customers' needs

You must know if what you have to offer is in high demand at work. Find out the direction in which your company is headed and the areas in which it needs maximum improvement. This will ensure that you ideas have a business impact and act as a catalyst in your growth within the organisation. Tailor your ideas to meet the organisational objectives and you will be in a position to add maximum benefit to your organisation.

Understand your work environment
In today's teamwork-oriented work environments, no man is an island. You are always a part of the bigger picture that the organisation has in mind. Expose yourself to different realities.

Google.com founders Larry Page and Sergey Brin were batchmates at Stanford when the thought of empowering people by creating an easy search mechanism hit them. The Naukri.com advertisement depicting Hari Sadu as the monster boss is a good example of out-of-the-box thinking, because it mixes humour with a message.

So keep your eyes and ears open and indulge in some idea generation activities.

29 May 2007

TEAM Works

There are few jobs that don't require us to interact with colleagues in a team. For the most part, we need to work cohesively with others at our workplaces to achieve the organisational goals.

Participate

Whether it is meetings, brainstorming sessions, conference calls or any other activities, it is important that you participate wholeheartedly. If someone puts forward an idea, ask questions without restraint.

Speak your mind freely but, of course, remember to be inoffensive.

Keep the common goal in mind

The formal definition of teamwork is 'cooperative effort' by the members of a group or team to achieve a common goal.

Be open-minded

Often, you may put forth ideas that will be mulled over by the team as a whole and may eventually be rejected. Be broad-minded and confident enough to accept this. Use this opportunity to get feedback on your ideas such that it helps improve your thinking process for the future.

Be clear about your role

Help your teammates and your leader

If your peer is stuck with a problem he or she can't resolve alone, assist him in solving the issue by all means. Of course, this doesn't mean you do all his work for him or even that you neglect your own duties completely.

One of the best ways to help your supervisor is to keep him or her updated at all times about the percentage completion of your work. It may be a short daily e-mail, or even a daily status meeting by which you can do this.

Don't be the dominating one

If one person takes up the floor and tries to steamroll others with his ideas, it can only have a negative effect. The team member who does this is usually the most annoying person, who tries to force his ideas and opinions on everyone.


Don't forget to have fun!

A team should always take the opportunity to meet in a relaxing unofficial environment where there is no talk of a project or its problems, even if it means just going to the office canteen for a cup of coffee.

Always remember the other popular expansion of TEAM: Together Everyone Achieves More.

28 May 2007

Never overlook a customer complaint!!!

An Interesting Story

Never underestimate your Clients' Complaint, no matter how funny it might seem!

This is a real story that happened between the customer of General Motors and its Customer-Care Executive. Pls read on.....

A complaint was received by the Pontiac Division of General Motors:

'This is the second time I have written to you, and I don't blame you for not answering me, because I sounded crazy, but it is a fact that we have a tradition in our family of Ice-Cream for dessert after dinner each night, but the kind of ice cream varies so, every night, after we've eaten, the whole family votes on which kind of ice cream we should have and I drive down to th e store to get it. It's also a fact that I recently purchased a new Pontiac and since then my trips to the store have created a problem.....

You see, every time I buy a vanilla ice-cream, when I start back from the store my car won't start. If I get any other kind of ice cream, the car starts just fine. I want you to know I'm serious about this question, no matter how silly it sounds "What is there about a Pontiac that makes it not start when I get vanilla ice cream, and easy to start whenever I get any other kind?" The Pontiac President was understandably skeptical about the letter, but sent an Engineer to check it out anyway.

The latter was surprised to be greeted by a successful, obviously well educated man in a fine neighborhood. He had arranged to meet the man just after dinner time, so the two hopped into the car and drove to the ice cream store. It was vanilla ice cream that night and, sure enough, after they came back to the car, it wouldn't start.

The Engineer returned for three more nights. The first night, they got chocolate. The car started. The second night, he got strawberry. The car started. The third night he ordered vanilla. The car failed to start.

Now the engineer, being a logical man, refused to believe that this man's car was allergic to vanilla ice cream. He arranged, therefore, to continue his visits for as long as it took to solve the problem. And toward this end he began to take notes: He jotted down all sorts of data: time of day, type of gas uses, time to drive back and forth etc.

In a short time, he had a clue: the man took less time to buy vanilla than any other flavor. Why? The answer was in the layout of the store. Vanilla, being the most popular flavor, was in a separate case at the front of the store for quick pickup. All the other flavors were kept in the back of the store at a different counter where it took considerably longer to check out the flavor.

Now, the question for the Engineer was why the car wouldn't start when it took less time. Eureka - Time was now the problem - not the vanilla ice cream!!!! The engineer quickly came up with the answer: "vapor lock".

It was happening every night; but the extra time taken to get the other flavors allowed the engine to cool down sufficiently to start. When the man got vanilla, the engine was still too hot for the vapor lock to dissipate.

Even crazy looking problems are sometimes real and all problems s4eem to be simple only when we find the solution, with cool thinking.

What really matters is your attitude and your perception.

25 May 2007

Datagrid Event Property

Use datagrid's event property tab in order to add edit event.

ACE Personal Interview

The key to acing personal interviews lies in doing an objective analysis of what you have done in the past, what you are doing presently and finally what you intend to do in the future. Visualise yourself doing well, practise a lot and success will be yours.

Well, here's some food for thought.

Extra-curriculars/ Hobbies
Extra-curricular activities can be broadly defined as activities that are pursued formally, apart from your academic or curricular activity. For example, you could have participated in debates, dramatics or some sports along with your formal education.

Hobbies, on the other hand, are activities you are really passionate about and will do anything to follow. In a nutshell, the difference between an extracurricular activity and a hobby is the level of passion involved.

Do some serious introspection over your extracurricular activities and/ or hobbies. Try and formulate answers to the following questions:
- What have I learnt from this activity?
- Is there any synergy between this activity and my chosen profession? If so, how?
- How will I continue with this activity after I start work, when I am faced with time constraints?
- What does this activity/ hobby say about me as a person?

If hobbies are 'things you are really passionate about', it is expected you will brush up your knowledge about them.

General awareness
This area may or may not be touched upon, but if it is, the purpose is to check how alive and sensitive the candidate is to his socio-political and economic ecology. The purpose may also be to check the candidate's maturity and reasoning ability.

At this stage, you should know the difference between General Knowledge and General Awareness.

Knowing the name of the island in which Tokyo is based is general knowledge. Understanding the difference between Fundamental Rights and Directive Principles of state policy is general awareness. To cite another example, knowing the name of the wind blowing across the Alps is GK, while understanding the problems caused by terrorism is GA.

Career goals
-What you need to do is to spend some time thinking:
-What made you choose your undergraduate stream?
-Why (if at all) are you moving away from pursuing higher studies/ career in that field?
-Why are you interested in management as a career?
-When and how did you first become interested in management?
-What specialisation within management would interest you (given your knowledge and inclinations at present)?
-What are your plans after an MBA?
-Where do you see yourself five years down the line?
-Where do you see yourself 10 years down the line?

Personality
Personality is an outward manifestation of your character. Personality can be developed or groomed; character is more internal. Thinking on these lines will help you handle questions like:

-What are you like as a person?
-What are your strengths and weaknesses?
-Why do you think they are strengths and weaknesses?
-When have you demonstrated these strengths and weaknesses?
-What are you doing about your weaknesses? (When mentioning a weakness in the interview, always mention the action you are taking to get rid that weakness)
-How do you visualise success? What role does it play in your life?
-Has success changed you in any way? How?
-What are your priorities in life, and why?
-List down the three most important events in your life in chronological order. Please state your reasons for choosing these.
-What is your dream in life?
-Describe a personal or familial crisis that you had to go through in your life? How did you handle the crisis? What special qualities do you think you possess that helped you deal with the crisis?
-Who is your role model? Why?

24 May 2007

Stored procedure to send Mails in SQL

--All leave application should be answered within 48 hours at the maximum.
--Unanswered leave applications will go to Vishal/kanika straight away after 48 hours.
--Later you can use it in SQL Job as well

CREATE Procedure sn_SMTPMail
AS
SET nocount on

declare @oMail int --Object reference
declare @resultcode int

--EXEC @resultcode = sp_OACreate 'CDONTS.NewMail', @oMail OUT

if @resultcode = 0

BEGIN

DECLARE @t int
DECLARE @str varchar(200)
DECLARE cur CURSOR FOR Select id from tablename
OPEN cur FETCH NEXT FROM cur INTO @t WHILE @@FETCH_STATUS = 0 BEGIN SET @str = 'Leave id: ' + cast(@t as varchar(20)) + ' is due more than 48 hours. Please Take Appropriate Action. ' EXEC @resultcode = sp_OACreate 'CDONTS.NewMail', @oMail OUT EXEC @resultcode = sp_OASetProperty @oMail, 'From', 'janki_shah@yahoo.com'
EXEC @resultcode = sp_OASetProperty @oMail, 'To', 'jankit_shah@yahoo.com'
--EXEC @resultcode = sp_OASetProperty @oMail, 'HTMLBody', 0
EXEC @resultcode = sp_OASetProperty @oMail, 'Subject', 'Reminder'
EXEC @resultcode = sp_OASetProperty @oMail, 'Body', @str
EXEC @resultcode = sp_OAMethod @oMail, 'Send', NULL
EXEC sp_OADestroy @oMail

FETCH NEXT FROM cur INTO @t
END
CLOSE cur
DEALLOCATE cur

END
SET nocount off

GO

Remove Cache From ASPX page

Response.Cache.SetCacheability(HttpCacheability.NoCache)

23 May 2007

10 most important security issues and solutions in PHP (though I was able to get only 8)

Best way to prevent and handle all type of security issues is ‘not to trust user’s input data’ and handle it smartly.

a. Register Globals
1. With register_globals enabled, this page can be requested with ?authorized=1 in the query string to bypass the intended access controls. Without it, ordinary global variables (such as $authorized in the example) are not affected by data submitted by the client.

2. With register_globals enabled, this page can be requested with virtual address of a page and if allow_url_fopen is enabled (which it is by default) then this will include the output as a common local file, user can save the file on his / her desktop.A best practice is to initialize all variables and to develop with error_reporting set to E_ALL, so that the use of an uninitialized variable won't be overlooked during development.

b. Data Filtering
This is independent of programming language or platform. It involves the mechanism by which you determine the validity of data that is entering and exiting the application, and a good software design can help developers to:Options to ensure that data filtering can not be bypassed vary but one general approaches are given here.1. The Dispatch MethodTo have a single PHP script available directly from the web. Based on the information received, one can make conditional use of include file.for ex., if query string has a variable named about us then include aboutus.php and if it has value contactus then use contactus. Another ex., Each form that is submitted is expected to have a form variable named form that uniquely identifies it, and security.inc has a separate case to handle the data filtering for that particular formThis type of conditional include is not possible in ASP.

c. Session ID Protection
Session ID hijacking can be a problem with PHP Websites. The PHP session tracking component uses a unique ID for each user's session, but if this ID is known to another user, that person can hijack the user's session and see information that should be confidential. Session ID hijacking cannot completely be prevented; you should know the risks so you can mitigate them.A user who creates a new session by logging in should be assigned a fresh session ID using the session_regenerate_id function. A hijacking user will try to set his session ID prior to login; this can be prevented if you regenerate the ID at login.

d. Better inbuilt encryption functions
To encrypt any info is some times a crucial necessity in web page. PHP had MD5 as one of the standard encryption function. The benefit of this function is, it’s encrypted value can not easily be decrypted to original text. So chances for any hijacking of encryption’s originals text is very low.

e. Cross Site Scripting (XSS) Flaws
Cross site scripting, or XSS, flaws are a subset of user validation where a malicious user embeds scripting commands -- usually JavaScript -- in data that is displayed and therefore executed by another user.This can be prevented by using htmlspecialchars.

f. SQL Injection Vulnerabilities
SQL injection vulnerabilities are yet another class of input validation flaws.SELECT * FROM users WHERE name='$username' AND pass='$password';

However, if the user who's logging in is devious, he may enter the following as his password:

' OR '1'='1

This results in the query being sent to the database as:

SELECT * FROM users WHERE name='known_user' AND pass='' OR '1'='1';

This will return the username without validating the password -- the malicious user has gained entry to your application as a user of his choice. To alleviate this problem, you need to escape dangerous characters from the user-submitted values, most particularly the single quotes ('). The simplest way to do this is to use PHP's addslashes() function.If you're developing software that may be installed on shared servers where you might not be able to change the php.ini file, use code to check that status of magic_quotes_gpc and, if it is turned on, pass all input values through PHP's stripslashes() function. You can then apply addslashes() to any values destined for use in database queries as you would normally.

if (get_magic_quotes_gpc()){
$_GET = array_map('stripslashes', $_GET);
$_POST = array_map('stripslashes', $_POST);
$_COOKIE = array_map('stripslashes', $_COOKIE);
}The best habit is to make a reusable type of function for each input variable which can addslashes (if magic quotes are disabled) and also check max length and truncate all the characters after that length.

g. safe_mode
The safe mode setting can be very useful to prevent unauthorized access to local system files. It works by only allowing the reading of files that are owned by the user account that owns the executing PHP script. If your application opens local files often, consider enabling this setting.

h. disable_functions
This setting can only be set in your php.ini file, not at runtime. It can be set to a list of functions that you would like disabled in your PHP installation. It can help prevent the possible execution of harmful PHP code. Some functions that are useful to disable if you do not use them are system and exec, which allow the execution of external programs.

10 Advantages of PHP over ASP

Both ASP and PHP are languages used to build Dynamic Web sites that can interact with Databases and exchange information

a. PHP (Hypertext Pre-Processor) is an object oriented language. ASP is not really a language in itself, it's an acronym for Active Server Pages, the actual language used to programme ASP is Visual Basic Script or Jscript.

b. Online support is available for PHP while ms had dropped its support for ASP.

c. The PHP development team has an outstanding reputation for fixing bugs, and in order to streamline the process they even have an online system through which new bug reports can be submitted. Most bugs are resolved within 24 hours,

d. are a huge number of outstanding bugs in ASP which will probably never be fixed like ASP engine finishes its job of processing the code and then send the codes to users browser. From this point on words till again the page request comes back to server, there is no control of ASP on the page. So we should not expect ASP to perform some tasks which are likely to happen at the client browser end

e. PHP is both cross platform and open source, available for every major operating system and works with most web servers, while ASP works major on MS server.

f. You could make the point that PHP is a more mature language than ASP. ASP has only been around since 1996; PHP has been around since 1994, and has a huge base of developers working on it every waking minute of every day; bugs are usually fixed within minutes of being reported and new features are being integrated daily.

g. It is easily extendable by anyone capable of coding in C, and comes pre-bundled with more functionality than ASP could ever offer

h. Simple capabilities, such as FTP, data compression, file uploads, XML, MD5, encryption and email are not included in ASP and require expensive, third-party packages to be installed. All of this functionality and more are built right into PHP.

i. Complex functions such as dynamic images, IMAP, SNMP, dynamic flash, PDF, native access (non ODBC) to Oracle, Ovrimos, Postgre, Sybase, mSql, MSSQL, Ingres, Interbase and Informix databases, LDAP, and sockets, just to name a few, are available for free to any installation of PHP, but are not (and probably never will be) available with ASP.

j. ASP natively supports only Access and MSSQL, whereas PHP natively supports a huge number of databases.

k. MySQL is a database that PHP closely integrates with; it is a very powerful database that rivals Oracle in speed.

l. PHP, MySQL is free, and blows most other databases out of the water. Another hidden cost with ASP is the database angle; Microsoft expects you to develop using Access and when your webpage outgrows it, to switch to MSSQL, an extremely expensive option. What most people don't realize is how quickly you can outgrow Access.

m. While working with Access, you're technically limited to around 30 simultaneous connections, realistically it's closer to 5. Not many websites can survive such limitations. Most moderately sized websites require over 1000 simultaneous database connections. In addition, Access is SLOW. And you forego a lot of cool database functionality such as stability, transactions, replication, stored procedures, triggers, and so on. There are so many reasons not to use Access.

n. And finally, cost. PHP is free. ASP isn't free. If you want to use ASP, you have to use IIS, and if you want to use IIS, you have to buy Windows. Traditionally, the cost of Windows has been high. Microsoft has been aggressively trying to reduce this factor but they're hardly going to give Windows away for free. The cost of running an ASP-based website implies a full Windows server platform; development costs are higher, software licenses are expensive and speed, security and flexability are all sacrificed. but there are a couple of projects that allow ASP to run on other platforms and servers but guess what, most of them cost money.

o. PHP can be accessed by command prompt.

p. Perfomance and execution speed of a PHP script can be increased by Zend Optimizer whilest for ASP no such tools are available.

22 May 2007

Disadvantages of PHP

The most common and most severe security vulnerabilities in PHP scripts, and indeed in any Web application, are due to poorly validated user input

1) Calling External Programs
Call like system($userinput) or is insecure because it allows the user to execute arbitrary commands on the host.

2) Database Interactions
mysql_db_query
($DB, "SELECT something
FROM table WHERE name=$username");

In this example, the user can use a semicolon in the input to end the current query and supply arbitrary commands to the database. The input ";drop db database" will expand to the query string "SELECT something FROM table WHERE name=;drop db database", which will result in an error (because the first part of the query is now invalid) followed by a successful drop of the entire database.

3) URL Includes and Opens
include ("http://some.site.com/some_script.php");
It will know to fetch the file from the location and include it in your script. You can also open remote files for reading the same way. This can be potentially dangerous, since there is a possibility that the remote site is compromised or the network connection is spoofed. In either case, you are injecting unknown and possibly hostile code directly into your script with an include() like that

4) Unvalidated Input Errors
$month = $_GET['month'];

Here there is no such method to identify or handle this input variable. It can return in error.
The application works perfectly, as long as the specified month is a number between 1 and 12

However, a malicious user might append ";ls -la" to the year value and thereby see a listing of your Website's html directory. An extremely malicious user could append ";rm -rf *" to the year value and delete your entire Website!

Do not use Javascript validation for this; such validation methods are easily worked around by an exploiter who creates their own form or disables javascript. User preg_match or some regular expression for the same.

5) Include Files
Sometimes it happens that a PHP script needs to include other files as part of itself. A lot of programmers have a tendency to name those include files with a .inc extension. The problem here is that if the server is not aware that those files are actually parts of PHP scripts, it will just show the code to whoever requested it. This gives attackers the opportunity to study the code for security holes all they want and to see any hard-coded data that may be secret.

There are several ways to prevent this. One way is to name all include files with a .php extension (or .php3, or whatever the server associates with PHP) so that the server will interpret them instead of showing them.

Another possible solution is to associate .inc files with PHP. Yet another solution would be to prevent all .inc files from being displayed. In Apache, the last can be achieved by something like this a section in the httpd.conf file.

10 Advantages of PHP over ASP

Both ASP and PHP are languages used to build Dynamic Web sites that can interact with Databases and exchange information.

a. PHP (Hypertext Pre-Processor) is an object oriented language. ASP is not really a language in itself, it's an acronym for Active Server Pages, the actual language used to programme ASP is Visual Basic Script or Jscript.

b. Online support is available for PHP while ms had dropped its support for ASP.

c. The PHP development team has an outstanding reputation for fixing bugs, and in order to streamline the process they even have an online system through which new bug reports can be submitted. Most bugs are resolved within 24 hours,

d. are a huge number of outstanding bugs in ASP which will probably never be fixed like ASP engine finishes its job of processing the code and then send the codes to users browser. From this point on words till again the page request comes back to server, there is no control of ASP on the page. So we should not expect ASP to perform some tasks which are likely to happen at the client browser end

e. PHP is both cross platform and open source, available for every major operating system and works with most web servers, while ASP works major on MS server.

f. You could make the point that PHP is a more mature language than ASP. ASP has only been around since 1996; PHP has been around since 1994, and has a huge base of developers working on it every waking minute of every day; bugs are usually fixed within minutes of being reported and new features are being integrated daily.

g. It is easily extendable by anyone capable of coding in C, and comes pre-bundled with more functionality than ASP could ever offer

h. Simple capabilities, such as FTP, data compression, file uploads, XML, MD5, encryption and email are not included in ASP and require expensive, third-party packages to be installed. All of this functionality and more are built right into PHP.

i. Complex functions such as dynamic images, IMAP, SNMP, dynamic flash, PDF, native access (non ODBC) to Oracle, Ovrimos, Postgre, Sybase, mSql, MSSQL, Ingres, Interbase and Informix databases, LDAP, and sockets, just to name a few, are available for free to any installation of PHP, but are not (and probably never will be) available with ASP.

j. ASP natively supports only Access and MSSQL, whereas PHP natively supports a huge number of databases.

k. MySQL is a database that PHP closely integrates with; it is a very powerful database that rivals Oracle in speed.

l. PHP, MySQL is free, and blows most other databases out of the water. Another hidden cost with ASP is the database angle; Microsoft expects you to develop using Access and when your webpage outgrows it, to switch to MSSQL, an extremely expensive option. What most people don't realize is how quickly you can outgrow Access.

m. While working with Access, you're technically limited to around 30 simultaneous connections, realistically it's closer to 5. Not many websites can survive such limitations. Most moderately sized websites require over 1000 simultaneous database connections. In addition, Access is SLOW. And you forego a lot of cool database functionality such as stability, transactions, replication, stored procedures, triggers, and so on. There are so many reasons not to use Access.

n. And finally, cost. PHP is free. ASP isn't free. If you want to use ASP, you have to use IIS, and if you want to use IIS, you have to buy Windows. Traditionally, the cost of Windows has been high. Microsoft has been aggressively trying to reduce this factor but they're hardly going to give Windows away for free. The cost of running an ASP-based website implies a full Windows server platform; development costs are higher, software licenses are expensive and speed, security and flexability are all sacrificed. but there are a couple of projects that allow ASP to run on other platforms and servers but guess what, most of them cost money.

o. PHP can be accessed by command peompt.

Sending mails in .NET & C#

My ideal method to send standard html mails through an application is by reading an html file and replacing its content with final data and send it.

I was very much familiar and proficient in ASP and PHP, now i tried the same with ASP.NET C# and the details of the same are given below:


string path = Request.MapPath("leave_mail_tpl.html");
//Session["eid"]
//opening a file
//FileStream file = new FileStream("leave_mail_tpl.html");
//reading a file
StreamReader sr = new StreamReader(path);
string mailbody = sr.ReadToEnd().ToString();
sr.Close();


mailbody = mailbody.Replace("empname", empname);
and so on for all the replacable elements.


MailMessage msg = new MailMessage();
//System.Text.StringBuilder str = new System.Text.StringBuilder();
msg.To=toemail;
msg.Cc = ccemail;
msg.From =fromemail;
msg.Subject = "A Leave Request from " + empname;
msg.BodyFormat = MailFormat.Html;
msg.Body = mailbody.ToString();
try
{
SmtpMail.SmtpServer= "ip adress";
SmtpMail.Send(msg);
}
catch(Exception ex)
{
// show success message
}

21 May 2007

SQL DO's and DONT's

DO know your tools.

Spend a weekend at MSDN and browse through all T-SQL commands

DON'T use cursors

They should be your preferred way of killing the performance of an entire system. Did you know that every FETCH being executed has about the same performance of executing a SELECT? This means that if your cursor has 10,000 records, it will execute about 10,000 SELECTs! If you can do this in a couple of SELECT, UPDATE or DELETE, it will be much faster.

I have never seen cursors being well used, except for DBA work. And good DBAs, most of the time, know what they are doing. But, if you are reading this, you are not a DBA, right?

DO normalize your tables

There are two common excuses for not normalizing databases: performance and pure laziness.
Often I see programmers de-normalizing databases because "this will be slow". And, more frequent than the inverse, the resulting design is slower. DBMSs were designed to be used with normalized databases, so design with normalization in mind.

DON'T SELECT *

try to specify only the columns you'll need. This will:
- Reduce memory consumption and network bandwidth
- Ease security design
- Gives the query optimizer a chance to read all the needed columns from the indexes

DON'T create an index on the "Sex" column

How indexes speed up table access?

You can see indexes as a way of quickly partitioning a table based on a criteria.

If you create an index with a column like "Sex", you'll have only two partitions:
Male and Female.

What optimization will you have on a table with 1,000,000 rows? Remember, mantaining an index is slow. Always design your indexes with the most sparse columns first and the least sparse columns last, e.g, Name + Province + Sex.

DO use transactions

Specially on long-running queries. This will save you when things get wrong.

DON'T open large recordsets

A common request on programming forums is: "How can I quickly fill this combo with 100,00 items?". Well, this is an error. You can't and you shouldn't. First, your user will hate browsing through 100,000 records to find the right one. A better UI is needed here, because you should ideally show no more that 100 or 200 records to your users.

DON'T do SELECT max(ID) from Master when inserting in a Detail table.

This is another common mistake, and will fail when two users are inserting data at the same time. Use one of SCOPE_IDENTITY, IDENT_CURRENT, and @@IDENTITY. Avoid @@IDENTITY if possible because it can introduce some nasty bugs with triggers.

DON'T use the TEXT datatype

Unless you are using it for really large data. The TEXT datatype is not flexible to query, is slow and wastes a lot of space if used incorrectly. Sometimes a VARCHAR will handle your data better.

DO use referential integrity

This can be a great time saver. Define all your keys, unique constraints and foreign keys. Every validation you create on the server will save you time in the future.

19 May 2007

Planning a Project

The success of a project will depend critically upon the effort, care and skill you apply in its initial planning. This article looks at the creative aspects of this planning.

THE SPECIFICATIONA specification is the definition of your project: a statement of the problem, not the solution.

The outcome of this deliberation should be a written definition of what is required, by when; and this must be agreed by all involved. There are no short-cuts to this; if you fail to spend the time initially, it will cost you far more later on.

The agreement upon a written specification has several benefits:

- the clarity will reveal misunderstandings

Specification includes:
- Global context
- Interfaces
- Time scales
- External Dependencies
- Resources
- Specification may change

Providing Structure
What you and your team actually needs to do and how to do it.

Work Breakdown Strucutre
Dividing a task into small achievable and manageable units.

Task Allocation

Establishing Controls
Like a 'doing' phase (work in progress)
- Make mile stones

Communication is your everything, to monitor progress, to receive early warnings of danger, to promote co-operation, to motivate through team involvement.

Who knows the best?
Ask your team, they too must be having some best ideas.

This does not mean that your project should be planned by your committee - rather that you as manager. Plan the project based upon all the available experience & creative ideas.

So communicate as per the work breakdown structure to team and then ask for their comments.

Testing & Quality
- How long will the testing take
- How do we know we have done it right.

Fighting for time
As a manager you have to regulate the work pressure & work load which is imposed upon your team. Protect them from the un-reasonable demands of rest of the company.

Open meetings with all

Install cURL and liburl on windows PC (other than 9x)

Copy and paste php447.Configure IIS to execute PHP files from php447/php,exe


Now copy and paste php_curl from php447/extensions to php447/, winnt/system, winnt/system32, winnt/


Now follow instructions from http://curl.netmirror.org/libcurl/php/iis.html.


It has detail information on:

- The extensions directory has not been set correctly in the php.ini file to fix it

- make sure there is the following line in your php.ini file extension_dir="c:\php\extensions\" (or the relevant directory string) (I put the \ on the end because php automagically puts in a / if its not there. I'm not sure if it has any effect tho. but it did change the warning messages I was getting.)

- Make sure the php_curl.dll file is in that directory. Note: the php_curl.dll is the PHP/CURL binding DLL and is included in the binary PHP download package for Windows.

- Also make sure that the files necessary for curl to run are in the system[32] directory [32] for non 9x machines. libeay32.dll ssleay32.dll make sure that the version of php_curl.dll, php.exe & php4ts.dll is the same (I found this out by running the installer. and then copying the php_curl.dll file from the zip package) to fix this replace all the files in the php install directory with those from the zip package. (theres only 3 or so)

18 May 2007

17 May 2007

View State

Introduction
-------------

The web is a state less medium - state is not maintained between client requests by default. ASP.NET is providing a facility to maintain this.
Page level state is information maintaned when an element on the web form page causes a subsequent request to the server for the same page - referred to as "postback".
The control.viewstate property is associated with each server control in your web form and provides a dictionary object for retaining values between such multiple requests for same page. This is the method that the page uses to preserve page and control property information in the page.
When a page is re-loaded two methods pertaining to viewstate are called: LoadViewState and SaveViewState.

Post back controls like text box and non post back controls like label controls.

ViewState is not limited to the storage of simple values, you can use viewstate to store any object as long as it is serializable.

Session State or ViewState?

There are certain cases where holding a state value in ViewState is not the best option. The most commonly used alternative is Session state, which is generally better suited for:

Large amounts of data.As ViewState increases the size of both the HTML page sent to the browser and the size of form posted back, it's a poor choice for storing large amounts of data.

Sensitive data that is not already displayed in the UI.While the ViewState data is encoded and may optionally be encrypted, your data is most secure if it is never sent to the client. So, Session state is a more secure option.

Objects not readily serialized into ViewState, for example, DataSet.As already discussed the ViewState serializer is optimized for a small set of common object types. Other types that are serializable may be persisted in ViewState, but are slower and can generate a very large ViewState.

16 May 2007

Split in C$

private string splitString = "1,2,3,4,5,6";
private char[] sep = {','};

Array a = stringToSplit.Split(sep);
forint i = 0 | i less than a.Length | i plusplus
opening curly braces
Console.WriteLine(a.GetValue(i).ToString());
closing curly braces

Page.PostBack in C#

!Page.Postback prevents re-loading of data on my page's server control

14 May 2007

Show a file uploading progress bar





























“script language="JavaScript"
delay = 100;
imgNumber = 0;
totalimgNumber = 5;
anim = new Array();

for (i = 0; i < src =" '../images/upload'" src =" anim[imgNumber].src;">= totalimgNumber) imgNumber = 0;
}

function animate() {
Switch();
setTimeout("animate()", delay);
}
/script”

Use onClick="animate()" on a submit button in order to post data and initiate progress bar.

Images are also attached here.


















11 May 2007

360 degree virtual tour

Use javasclass (some PTViewer) for this purpose.
An upload 360 degree panoramic image from user and assign its to this javaclass.

09 May 2007

Make Money Online

1) Google Adsense :

Google Adsense is the leader in web-based content-sensitive marketing.Webmasters place Google AdSense JavaScript code on their web pages and Google AdSense serves advertisements based upon the content of the web page.There should be a Google AdSense skyscraper displayed on the right side of this web page right now.Some webmasters are either not accepted into the Google AdSense program, or do not wish to do business with Google.

2) Clicksor:

Clicksor will pay you up to 60% of the advertising clicks revenues generated from your website. Contextual Advertising Technology by Clicksor allows your visitors to enjoy the content of your website and bring generous earnings to you at the same time.As an affiliate, Clicksor passes its profits along to you by paying up to 60% of the advertising clicks revenues generated from your website. Clicksor provides online real time stats and a fortnightly payment schedule. In any pay period in which your earnings exceed $50.00, payments are made either by check or instantly through PayPal. Revenue totalling less that $50 will rolled into the following period.Clicksor offers webmasters the opportunity to earn additional income by simply underlining a selection of clickable text or dislaying targeted contextual banner on their websites.

3) Target Point:

Targetpoint’s services are particularly publisher-oriented: You’ll have absolute control over the appearance of your ads, supervision over ad content, up-to-date statistics on your site’s performance and, most importantly, better bottom-line revenue. Targetpoint offers Publisher services, which generate more money using our new, patent pending content recognition and matching technology: Adpoint generates content-relevant, revenue-evaluated ads. Exitpoint helps utilizing the full capacity web exit traffic. Searchpoint (beta) features enhanced search capabilities, which enhance your users’ experience and generate additional profit. Registration is free and quick. You are guaranteed to get 60% of the total on-click revenue. Payment options include Bank checks, Paypal and Wire transfers (if eligible).

4) Bidvertiser:

Place text ads on your site and get paid for every click Are you sure you are getting the most out of your advertising space?-Join BidVertiser now and we will turn your advertising space into cash! Simply display the BidVertiser text ads on your website and let advertisers bid against each other! We will always display the highest bidders to maximize your revenue! Get paid for every click -You get paid for every visitor that clicks on an ad. Our goal is to enable you to make as much as possible from your advertising space, by letting advertisers bid on your ad space. We pay by monthly checks, with a minimum of only US $25. Always have the highest bidders displayed on your website -BidVertiser will always display the highest bidders on your site, assuring the maximum revenue possible at any given time. Have your bidding steadily improved over time -You will see a constant improvement in your bidding over time, as both your visitors and our advertisers will be exposed to the opportunity of bidding against each other on your ad space.

5) Revenue Pilot:

RevenuePilot provides you with the most innovative, efficient and effective way to monetize your traffic. The Pay For Performance (PFP) and the Pay Per Click (PPC) markets have created ample opportunity for the web publishing community to turn its traffic into pure profits. RevenuePilot offers its affiliates seamless entrance into this highly profitable arena through its Premiere Pay Per Click Network.

6) Searchfeed:

By partnering with Searchfeed.com, Webmasters enhance site content while earning additional revenue from existing Web traffic. Through the integration of paid keyword content, visitors gain access to more relevant information about an area of interest, increasing usability and overall 'stickiness' of a partner's site. Searchfeed.com's ad technology is deployed through both search and content channel integration, helping to monetize Internet traffic more effectively while maintaining the existing look and feel of a partner's site.

7) Fastclick:

Generating revenue, superior technology, a trusting partnership and customer support are the driving force of our Publisher network. Earn up to an industry-high 65-percent monthly payout on all advertising revenue your website generates! Fastclick pays by the 25th of the month for the previous month by check or PayPal. And now you can improve your ad revenue with Text Ads! Text Ads are a new, text-based ad format customizable by the publisher to integrate with your site and complement your current display advertising. Join us to see the possibilities. 8) ClixGalore: Start earning large amounts of commission now by joining one of the many Affiliate programs listed in the clixGalore affiliate network.Using the 'Instant Website Builder' tool, located in your clixGalore Member Home area, you can easily and instanly generate promotional web pages containing our Merchant's products. You may use these pages to promote and earn commission for product sales generated for our Merchants.clixGalore is one of the larger affiliate networks with over 4500+ Affiliate programs for you to join. Affiliate networks and affiliate programs are increasingly used by merchants for affiliate marketing and product / website promotion. These merchants seek affiliates to promote their products / services and in return will pay you high commissions.

04 May 2007

Streaming video files with FLV | On the fly converting video to flv files


I have to convert the video files into flv files using asp / PHP script. For this we are using ffmpeg.exe tool. This is a command line tool It will execute in comman prompt and will convert the video files into .flash files. For this we are using Dynu component in asp to call the exe file. We have to use "FFmpeg -i GLOBE.AVI -r 25 -acodec mp3 -ar 22050 -s 320x240 -y GLOBE_21.flv"this line in command line tool so that it will convert into .flv files.

php error_reporting(E_ALL);$obj = new COM("Dynu.Exec");echo "

";echo $obj->execute("C:\Inetpub\wwwroot\php_streaming\Video\ffmpeg\batch.bat");echo "
";//Response.Write(oExec.execute("C:\Inetpub\wwwroot\php_streaming\Video\ffmpeg\batch.bat"))

In ASP you can use it like:
Set oExec = Server.Createobject("Dynu.Exec")Response.Write("

")REM Execute the command "ipconfig" and display its result.Response.Write(oExec.execute("ipconfig"))REM Execute the command "nslookup -type=mx microsoft.com" and display its result.Response.Write(oExec.execute("C:\Inetpub\wwwroot\new\enginetest\ffmpeg.exe"))REM Execute the batch file and display its result.' Response.Write(oExec.execute("C:\Inetpub\wwwroot\new\test.bat"))'oExec.parameters("-i GLOBE.AVI -r 25 -acodec mp3 -ar 22050 -s 320x240 -y GLOBE_21.flv")Response.Write("

")Set oExec = nothing

if you have avi file and want to convert it to flv then use:

$command = "CALL C:\Inetpub\wwwroot\streaming\ffmpeg.exe -y -i ".$dir." -acodec mp3 -ar 22050 -f flv ".$flvpath;

where dir is the file path of avi file.

Enjoy Programming

- Jankit

03 May 2007

Invest in PPF and be crorepati

In Plan 1 mentioned below, I have taken an investment of Rs 3,000 per month or Rs 36,000 per year. According to Plan 1 you can be a crorepati in the next 40 years. You can decrease the number of years by investing more per month or by increasing your investments gradually.
Assumptions

~ PPF will give a consistent return of 8 per cent per annum.
~ Withdrawal will not attract capital gain tax, that is, the tax structure would maintain its status quo.

Advantage
~ Extremely low risk, since the government manages PPF.

Disadvantages
~ Longer tenure.
~ Yielding 8 per cent interest consistently seems to be very unlikely. Low risk investors need to adjust their investment based on the interest rates.