Wednesday, December 30, 2009

generate/create powerful/customized passwords using the command " pwgen " on Linux Command Line

When anyone registering with a website , it may say " your password must have 8 or more characters and it should be a combination of a-z, A-Z, 0-9, and atleast a symbol. Then what should you do? most probably you have to create a new password to meet with these requirements because you didn't have a password which meets with these requirements.
If you are a Linux user you can use your Linux Command line to create a random, powerful password which can't be guessed by anyone.
First of all you must have "pwgen" to generate new passwords using  Linux Command line. When you type pwgen in your terminal it should show some passwords which has generated randomly. If it show these message similar to this "bash: pwgen: command not found" when you type pwgen, it means you didn't have pwgen installd in your system. So, use your "package manager" to install it. After installing pwgen, you can type pwgen and view some random passwords. You can use pwgen with some options to meet your password requirements. use "pwgen --help" to see available options on the command. This command generates random passwords and you can't see the same password twice by using the pwgen command with the same options.

Here is the syntax you could use this pwgen command to generate passwords.
pwgen [ OPTIONS ] [ pw_length ] [ num_pw ]

  • [ OPTIONS ] -means availabe customizations for pwgen. you can use several options at one time, but all of theose options should not be seperated by spaces or something. but when you start using options, it should contain - mark before the first option that you call.
  • [ pw_length ] is the character length of the password that you need.
  • [ num_pw ] here you can say the number of passwords needed.
when using these options don't use bracket [ ] marks.

Options supported by pwgen:
  -c or --capitalize
    Include at least one capital letter in the password

  -A or --no-capitalize
    Don't include capital letters in the password

  -n or --numerals
    Include at least one number in the password

  -0 or --no-numerals
    Don't include numbers in the password

  -y or --symbols
    Include at least one special symbol in the password

  -s or --secure
    Generate completely random passwords

  -B or --ambiguous
    Don't include ambiguous characters in the password

  -h or --help
    Print a help message

  -H or --sha1=path/to/file[#seed]
    Use sha1 hash of given file as a (not so) random generator

  -C
    Print the generated passwords in columns

  -1
    Don't print the generated passwords in columns

  -v or --no-vowels
    Do not use any vowels so as to avoid accidental nasty words



Technorati Tags: ,

pwgen භාවිතා කර Linux command line එකෙන් මුරපද හදමු.

මුරපදයක් යනු වර්තමානයෙ දී ඉතා වැදගත් දෙයකි. එය යම් තරමකින්වත් අාරක්ෂිත මුරපදයක් නොවුවහොත් ඔබගෙ අන්තර්ජාල ගිණුම් වලට  අනවසර පුද්ගලයින් අැතුල් වී ඔබට සිතා ගත නෙෙහැකි ප්රතිපල උදාකරවීමට ඉඩ අැත. තවද සමහර වෙබ් අඩවි වල ලියාපදිංචි වන විට අප විසින් සාමාන්යයෙන් භාවිතා කරන මුරපදය පිලිනොගැනීමට ඉඩ අැත. ( සමහර වෙබ් අඩවි වල ලියාපදිංචි වන විට ලබා දෙන මුරපදය එම වෙබ් අඩවිය මගින් ඉල්ලා සිටින අාකාරයට ලබා දිය යුතුය. එනම් සමහරවිට මුරපදයතුල ඉංග්රිසි කැපිටල් අකුරක්, ඉංග්රිසි සිම්පල් අකුරක්, ඉලක්කමක්, සංකෙතයක් (symbol) හා මුරපදය අවම වශයෙන් අක්ෂර (characters) 8 කින් යුක්ත විය යුතු යැයි ප්රකාශ කරයි. මෙවිට ඔබට සිදුවන්ෙන් නව මුරපදයක් තැනීමටය. මෙම මුරපදය ඔබට පහසුවෙන් මතක තබා ගත හැකි විය යුතු මෙන්ම අන් අයට අනුමාන කිරීමට අපහසු එකක්ද විය යුතුය.)
ඔබ ලිනක්ස් පරිෂීලකයෙක් නම් ඔබට අාරක්ෂිත මුරපදයක් සෑදීම වෙනුවෙන් මොළය වෙහෙසමින් කල්පනා කල යුතු නොෙව්. එනම් linux command line එක භාවිතා කර ඔබට උවමනා අාකාරයට මුරපදයක් තනාගත හැක. මෙයට අදාල විධානය pwgen ය. මෙහිදී ඔබට අවශ්ය මුරපදයෙ අාකාරය pwgen විධානය සමග ලබා දුන් විට මුරපදය තිරය මත පෙන්වයි. මෙහි දී මුලින් භාවිතා කල විධානයම නැවත ලබා දුන්නද ඔබට මුලින් පෙන්වූ මුරපදය නැවත වරක් නොපෙන්වයි. එනම් මෙහිදී මුරපද නිර්මාණය කරනුයෙ අහඹු ලෙසය.
linux command line එක මත pwgen විධානය සමග ලබා දුන් විට bash: pwgen: command not found අිකාරයෙන් පණිවුඩයක් දිස්වන්ෙන් නම් ඔබගෙ package manager එක භාවිත කර pwgen ස්ථාපනය කර ගන්න.

pwgen
විධානය භාවිත කල යුතු අාකාරය පහත දැක්වෙ.
pwgen [ OPTIONS ] [ pw_length ] [ num_pw ]

  • මෙහි [ OPTIONS ] යන ස්ථානයට ඔබට අවැසි මුරපදයෙ අාකාරය එනම් මුරපදයතුල ඉංග්රිසි කැපිටල් අකුරක්, ඉංග්රිසි සිම්පල් අකුරක්, ඉලක්කමක්, සංකෙතයක් (symbol) අවැසි දැයි ප්රකාශ කල හැක. OPTIONS ලබා දෙන විට අාරම්භයට - සලකුණ ලබා දීමට අමතක නොකල යුතුය.
  • [ pw_length ] යන ස්ථානයට ඔබට අවැසි මුරපදය සමන්විත විය යුතු අක්ෂර (characters) ගණන ලබා දිය හැක.
  • [ num_pw ] යන ස්ථානයට ඔබට අවැසි මුරපද ගණන ලබා දිය හැක. එනම් තිරය මත දිස්විය යුතු මුරපද ගණන ලබා දිය හැක
  • (මෙහිදී වරහන්, එනම් [  ] භාවිත නොකිරීමට වගබලා ගන්න.)

Options supported by pwgen:

  -c or --capitalize
    අඩුම තරමින් එක capital අකුරක්වත් අැතුලත් විය යුතු බවට උපදෙස් දෙයි.


  -A or --no-capitalize
    capital අකුරු අැතුලත් නො විය යුතු බවට උපදෙස් දෙයි.


  -n or --numerals
    අඩුම තරමින් එක ඉලක්කමක් වත් අැතුලත් විය යුතු බවට උපදෙස් දෙයි.


  -0 or --no-numerals
    ඉලක්කම් අැතුලත් නො විය යුතු බවට උපදෙස් දෙයි


  -y or --symbols
    අඩුම තරමින් එක සලකුණක්වත් අැතුලත් විය යුතු බවට උපදෙස් දෙයි.


  -s or --secure
    සම්පූර්ණයෙන්ම අහඹු මුරපද නිර්මාණය කරයි.


  -B or --ambiguous
    Don't include ambiguous characters in the password


  -h or --help
    pwgen හා අදාල උපකාරක පිටුව පෙන්වයි.


  -H or --sha1=path/to/file[#seed]
    Use sha1 hash of given file as a (not so) random generator


  -C
    නිර්මාණය කරන ලද මුරපද, තීරු ලෙස තිරය මත පෙන්වයි.


  -1
    නිර්මාණය කරන ලද මුරපද, තීරු ලෙස තිරය මත නොපෙන්වයි.


  -v or --no-vowels
    මුරපද නිර්මාණය කරන විට vowels භාවිතා නොකරයි. එවිට වදන් ලෙස ශබ්ද කල හැකි මුරපද නිර්මාණය නොකරයි.




Technorati Tags:

Saturday, December 26, 2009

php හි Operators භාවිතා කිරීම. ( Comparison Operators - සංසන්දනය කිරීමට භාවිතා කරන Operators )


නමින් කියැවෙන පරිදිම අගයන් 2 ක් සංසන්දනය කිරීමට භාවිතා කරයි.

අාකාර කීපයකි


==


Equal



===


Identical


!=


Not equal


<>



Not equal


!==



Not identical


<



Less than


>



Greater than


<=


Less than or equal to



>=



Greater than or equal to





== ( Equal )


වම් පස අගය දකුණු පස අගයට සමාන දැයි පරීක්ෂා කරයි.


$a == $b ( $a අගය $b අගයට සමාන නම් $a  == $b යන්න සත්ය වෙි. )





$a === $b ( Identical )


වම් පස අගය දකුණු පස අගයට සමාන දැයි පරීක්ෂා කරයි. තවද එම අගයන් 2ම එකම අාකාරයෙ දැයි පරීක්ෂා කරයි.


$a == $b ( $a අගය $b අගයට සමාන නම් ද එකම අාකාරයෙ නම් ද $a === $b  යන්න සත්ය වෙි. )




!= ( Not Equal )



වම් පස අගය දකුණු පස අගයට සමාන දැයි පරීක්ෂා කරයි.


$a != $b ( $a අගය $b අගයට සමාන නැති නම් $a != $b යන්න සත්ය වෙි. )





<> ( Not Equal )



වම් පස අගය දකුණු පස අගයට සමාන දැයි පරීක්ෂා කරයි.


$a <> $b ( $a අගය $b  අගයට සමාන නැති නම් $a <> $b යන්න සත්ය වෙි. )



< ( Less than )


වම් පස අගය දකුණු පස අගයට වඩා අඩු දැයි පරීක්ෂා කරයි.

$a < $b ( $a අගය $b අගයට අඩු නම් $a < $b යන්න සත්ය වෙි. )



> ( Greater than )


වම් පස අගය දකුණුපස අගයට වඩා විශාල දැයි පරීක්ෂාකරයි.


$a > $b ( $a අගය $b අගයට විශාල නම් $a > $b යන්න සත්ය වෙි. )



<= ( Less than or equal to )


වම් පස අගය දකුණු පස අගයට අඩු/සමාන දැයි පරීක්ෂා කරයි.


$a <= $b ( $a අගය $b අගයට අඩු/සමාන නම් $a <= $b යන්න සත්ය වෙි. )



>= ( Greater than or equal to )


වම් පස අගය දකුණු පස අගයට විශාල/සමාන දැයි පරීක්ෂා කරයි.


$a >= $b ( $a අගය $b අගයට විශාල/සමාන නම් $a >= $b යන්න සත්ය වෙි. )







php හි Operators භාවිතා කිරීම. ( Arithmetic Operators - ගණිතමය කාර්යයන් සදහා භාවිතා කරන Operators )



Arithmetic Operators - ගණිතමය කාර්යයන් සදහා භාවිතා කරන  Operators

Arithmetic Operators ගණිතමය කාර්යයන් සදහා භාවිතා කරයි.
Arithmetic Operators අිකාර හයකි. එනම්

  1. Negation ( නැත යන අර්ථය )
  2. Addition ( එකතු කිරීම )
  3. Subtraction ( අඩු කිරීම )
  4. Multiplication ( ගුණ කිරීම )
  5. Division ( බෙදීම )
  6. Modulus ( බෙදා ඉතිරි අගය )

Example
Name
Result
-$a
Negation
Opposite of $a. ( $a හි නැත යන අර්ථය )
$a + $b
Addition
Sum of $a and $b. ( $a හා $b හි එකතුව )
$a - $b
Subtraction
Difference of $a and $b.( $a හා $b හි වෙනස )
$a * $b
Multiplication
Product of $a and $b. ( $a හා $b හි ගුණිතය )
$a / $b
Division
Quotient of $a and $b. ( $a අගය $b න් බෙදීම )
$a % $b
Modulus
Remainder of $a divided by $b. ( $a අගය $b න් බෙදා ඉතිරි වන අගය )




Technorati Tags:


php හි Operators භාවිතා කිරීම. ( Assignment Operators - අිදෙශ කිරීමට භාවිතා කරන Operators )

සාමාන්යයෙන් භාවිතා වන assignment operator එක වනුයෙ = ලකුණය. මෙහිදී මෙය වම්පස හා දකුණුපස සමානයි කීමට නොව දකුණුපස අගය වම්පස අගයට ලැබෙන/ලබාදෙන බව කීමට භාවිතා කරයි.

මෙය භාවිතා කර අපට විශාල වැඩ කාෙටසක් සිදු කල හැක.


$a = ($b = 4) + 5; // $a is equal to 9 now, and $b has been set to 4.
?>

මෙහිදී $a සදහා ලැබෙන පිලිතුර වනුයේ 9 යි. එනම් $a සදහා = ලකුණින් දකුණු පස අැති අගයන් වල එකතුව අාදෙශ කරයි. එ් අතරම $b සදහා 4 අාදෙශ කරයි.

තවද අපට වෙනත් සමහර assignment operators ද මෙම = සලකුණ සමග භාවිතා කල හැක.



$a = 3;
$a += 5; // sets $a to 8, as if we had said: $a = $a + 5;

$b = "Hello ";
$b .= "There!"; // sets $b to "Hello There!", just like $b = $b . "There!";

?>




Technorati Tags: