IPL player arrested for misbehaving with American woman

IPL player arrested for misbehaving with American woman:

 

 

Spot fixing in IPL

 

JavaScript to check when the browser window is close

Does anyone know any way that I can use javascript to check when the browser window is close and pop-up a confirmation dailog to ask whether the user is confirm to exit the browser or change his mind to stay?
Here is the answer to above questions.
<script language=”javascript”>
window.onbeforeunload = function ()
{
var disp_txt = “”;

disp_txt+= “WAIT! READ THIS MESSAGE.\n\n”;
disp_txt+= “Yepie, you got the answer here.\n\n”;

location.assign(“http://blog.kapilsakhare.in”);
return disp_txt;
}
</script>

10 ways to generate random password from command line

Here’s 10 ways to generate random password:

For any of these random password commands, you can either modify them to output a different password length, or you can just use the first n characters of the generated password if you don’t want such a long password.

This method uses SHA to hash the date, runs through base64, and then outputs the top 32 characters.
date +%s | sha256sum | base64 | head -c 32 ; echo
This method used built-in /dev/urandom feature, and filter out only characters that you would normally use in a password. Then it outputs the top 32 characters.
< /dev/urandom tr … Continue Reading

Auto Optimize Your MySQL Tables Script

To make MySQL driven websites running fast, I’ve pieced together a script and cron job that will save you some support calls.

Step 1: Create a PHP script:
<?php
// Change vars as needed here
$server = “localhost”;
$user = “mysql_user”;
$pwd = “mysql_password”;
$dbName = “mysql_dbName”;

$link = mysql_connect($server, $user, $pwd);

if (!$link) {
die(‘Could not connect: ‘ . mysql_error());
}

$db_selected = mysql_select_db($dbName, $link);

if (!$db_selected) {
die (‘Can\’t use $dbName : ‘ . mysql_error());
}

// Find all tables in the selected DB
$alltables = mysql_query(“SHOW TABLES”);

// Process all tables.
while ($table = mysql_fetch_assoc($alltables))
{
foreach ($table as $db => $tablename)
{
Continue Reading

Few Tips for Optimizing PHP code

1. If a method can be static, declare it static. Speed improvement is by a factor of 4.

2. echo is faster than print.

3. Use echo’s multiple parameters instead of string concatenation.

4. Set the maxvalue for your for-loops before and not in the loop.

5. Unset your variables to free memory, especially large arrays.

6. Avoid magic like __get, __set, __autoload

7. require_once() is expensive

8. Use full paths in includes and requires, less time spent on resolving the OS paths.

9. If you need to find out the time when the script started executing, INSERT:CONTENT:END SERVER['REQUEST_TIME'] is preferred to time()

10. See if you can use … Continue Reading

What’s the Maximum Length For MySQL TEXT Field Types

MySQL engine supports 4 TEXT field types

TINYTEXT
TEXT
MEDIUMTEXT
LONGTEXT

MyISAM tables in MySQL have a maximum size of a row of 65,535 bytes, so all the data in a row must fit within this limit.
However, the TEXT types are stored outside the table itself and only contribute 1 to 4 bytes towards this limit.

TEXT data types are also able to store much more data than VARCHAR and CHAR text types so TEXT types are what you need to use when storing web page or similar content in a database.

The maximum amount of data that can be stored in each data type is as … Continue Reading

Stop Cron Job From Emailing

At the end of the cmd of the cronjob you can add: >/dev/null 2>&1
a line would look like this: etc/web/htdocs/cron.php >/dev/null 2>&1

15 Famous Sayings by Chanakya

1) “Learn from the mistakes of others… you can’t live long enough to make them all yourselves!!”
- Chanakya

2)”A person should not be too honest. Straight trees are cut first and Honest people are screwed first.”
- Chanakya

3)”Even if a snake is not poisonous, it should pretend to be venomous.”
Chanakya

4)”There is some self-interest behind every friendship. There is no friendship without self-interests. This is a bitter truth.”
- Chanakya

5)” Before you start some work, always ask yourself three questions – Why am I doing it, What the results might be and Will I be successful. Only when you think deeply and find satisfactory … Continue Reading

Funny Company Names

1. NIIT : Not Interested in IT

2. WIPRO : Weak Input, Poor & Rubbish Output

3. HCL : Hidden Costs & Losses

4. TCS : Totally Confusing Solutions

5. INFOSYS : Inferior Offline Systems

6. HUGHES : Highly Useless Graduates Hired for Eating and Sleeping

7. BAAN : Beggars Association and Nerds

8. IBM : Implicitly Boring Machines

9. SATYAM : Sad And Tired Yelling Away Madly

10. C-DOT : Coffee During Office Timings

11. AT&T : All Troubles & Terrible

12. CMC : Coffee, Meals and Comfort

13. DEC : Drifting & Exhausted Computers

14. ORACLE : Online Romance And Chatting with Lady Employees

15. PATNI: Pathetic Appraisal Techniques, No Increments

Older Posts »»