CSS Triangle


You can make them with a single div. It’s nice to have classes for each direction possibility.

<div class="arrow-up"></div>
<div class="arrow-down"></div>
<div class="arrow-left"></div>
<div class="arrow-right"></div>


The idea is a box with zero width and height. The actual width and height of the arrow is determined by the width of the border. In an up arrow, for example, the bottom border is colored while the left and right are transparent, which forms the triangle.

.arrow-up {
        width: 0;
        height: 0;
        border-left: 5px solid transparent;
        border-right: 5px solid transparent;

        border-bottom: 5px solid black;

.arrow-down {
        width: 0;
        height: 0;
        border-left: 20px solid transparent;
        border-right: 20px solid transparent;

        border-top: 20px solid #f00;

.arrow-right {
        width: 0;
        height: 0;
        border-top: 60px solid transparent;
        border-bottom: 60px solid transparent;

        border-left: 60px solid green;

.arrow-left {
        width: 0;
        height: 0;
        border-top: 10px solid transparent;
        border-bottom: 10px solid transparent; 

        border-right:10px solid blue;


Save your website bandwidth with PHProxy and ip2nation
What is ip2nation?

There is currently numerous companies on the net charging for databases or files containing knowledge about where an IP is apportioned (as in which country). This knowledge is in fact obtainable free at ARIN, APNIC, RIPE etcetera. Though, those files are not in any way optimized for queries & are indeed very slow. This is where ip2nation.com comes in.

We utilitize these files to generate a MySQL database table with the appropriate indexes. We have also optimized the table & removed unneccesary information in order to make queries lightning speedy. In order to utilitize the table you may find help in the PHP examples under “Sample scripts”.

What is PHPProxy?

PHProxy is a web HTTP proxy programmed in PHP meant to bypass firewalls and access otherwise inaccessible resources (i.e. blocked sites). If the server this script is run on can access a resource, so are you able to!

With the proxy script PHProxy and the information IP location database from ip2nation it is simple to block visitors which are coming from other countries then your target group. In this tutorial you will learn how to add the necessary code to your PHProxy powered proxy web-site.

Step 1

Download ip2nation and import the sql file into your database (test).

Step 2

Download PHPProxy and add the following code to the index.php file

$DBHOST = 'localhost';
$DBUSER = 'user';
$DBPASS = 'password';
$DATABASE = 'test';
$my_countries = array('in', 'us');
$use_ip2nation = true; //true for blocking countries

Step 3

Find the following code in index.php

function proxify_css_url($url)
$url = trim($url);
$delim = strpos($url, ‘”‘) === 0 ? ‘”‘ : (strpos($url, “‘”) === 0 ? “‘” : ”);

return $delim . preg_replace(‘#([\(\),\s\'”\\\])#’, ‘\\$1’, complete_url(trim(preg_replace(‘#\\\(.)#’, ‘$1’, trim($url, $delim))))) . $delim;
Add the following code after that to check if the resulting country is in our list or not. if its in our list it will go ahead.

if ($use_ip2nation) {
$db = mysql_connect($DBHOST, $DBUSER, $DBPASS);
$sql = "SELECT country FROM ip2nation WHERE ip < INET_ATON('".$_SERVER['REMOTE_ADDR']."') ORDER BY ip DESC LIMIT 0,1";
$res = mysql_query($sql);
$country = mysql_result($res, 0, 'country');
if (!in_array($country, $my_countries)) {
show_report(array('which' => 'index', 'category' => 'error', 'group' => 'resource', 'type' => 'otherthan_in_us'));

Step 4

Add the following code in index.inc.php.

$show_web_form = true;

Find the following code index.inc.php (near line 83)

case ‘hotlinking’:
$message = ‘It appears that you are trying to access a resource through this proxy from a remote Website.<br />’
. ‘For security reasons, please use the form below to do so.’;

Add the following code after that

case 'otherthan_in_us':
$message = 'Sorry this service is only for india and us.
Click topsite in the footer part.';
$show_web_form = false;

Add the following code to allow user to view form or not before starting of <form> tag in index.inc.php

if ($show_web_form) {

and add this code after </form> tag to show alternate stuff to user.

} else {
// show custom content for blocked user to tell that they are blocked for the content


Tutorial: Create a zip file from folders on the fly

Sometimes in web programming when dealing with multiple files or directory download operations, it is better to serve the user with a single zip file rather than let the user manually download the file one by one using direct link download . To overcome this problem, we have to create a zip file on the fly without have to manually create it using any commpresion tools or softwares.

PHP has some functions dealing with file compression that enables us to create zip file on the fly. In this tutorial i will use PHP CreateZipFile classs package from Rochak Chauhan. I have made some examples below to explain how to craete zip file on the fly from multiple files or directory.

Example 1, create zip file from existing files:


include_once 'CreateZipFile.inc.php';
$createZip = new CreateZipFile;
$filecontent1 = file_get_contents('fileone.txt');
$filecontent2 = file_get_contents('filetwo.txt');
$createZip->addFile($filecontent1, '/fileone.txt');
$createZip->addFile($filecontent2, '/filetwo.txt');
$zipFileName = 'myzip.zip';
$handle       = fopen($zipFileName, 'wb');
$out           = fwrite($handle, $createZip->getZippedFile());
To create zip file:
  • add a directory into zip file using addDirectory method
  • add files into directory using addFile method
  • create zip file temporary for download and delete it after the file is downloaded
Example 2, create zip file for a directory with it’s contents/subdirectories

include_once 'CreateZipFile.inc.php';
$createZip = new CreateZipFile;
$createZip->zipDirectory('/testdir', '');
$zipFileName = 'myzip.zip';
$handle       = fopen($zipFileName, 'wb');
$out           = fwrite($handle, $createZip->getZippedFile());
To create zip file for a directory, use zipDirectory method that takes two arguments, first is the name of directory that want to be zipped and second is directory name for zipped file.

Oradour-sur-Glane: The Village Massacred in WW2 and Preserved Since Then

On 10 June 1944, at around 2 PM, four days after the Allied invasion of Normandy, approximately 150 Waffen-SS soldiers entered the tranquil village of Oradour-sur-Glane in the Limosin region of south central France. For no apparent reason, Hitler’s elite troops destroyed every building in this peaceful village and brutally murdered a total of 642 innocent men, women and children, a tragedy which has gone down in history as one of the worst war crimes committed by the German army in World War II.

A new village of Oradour-sur-Glane was built after the war, at the northwest of the site of the massacre, where ruined remnants of the former village still stand as a memorial to the dead and a representative of similar sites and events. Its museum includes items recovered from the burned-out buildings: watches stopped at the time their owners were burned alive, glasses melted from the intense heat, and various personal items and money.

To this day there is no universally agreed explanation as to why the SS acted as they did, or why they chose Oradour for their attack. The town had been far from any center of conflict, was not, nor had ever been an active resistance stronghold.

There is one theory has to what may have happened. On June 9, 1944, the day before the massacre, a German office named Helmut Kämpfe was kidnapped by the Resistance and taken to Breuilaufa by way of Limoges where he was killed the same day. Whilst he was being driven through Limoges, Kämpfe managed to throw his personal papers out of the vehicle as a clue to his whereabouts; they were found and handed in to his commanding officer Sylvester Stadler.

The same day, another officer, Karl Gerlach and his driver were kidnapped by the Resistance and might have been taken to Oradour-sur-Vayres, about 35 miles away to the south of Oradour-sur-Glane. The two towns are very similar in appearance and Gerlach might have mistaken Oradour-sur-Glane for Oradour-sur-Vayres. Gerlach managed to escape and he report to Stadler what had happened.

Sylvester Stadler believed that the kidnapped officer Kämpfe was being held prisoner at Oradour-sur-Glane. He ordered Adolf Diekmann and his soldiers to proceed to Oradour-sur-Glane and take about thirty villagers hostages to negotiate the release of Helmut Kämpfe. Diekmann instead ordered the population exterminated and the village burned to the ground.

Stadler felt Diekmann had far exceeded his orders and began a judicial investigation. Diekmann was killed in action shortly afterward during the Battle of Normandy, and a large number of the third company, which had committed the massacre, were themselves killed in action within a few days, and the investigation was suspended.

The massacre at Oradour-sur-Glane was not the only collective punishment reprisal action committed by the Waffen SS: other well-documented examples include the French towns of Tulle, Ascq, Maillé, Robert-Espagne, and Clermont-en-Argonne; the Soviet village of Kortelisy (in what is now Ukraine); Lithuanian village of Pirčiupiai; the Czechoslovakian villages of Ležáky and Lidice (in what is now the Czech Republic); the Greek towns of Kalavryta and Distomo; the Dutch town of Putten; Serbian towns of Kragujevac and Kraljevo; Norwegian village of Telavåg; and the Italian villages of Sant’Anna di Stazzema and Marzabotto. Furthermore, the Waffen SS executed hostages (random or selected in suspect groups) throughout France as a deterrent to resistance.

This slideshow requires JavaScript.

Photo creditPhoto creditPhoto creditPhoto creditPhoto creditPhoto creditPhoto creditPhoto creditPhoto creditPhoto creditPhoto credit

Strange Airport : Princess Juliana Airport and Maho Beach

Maho Beach is located on the Dutch side of the Caribbean island of Saint Martin. If you love watching airplanes takeoff and land, this should be your next holiday destination, because sitting right next to the Maho Beach is the busy Princess Juliana International Airport. Aircrafts approaching the airport comes from the direction of the sea and because they must touch down as close as possible to the beginning of runway 10 due to its short length, the aircraft on their final approach flies over the beach at minimal altitude.

You can lie on the beach and watch the underbelly of a 747 thundering within a few dozen yards over your head; the blast from the jet engine blowing sand and belongings all over the place. The thrilling approaches and ease of access for shooting spectacular images makes the airport one of the world’s favorite places among plane spotters.

Watching airliners pass over the beach is such a popular activity that daily arrivals and departures airline timetables are displayed on a board in most bars and restaurants on the beach, and the Sunset Beach Bar and Grill has a speaker on its outside deck that broadcasts the radio transmissions between pilots and the airport’s control tower.

This slideshow requires JavaScript.

Photo creditPhoto creditPhoto creditPhoto creditPhoto creditPhoto creditPhoto creditPhoto creditPhoto creditPhoto creditPhoto creditPhoto creditPhoto creditPhoto creditPhoto creditPhoto credit

Text-overflow CSS

Sometimes text will have to be clipped. For instance when it overflows the element’s box. When this happens, you want to leave a visual “hint” to the user that text has been clipped. This is were the text-overflow-props come in. The most common way to use it is the ellipsis character: “…” although, as the spec says, “the actual character representation may vary”. Opera supports this as well using it’s vendor prefix: -o-text-overflow.

Support for these features is very limited at the moment, WebKit only supports the short-hand text-overflow, and even that is only partly implemented. text-overflow: ellipsis-word; and text-overflow: inherit; don’t work yet. Internet Explorer, funnily enough, supports this too in IE6 and up, according to the MSDN page about it.

The following two divs contains the following text: “Lorem ipsum dolor sit amet, consectetur”. As you can see, it is clipped. The first uses text-overflow: ellipsis;, the second uses text-overflow: clip;.



Text-shadow, Photoshop like effects using CSS

CSS3 finally eliminates the need for Photoshop when all you want to do is a simple shadow. The text-shadow property is used as follows:

text-shadow: 2px 2px 2px #000;

This produces the text with a shadow 2px right and below of the text, which blurs for 2px.