Archive for the 'Uncategorized' Category
Mysql + tableaux
Compteur
if (count($TABLEAU)>0):
ksort($TABLEAU);
While (List($KEY,$VALUE)=each($TABLEAU)):
echo (”$KEY -> $VALUE”);
EndWhile;
Endif;
Les tableaux php
_______________________
# connection SQL et ouverture de la base
mysql_connect(”localhost”,”root”,”");
mysql_select_db(”test”);
$res = mysql_query(”select distinct anneR from bfone order by anneR “) ;
$nbans = 0 ;
while ($ligr=mysql_fetch_array($res)) {
$nbans++ ; $ans[$nbans] = $ligr["anneR"] ;
} ; # fin de tant que
A Problèmes et erreurs communes MySQL 5.0.0 alpha
“TUTORIAL / www.cgi-interactive-uk.com
Bash Shell Script (mysqlbackup)
#!/bin/sh
mysqldump -uroot -ppwd –opt db1 > /sqldata/db1.sql
mysqldump -uroot -ppwd –opt db2 > /sqldata/db2.sqlcd /sqldata/
tar -zcvf sqldata.tgz *.sql
cd /scripts/
perl emailsql.cgi
The first mysqldump statement has 4 parameters passed to it :-
* -u = your MySQL username. (substitute root with your username)
* -p = your MySQL password. (substitute pwd with your password)
* –opt adds the most common and useful command line options, resulting in the quickest possible export. This option automatically includes –add-drop-table, –add-locks, –extended-insert, –quick and –use-locks.
* the database name to extract. (substitute db1 with your database name)
* the > /sqldata/db1.sql redirects all the output to a file called db1.sql in a directory /sqldata/.
Perl script (emailsql.cgi)
After creating the script, you need to make it executable by CHMODing the file permissions to 700.
#!/usr/bin/perl -w
use MIME::Lite;
$msg = MIME::Lite->new(
From => mysqlbackup@yoursite.co.uk,
To => you@yoursite.co.uk,
Subject => sqldata.tgz MySQL backup!,
Type => text/plain,
Data => “Hi You,\n MySQL database backups.”);$msg->attach(Type=>application/x-tar,
Path =>”/sqldata/sqldata.tgz”,
Filename =>”sqldata.tgz”);$msg->send;
Adding the Script to Cron
0 2 * * * /myscripts/mysqlbackup
0 5 * * 0 /myscripts/reindex
There are five fields for setting the date and time separated by a space, followed by the name of the script you wish to run. The five time settings are in the following order.
* Minutes - in the range of 0 - 59
* Hour - in the range of 0 - 23
* Day of month - in the range 1 - 31
* Month - in the range 1 -12
* Day of week - in the range 0 - 6 (0 = Sunday)
Any field with a * means run every possible match, so for example a * in the day of month field will run the script every single day of the month at the specified time. (…)
The above example shows my current crontab. The file has two entries, one for each script I wish to run. The first entry tells cron to run the mysqlbackup script every morning at 2am. The second entry runs my search engine indexer every Sunday morning at 5am.”
How to backup your MySQL tables and data every night using a bash script and cron CGI interactive
Cron tab + mod perl
# every monday rebuild all, including pdf
30 03 * * 1 /usr/local/modperl-docs/bin/site_build_force_pdf_index
# update all (only changes/no pdf) every 6 hours
15 6,12,18 * * * /usr/local/modperl-docs/bin/site_build_index
# update all (only changes and pdfs) once a day
15 0 * * * /usr/local/modperl-docs/bin/site_build_pdf_index
_____________________
Tutorial sur l’utilisation de Mysql avec Perl
CRON
[UNIX] Crontab mkaz.com
Récupérer les accents français quand MySql parle latin… au lieu de UTF-8
Apache Server 2.0.54
PHP 5.0.4
MySQL 4.1.12
and WordPress 1.5.1.3The problem all originates from MySQL 4.1
version 4.1 MySQL supports different language encodings
problem : “Client” encoding language and the “Server” encoding language.
The “Client” was set to Latin-1 encoding
The “Server” was set to UTF-8“MySQL tries to translate from one language to the other when it puts the information in its Database. The problem is, my WordPress encoding already was UTF-8. So MySQL basically took UTF-8 encoded text (from WordPress) and treated it as Latin-1 encoded text and tried to convert it to UTF-8. Doing that, some characters where fine but more complex ones where not…
To solve this problem, you have to tell MySQL to treat all the stuff from WordPress as UTF-8 stuff.
First open the file: wordpress\wp-includes\wp-db.php
Find line 56, it should read as this:
$this->select($dbname);Go to the beginning of the line and punch “enter” to make it move one line down and leave a blank line on line 56.
Then place this line at line 56:
$this->query(”SET NAMES ‘utf8′”);Then your lines should look like this:
56 $this->query(”SET NAMES ‘utf8′”);
57 $this->select($dbname);“now have a wordpress that can display and retain text in any language your computer can write in :)”
One final note, your Database must be a UTF-8 Database and your WordPress encoding must be UTF-8 also. For wordpress, you can find this in Options/Reading.
The patch we found that seems to have worked for some people but not for others was to add the line $this->query (”SET NAMES ‘utf8′”); after line 43 in wp-db.php.
http://wordpress.org/support/topic/48459?replies=6
AJAHT
“What’s in a name? That which we call a rose
By any other word would smell as sweet.”
Romeo and Juliet (II, ii, 1-2)
Introducing AJAHT Rod Divilbiss 12/06/2006
MySql relation table
How can I use the relation table in Query-by-example?Here is an example with the tables persons, towns and countries, all located in the database mydb. If you don’t have a pma_relation table, create it as explained in the configuration section. Then create the example tables:
CREATE TABLE REL_countries (
country_code char(1) NOT NULL default ”,
description varchar(10) NOT NULL default ”,
PRIMARY KEY (country_code)
) TYPE=MyISAM;INSERT INTO REL_countries VALUES (’C', ‘Canada’);
CREATE TABLE REL_persons (
id tinyint(4) NOT NULL auto_increment,
person_name varchar(32) NOT NULL default ”,
town_code varchar(5) default ‘0′,
country_code char(1) NOT NULL default ”,
PRIMARY KEY (id)
) TYPE=MyISAM;INSERT INTO REL_persons VALUES (11, ‘Marc’, ‘S’, ”);
INSERT INTO REL_persons VALUES (15, ‘Paul’, ‘S’, ‘C’);CREATE TABLE REL_towns (
town_code varchar(5) NOT NULL default ‘0′,
description varchar(30) NOT NULL default ”,
PRIMARY KEY (town_code)
) TYPE=MyISAM;INSERT INTO REL_towns VALUES (’S', ‘Sherbrooke’);
INSERT INTO REL_towns VALUES (’M', ‘Montréal’);To setup appropriate links and display information:
* on table “REL_persons” click Structure, then Relation view
* in Links, for “town_code” choose “REL_towns->code”
* in Links, for “country_code” choose “REL_countries->country_code”
* on table “REL_towns” click Structure, then Relation view
* in “Choose field to display”, choose “description”
* repeat the two previous steps for table “REL_countries”Then test like this:
* Click on your db name in the left frame
* Choose “Query”
* Use tables: persons, towns, countries
* Click “Update query”
* In the fields row, choose persons.person_name and click the “Show” tickbox
* Do the same for towns.description and countries.descriptions in the other 2 columns
* Click “Update query” and you will see in the query box that the correct joins have been generated
* Click “Submit query”
Mod_rewrite
Mod_rewrite, ou la réécriture des URL “à la volée”
AuthName “Protected Area”
AuthType Basic
AuthUserFile /var/www/virtual/site.com/htdocs/repertoire/.htpasswd
require valid-user
AuthUserFile /home/login/.htpasswd
AuthGroupFile /dev/null
AuthName “Acces Restreint”
AuthType Basicrequire valid-user
Protéger les images :
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://www.site.info/.*$ [NC]
ReWriteRule .*\.(gif|png|jpe?g)$ - [F]
Just wonderful !!!
Aral Balkan "decided to write my own script to carry out the migration as the latest WordPress release doesn’t contain one and the only other alternative, apparently, would have been to go through a ridiculous series of upgrades".
Download the b2 to WP migration script (b2towp.zip; 19kb)
1. Use PHPMyAdmin to export your b2 database into an SQL file.
2. Install WP 2.0.2
3. On the machine you installed WP, use PHPMyAdmin to create a database for your b2 database and import it from the SQL file you created in Step 1.
4. Open the b2towp.php file in an editor and enter the database connection info for both the b2 and WP databases at the head of the file.
5. Run the b2towp.php script
Can't wait to test it.
Dynamic Text Replacement by Stewart Rosenberger
ECRIRE UN TEXTE DANS UNE POLICE SPÉCIFIQUE
Cuts and caps www.briarpress.org (downloadable for personal use)
Text replacement
Image repacement wordpress plugin : This plugin creates image replacements for HTML tags. Generally it will be used to replace the titles for posts, but it can replace any HTML tags with images of the text in any font
Play back .ogg files in Media Player If you are a Windows user who wants to be able to listen to .ogg files in Windows Media Player, then this is what you want. Illiminable's DirectShow filters support playing of files encoded with Vorbis, Speex, Theora, and/or FLAC.
easily create Ogg Vorbis files in Windows If you are a Windows user looking to easily create your own Ogg Vorbis files from a .WAV file or losslessly compressed file using an easy drag-and-drop GUI, rarewares' oggdrop is for you.
Recent Comments