Posts

Showing posts from 2012

Create RSS feed for php mysql

http://www.carronmedia.com/create-an-rss-feed-with-php/ dont forget to add feed to header!

Connect DB using UNICODE

mysql_query("SET NAMES utf8");  add this line

Joomla + APC + memcached

APC makes good cache. configurations http://php.net/manual/en/apc.configuration.php apc.enabled=1       # default = 1 apc.shm_segments=1  # default = 1 apc.shm_size=128    # default = 30 apc.ttl=7200        # default = 0 apc.user_ttl=7200   # default = 0 apc.num_files_hint=1024  # default = 1000 apc.mmap_file_mask=/tmp/apc.XXXXXX  # default = no value apc.enable_cli=1    # default = 0 and apc.shm_size=256 apc.num_files_hint=10000 apc.user_entries_hint=10000 apc.max_file_size=5M apc.stat=0 dont forget there is apc.php file that shows apc stats. Memcached to install memcached http://dag.wieers.com/rpm/FAQ.php#B2 get dag wieers yum repo, then enable You need to edit the file /etc/yum.repos.d/rpmforge.repo and put "enabled = 1"...

In case of Jquery conflict

Just change $ with  jQuery or  call  var $j = jQuery . noConflict (); $j and replace $ with new $j

Remove all i386 packages from CentOS 5 x86_64

A quick solution to duplicate packet installation. This tutorial will show you how to remove all i386 packages from CentOS 5 x86_64 server # yum remove \*.i\?86 source is  http://www.how2centos.com/removing-all-i386-packages-from-centos-5-x86_64-server/

Find Large Files on Linux

http://support.foray.com/index.php?_m=knowledgebase&_a=viewarticle&kbarticleid=17 At the command line as root enter: find / -size +102400k This will find all files on the entire system that are bigger than 100 MB. Use  this one to see the sizes: find / -size +103400k | xargs ls -laAh Use "find ." to look only in the current directory. find . -size +103400k | xargs ls -laAh

Inject metadata on all videos

Had a good luck with pseudo streaming with apache. It works nicely with flowplayer solution. Now I have to inject metadata into every single flv video. There is a classic tool named flvtool2 but it is very slow and memory consuming is much. Luckily there is cool new tool named Yamdi appeared recently. With Yamdi you can inject metadata into very big flv file in a just few seconds while flvtool2 does that job about 10 mins. Installing yamdi was very simple All I did was wget yamdi from  http://yamdi.sourceforge.net/ gcc yamdi.c -o yamdi -O2 -Wall mv yamdi /usr/bin/ There is older versions on yum repos but only recent version (1.8) has -w option that replaces original file with injected file. And here is bash script that scans folder for *.flv and injects it with metadata and replaces with original file. #!/bin/bash VIDEOS_DIR=/webdir/videodir for i in $VIDEOS_DIR/*.flv do yamdi -w -i $i -o ${i}.tmp echo "conversion done on" $i done save above as so...

FLV streamint through Apache

Had to change red5 to pseudo streaming. So did some homework and found  http://flowplayer.org/forum/5/51322 In case of something lost, What I did was downloaded http://people.apache.org/~pquerna/modules/mod_flvx.c installed httpd-devel and gcc compiled with  apxs -i -a -c mod_flvx.c added handler  AddHandler flv-stream .flv (load module allready been added while compiling) here is flowplayer pseudo http://flowplayer.org/plugins/streaming/pseudostreaming.html and jwplayer pseudo http://www.longtailvideo.com/support/jw-player/jw-player-for-flash-v5/12534/video-delivery-http-pseudo-streaming

New server

Got new server and this time am using virtualmin and webmin This is how I installed virtualmin  http://www.virtualmin.com/documentation/installation And webmin  http://www.webmin.com/rpm.html Also I've added this repo addition to jasonlitka wget http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt rpm --import RPM-GPG-KEY.dag.txt cd /tmp wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm rpm -ivh rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm and installed phpmyadmin with alias. http://www.khattam.info/howto-install-phpmyadmin-in-centos-5-2010-09-25.html

htaccess php error show

just add this line to .htaccess php_flag display_errors on done.

Convert Mongolian text to English

I often needs to convert Mongolian letters to English. Most scripts uses only English letters to create folders, create Files and SEF URLs. So I always had to create Mongolian to English converter. $txt = mb_strtolower($txt, 'UTF-8'); $Msearch  = array('а','б','в','г','д','е','ё','ж','з','и','й','к','л','м','н','о','ө','п','р','с','т','у','ү','ф','х','ц','ч','ш','щ','ъ','ь','ы','э','ю','я'); $Mreplace = array('a','b','v','g','d','e','yo','j','z','i','i','k','l','m','n','o','o','p','r','s','t','u','u','f'...