Tuesday, April 29, 2008

Javascript in VB.Net webpage

Using javascript in an ASP.net webpage can sometimes do small wonders. It can reduce some coding and also can be efficient at times. Lets look at an example on how to do this.

Consider this ASP.net page.



<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
   <title>Javascript-ASP.NET Example</title>
</head>
<body>
   <form id="form1" runat="server">
   <div>
        <asp:Button ID="Button1" runat="server" Text="Show Javascript Alert" />
   <br />
   </div>
   </form>
</body>
</html>


The page has only one (Just to keep things simple) with the label "Show Javascript Alert". Now before doing some tasks when the user clicks on the button you may sometimes want to display a message to the user or may even ask for a confirmation whether to go ahead. This can be easily done adding a javascript alert and associating it with the button.

Lets say you want to use a javascript alert 'if (! confirm('Continue?')) return false;' to ask the user 'Continue?' and do something if user clicks Yes and Do Nothing if No is clicked. Go to the VB source file of the page and at the Page_Load () event add 'Button1.Attributes.Add("OnClick", "javascript:if (! confirm('Continue?')) return false;")'. This is considering that the Button's id is Button1. Now view the page in your browser and click on the button , you should see the Javascript alert.

What happens here:

If you go back and have a look at the Default.aspx page source, you'll see


<asp:Button ID="Button1" runat="server" Text="Show Javascript Alert" />
.

This is the line of code which creates the Button and labels it "Show Javascript Alert". But as you can see there's no OnClick event. So the button doesn't do anything till this point.

Now go to the Default.aspx.vb to view the back end VB code of the page. We've added '

Button1.Attributes.Add("OnClick", "javascript:if (! confirm('Continue?')) return false;")

' in the Page_Load () event. This is where the buttons 'OnClick' even is defined. One important thing to notice here is that the 'OnClick' doesn't replace the 'Button1_Click' event of the button, in fact 'Button1_Click' gets executed right after the user responds to the OnClick. So we can put whatever action we want to perform if the user says 'Continue' in the Button1_Click() event.

Now load the page in your browser and view the HTML source. Most likely you'd see something like this :

<input type="submit" name="Button1" value="Show Javascript Alert" onclick="javascript:if (! confirm('Continue?')) return false;" id="Button1" />


As you can see the 'Button1.Attributes.Add' does the magic here. It lets you add methods to a control. Here we just added the 'OnClick' to the control Button1.

Monday, March 31, 2008

19 Free Online Password Generators and password Strength checkers

Password Generators

Choosing your password can be a difficult task if you want to make it strong and also easy to remember. Thats where password generators can help us. With a single click we can generate single or multiple passwords and if you don't like the password just click again to generate another.  It saves a lot of brainstorming especially if you are used to think up a few new passwords everyday for new registration, unless you use a single password for all your accounts. (which is very risky IMO, imagine if you lose the password, you lose all your accounts!)    

Here's a list of online password generators and strength checkers which you can use to make a stronger password.

You can set the length of the password (min 4 but it recommends min 12 for a strong password) and other parameters to include like numbers, case of letters etc and also what characters you want to exclude. Select your options and hit generate your string password would be generated instantly 

To quote them
The PC Tools Password Generator allows you to create random passwords that are highly secure and extremely difficult to crack or guess due to an optional combination of lower and upper case letters, numbers and punctuation symbols. 
The interface is almost similar to the above one. select your options and click generate to get your strong password. It would even display the phonetics of the password. 

Specify which type of letter you want to use in your password. Including string letters, case to use, digits to use and symbols. Select the desired length of the password and click generate.  

Just select the length and whether symbols to be included or not and click on 'Generate Password'. Your password would be generated along with a hint to remember it. Like the one in the picture. '

No configuration to make. The webpage would provide you with ten randomly generated passwords when its loaded. The passwords includes alphabets and numbers though I didn't see any symbols in them. 


To quote them 
It was originally designed to help make up passwords that would be easy to remember but relatively difficult for nefarious types to guess. The best way to do this is a pattern of letters that sounds like a word but is not, in fact is total nonsense. The generator now supports two phonetic patterns. With either one, it will probably take a few tries to find a password you like
You can select options like what you want to include in your password (vowels, consonant, numbers and special) and also the pattern and then generate your password. 

It generates a password using a set of random data such as  your browser, window position, timer, mouse etc. You can also provide your own random string. 
You can select the password length and the bit strength and generate your password. It would also show how strong your password is once its been generated and also how effective protection it would give you. 

Apart from presenting you with 10 random password when the page is loaded,  you can also choose from options like the length of the password and characters to include and generate passwords.

Similar interface to most of the password generator sites. Choose your options and generate the password. You can also generate multiple passwords at once just by selecting how many passwords to be generated. There is also a short guideline on how to create strong passwords. 

Very similar interface with most of the online password generator but with a few different type of memory aids to chose from so you can remember your password easily. 
The page loads with long list of generated passwords. Refresh the page to get a new list. 

Select the length and how strong you want your password to be (Everyday Use,  Medium Strength, Strong Encryption) and generate your password. 

Set the password pattern  and length to generate your password. 


Password Strength Checkers 

Just enter your password in the text box and you can see the strength (weak, medium, strong, best) in the bar below

Enter your password and see how strong is it in a progress bar with starting value of 'Weak' to Ending value 'Strong' 

Enter your password and view how strong it is. It would also tell you details like charset size, 
entropy and give you tips on improving your password if its found to be a weak one. 

View the strength of the password in the color bar below as you type it. 

Simple password strength checker.

It shows the strength of your password in % and also gives detailed information like different chars used, cases used and many more. 


Note : Given the debate that is always on about the dependability of password generators and strength checkers and the risk factors involved (if at all) of using these, use this tools only at your own risk. However I really don't see much of a trouble to use these stuffs and in fact these should come in handy.

Saturday, March 29, 2008

Free forum/Community builder software

Look beyond vBulletin. If you are planning to add a forum or bulletin board to your site and don't want to spend a lot on the platform, the good news is that there are a lot of free alternatives available. Here are a few listed below, leave a comment if I have missed out on something.     

A free community software based on PHP and MySQL. Complete feature list -
http://www.simplemachines.org/about/features.php

phpBB is one of the most widely used Open Source forum solution. Version 3.0 incorporates a professional-quality modular design, high security, multiple-language interface, support for a multitude of database servers and complete layout customisation, all with a low execution overhead. Complete feature set can be found here http://www.phpbb.com/about/features/

From the creators of WordPress, bbPress is focused on web standards, ease of use, ease of integration, and speed. 
View live here http://bbpress.org/forums/

a PHP/MySQL discussion forum with frame-based layout, for easy navigation.
View live forum http://www.beehiveforum.net/forum/

Impressive community builder based on PHP/MySQL  With dolphin you can create dating sites, social networks, content sharing portalsThough free, it requires a fee of $39/yr if you want to remove the links to publisher.

Powered by PHP and MySQL, icebb is a free and open source forum solution.
Try it here http://icebb.net/demo/

nextBBS is an open-source Internet forum system written in PHP and its currently running its public beta.

UseBB is a light and Open Source PHP 4 and MySQL based forum package, distributed freely under the GPL license. 
Try it here -  http://www.usebb.net/community/forum.php?id=7

Vanilla is an open-source, standards-compliant, multi-lingual, fully extensible discussion forum for the web.

Scan a file for virus online with multiple AntiVirus

Need to check a file for virus but don't have any antivirus installed on your PC. Well, why don't do it online? And how about scanning it with more than one Antivirus, all for a single click. VirusTotal lets you upload the suspected file and then scan it with several AV engines and displays the result returned by each of them. Its quite easy to use. 

You can even email your file to scan@virustotal.com with 'SCAN' as the subject line and attaching the file (within 10mb)

But don't uninstall your Antivirus yet. This online solution doesn't give you real-time protection and is only suitable for on demand scanning of single individual files. 

Friday, March 28, 2008

How to remove / hide the blogger Navbar

Personally the blogger navbar doesn't bother me (well, not till now!) and so it stays there. But for the ones who are bugged to see this navbar and want to remove it here's how -

Login to your blogger account and from the dashboard go to Layout--> Edit HTML. Go through the code to find section of code starting like 'Navbar1' or 'Navbar-iframe' or something similar (depending on your template) and modify the content between the braces replacing the previous codes with the following. (Make sure you backup your full template first before modifying anything in case anything goes wrong)

height:0px;
visibility:hidden;
display:none;

Now save the HTML and view your blog. The navbar should be gone.

Thursday, March 27, 2008

Free Online Guitar Chord Dictionaries

Okay so my guitar mania continues. After bringing out lists of Guitar tuner , Metronomes and mobile tools for guitarist today I am posting a list of online Guitar chord dictionaries. One of the difficult tasks for a beginner in guitar is to find and know the different chords formation. What adds to the confusion is that a chord can be played in many different formations. This is where the Chord dictionaries comes handy. I have listed only free and online dictionaries in the post (may be I would do a post in standalone dictionaries later) which doesn't need any kind of registration. (I hate feeling out those forms for each and every damn thing, don't you?). Anyway if I have left out some good free online chord dictionaries which you know of please comment and let me know.


Guitar basics chord dictionary
Huge database of guitar chords. The chords are presented in a simple easy to understand [0 0 0 0 0 0] like format but absolute beginners can find it a bit tough without the graphical notations portraying the guitar neck. But again, they have a short guide which explains the notations nicely.

Howard's Big List of Guitar Chords
This one hase over 42,000 guitar chords listed! To view the chord shapes, click on the root note of the chord you want to find and select the chord you want from the list of shapes for that chord.

About.com Guitar Chord Library
A chord dictionary with easy to understand graphical notations.

MoneyChords Guitar Chord Dictionary

A 50 page Guitar Chord Dictionary,

World Star Guitar Chord Dictionary
An interactive guitar chord dictionary. Select the Key and the tuning and then the chord and you can view the chord in a graphical notations (easy for beginners to understand)

VideoGuitarLessons Chord Dictionary




















Not a huge chord list but very easy to understand for beginners with a nice interactive way to find and view chords.

Pompidula Basic Guitar Chord Dictionary

Decent database of guitar chords with a easy to use interface.

Amazing licks Guitar Chord Dictionary
A simple to use chord dictionary.

Guitar Chord Explorer by Michael Hogg


















Impressive online tool to find guitar chords with a easy to use interface and many options to select from, needs Java.

GuitarTabsChordsChords Dictionary
Not a huge list of chords but simple interface, easy on beginners.

Guitar Consultant Guitar Chords

Over 1,500 Free Online Guitar Chords

Ultimate Guitar Chord Chart
Over 1200 guitar chord positions! PDF format also available.

Add Rating star/ rate post widget to your blog

Always wondering after making a new blog post what the readers think about it? Well now there's a way to know it instantly. Add the rating star widget to your blog and get immediate feedback from readers about your post. Its available free of charge and can also be used with TypePad, WordPress (hosted) or Drupal platforms besides Blogger.








So now readers can rate your post easily.

Monday, March 24, 2008

How to add a Privacy Policy to a blogger blog (Adsense requirement)

The updated Google Adsense Terms and Conditions makes it mandatory for your site or blog to have a Privacy Policy. Though I am not using Adsense on my blog yet (and so I still don't have a privacy policy), I am posting this guide for the bloggers who display adsense on their blog but don't have a clue on how to add a privacy policy to a blogger blog.

First you need your privacy policy to be ready. You can do a google search to find from a variety of templates or you can use one specifically for adsense . Choose a template and make changes to it as per your specific requirements. Once you have your own privacy policy ready its now time to post it.

As blogger don't have a static page feature, we need a little trick. We are going to backdate the privacy policy post to a very old date. Create a new post with a title like 'Privacy Policy' , so that its easy to recognize its purpose. Copy paste the content of the privacy policy you have just prepared. Click on the 'Post Options' (on the bottom left side) to see the date time option. set the date to a very old date so that your privacy policy doesn't show up as just another new post in your blog and click publish.




There, your privacy policy is ready. Now one last thing to do is to post a link to your privacy policy from your blogs index page. One you've published your 'privacy policy' post, view it on a browser and copy the permalink for the post. Now add this link as a sidebar widget from the Layout--> Add a page element. You can either create a list with other useful links and put your privacy policy link there or you can just create a single link to your privacy policy with href tag.

Thats it! Your blogger blog privacy policy is ready. Any issues please feel free to ask!