Archive for the 'Programmation' Category

Duplicate entry ‘0’ for key 1

Making the server switch was an easy task. I uploaded my sql database in it’s new home and checked if things where fine. At first sight, it looked fine, but when I wanted to post something on my blog, I would get the Duplicate entry ‘0’ for key 1 error showing up. Did a little search on the subject to find out that my exported database didn’t contain the auto_increment ability in it… (I’m using wordpress 2.0.1 with phpmyadmin 2.6.2 (if I’m right)) So to make a long story short, here’s how I fixed it:
1. Go into your phpmyadmin panel. 2. For each tables structure, edit the first entry (which should be a primary key such as ID). 3. Delete the 0 in the default value and select “auto_increment” in the drop-down menu next to it (on the right). 4. Save. 5. Go to the next table and do the same.
After doing this, you should not face the problem anymore. Thanks to search engines for the answer 🙂

K2 Optimized

Since I began my journey to SEO, I’ve learned many things such as keyword optimisation, use of

tags and much more. One important aspect of SEO is having optimized page, and since I’m trying to promote my blog, I had to look at this point. With a quick test, I realised that K2 template wasn’t optimized to give a fast result, giving many spaces between codes which makes the file size bigger. Let’s take this for example: I went to my Be different post, saved the page using the save as option included in any browser. I opened the page using notepad and looked for empty spaces. File size at the beginning (no edit): 20.05 KB File size after empty space removal (edit) : 19.85 KB File size after Google Anaylitics removal (edit) 19.63 KB This is 0.30 KB, not big but makes a difference for slow bandwidth users. Also, take into consideration I started with a 20.05 KB page. 0.30 KB over 20.05 equals 1.5% of “used bandwidth for code”. Make that go on a 500 KB page and you get 7.5 KB. I know that’s small gain, but it’s only one step closer to a smaller file size. I want my pages to load in less than 2 seconds. Then I checked at the content in my folder related to this internet file. I had Google Analytics in my source code so I could get statistics about the users, but the file is 17.6 KB. I decided to remove this part of my code since Google Analytics wasn’t providing me the kind of statistics I was looking for (even though they are good, but I want public stats). So far, I’ve been able to save 17.9 KB from only two modification (one that you might not be able to do though). [NOTE] Not to my surprise, by removing both LiveSearch and AJAX comments in the K2 option panel, my speed improved greatly. LiveSearch wasn’t that important but AJAX commenting was a nice feature, but not worth the speed improvement I get from removing it. I also started using CSS Compress. Can’t really tell how much it is efficent though.

Add adsense in your WordPress blog

After writing a comment on, I was “due” to post it here. I managed doing the same though using a different method. Yes, it’s possible to do something similar using other way. But mine is, I would say, easier to manage. I got the wonderful Acme tech Adsense Deluxe plugin which allows me to plug the ad into the script easily. My code is only added at 3 different places in the templates files: 1. In the theloop.php, find
then add this code just before
< ?php if ($adsensevar == 2){ adsense_deluxe_ads('Midpage'); $adsensevar = 0; }else{ $adsensevar++; } ?>
This code will output a ad every 3 posts (but beware, google TOS says no more than 3 ads per page, so I’ve warned you). 2. In the sidebar.php just before the div class clear, add
< ?php adsense_deluxe_ads('Sidebar'); ?>
This code output the ad in the sidebar 3. In single post add
< ?php adsense_deluxe_ads('Midpage'); ?>
after the
< ?php include (TEMPLATEPATH . '/theloop.php'); ?>
call. This will output the ad just before the comments and the comment box. Using ad sense deluxe (which you should have actived), create a block called MidPage (which would generally contain the code for a 468×60 banner) and a Sidebar (which contains any scrapper kind) and you’re done. Might be a bit long, but it’s easier to manage after. Ask any question if there’s a problem.

How the warez scene works

An article from 2600 that seems to be one of the most well-rounded and informative article’s about how the Scene works & How warez/other files get spread through the p2p networks.

read more

My personal view of the best statistic system

  • Good graphical interface
  • Easy use of templates
  • Easy to modify localization
  • Tons of informations
    1. Uniques > Country > Page viewed > Amount of time spent viewing > Bandwidth spent
    2. Page views
    3. Referee
    4. Popular pages > Bandwidth spent
    5. Time of the day
    6. Keywords
    7. Bots
    8. In and Out
    9. Check for regular users (through cookies)
  • Statistics for a certain period of time
    1. Hours
    2. Days
    3. Months
    4. Semesters
    5. Years
  • Each links on a page are being rewritten to contain the “Out” function
  • A complete path of each user navigation throught the site
  • Use of AJAX to load each statistics and to periodically update itself live
  • Send statistics to email
  • Even though it still lacks of major features, I’m looking for propositions. I really want this statistic script to be the best out there.