Sunday 31 July 2011

Top 10 worst male health habits

From workouts to healthy diets, many of us make an effort to look after ourselves. However, we could be compromising our health on a daily basis without even knowing it. From bottling things up to eating fast food, here are the top 10 male habits you should try to break.



Avoiding the doctor


Research by the charity Men’s Health Forum has revealed that men are 20% less likely than women to visit their doctor, despite the fact that they have shorter life spans than women and are more likely to die from cancer. While visiting the doctor is rarely a pleasant experience, diagnosing most illnesses early increases rates of survival, so stop ignoring those symptoms and give your doctor a call.


Not doing self-checks


Just like with visiting the doctor, many men avoid doing necessary health self-checks due to fear, denial of the risks, or confusion over what to do. However, it is vital that men check themselves regularly for signs of testicular cancer as incidence of the disease is on the rise, particularly in young and middle-aged men. If you are not sure how to go about checking yourself, visit a reputable website or ask your doctor for tips on performing these necessary checks.


Binge drinking




men-beer_430


Although women are rapidly catching up with men in the drinking stakes, binge drinking is still more common among men than women, and there are consistently higher rates of alcohol-related deaths and hospitalisations in men.

Binge drinking not only affects long term health, but it puts your immediate safety at risk and can also lead to rapid weight gain. To safeguard your health, it’s important to stick to recommended limits and drink in moderation.


Bottling things up


On the whole, men are less likely than women to talk about their feelings, express emotion or ask for help and support. Perhaps as a consequence of this, men are half as likely as women to be diagnosed with depression, yet are 77 per cent more likely to commit suicide.

Depressed men are also twice as likely as depressed women to resort to alcohol and drug abuse. Bottling up anger is just as detrimental to men’s health, with research suggesting that men who don’t express their anger increase their risk of a heart attack.


Stressing over work


While men and women are equally exposed to workplace stress, according to a survey of 3,000 workers by Medicash, men are four times more likely than women to take a sick day due to work related stress and are twice as likely to turn to alcohol to help deal with it.

As workplace stress can be an important factor in the development of depression, heart disease and stroke, it is vital to seek a way to resolve your feelings and ease your stress; whether it is by talking to your boss, changing your job or seeking professional help.


Taking hot baths


Many men enjoying soaking in the tub, but for all those trying to conceive it may be time to swap those long baths for showers. Researchers from the University of California, San Francisco, found through their three-year study that having hot baths can significantly reduce male fertility.

As sperm develop best in cool surroundings, men should avoid any activity that leads to overheating this area, including sitting in hot tubs or Jacuzzis and regular, prolonged use of laptops.


Not applying sun cream


Although skin cancer is the most common form of cancer in the UK, multiple research studies have shown that few of us regularly wear sunscreen, and that men are the worst offenders.

According to research by Mintel on sun cream use in France, Germany, Spain and the UK, an average of 52 per cent of women use sunscreen, compared to only 37 per cent of men. However, with many men spending significant time outdoor for sports, work or leisure, it is vital to cover up with appropriate clothing and sun cream before heading outside.


Poor bathroom hygiene


Do you wash your hands after you’ve visited the bathroom? According to a study by the American Society for Microbiology and the Soap and Detergent Association, one in three men don’t! Furthermore, a study by the London School of Hygiene & Tropical Medicine carried out at UK service stations found that only a third of men washed their hands with soap. Not washing your hands is the quickest way to spread germs and infection, so protect your health and those around you by making sure you lather up before leaving the bathroom.


Not brushing their teeth


According to a study by the American Dental Association, only 66 per cent of men brush their teeth twice or more a day, compared to 86 per cent of women. Furthermore, research findings published in the Journal of Periodontology showed that women are almost twice as likely to have regular dental checkups than men. Failing to look after your pearly whites is not only bad news for your teeth and gums; research has shown that gum disease can increase risk of heart disease, erectile dysfunction and dementia.


Eating fast food and takeaways


In today’s fast food culture, many of us are guilty of hampering our weight loss by indulging in too much junk food, and this is particularly true for men. A survey by Pew Research Center revealed that 47 per cent of men eat in a fast food restaurant at least weekly, compared to 35 per cent of women. With an average takeaway containing over half your recommended daily calories and copious amounts of salt, do your health a favour by cutting back on takeaways and replacing with home-cooked meals.

Tuesday 26 July 2011

People get scared , Funny Video

Superb Video


[youtube http://www.youtube.com/watch?v=U_AXcKUEk4w&w=425&h=349]

Wednesday 20 July 2011

Move (Copy) Div From One Place To Another Using jQuery

Hello Friends if you want to copy or move the data from one div to onther div you can do it easily with jquery.I can do it by creating new HTML and append it to Active records list. But i came to know about Clone functionality of jQuery, Which is best thing to move or copy any html element.

here are two possibility in Clone function of jQuery. If you want to keep the Div at their place and create the same Div at some other place than you can go for Clone. If you want to Move the Div from one place to another than use appendTo. Look at below syntax.

$("div#source_div_id").appendTo("div#destination_div_id");

Find Number of Child Elements (Length) Using jQuery

Hi Friends, Some days ago I was working on one task in which I was trying to find number of child elements by id or class of parent element by jQuery. I searched about it and found solution for it, So I thought it is worth to share on my wesbite for users, So it can be helpful for anyone and save time for someone.

So below I am going to show to show you can find number of child elements using jQuery.

$(“div#parent_div”).children().length

So by above code you can find number of child elements by id of parent element. In above code id of parent element is “parent_div” , So if you will use this code you will get number of child elements inside this parent.

So by above code you can find number of child elements by id of parent element. In above code id of parent element is “parent_div” , So if you will use this code you will get number of child elements inside this parent

Sunday 17 July 2011

5 useful url rewriting examples using .htaccess

1) Rewriting product.php?id=12 to product-12.html
It is a simple redirection in which .php extension is hidden from the browser’s address bar and dynamic url (containing “?” character) is converted into a static URL.
RewriteEngine on
RewriteRule ^product-([0-9]+)\.html$ product.php?id=$1
2) Rewriting product.php?id=12 to product/ipod-nano/12.html
SEO expert always suggest to display the main keyword in the URL. In the following URL rewriting technique you can display the name of the product in URL.
RewriteEngine on
RewriteRule ^product/([a-zA-Z0-9_-]+)/([0-9]+)\.html$ product.php?id=$2
3) Redirecting non www URL to www URL
If you type yahoo.com in browser it will be redirected to www.yahoo.com. If you want to do same with your website then put the following code to .htaccess file. What is benefit of this kind of redirection??
RewriteEngine On
RewriteCond %{HTTP_HOST} ^optimaxwebsolutions\.com$
RewriteRule (.*) http://www.optimaxwebsolutions.com/$1 [R=301,L]
4) Rewriting yoursite.com/user.php?username=xyz to yoursite.com/xyz
Have you checked zorpia.com.If you type http://zorpia.com/roshanbh233 in browser you can see my profile over there. If you want to do the same kind of redirection i.e http://yoursite.com/xyz to http://yoursite.com/user.php?username=xyz then you can add the following code to the .htaccess file.
RewriteEngine On
RewriteRule ^([a-zA-Z0-9_-]+)$ user.php?username=$1
RewriteRule ^([a-zA-Z0-9_-]+)/$ user.php?username=$1
5) Redirecting the domain to a new subfolder of inside public_html.
Suppose the you’ve redeveloped your site and all the new development reside inside the “new” folder of inside root folder.Then the new development of the website can be accessed like “test.com/new”. Now moving these files to the root folder can be a hectic process so you can create the following code inside the .htaccess file and place it under the root folder of the website. In result, www.test.com point out to the files inside “new” folder.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^test\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.test\.com$
RewriteCond %{REQUEST_URI} !^/new/
RewriteRule (.*) /new/$1

MySQL Injection Attacks

As a PHP developer, I work quite a bit with MySQL database tables, both in the course of developing new websites / web applications, as well as modifying or adding features to existing websites.
One thing that always surprises me when working on code written by others is how frequently the code is subject to what is called MySQL Injection Attacks.
MySQL Injection Attacks are basically where, due to poorly written code, hackers can execute custom MySQL commands (that the developer did not wish the script to be able to execute). These hacks can range from deleting all data in a database table, to logging in as a user, to even stealing data from databases in certain cases.
Well-written MySQL queries can easily prevent such attacks. However, many developers, either out of ignorance or, well, laziness, just don’t properly write their queries.
Let’s back up a few steps here. Some servers, especially in past years, have had a PHP option called Magic Quotes (deprecated as of PHP 5.3.0) enabled. This option automatically “escapes” special characters in data that users submit, say, through a web form.
This escaping is necessary on all user-submitted data that is used in a MySQL query. However, setting the server to automatically escape all user-submitted data is problematic for several reason.
A much better way of doing it is to escape each piece of user-submitted data right when it is inserted into the query. Most MVC frameworks which contain some database model have their own custom-named function that can do this for you.
For those of you who are writing in raw PHP code, PHP has a built-in mysql_real_escape_string function, which you can use to obtain the same results (many custom database libraries use that function).
Anyway, there is no excuse for programmers to not take this small, basic step in securing their web applications, so make sure you take advantage of the tools at your disposal here.

Having Clause - MySQL

The HAVING clause is used in combination with the GROUP BY clause. It can be used in a SELECT statement to filter the records that a GROUP BY returns.
The syntax for the HAVING clause is:
SELECT column1, column2, … column_n, aggregate_function (expression)
FROM tables
WHERE predicates
GROUP BY column1, column2, … column_n
HAVING condition1 … condition_n;
aggregate_function can be a function such as SUM, COUNT, MIN, or MAX.

Wednesday 13 July 2011

Import Unicode CSV Files T MySQL

Unicode UTF-8 comma-separated values (CSV) text files, which are exported or generated by such applications as Microsoft Access or Excel, can be imported to MySQL via LOAD DATA INFILE command. CSV data files that are in a Vietnamese legacy encoding should first be converted to Unicode UTF-8, using UnicodeConverter tool, before proceeding with the import.

Make sure that MySQL default charset is utf8. You may need to create the schema (i.e., database structure and tables) before executing the LOAD DATA command. This can be accomplished manually or by MySQL Migration Toolkit to re-create the schema in MySQL database and then use TRUNCATE command to clear the table (delete all rows) before importing. For example:

mysql> TRUNCATE TABLE authors;

or

mysql> DELETE FROM authors;

The import will be executed as follows:

mysql> LOAD DATA LOCAL INFILE ‘authors.txt’ INTO TABLE authors FIELDS TERMINATED BY ‘,’ ENCLOSED BY ‘”‘ LINES TERMINATED BY ‘\r\n’;

for a CSV file ‘authors.txt’ with records having data fields as follows:

“authid”,”lastname”,”firstname”,”address”,”city”,”country”,”phone”,”email”
1,”Nguyễn”,”Trần”,”Lý Thường Kiệt”,”Sài Gòn”,”Việt Nam”,”848-999-9999″,”nguyentran@yahoo.com”
2,”Lê”,”Lý”,”Phố Quang Trung”,”Hà Nội”,”Việt Nam”,”848-888-8888″,”lely@yahoo.com”

The line terminator ‘\r\n’ is for Windows systems; for Unix/Linux, ‘\n’ is used.

Find N’th Highest Salary.......

SELECT salary
FROM employee a
WHERE 3 = (
SELECT count( salary )
FROM employee b
WHERE a.salary <= b.salary )
LIMIT 0 , 30

Thursday 7 July 2011

Basic Drupal site configuration....

Here I will point out some things that should be done by yourself after you have installed Drupal. It's a basic Drupal site configuration - some things that I always do when I create new Drupal website.

I assume you have installed Drupal on your web server. Installation is very easy, it's a matter of "point and click". Just make sure you create your database before that. More info on Drupal installation can be found in install.txt file that comes with Drupal installation.

So, you've just installed Drupal on your web-server (or your localhost), and now you ask yourself: "Hmmmm..... Now what?". Of course, it depends on the nature of your future website what you want to do with it, but before all that there's some basic Drupal site configuration that I always do, and I suggest you do it as well.

You are presented with a nice blue theme and a welcome message "Welcome to your new Drupal website!" and some additional info on setting up your Drupal website. I suggest you read that text and then do the following:

1. Go on and create your first account by clicking "create the first account." link. That first account that you create will be the admin account for your drupal website! It will have a user id of 1. You can name it "admin" or whatever you like.

2. After that you are back to frontpage of your installation. Go to your admin section, and click on "Modules". On modules listing page, mark checkboxes for the following modules: Contact, Path, Search and Statistics. Click "Save configuration". This will install some additional core modules that are not enabled by default, but I always use them.

3. Enable Clean URLs by visiting admin -> Site configuration -> Clean URLs (you need to have mod_rewrite Apache module enabled for this to work).

4. Go to admin section. If you see a message at the top that says "One or more problems were detected with your Drupal installation. Check the status report for more information.", don't worry about it, we'll fix that in a minute. Click "Site information" and fill in all those fields for your Drupal website. I think they are all pretty much self-explanatory :-)

5. Next, click "File system" in admin section. You will hopefully get a message that "Files" directory was created. Click "Save configuration".

6. Now we need to setup Cron for out Drupal installation. In case you didn't know, cron is a unix process that works in a background all the time and it can execute certain commands for you at any time you tell it to do so. Drupal NEEDS cron job to be set up in order to function properly. So, login to your VPS (or dedicated server) and type following command:

crontab -e

This opens up your cron edit screen. Add the following line to it:

0 9 * * * wget -q http://www.your-domain.com/cron.php

This tells your cron to execute cron.php script at exactly 9am every day. You should be fine with it, although you can choose whatever time of the day you want.

(in case you don't have shell access, and you are on shared hosting, you should have some kind of setting up a cron. I know that in Cpanel you can set up a cronjob very easy, through graphical user interface. If you cannot do that, I suggest you contact you hoisting provider for assistance about setting up your cronjob for Drupal).

7. Ctrl+X and 'Y' and Enter. You should be out of your cron settings program. You can check if you successfully added cronjob by executing
crontab -l

8. Now go back to your browser, to your admin page of Drupal installation. You can run cron manually now, and then you shouldn't do it anymore, since we've just set up a cronjob for Drupal. Now you shouldn’t receive any error messages at the top of the window in admin section.

9. Go to front page of your Drupal website. You are going to create your first piece of content in Drupal.

Create content - > Story

Create it! Be creative ;) Write something just for fun, as we have a little bit more to configure. After you click Submit, your "story will be created. Congratulations, you've just created your first piece of content (node) in Drupal.

10. Go to your webroot directory where your Drupal installation is. Open up your .htaccess file and add following lines to it:

RewriteCond %{HTTP_HOST} ^your-domain.com$ [NC]
RewriteRule ^(.+)/$ http://%{HTTP_HOST}/$1 [R=301,L]

or, if you have 'www' part in your domain name, add this instead:

RewriteCond %{HTTP_HOST} ^(www.)?your-domain\.com$ [NC]
RewriteRule ^(.+)/$ http://%{HTTP_HOST}/$1 [R=301,L]

Save ".htaccess" file.

What this does is that it gets rid of a trailing slash at the end of your Drupal URLs. So, if you type URL with a slash at the end, it will automatically get rid of it. This is extremely important for search engines like Google and your website ranking, that's why we do this.

You should now have a basic Drupal website up and running with minimal number of modules running.

I suggest you now play around your Drupal website, explore the admin section a little bit more, just to see that it's nothing really difficult there. Any questions or suggestions, I'd be happy to read them.

What is Drupal and why you should use it??

Maybe you've heard about Drupal somewhere, maybe a friend told you about it, or maybe you just saw some cool website and found out it has been made with Drupal.

Drupal is CMS - Content Management System. It means you somehow "manage content" with it. So, what kind of content can you manage with Drupal? Any kind!

You see, every piece of content in Drupal is called a node. Node is the smallest chunk of information in Drupal, if you want to call it like that. Node is actually this article that you are reading right now.

Nodes can be of different types. That's where "content types" come in the game. Drupal comes with some pre-defined content types like "story" and "page" content types. The good thing about content types is that you can define your own content types and also you can extend them (more about that later).

The important thing to understand is that most of the content in Drupal is made up of nodes. Nodes can have comments, and comments can be submitted by users.

What can You create with Drupal?

With Drupal you can create:

* Simple n-number-of-pages static website
* Simple personal homepage
* Company website
* Weblog
* Dating website
* Myspace-like website
* (insert your favorite type of website here)

Basically, there are no limits with Drupal, and you really can make any type of website you want.

Of course, it all comes to you and your skills. It helps a lot if you know some html, php, css and that kind of stuff. It is not necessary but it will help.

Why you should use Drupal?

* Easy to use (even if you don't know html, php...)
* Lots of modules
* Lots of themes
* Great established user community
* You can make a website in terms of hours, even minutes

Hosting your Drupal site

If you are serious about your Drupal projects, then I suggest you go with a standalone IP address. Therefore, choose either VPS (virtual private server) or a dedicated server (if you can afford it).

DO NOT even think about having big Drupal website on shared hosting. Drupal is hard on system resources, both CPU and RAM, so my friendly advice to you is to avoid shared hosting. I am telling you this from my personal experience. One community website that I have made (which I will tell you about in later postings) was initially on shared hosting. It was my first Drupal project, and I didn't know much about Drupal, I just learned how to this and that in Drupal, not paying attention to Drupal usage of system resources.

Then one day I got an email of warning from my hosting provider that my website is causing problems with CPU and RAM usage, therefore other websites on shared hosting were not working. That was the moment when I realized I have to move to a VPS.

The only case where I could imagine running Drupal on a shared hosting if you are going to run a small website with mostly static content, then it is fine.

With that in mind, I hope you now have a basic understanding of what Drupal is and what Drupal can do for you.

5 G’s To Grow A Great Life

Greatness arises out of a deliberate attempt to do the small on a consistent basis with a touch of excellence.

It is true that those who are faithful, with the ‘little’ that they possess in life, are better equipped to handle the ‘large’ when it is finally unveiled to them.

In addition, another truth is often revealed, that when you need something done then ask a busy person. They are the possessors of the skill-set and the discipline-set that will allow them to prioritize and delegate all the way to success.

But please allow me to share with you the five G’s that will position you so that you can begin to grow a great and deliberate life.

1. Grab A Goal

Without a goal your life will be aimless. But in your grabbing do the following…

1. Write your goal down and write it down as it has already been achieved.
2. Set a date for the achievement of that goal.
3. Divide the larger goal into smaller and manageable chunks that will allow you to achieve sub-goals along the way.
4. Get into action immediately

2. Grasp An Opportunity


Opportunity, as I think either Thomas Edison or Henry Ford said, usually appears with its sleeves rolled up. That means work.

Don’t just sit around waiting for your next opportunity. Make your opportunity. Be the maker and not just the taker – it is only your imagination away. If you can think it you can find a way to do it.

3. Grip & Never Let Go Of Life

Any dream fulfilled may require some gutsy effort. Persistence. Perseverance. Push. Press on. Once you’ve grasped and grabbed it’s time to grip.

Face each new challenge with the ‘can do’ attitude and the ‘I will find a way’ determination. You are worthy of great success, and success is for the gripper.

4. Grin & Make It Your Practice To Laugh

Smile your way all the way to success. Enjoy the journey. Always see the funny side of things. Have fun. Celebrate each small achievement. Party amidst the potential.

Share the joy with your fellow travelers including your family and friends. Laugh in the face of faith and even in the face of fear – for it will sustain and energize you.

5. Greet Each Day With A Thankful Heart

I recently watched an interview of a young man who became a quadriplegic as a direct result of a helicopter accident. His positive attitude shone throughout the interview. So what do I as an able-bodied male, have to worry about. I have so much to be thankful for, and so do you.

Greet each day with a sense of gratitude. While ever you and I have breath in our body we have so much to be thankful for. Take a regular thankful stock-take of your life and all complaints will dissipate.

Go on! Grab, grasp, grip, grin and greet. Five G’s with the greatest of ease to destroy the disease of desperation and construct the deliberate life.