Директно с пример :)
Нормална заявка:
SELECT * FROM PRODUCTS
Същата заявка, но ще бъде експортирана в csv:
SELECT * INTO OUTFILE '/tmp/products.csv' FIELDS TERMINATED BY ',' ENCLOSED BY '"' ESCAPED BY '\\' LINES TERMINATED BY '\n' FROM products
sadmin
Синтезирано ръководство за инсталиране на eAccelerator под Debian Lenny
apt-get update && apt-get install build-essential php5-dev bzip2
cd /tmp/
wget http://bart.eaccelerator.net/source/0.9.6.1/eaccelerator-0.9.6.1.tar.bz2
tar xvjf eaccelerator-0.9.6.1.tar.bz2
cd eaccelerator-0.9.6.1
phpize
./configure
make && make install
vim /etc/php5/conf.d/eaccelerator.ini
extension="eaccelerator.so"
eaccelerator.shm_size="16"
eaccelerator.cache_dir="/var/cache/eaccelerator"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="0"
eaccelerator.shm_prune_period="0"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"
При пускане на VMware Player 3.1.3 build-324285(VMware WorkStation 7.1.3 build-324285) излизат следните грешки:
Грешка 1.
Could not open /dev/vmmon: No such file or directory.
Please make sure that the kernel module `vmmon' is loaded.
Failed to initialize monitor device.
Решение 1.
modprobe vmmon
Грешка 2.
Failed to open device "/dev/vmci": No such file or directory
Please make sure that the kernel module 'vmci' is loaded.
Module DevicePowerOn power on failed.
Решение 2.
modprobe vmci
Грешка 3.
Cannot open file dndlog.conf: No such file or directory
Решение 3.
mkdir ~/.vmware/dndlogs
touch ~/.vmware/dndlogs/dndlog.conf
Грешка 4.
Could not connect Ethernet0 to virtual network "/dev/vmnet8"
More information can be found in the vmware.log file. Virtual device Ethernet0 will start disconnected.или
VNET: MACVNetPortOpenDevice: Ethernet0: can't open vmnet device (No such file or directory) във vmware.log
Решение 4.
modprobe vmnet
Общо решение
Тези грешки възникват защото не са заредени необходимите модули:
Решението е просто да се заредят :)))
echo "vmmon" >> /etc/modules
echo "vmci" >> /etc/modules
echo "vmnet" >> /etc/modules
При необходимост модулите да бъдат заредени веднага се прави следното :) :
modprobe vmmon;modprobe vmci;modprobe vmnet;
С това "Общо решение" модулите ще бъдат заредени след reboot на машината.
1. Хранилище в /etc/apt/sources.list
deb http://www.debian-multimedia.org squeeze main non-free
2. Инсталиране на keyring-a
apt-get update && apt-get install debian-multimedia-keyring --force-yes --
3. Инсталиране на mplayer. Умишлено първо го премахвам и после го инсталирам понеже на доста хора се е слувало следното: Инсталират си mplayer от basic хранилищата на дистрото и когато искат да го ъпдейтнат от debian-multimedia се получават куп грешки. Когато се премахне и след това инсталира работи супер всичко :)
apt-get remove mplayer && apt-get install mplayer
Бележка: Ето я грешката която излиза когато се ъпдейт MPlayer от debian-multimedia:
Preparing to replace mplayer 2:1.0~rc3++final.dfsg1-1 (using …/mplayer_2%3a1.0~rc3++svn20100804-0.2_i386.deb) …
Unpacking replacement mplayer …
dpkg: error processing /var/cache/apt/archives/mplayer_2%3a1.0~rc3++svn20100804-0.2_i386.deb (--unpack):
trying to overwrite '/usr/share/pixmaps/mplayer.xpm', which is also in package mplayer-gui 2:1.0~rc3++final.dfsg1-1
configured to not write apport reports
dpkg-deb: subprocess paste killed by signal (Broken pipe)
Processing triggers for menu …
Errors were encountered while processing:
/var/cache/apt/archives/mplayer_2%3a1.0~rc3++svn20100804-0.2_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
1. Добавяне на хранилища /etc/apt/sources.list
deb http://ftp.de.debian.org/debian/ squeeze main contrib non-free
deb-src http://ftp.de.debian.org/debian/ squeeze main contrib non-free
deb http://security.debian.org/ squeeze/updates main contrib non-free
deb-src http://security.debian.org/ squeeze/updates main contrib non-free
deb http://ftp.de.debian.org/debian/ squeeze-updates main contrib non-free
deb-src http://ftp.de.debian.org/debian/ squeeze-updates main contrib non-free
2. Инсталиране на необходимите пакети
apt-get update && apt-get install compiz compizconfig-settings-manager compiz-fusion-plugins-main compiz-gnome compiz-gtk fusion-icon compiz-fusion-plugins-extra compiz-fusion-plugins-unsupported nvidia-glx nvidia-xconfig nvidia-kernel-dkms nvidia-settings
3. Рестартиране на системата
reboot
4. Преглед дали модулите са заредени успешно
lsmod | grep -i nvidia
Изхода е подобен на този:
nvidia 9842520 31
i2c_core 12787 3 videodev,nvidia,i2c_i801
Сега остава да се конфигурира и xorg.conf
5. Спиране на Гном
/etc/init.d/gdm3 stop
6. Alt + F2 и логин като root
X -configure
mv ~/xorg.conf.new /etc/X11/xorg.conf
nvidia-xconfig
7. vi /etc/X11/xorg.conf
Добавяне на тази секция
[…]
Section "Extensions"
Option "Composite" "enable"
EndSection
[…]
Добавяне в секция "Device"
[…]
Option "AllowGLXWithComposite" "true"
Option "TripleBuffer" "true"
Option "XAANoOffscreenPixmaps" "true"
Option "RenderAccel" "true"
[…]
в секция "Screen"
[…]
Option "AddARGBGLXVisuals" "true"
Option "AddARGBVisuals" "true"
[…]
Работещ конфигурационен xorg.conf файл(това е лично за моята машина т.е. не означава, че ще работи на всяка)
#@#:~$ cat /etc/X11/xorg.conf
# nvidia-xconfig: X configuration file generated by nvidia-xconfig
# nvidia-xconfig: version 1.0 (buildd@barber) Sun Jun 13 12:08:56 UTC 2010
Section "ServerLayout"
Identifier "X.org Configured"
Screen 0 "Screen0" 0 0
InputDevice "Mouse0" "CorePointer"
InputDevice "Keyboard0" "CoreKeyboard"
EndSection
Section "Files"
ModulePath "/usr/lib/xorg/modules"
FontPath "/usr/share/fonts/X11/misc"
FontPath "/usr/share/fonts/X11/cyrillic"
FontPath "/usr/share/fonts/X11/100dpi/:unscaled"
FontPath "/usr/share/fonts/X11/75dpi/:unscaled"
FontPath "/usr/share/fonts/X11/Type1"
FontPath "/usr/share/fonts/X11/100dpi"
FontPath "/usr/share/fonts/X11/75dpi"
FontPath "/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType"
FontPath "built-ins"
EndSection
Section "Module"
Load "record"
Load "dri2"
Load "dbe"
Load "extmod"
Load "glx"
EndSection
Section "InputDevice"
Identifier "Keyboard0"
Driver "kbd"
EndSection
Section "InputDevice"
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "auto"
Option "Device" "/dev/input/mice"
Option "ZAxisMapping" "4 5 6 7"
EndSection
Section "Monitor"
Identifier "Monitor0"
VendorName "Monitor Vendor"
ModelName "Monitor Model"
EndSection
Section "Extensions"
Option "Composite" "enable"
EndSection
Section "Device"
### Available Driver options are:-
### Values: <i>: integer, <f>: float, <bool>: "True"/"False",
### <string>: "String", <freq>: "<f> Hz/kHz/MHz"
### [arg]: arg optional
#Option "SWcursor" # [<bool>]
#Option "HWcursor" # [<bool>]
#Option "NoAccel" # [<bool>]
#Option "ShadowFB" # [<bool>]
#Option "VideoKey" # <i>
Identifier "Card0"
Driver "nvidia"
VendorName "nVidia Corporation"
BoardName "C77 [GeForce 8100 / nForce 720a]"
Option "AllowGLXWithComposite" "true"
Option "TripleBuffer" "true"
Option "XAANoOffscreenPixmaps" "true"
Option "RenderAccel" "true"
EndSection
Section "Screen"
Identifier "Screen0"
Device "Card0"
Monitor "Monitor0"
Option "AddARGBGLXVisuals" "true"
Option "AddARGBVisuals" "true"
SubSection "Display"
Viewport 0 0
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 4
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 8
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 15
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 16
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 24
EndSubSection
EndSection
8. Пускаме Гном
/etc/init.d/gdm3 start
9. Проверяваме дали сме готови за 3D ефектите:
glxinfo | grep direct
Изход:
direct rendering: Yes
GL_EXT_Cg_shader, GL_EXT_depth_bounds_test, GL_EXT_direct_state_access,
10. Стартиране на Compiz и настройки:
Applications > System Tools > Compiz Fusion Icon:
Пълната статия може да бъде намерена в howtoforge .
В един момент забелязвам, че тоя Piwik не брой и тъкмо щях да го ругая, че е поредната боза, реших да го разгледам по- отблизо. Видях, че колектора които се изпълнява "WEBDIR/misc/cron/archive.sh" казва, че php-то което се изпълнява няма памет (ей това си е сериозна причина да кажа, че е пълна шит , но както и да е(да го напишат на perl)). Съответно когато излезе тази грешка излиза и отчита посещенията само на сайтовете преди тази грешка За да не променям глобалния php conf само заради тоя piwik едитнах колектора или по- точно на 45 ред добавих следното:
PHP_BIN="$PHP_BIN -d memory_limit=1300M";
Идеята е когато изпълнява php-то да добави този аргумент за да ползва повече памет(но докога ще бъде така …)
Когато се пусне отново ще колектне и архивира всички данни за всички сайтове(освен ако и тази памет не му стига :( ).
Upgrade на Pligg от terminal:
bf:# cat pligg_upgrader_executor.sh
#!/bin/bash
# DH Pligg Upgrader v 1.0 (Written by amri)if [ "$#" -ne 2 ];
then
echo "Use arguments: install.sh PATH DOMAIN";exit;
fi;PATH=$1;
DOMAIN=$2;
CP="/bin/cp";
UNZIP="/usr/bin/unzip";
RM="/bin/rm";
CURL="/usr/bin/curl";
CHMOD="/bin/chmod";
MV="/bin/mv";
WGET="/usr/bin/wget";if [ ! -f "/tmp/latest.zip" ]
then
$WGET -q "http://pligg.com/downloads/latest/latest.zip" -O "/tmp/latest.zip";
fi;if [ ! -d "$PATH" ]
then
echo "DIRECTORY $PATH NOT EXIST!";exit;
fi;cd $PATH;
$CP /tmp/latest.zip . > /dev/null
$CP -Rvp templates templates.bak > /dev/null
$CP settings.php settings.php.bak > /dev/null
$CHMOD -R 777 modules languages cache settings.php > /dev/null
$UNZIP -o latest.zip > /dev/null
$CP -Rvp templates.bak/* templates/ > /dev/null
$RM -fr templates.bak > /dev/null
$CHMOD -R 777 modules languages cache > /dev/null
($CURL -e "http://$DOMAIN/install/upgrade.php?language=local" -F 'submit=yes' "http://$DOMAIN/install/upgrade.php?language=local") 2> /dev/null > /dev/null;
$MV settings.php.bak settings.php > /dev/null
$RM -fr settings.php.default libs/dbconnect.php.default install/ latest.zip > /dev/null
echo "[ OK ]";
Метод 1
select @rand:=CEIL(MAX(uid)*RAND()) AS uid from tablica;select ddate,title,url,visits from tablica where uid>=@rand order by uid limit 10;
Метод 2
SELECT uid,ddate,title,url,visits FROM tablica T JOIN (SELECT FLOOR(MAX(uid)*RAND()-1024) AS ID FROM tablica) AS x ON T.uid >= x.ID LIMIT 10;
Метод 3
SELECT uid,ddate,title,url,visits FROM tablica T JOIN (SELECT MAX(uid) AS ID FROM tablica) AS x ON T.uid >= FLOOR(x.ID*RAND()) LIMIT 10;
Метод 4
SELECT uid,ddate,title,url,visits FROM tablica t JOIN (SELECT(FLOOR(max(uid) * rand())) as maxid FROM tablica) as tt on t.uid >= tt.maxid LIMIT 10;