Thursday, January 31, 2013

Utiliser le bureau à distance sur deux PC reliés avec un routeur

Introduction - accès à la configuration du routeur

Dans ce tutoriel, nous apprendrons comment utiliser la fonction Bureau à distance entre 2 pc avec routeur sur un réseau différent. Cela va vous permettre de prendre le contrôle d'un PC de votre réseau (le principe est presque le même pour un utilisateur distant que vous souhaiteriez dépanner.
Premièrement, vous devez entrer dans la configuration du routeur reliant le PC auquel vous voulez avoir accès à distance. Pour ce faire, selon le fabricant du routeur, ouvrez votre navigateur Internet et inscrivez dans la barre d'adresses 192.168.0.1 (ou, plus généralement, l'adresse IP de configuration de votre routeur qui doit être indiquée dans le manuel) et vous devriez voir une page web de configuration avec la marque de votre routeur. Pour mon exemple, j’utiliserai un routeur D-Link qui donne cette page :
panel de configuration du routeur
Dans la section Username, si vous n'avez pas déjà changé le mot de passe, inscrire admin puis validez et allez dans la section port forwarding :
port forwarding
Dans la section Name : Pour Windows XP, entez le nom de l'ordinateur que vous allez trouver dans Démarrer => Panneau de configuration => Système => Nom de l'ordinateur et prenez le nom complet de l'ordinateur.
Nom de l'ordinateur - XP
Pour Windows Vista, cliquez sur Démarrer => Panneau de configuration => Système => Nom de l'ordinateur et prenez le nom complet de l’ordinateur.
Nom de l'ordinateur - Vista
Cliquez sur le menu Démarrer => Exécuter et tapez cmd puis validez par la touche Entrée. Ensuite, tapez ipconfig puis validez avec la touche Entrée. Prenez en note le numéro de l'adresse IP qui correspond. Il ressemblera à quelque chose du genre 192.168.0.200. Entez cette adresse ip dans la section port forwarding (section IP adress). Enregistrez les modifications de la configuration de votre routeur puis fermez votre navigateur Web.

Configuration de Windows

Allez dans la section Utilisation à distance (Démarrer => Panneau de configuration => Système) et cochez les cases Autoriser l'envoi d'invitations à distance à partir de cet ordinateur et Autoriser les utilisateurs à se connecter à distance à cet ordinateur.

Création du compte DynDNS

Cette étape consiste à créer un compte avec dyndns.com puisque l'adresse IP de l'ordinateur et l'adresse IP du routeur ne sont pas identiques et nous voulons que l'utilisateur distant puisse accéder à notre ordinateur en entrant un nom (et pas une adresse IP). Rendez-vous à l'adresse suivante : http://www.dyndns.com/ puis cliquez sur Ok.

definition d'un reseau informatique

http://www.idea-informatique.fr/pht/pht09720964.JPG 




definition d'un reseau informatique

Définition 1

Un réseau informatique, ou plus simplement "réseau", est un ensemble d'équipements reliés entre eux dans le but d'échanger des informations.
Cette défintion très simple et même simpliste place le matériel (hardware) au coeur de la notion de réseau. Elle est aussi limitative se contentant de l'échange d'information comme unique objectif d'un réseau informatique.

Définition 2

Un réseau informatique est un ensemble de moyens matériels et logiciels mis en oeuvre pour assurer les communication entre ordinateurs, stations de travail et terminaux informatiques.
Cette définition, plus globale, complète la précédente en mettant en exergue la partie logicielle (software) d'un réseau qui en est la véritable valeur ajoutée.

Créer un réseau informatique a partir de deux ou plusieurs ordinateurs

Définition :
Un réseau local est un groupe d'ordinateurs et de périphériques installés dans un rayon relativement limité et connectés entre eux par un lien de communication qui permet à chacun d'interagir avec n'importe quel autre élément du réseau. Un réseau local se compose généralement de micro-ordinateurs et de ressources partagées, comme des imprimantes et de disques durs.
Les différents dispositifs d'un réseau local s'appellent des nœuds ; ces derniers sont connectés par des câbles sur lesquels circulent les messages.
Lorsque vous disposez de plusieurs ordinateurs, il est très utile de les connecter ensemble pour partager des ressources (lecteur de CD, disque dur , lecteur de DVD, modem …) , d'échanger des informations (sauvegardes, travail à plusieurs..) ou même de jouer à plusieurs dans un même jeu.
Pour créer un réseau local en RJ45 sous Windows 95/98/Me/XP il faut :
· 2 ou plusieurs ordinateurs tournant sous Windows 9X, Me ou XP
· des cartes Ethernet, (comportant une prise RJ45)
· des câbles RJ45
· un hub ou switch (boîtier auquel on connecte les câbles RJ45 provenant des différents ordinateurs du réseau)
PS : Il faut donc installer dans chaque ordinateur du réseau local une carte réseau ethernet.
Réseau informatique - Switch - Hub - routeur
Installation des cartes réseau
La première chose à faire est d'ouvrir votre ordinateur et d'y insérer la carte réseau. Pour cela vous aurez besoin d'un tournevis. Avant toute chose, débranchez l'alimentation, il ne vous reste plus qu'à trouver un emplacement de libre pour insérer la carte Ethernet que vous avez acheté.
Remarque : il faut faire la même chose sur chaque PC du réseau.
Installation de la carte réseau sous Windows
Remarque : il faut faire la même chose sur chaque PC du réseau.
Dans la plupart des cas, lorsque vous avez branché la carte réseau, Windows au démarrage suivant, la détecte et l'installe tout seul. Si ce n'est pas le cas, utilisez les drivers fournit avec l'achat de la carte réseau. Généralement les drivers sont fournis sur un cédérom. Vous pouvez aussi trouvé les derniers drivers sur le site internet du constructeur. Si vous ne connaissez pas l'adresse du site internet du constructeur, vous pouvez passer par le site suivant http://www.touslesdrivers.com qui vous emmenera sur le site du constructeur
Configuration du réseau :(pour plusieurs postes en Windows XP Pro avec serveur Windows 2003)
Une fois que toute les cartes réseau sont branchées et configurer, il ne vous reste plus qu'à configurer votre réseau. Pour cela cliquer sur le menu Menu Démarrer puis Panneau de configuration. Ensuite, cliquer sur Connexion réseau
Choisissez la connexion réseau que vous voulez activer (si vous en avez plusieurs : réseau câblé, WIFI ...). Pour cela, cliquez droit sur la connexion réseau puis choisissez Propriété comme le montre l'image suivante :
Propriété de connexion au réseau local
La boîte de dialogue suivante s'ouvre alors
Connexion réseau local
Cliquez ensuite sur le bouton Bouton propriétés. La boîte de dialogue suivante s'ouvre alors :
protocole TCP/IP
Cliquez sur "Protocole Internet (TCP /IP) puis cliquez sur le bouton Bouton Propriété. La boîte de dialogue suivante apparaît :
adresse IP - masque de sous réseau - Passerelle - DNS primaire
Pour cet exemple, j'ai plusieurs postes configurer en windows XP Pro relié à un serveur Windows 2003. Mon serveur est connecté à un routeur qui partage l'accès Internet sur tous les postes.
Explication de l'image précédente :
Par défaut, les butons radios "Obtenir une adresse IP automatiquement" et "Obtenir les adresses des serveurs DNS automatiquement" sont cochées. Lorsque ces deux boutons sont cochés cela signifie que vous n'avez pas de réseau branché à votre ordinateur ou les adresses sont automatiquement founis par un serveur que l'on nomme DHCP. Dans cette exemple, je posséde un serveur mais je n'utilise pas la fonction DHCP, j'attribue moi même les adresses IP de mes ordinateurs. Si votre réseau n'est pas connecté à Internet, vous pouvez utiliser n'importe quelle adresse IP notées sous la forme xxx.xxx.xxx.xxx où chaque xxx représente un nombre de 0 à 255 (ainsi l'adresse 192.168.171.100 est une adresse valide tandis que 126.256.23 est invalide). Attention à toutefois mettre les mêmes trois premiers chiffres à tous (Exemple : 192.168.1.10, 192.168.1.20, 192.168.1.30 ...). Par contre, si votre réseau va sur Internet, vous ne pouvez pas utiliser n'importe qu'elle adresse IP car vous risqueriez de tomber sur une adresse IP qui est déjà attribuer à quelqu'un et ne pas pouvoir sortir sur internet. Par exemple, si vous mettez l'adresse IP 193.252.19.3 dans votre réseau local, vous ne pourrez pas aller sur le site de wanadoo.fr qui à cette adresse IP. On parle d'adresse IP fixe. Cependant, la norme veut que certaines classes d'adresse IP ne vont jamais sur Internet :
- 10.0.0.0 à 10.255.255.255
- 172.16.0.0 à 172.31.255.255
- 192.168.0.0 à 192.168.255.255
Après avoir saisi l'adresse IP, le masque de sous réseau se met automatiquement. Généralement, c'est 255.255.255.0. Il est le même pour tous les ordinateurs. Le masque de sous réseau permet à tous les ordinateurs du réseau de savoir que un autre ordinateur est dans le même réseau. Dans l'adresse de la passerelle, il faut mettre l'adresse IP de votre modem ou de votre routeur. C'est elle qui permettra a votre ordinateur de se connecter à Internet. En serveur DNS, il faut mettre l'adresse IP de votre FAI. Celui-ci doit la fournir. Dans mon cas, j'utilise une adresse privée du type 192.168.1.3 car c'est mon serveur qui me donne l'accès à Internet. On parle alors de serveur DNS. Cliquez deux fois sur OK pour fermer les boîtes de dialogue.
Dans le menu Menu Démarrer, cliquez droit sur le poste de travail est choisissez "Propriété" comme le montre l'image suivante :
Propriétés du poste de travail
La boîte de dialogue suivante apparaît après avoir cliqué sur l'onglet "Propriété système"
Propriétés systèmes
Cliquez ensuite sur le bouton Bouton Modifier. La boîte de dialogue suivante apparaît :
Modification du nom de l'ordinateur
Dans la zone de texte Nom de l'ordinateur, saisissez un nom pour votre ordinateur. Peut importe le nom, celui-ci apparaît dans vos Favoris réseau.
ATTENTION : il ne peut y avoir qu'un même nom d'ordinateur sur le réseau. Exemple Helplcic est un nom d'ordinateur et Helpclic1 en est un deuxième
Dans la section :
Domaine informatique - Groupe de travail
Votre ordinateur doit appartenir OBLIGATOIREMENT à un Groupe de travail ou à un Domaine pour que les ordinateurs puissent se voir. Pour mon exemple, mon ordinateur fait partie d'un domaine car il est géré par un serveur. Si vous n'avez pas de serveur, vos ordinateurs doivent appartenir au même Groupe de travail. Généralement, Windows donne comme nom soit MSHOME, soit WORKGROUP ou vous pouvez donner un autre nom. Par contre, tous les ordinateurs doivent avoir le même nom de groupe de travail. Cliquez sur le bouton OK.
Si vous êtes en Domaine, Windows vous demandera de vous connectez en tant qu'Administrateur sur le domaine. Vous devrez certainement redémarrez l'ordinateur pour prendre en compte les modifications.
Vérification de votre connexion au réseau
Si vous avez suivi les étapes précédentes, vous devriez avoir une icône Favoris réseau dans le menu Menu Démarrer. De plus, vous devriez voir les ordinateurs comme le montre l'image suivane :
Favoris réseau
Si vous n'arrivez pas à voir les ordinateurs, c'est que vous avez fait une erreur quelques part. Vous pouvez tester les adresses IP de votre ordinateur ou de votre réseau grâce au bouton Invite de commande DOS. La fenêtre suivante s'ouvre alors. La commande ping permet de tester la connexion reseau. Il suffit de saisir ping 192.168.1.10. Cette adresse est celle de ma carte reseau. Vous pouvez tester à partir de votre pc, les autres adresses IP. La première copie d'écran vous montre une adresse qui se voit sur le réseau et la seconde une adresse qui ne se voit pas sur le réseau
Commande ping OK

online voting system using jquery

In this post is all about creating simple online voting system using PHP, jQuery Ajax. Displays the number of votes per article, This is not  IP Address based voting but restricts user to vote only once. Let’s start building it.

Requirements for Voting System:

Dificulty: Intermediate
S/W Needed: PHP, Mysql, HTML Editor

Create Article Table:

As a first step in the process of creating this voting system add the Table to the Database.
CREATE TABLE Article (
id INT PRIMARY KEY AUTO_INCREMENT ,
heading TEXT ,
content TEXT ,
rating INT NOT NULL DEFAULT '0' );

Voting.php

This file contains the UI and retrives the existing vote from DB.
<?php
 require 'config.php';
 require 'opendb.php';

 //Pass the ID of the Article here
 $id = 1;

 $sql = "SELECT * FROM Article WHERE id=$id";
 $result = mysql_query($sql) or die(mysql_error());
 $row = mysql_fetch_assoc($result);

 $ratings = $row["rating"];

?>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
 body{
  background-color:#111;
  color:#FFF;
 }
 #voteBox{
  text-align:center;
  background-color:#232323;
  width:50px;
  height:50px;
  padding:8px 3px 0px 2px;
 }

 .submitVote{
  float:right;
  padding-top:20px;
  padding-right:180px;
  font-size:16px;
  color:#fae240;
 }
 div a
 {
  text-decoration:none;
  color:#30c5f0;
  border-bottom:thin dotted;
 }

 div a:hover
 {
  text-decoration:none;
  color:#30c5f0;
  border-bottom:none;
 }
</style>

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<script type="text/javascript">
 $(document).ready(function()
 {
  $(".submitVote a").click(function()
  {
   var ID = <?php echo $id;?>//$("#vote").text();
   var rating = <?php echo $ratings;?> 

   var queryString = 'id='+ ID +'&vote='+rating;
   $("#vote").text(rating+1); 

    $.ajax({
    type: "POST",
    url: "submitVote.php",
    data: queryString,
    cache: false,
    success: function(html)
    {

     $(".submitVote").html('<p style="margin:1px;padding:0px;">Submit your vote</p>');
     $("#greet").html("Thanks for voting!");
     $("#greet").delay(500).fadeOut(2000);

    }
    });

  });

 });
</script>

</head>

   <body>
    <div style="width:350px;">
        <span class="submitVote" >
            <p style="margin:1px;padding:0px;">
                Submit your <a href="#">vote</a>
            </p>
        </span>
        <div id="voteBox">
            <div id="vote"> <?php echo $ratings;?> </div>
            <span style="color:#fae240;">votes</span>
        </div>
        <div id="greet" style="padding-left:65px;"></div>
    </div>
</body>
</html>
Code Explanation:
Get the initial value of the rating from the Database for the particular article using the supplied “id” value
$sql = "SELECT * FROM Article WHERE id=$id";
 $result = mysql_query($sql) or die(mysql_error());
 $row = mysql_fetch_assoc($result);

 $ratings = $row["rating"];
On Submit of the vote pass the existing rating value to the “submitvote.php” as queryString
var queryString = 'id='+ ID +'&vote='+rating;
  $("#vote").text(rating+1); 

  $.ajax({
    type: "POST",
    url: "submitVote.php",
    data: queryString,
    cache: false,
    success: function(html)
    {}
   });
Hide the href using jquery and greet for submiting the vote.
$(".submitVote").html('<p style="margin:1px;padding:0px;">Submit your vote</p>');
 $("#greet").html("Thanks for voting!");
 $("#greet").delay(500).fadeOut(2000);

submitVote.php

Updates the new rating value in the DB for particular Article.
<?php
 require 'config.php';
 require 'opendb.php';

 if($_POST['id'])
 {
  $id=mysql_escape_String($_POST['id']);
  $rating=mysql_escape_String($_POST['vote']);
  $rating= $rating+1;

  $sql = "update Article set rating='$rating' where id='$id'";
  mysql_query($sql);
 }
?>
Code Explanation:
We are updating the new voting value into the Database.
$sql = "update Article set rating='$rating' where id='$id'";
 mysql_query($sql);
Conclusion:
Simple voting system allows user to rate the article once without ip tracking. And excellent UI design for rating an Article. Ajax makes sure that page is not refreshed on voting.
Any doubts in implementing this, please comment here.

how to craet a PHP calendar

http://www.veign.com/blog/wp-content/uploads/blogger/php-calendar-744584.jpg 


This tutorial will show you how to render a calendar for the current month using PHP and HTML. This tutorial makes use of PHP’s calendar functions – you must have these installed for the code to work. For more information visit the calendar section on PHP website.
You can view an example of the calendar here.
To start with lets define some CSS style. Here’s are the styles used in the example (change these to suit your site):

Calendar Styles

<style type=”text/css” media=”all”>

    body {
  
        background-color: #2A2A2A;
        color: #EEEEEE;
        font-family: Tahoma, Verdana, sans-serif;
        font-size: 10px;
  
    }
  
    table {
  
        width: 125px;
  
    }
  
    td {
  
        padding: 1px;
        border: 1px solid #666666;
        text-align: center;
  
    }

</style>
To render the calendar we need the current month and year (expressed as integers). Using PHP’s calendar functions we can determine the variables we need to render the calendar: the number of days in the month and the start day. The function jddayofweek() allows you to get a day as an integer and the jdmonthname() converts the month to a word.

Calendar Variables

<?php

    // get this month and this years as an int
    $thismonth = ( int ) date( “m” );
    $thisyear = date( “Y” );
  
    // find out the number of days in the month
    $numdaysinmonth = cal_days_in_month( CAL_GREGORIAN, $thismonth, $thisyear );
  
    // create a calendar object
    $jd = cal_to_jd( CAL_GREGORIAN, date( “m” ),date( 1 ), date( “Y” ) );
  
    // get the start day as an int (0 = Sunday, 1 = Monday, etc)
    $startday = jddayofweek( $jd , 0 );
  
    // get the month as a name
    $monthname = jdmonthname( $jd, 1 )

?>
Now using some simple HTML we’ll start off the table, we’ll start the week with Sunday and end it with Saturday.

Calendar Table Head

<table>
    <tr>
        <td colspan=”7″><div align=”center”><strong><?= $monthname ?></strong></div></td>
    </tr>
    <tr>
        <td><strong>S</strong></td>
        <td><strong>M</strong></td>
        <td><strong>T</strong></td>
        <td><strong>W</strong></td>
        <td><strong>T</strong></td>
        <td><strong>F</strong></td>
        <td><strong>S</strong></td>
    </tr>
    <tr>
Now the guts of rendering the calendar. We need to work out from the start day how many empty cells the calendar must start off with. Then we render each day as a cell; every seven cells we start a new row. Finally, we clean up by working out how many empty cells we need to complete the current row.

Rendering the Calendar

<?php

    // put render empty cells

    $emptycells = 0;

    for( $counter = 0; $counter <  $startday; $counter ++ ) {
  
        echo “\t\t<td>-</td>\n”;
        $emptycells ++;
  
    }
  
    // renders the days
  
    $rowcounter = $emptycells;
    $numinrow = 7;
  
    for( $counter = 1; $counter <= $numdaysinmonth; $counter ++ ) {
  
        $rowcounter ++;
      
        echo “\t\t<td>$counter</td>\n”;
      
        if( $rowcounter % $numinrow == 0 ) {
      
            echo “\t</tr>\n”;
          
            if( $counter < $numdaysinmonth ) {
          
                echo “\t<tr>\n”;
          
            }
      
            $rowcounter = 0;
      
        }
  
    }
  
    // clean up
    $numcellsleft = $numinrow – $rowcounter;
  
    if( $numcellsleft != $numinrow ) {
  
        for( $counter = 0; $counter < $numcellsleft; $counter ++ ) {
      
            echo “\t\t<td>-</td>\n”;
            $emptycells ++;
      
        }
  
    }

?>
Then we just finish off the HTML.

Finishing Off

    </tr>
</table>
</body>
</html>
And finally here’s the complete working code. If you want render a calendar for any given month or any given year simply override the $thismonth and $thisyear variables.

Calendar Source Code

<!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>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″ />
<title>Calendar</title>
<style type=”text/css” media=”all”>

    body {
  
        background-color: #2A2A2A;
        color: #EEEEEE;
        font-family: Tahoma, Verdana, sans-serif;
        font-size: 10px;
  
    }
  
    table {
  
        width: 125px;
  
    }
  
    td {
  
        padding: 1px;
        border: 1px solid #666666;
        text-align: center;
  
    }

</style>
</head>
<body>
<?php

    // get this month and this years as an int
    $thismonth = ( int ) date( “m” );
    $thisyear = date( “Y” );
  
    // find out the number of days in the month
    $numdaysinmonth = cal_days_in_month( CAL_GREGORIAN, $thismonth, $thisyear );
  
    // create a calendar object
    $jd = cal_to_jd( CAL_GREGORIAN, date( “m” ),date( 1 ), date( “Y” ) );
  
    // get the start day as an int (0 = Sunday, 1 = Monday, etc)
    $startday = jddayofweek( $jd , 0 );
  
    // get the month as a name
    $monthname = jdmonthname( $jd, 1 )

?>
<table>
    <tr>
        <td colspan=”7″><div align=”center”><strong><?= $monthname ?></strong></div></td>
    </tr>
    <tr>
        <td><strong>S</strong></td>
        <td><strong>M</strong></td>
        <td><strong>T</strong></td>
        <td><strong>W</strong></td>
        <td><strong>T</strong></td>
        <td><strong>F</strong></td>
        <td><strong>S</strong></td>
    </tr>
    <tr>
<?php

    // put render empty cells

    $emptycells = 0;

    for( $counter = 0; $counter <  $startday; $counter ++ ) {
  
        echo “\t\t<td>-</td>\n”;
        $emptycells ++;
  
    }
  
    // renders the days
  
    $rowcounter = $emptycells;
    $numinrow = 7;
  
    for( $counter = 1; $counter <= $numdaysinmonth; $counter ++ ) {
  
        $rowcounter ++;
      
        echo “\t\t<td>$counter</td>\n”;
      
        if( $rowcounter % $numinrow == 0 ) {
      
            echo “\t</tr>\n”;
          
            if( $counter < $numdaysinmonth ) {
          
                echo “\t<tr>\n”;
          
            }
      
            $rowcounter = 0;
      
        }
  
    }
  
    // clean up
    $numcellsleft = $numinrow – $rowcounter;
  
    if( $numcellsleft != $numinrow ) {
  
        for( $counter = 0; $counter < $numcellsleft; $counter ++ ) {
      
            echo “\t\t<td>-</td>\n”;
            $emptycells ++;
      
        }
  
    }

?>
    </tr>
</table>
</body>
</html>

Sunday, January 27, 2013

10 Secrets No Other CSS Master Will Tell You – Part 1

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1IfVRsDaB_qdJ6DUVJV_-gqI648dTku_AtGPCRKNOYKuH9xg8LVsqKhKSqbkphVNTcMvVnnZZe5TUzIVfmnXYc676LQJgDwW3RTxCANfxuFeqC5JrhC3e0qUI8cnO_X4w2KFacYLDS8A/s320/css-in-pashto.jpg 


10 Secrets No Other CSS Master Will Tell You – Part 1

When it comes to revealing the top 10 secrets of CSS, all of a sudden pops up self-proclaimed gurus and experts to help you discover them. The fact is those so-called gurus had never walked down the street of the design world ever in their life, and that annoys the heck out of me.
I know those types and I call them an unappreciated Plato of a bookstore stockroom. It seems that they have the soundest tricks all over their sleeves, but ask them for any advice on how to tackle a particular problem, and suddenly they have to attend a meeting or they’re off on a vacation on Thailand for a couple of week.
10 Secrets No Other CSS Master Will Tell You – Part 1
While they may have few valid points, but most of the time my hunches tell me whether these CSS tricks are really valid as they claim to be or simply an untested CSS hack.
So instead of relying on anonymous sources, let’s dive into what the real and influential CSS developers have to say. Not only they’re walked the walk, but they’ve actually sweated out devoting most of their time in web development just to find some of the most valuable tricks on the planet. Moreover, their portfolio serves as a convincing evidence to back up their advice.
With that said, I’ll reveal you top 10 amazing CSS practices that you and every other web developer will find meaningful, useful, and challenging. Trust me on this as they are revealed by the true CSS masters. Simply soak it up through their time-tested knowledge and wisdom for your next venture.

1. Keep it Simple, Buddy!

What annoys me is the mentality of CSS hackers who are constantly and actively seeking complex solutions for simple problems. If you’re seeking complexity, then that’s what you’ll get – as the law of attraction says – ‘seek and you shall get. It will never let you go, and never help you in the long run, either.
When it comes to web development, Peter-Paul Koch is the guy you should listen to. Not only he’s worked with Apple and other bigger giants, but he’s also written several books on JavaScript. But don’t underestimate him when it comes to CSS.
Koch said something that every designers and developers should heed: Keep your CSS simple. Well, keeping CSS simple might not seem a regular job, but keeping your CSS free of CSS-hacks will benefit you in number of ways. First, as web browsers develop, you’ll be able to keep up with it easier. Second, accepting the web as it is the only best way to go as they’ll keep your website minimal and simple. Third, as web is such an unpredictable place, simplicity is often the key to code for higher efficiency.

2. Declare Your CSS in Single Line

Here’s what Jonathan Snook said, “Keep declarations in one line.” Before I explain, let me tell you that when Jonathan speaks, everyone in the Web development community listens. The Canadian has imprinted his name in the Web design and standards. He’s the authority figure who have spoken on various conferences, SXSW for example, and published several technical resources on Sitepoint.
After his background briefing, I really find it meaningful when he suggests us to use one-line CSS declarations in our stylesheet. Just consider this. If you’re looking for an element, id, or even a class, having everything organized in one line only makes scanning that much quicker and simple. Once I’ve found the ruleset, finding out the property is often straightforward as there are rarely that many.
Here’s a good example of what Jonathan wants to say:
The Pros
p {font-size:12px; border:1px solid #444; color:#333; background-color:#ff0000;}
The Cons
p {
font-size:12px;
border:1px solid #444;
color:#333;
background-color:#ff0000;
}
While it might not seem out-of-the-box trick, trust me on this as I say this. Using CSS in single line not only help you quickly scan your CSS scripts, but they’ll also keep the CSS file size smaller by throwing out the unnecessary spaces and whitespaces out of the window.

3. Utilize CSS Shorthand

Most of the intermediate CSS developers might know a thing or two about using CSS shorthand, while others completely disregard its full use thereby cramming their CSS file with space consuming property values.
Roger Johansson, a Swedish born designer, who has been working on the internet since 1994 has written an in-depth article on the significance of using CSS shorthand. He have illustrated his points with many examples there, but here’s one I would like to share with you, now!
Instead of using separate margin values for each side, use the CSS shorthand code to save a lot of space and avoid having to retype texts.
padding-top:2em;
padding-right:1em;
padding-bottom:0;
padding-left:0.5em;
Here’s the shorthand code that basically mean the same as above, but much more efficient.
padding:2em 1em 0 0.5em;
This trick avoids retyping, reduces the file size, help you organize things up, and more importantly keep the scripts clean and simple.

4. Let Block Elements to Fill Space Organically

Here’s another tip of the trade that Mr. Snook has to share with you guys – allow block elements to fill their space naturally. What does it mean anyway? Well, if you’re setting a width to an element, then don’t use margin or padding. Similarly, if you’re setting its margin and padding, then don’t use width property. In other words, if I’m setting the width of a division box, then I would only set the margin and padding values to the container inside it.
This method ensures that your layout won’t break and this method is often the simplest way to create layouts and elements for your designs.

5. Set a float to clear a float

It’s imperative to understand how floating works, but understanding how to clear it is also necessary.
While Trevor Davis isn’t a big name as Snook or Zeldman, but her surely deserves some credit based on his brilliant portfolio. If you’re looking to horn on your web development skills, his blog is what you should be checking out most of the time.
If you want to clear a float, the best way to do it is to introduce a clearing element for it. For example, I use an empty div with a ‘clear: both’ property for it. Now, there are several other ways to clear a float, but I’ve noticed few inconsistencies with those techniques, so I use an empty div instead.

Summary of 10 Secrets No Other CSS Master Will Tell You!

It makes me furious when most so-called gurus ask their readers to use CSS hacks to quickly get around CSS problems. But these CSS hacks are what their name imply, they simply can’t keep up with the ever-changing browser version, let alone CSS standards and practices. But there are several true masters of CSS who have really walked down the line coding CSS and those are the people you should look up to when it comes to learning the best tips, tricks, and trade of CSS.
In this article, we covered the first 5 top secrets that CSS Masters use in their daily life. In the next article, we’ll cover five more tips that will help you keep you CSS simple, clean, and minimal.

7 Advanced PHP Tips to Improve Your Programming


7 Advanced PHP Tips to Improve Your Programming

Since 1995, PHP has been the choice of programming languages for many Web developers to develop Web applications – small business web sites, blogs, e-commerce sites, Plugins, add-ons, and many more. In addition to that, PHP also has a huge online community and their members working towards almost around the clock crafting out new innovations each day.
PHP is both popular and free tool. PHP is an open-source programming language, meaning it’s completely free to use and extend its basic functionality.

7 Advanced PHP Tips to Improve Your Programming

The server-side scripting language is also supported by almost all the popular Web hosting server these days. The programming language is based on the standard C programming language, which is the standard programming language used by almost every Web developers.
PHP is both easy as well as fun to learn. You can examine current extension, modify it, and extend the functionality of the script and are use them anywhere you want.
If you know the basics of PHP, you can easily create interesting applications using PHP – news system, blogs, membership system, listing system, online shopping site.
In order to create interesting applications, you need to at least have a basic understanding of 7 PHP techniques will help you maximize output, improve your coding efficiency, and basically improve the environment you’ll be working mostly.

1. Be Familiar with SQL Injection

SQL injection is dangerous. Dangerous enough to allow hackers enter your database breaching the security by finding vulnerabilities in your script. Why? Well, if you realize, most programs these are built using PHP and MySQL. So knowing what to avoid beforehand helps you craft a secure code.
We’ve covered an article – avoiding PHP and MySQL Vulnerabilities – that helps you avoid certain coding practices so that you’re code is less prone to attacks from hackers.

2. Know the Basics of Comparison Operators

Comparison operators are crucial part of PHP. Most programmers, while they’re still in the learning phase, might not know the difference between some important comparison operators as they need to.
Each operator has their own significance while using them to compare between two values. For example, many PHPers don’t know the difference between =, ==, and === operators. While ‘=’ assigns a value, ‘==’ looks for equality, and then ‘===’ looks for identity.

3. Conserve the else Statement

Minimizing codes slightly hinders readability. But this tip, and the next that follows, will speed up coding process. But if you don’t want to sacrifice readability, you might as well skip this tip.
Making code simpler and smaller is a good practice.
Here’s an example.
A typical else statement looks like this:
if(condition is true){
$a=2;
}
else{
$x=5;
}
If the $a will have the default value of 5, then just start with it. Don’t bother using the ‘else’ statement just for the sake of it.
$a=5;
if(condition is true){
$a=2;
}
This might not seem a lot, but if you’re coding a hundred lines of code in each page, then this trick will surely save you a lot of time involved while writing various if/else statements..

4. Drop Brackets

Drop unnecessary brackets while coding to save few characters in your PHP code. Just like using the minimal else statement, you can minimize the file size by dropping brackets for single-line expression.
if($result){
print “I am here.”;
}
Is as same as:
if($result) $print “I am here.”;
Do the same for multiple stances.
if($result==’true’) print “I am here.”;
else print “Okay, Print this one instead.”;
Got it?

5. Use str_replace() over preg_replace() and ereg_replace()

While replacing strings, str_replace() is faster, almost 61% more faster than preg_replace() and ereg_replace().
But while using regular expressions, preg_replace() and ereg_replace() functions will be faster than str_replace().

6. Consider Using Ternary Operators

Instead of always using the usual if and else statements, use ternary operators. Ternary operators not only free space, but it also makes codes neat, stripped, and clear.
Beware when you use more ternary operators for a single statement, as PHP gets confused what to do next in those circumstances.
Here’s an example of ternary operator.
$dothis = (empty($_POST[‘dothis’]))? ‘default’ : $_POST [‘dothis’];
Which is as identical as the following if and else statement.
if(empty($_POST[‘dothis’])){
$action = ‘default’;
}else{
$action = $_POST[‘dothis’];
}

7. Use Memcached for Database caching

Memcached is an excellent way to cache your database. While there are many caching options available, Memcached seems to always top the list as the most efficient way to cache database.
It’s not easy to implement the caching system in the first place, but if you’re using PHP and MySQL to build a website, then Memcached might be the answer. Memcached will certainly help speed up the process by caching up web page and script, thereby serving those scripts from Memcached Server rather than the actual server. The web page request, as a result, becomes faster.
The caching structure was built for the first time for LiveJournal – a PHP-powered blogging platform.

8. Bonus: Use Frameworks

Use PHP Frameworks whenever possible. It’s true that you won’t require using frameworks for each projects, but frameworks like Zend, CakePHP, Symphony, and CodeIgniter can greatly reduce the time you spend while developing a site.
Frameworks are software that is bundled with frequently used utilities that help reduce the overhead while developing Web applications. For example, Framework takes care of all of those trivial and repetitive tasks, letting you speed up the Web development process itself.
Check out our article on – Which Framework should you use? – that’ll give you helpful advice on what to look for when it comes to choosing the right framework.
Less time spent in coding means less time spent in debugging and testing.

Summary of 7 Advanced PHP Tips to Improve Your Programming

When it comes to coding PHP, there’s always less time and much to do. First, there are repetitive codes, then bad PHP coding practice, followed by vulnerabilities that hackers exploit to enter your Website.
These top 7 advanced PHP coding practices will help you learn good practice early on. These tips will not only help free some space, but it also will make the code clean, tiny, and clear. As a result, coding becomes more enjoyable process, taking off overheads off your shoulder, and web development process more efficient.