Author: admin

  • init.d script for gearmand

    #!/bin/bash # # gearmand Startup script for the Gearman server # # chkconfig: – 85 15 # description: Gearman is a distributed job system. # processname: gearmand # config: /etc/sysconfig/gearmand # pidfile: /var/run/gearmand/gearmand.pid # ### BEGIN INIT INFO # Provides: gearmand # Required-Start: $local_fs $network # Required-Stop: $local_fs $network # Default-Start: # Default-Stop: # Short-Description:…

  • init.d script for stunnel on CentOS

    You might need to modify some settings to suite your installation. I installed from source. whereis stunnel (might need to ln -s /usr/local/bin/stunnel /usr/sbin/stunnel) vi /etc/init.d/stunnel #!/bin/bash # # stunnel This shell script takes care of starting and stopping # stunnel # # chkconfig: 345 80 30 # description: Secure tunnel # processname: stunnel #…

  • jQuery – Avoid duplicate element’s IDs

    If the input element has an ID and it is duplicate with another element, it’s likely cause an error. In this case, Firefox 3.5 and IE8 on Windows Vista has no problem while same browsers in Windows XP does not work. Problem … … … $(“#myform #action”).val(); That works in Vista and Mac OSX but…

  • jQuery form item highlighting

    $(document).ready(function(){ $(“input,textarea,select”) .focus(function() {$(this).addClass(“form-item-focus”);}) .blur(function() {$(this).removeClass(“form-item-focus”);}); });

  • MOD files import into iMovies for Panasonic SDR-H18

    This little trick is for iMovies to import MOD files automatically. Create this folder and copy MOD files to it: D:\MP_ROOT\101PNV01

  • Centos and BOINC/World Community Grid

    There are RPM packages for Fedora but doesn’t seem one for CentOS. There is no updated instructions on running BOINC client via command line. 1) Download and run boinc_6.2.15_i686-pc-linux-gnu.sh 2) Run “./boinccmd –project_attach www.worldcommunitygrid.org ” (Log into WCG, the key can be found on menu My Profile, near the bottom) 4) Run “./run_client –daemon” to…

  • Optimizing TCP stack under CentOS/RHEL Linux

    This is from one of our pretty old servers more /etc/sysctl.conf # Kernel sysctl configuration file for Red Hat Linux # # For binary values, 0 is disabled, 1 is enabled. See sysctl(8) for # more details. # Controls IP packet forwarding net.ipv4.ip_forward = 0 # Controls source route verification net.ipv4.conf.default.rp_filter = 1 # Controls…

  • Debugging jQuery selector

    Selectors are really powerful, but how to you know what/which elements were chosen? Use this statement var str = $(e).parents(“form tr”).map(function() { return this.tagName; }).get().join(“, “); alert(str);

  • PHP Error – DOMDocument not found

    If you see this error when your PHP version is already 5.x, make sure you install “yum install php-xmlrpc” and might have to restart the web server (just to be sure). PHP Fatal error: Class ‘DOMDocument’ not found in xxx

  • Gotchas with gettext in PHP

    Be careful when you first try gettext in PHP, it can be very unreliable/unpredictable because of different naming conventions. $vLang = ‘vi_VN’; $vDomain = ‘MyApp’; putenv(“LANGUAGE=”.$vLang); putenv(“LANG=”.$vLang); bindtextdomain($vDomain,AS_BASEDIR.’locale’); bind_textdomain_codeset($vDomain,”UTF-8″); setlocale(LC_ALL,$vLang.”.utf8″,$vLang.”.UTF8″,$vLang.”.utf-8″,$vLang.”.UTF-8″,$vLang); textdomain($vDomain); MyApp.po vs MyApp.mo PO is the human-readable and you perform the translation in here. MO is the binary file and it’s cached by Apache.…