HTML5: Contenteditable attribute

This part is of the HTML5 Post Series dedicated to spread knowledge about HTML5

HTML5, HTML5 HTML5 Everywhere!

In the last 5 years or so, we have seen so many javascript plugins that do many fantastic things we wish we could have with only simple HTML like validation, datepickers and autocomplete.

Here we are faced with one fascinating HTML5 attribute, contenteditable.

Values

  • true – The contenteditable attribute when given the value of true, makes content inside elements editable.
  • false – The attribute contenteditable can be given a false value which renders it useless.
  • inherit – It can also be given the value of inherit which makes it inherit contenteditable functionality if the parent is editable.

Sample Code

Can be edited

 <div contenteditable="true">
    This an editable element. Edit the content as much as you can.
  </div>

Cannot be edited

 <div contenteditable="false">
    This an editable element. Edit the content as much as you can.
  </div>

Usage

The contenteditable attribute is quite useful especially when creating CMS that uses javascript to directly edit HTML.

In Action

If you’re using one of the browsers that supports contenteditable, feel free to visit our demo

Browser Compatibility

The contenteditable attribute is supported in modern browsers like IE7+, Firefox 12, Chrome 20, Safari 5.1 and Opera 12.

 Working with HTML5

HTML5 has been gaining popularity in the web development world. There’s good reason too. HTML5 as brought us new tags like the datalist and video tags. HTML5 has also brought us attributes like data-* and placeholder attributes.

Although the benefit of HTML5 are numerous, a lot of developers don’t know much about them. I thought of doing the research for them for my own and their benefit.

I will be archiving posts about my HTML5 reasearch, tips and tricks here so there is a central point of reference on this site for HTML5 posts.

Input Types

  • Color – replacement for javascript colorpickers.

HTML5 Tags

  • Datalist – autocomplete replacement
  • Progress – replacement for jQuery UI progress bar

HTML5 Attributes

 Reset MySQL root password on Mac OS

Losing your password sucks especially when it’s the root password for your MySQL database.

Enter password: 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

Here’s a convenient way to reset your root password when you lose it.

/usr/local/mysql/bin/mysqladmin -u root -p password

The command line will give you a similar question:

Enter password:

Don’t add anything and you will push asked for your new password:

New password: 
Confirm new password:

Voila! Your MySQL root password has been reset!

While it is easy to reset your root password, unless of course it’s a development machine, it not recommended that you use your root account for menial purposes.

 A Guide To Generating Secure Passwords

We’ve all heard of horror stories where people have been locked out of their account because someone had cracked their password. We’ve heard of the stories where sites have been compromised because of easy to remember passwords.

Here’s a list of commonly used passwords from 2012

1. password
2, 123456
3. 12345678
4. abc123
5. qwerty
6. monkey
7. letmein
8. dragon
9. 111111
10. baseball
11. iloveyou
12. trustno1
13. 1234567
14. sunshine
15. master
16. 123123
17. welcome
18. shadow
19. ashley
20. football
21. jesus
22. michael
23. ninja
24. mustang
25. password1

Passwords are meant to be secure and hard to crack or guess. Well, guess what? Most of these passwords can be cracked almost instantly.

Here are a few guidelines to making your passwords secure.

Make Secure Passwords

Stay away from dictionary words

The easiest to crack passwords are those that are in the dictionary. If you are going to make a password, avoid words like, garden, flower or anything that can be taken from an english dictionary.

Make it long

A short password is an easier to crack password. It should be a rule of thumb to make your password at least 8 characters long.

Character Variety

Make a password that contains numbers and letters. Adding a symbol can make it more secure. A nice trick is to replace letters with symbols. For example, @ for a, e with 3, i with ! and s with $.

Don’t make a personal reference

Don’t make it easy for someone you know to guess your password. Don’t use any resemblance to your birthday, your telephone number or your anniversary.

No Repeated Patterns

Repeated patterns make your passwords more predictable.

Password Generators

It is hard to make a password. Not just any password but difficult to crack/guess passwords. Password generators are abound for people having a hard time making their passwords secure.

Random.Pw

Random.Pw helps you generate not so easy to remember passwords. It also makes a guess on how long a desktop computer would crack your generated password.

PasswordBird

PasswordBird makes use of 2 words and a date you would likely remember. It combines them to make a password. I won’t really recommend it but it would be better than the passwords we have presented above :)

Password Savvy

Let’s you choose your words and it mashes it up to generate secure passwords. These passwords usually pass our 5 rules.

Last piece of advice

There can never be an uncrackable password. Make a password and make it secure.

PS

It is usually a rule of thumb for security to change your passwords regularly.