2009
08.04

Few days ago i get 15MB .sql file in which only one table was there with data. My task is to just import those data in database. Now i have phpMyAdmin but it can allow me 8MB of file. Even i do not have any other support on server. So now i have to write my code or find some code on internet. I tried but dont get any proper solution. so i decided to write my own code. I have used this code to import full databases also for testing.

Here is code


<?php

// file name to import
$sqlfile = 'myfile.sql';
$mysql_host = 'localhost';
$mysql_username = 'root';
$mysql_password = '';
$mysql_database = 'database_name';

mysql_connect($mysql_host, $mysql_username, $mysql_password);
mysql_select_db($mysql_database);

// define Temporary variable.
$temp = '';

// read file
$lines = file($sqlfile);

// get line by line loop from file
foreach ($lines as $line)
{
	// we have to omit comment.
	if (substr($line, 0, 2) == '--' || $line == '')
		continue;

	// if it not comment than save it in $temp variable
	$temp. = $line;

	// If we get a semicolon at the end of line than
	if (substr(trim($line), -1, 1) == ';')
	{
		// Perform the query
		mysql_query($temp);
		// set temp variable to empty
		$temp = '';
	}
}
?>
2009
07.21

I am not a designer but sometime we programmer have to face situation of handling images and  other stuffs also. Few months ago i was asked by one person who is desinger for solution of PNG images in IE6. He was able to display foreground images in webpage properly but in background repet images he was failed.

I will give you both solution in this article here.

1. For Foreground images.
Download pngfix.js file from http://homepage.ntlworld.com/bobosola and follow instruction. This is best way to display images directly associated with IMG tag of HTML.

2. For Backgound repeted images.
for this we need to create one class. This class has location to images from root folder of website. Once all path are correct than you can use this class in your DIV or TABLE Tag.
Here is Class

If you want to use PNG non repeat:

width:10px;
height:10px;
_width: 10px;
_height: 10px;
background: url(whatever.png) top left no-repeat transparent;
_background-image: none;
filter:progid:DXImageTransform.Microsoft.
AlphaImageLoader(src=’whatever.png’,sizingMethod=’scale’);

if you want to use PNG with repeat:
display: block;
width: 10px;
background: url(whatever-repeat.png) top left repeat-y transparent;
_background-image: none;
filter:progid:DXImageTransform.Microsoft.
AlphaImageLoader(enabled=’true’, sizingMethod=’scale’, src=’whatever-repeat.png’);

The idea is very simple just use filter:progid:DXImageTransform.Microsoft.
AlphaImageLoader(enabled=’true’, sizingMethod=’scale’, src=’the-image-you-want-to-repeat.png’ ) and make sure you properly apply the other CSS rules. This technique uses scaling instead of repeating but for shadows and other cool effects it is sufficient.

One important note. Here this class is made in CSS file which is in images folder. set your path of .png images according to that in your class.

2009
05.14

Most of us get spam every day. Some of us get a little, and some of us get a lot, but if you have an e-mail account it is always there.

Spam is incredibly annoying, time-consuming, especially in large quantities. If you have a e-mail address which is public than you can receive hundreds of spam messages.

To understand where this spam mail comes we have to find out first that Where does all of this spam e-mail come from? Why is there so much of it?

Here are some reasons that how spammers get our e-mail address.

  • Main source for e-mail addresses is the Web itself. There are tens of millions of Web sites, and spammers can create search engines that spider the Web specifically looking for “@” sign that indicates an e-mail address. The programs that do the spidering are often called spam bots.

    TIP : Never post your full e-mail address where it is publicly displayed. Post it like abc (at-the-rate) yahoo (dot) com. If you own website than try to place image of e-mail address and do not post your email in alt tag of image.

    • Other primary sources are newsgroups and chat rooms. People (especially first-time users) often use their screen names, or leave their actual e-mail addresses, in newsgroups. Spammers use pieces of software to extract the screen names and e-mail addresses automatically.

      TIP : Try to use different screen name, and if you want to provide your e-mail address to other user please provide it like abc (at-the-rate) yahoo (dot) com.

      • Next is sites created specifically to attract e-mail addresses. For example, a spammer creates a site that says, “Win $1 million!!! Just type your e-mail address here!”. Once you enter your detail and your e-mail is stored in spammer list.

      TIP : Never post your e-mail address on such a sites. If you still wants to go than first try to enter some invalid e-mail address. If they ask for verification than only post your actual e-mail address.

      • In the past, lots of large sites also sold the e-mail addresses of their members. Or the sites created “option” e-mail lists by asking, “Would you like to receive e-mail newsletters from our partners?” If you answered yes, your address was then sold to a spammer.

      TIP : If you find such a option in any site while registration. Try to avoid this option.

      • Probably the most common source of e-mail addresses, however, is a “dictionary” search of the e-mail servers of large e-mail hosting companies like MSN, AOL or Hotmail.

      TIP : Try to make your profile private. Also do not post your e-mail address on such a profile. Most importantly if possible than use different profile name than your e-mail address prefix.

      E-mail addresses generally are not private. Once a spammer gets a hold of your e-mail address and starts sharing it with other spammers, you are likely to get a lot of spam.

      Try to avoid this basic sorces from where spammer get your e-mail adderss. This tips will surely make difference to minimize your spams.

      2009
      04.25

      Many persons around the globe work in offices where they have their unique id related to company’s website. When they first time setup Outlook express it took lot of time for them. And in case after formatting computer they again have to setup.

      so here i have listed some basic steps of How to Setup Email Account in Outlook Express.

      Open Outlook Express and follow this instructions.

      Go to  Tools Menu > Accounts Option

      Click   Add > Mail option

      Read More >>

      2009
      03.24

      Recently i came across one website in which there was on puzzle. It claimed that it was made by Einstein. Even i have also tried and honestly after 2 days i was not get much time to solve i checked answer. Answer is also available at website.

      Here is website link : http://www.coudal.com/thefish.php
      and here is Puzzle.

      There are five houses in a row in different colors. In each house lives a person with a different nationality. The five owners drink a different drink, smoke a different brand of cigar and keep a different pet, one of which is a Walleye Pike.

      The question is– who owns the fish?

      Hints:

      1. The Brit lives in the red house.
      2. The Swede keeps dogs as pets.
      3. The Dane drinks tea.
      4. The green house is on the left of the white house.
      5. The green house owner drinks coffee.
      6. The person who smokes Pall Malls keeps birds.
      7. The owner of the yellow house smokes Dunhills.
      8. The man living in the house right in the center drinks milk.
      9. The man who smokes Blends lives next to the one who keeps cats.
      10. The Norwegian lives in the first house.
      11. The man who keeps horses lives next to the one who smokes Dunhills.
      12. The owner who smokes Bluemasters drinks beer.
      13. The German smokes Princes.
      14. The Norwegian lives next to the blue house.
      15. The man who smokes Blends has a neighbor who drinks water.

      There are no tricks, pure logic will get you the correct answer. And yes, there is enough information to arrive at the one and only correct answer.

      If you get the correct answer, congratulations, you are one of the exclusive group of 121,348,731 people in the world who can.

      Rss Feed Tweeter button Facebook button Linkedin button