Author Archive

Mysql fix crashed tables

Sometimes, system halt or power off will make your MySQL database crashed and you without knowing it unless you try to access those bad tables.

Run this Linux command to automatically find crashed tables and fix them.

1
mysqlcheck --auto-repair -A -u <username> -p<password>
  • Share/Save/Bookmark

Change Firefox user agent to mobile devices’

Often you need view your mobile web development on mobile devices. Wouldn’t it be better to have Firefox, web developer, firebug and etc to help you?
You can change your desktop Firefox user agent string to make a mobile web site thinks you are view it from a mobile device.
Here’s how to do it.

  • Type about:config in Firefox address bar. And read the scary warning and proceed
  • Right click on the settings and select New -> String.
  • Enter the preference name: general.useragent.override, enter string value: BlackBerry9000/4.6.0.266 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/120

Then you’ve done.

In above example, “BlackBerry9000/4.6.0.266 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/120″ is Blackberry Bold user agent.

Common user agents
iPhone user agent:
Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A543a Safari/419.3
Windows mobile 6 user agent:
Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; IEMobile M.N)

In case you want to get full desktop power back, just select the settings you just added, and select “Reset”

  • Share/Save/Bookmark

Plesk common shell commands

Reload vhost.conf for single domain

1
/usr/local/psa/admin/sbin/websrvmng --reconfigure-vhost --vhost-name=

Update AWStats for only 1 domain in Plesk

1
/usr/local/psa/admin/sbin/statistics --calculate-one --domain-name=you-domain.com
  • Share/Save/Bookmark

Subversion client for Windows command line output unreadable characters

If you use subversion client windows command line

1
svn help

on a Windows system with current language for non-Unicode programs set to a different language such as Chinese Simplified.
You probably will see a screen with strange characters – garbage output in command prompt window.
It’s very easy to fix this by set an environment variable for your system

1
Set LANG=C
  • Share/Save/Bookmark

Simple helloworld c++ program to test noexec tmp partition

1
2
3
4
5
6
7
#include <iostream>
 
int main()
{
  std::cout << "Hello world, compiled with g++ on linux" << std::endl;
  return 0;
}

compile this and move to your secured tmp partition and execute it. If you get a permission error, tmp partition is mounted correctly with noexec.

  • Share/Save/Bookmark

Install VMware tools to Fedora 10 client OS on Windows Vista host OS

Software requirements:

  • Windows Vista Ultimate 64bit
  • VMware workstation 6.5.1
  • Fedora 10 64bit

Install packages that are required to build VMware tools:

1
 yum install gcc make kernel-devel</li>

Step by step guide

  1. Logon to Fedora, and select “Install VMware Tools” from VM menu
  2. After the tool cd was mount, open a terminal window logon as root user and type
    1
    2
    3
    
    cd ~
    mkdir VMware
    cd VMWare
  3. Type:
    1
    
    cp /media/VMware\ Tools/VMwareTools-7.8.4-126130.tar.gz ./
  4. Untar and install by typing:
    1
    2
    3
    
    tar zxpf ./VMwareTools-7.8.4-126130.tar.gz
    cd vmware-tools-distrib/
    ./vmware-install.pl
  5. Config and build VMware tool modules:
    1
    
    vmware-config-tools.pl

    and type y when prompt to build vmware modules

Restart your guest OS and then you should have vmware tool installed. You should be able to see your shared folder from the host OS.

  • Share/Save/Bookmark

Linux Server Security Checklist

  • Firewall (apf/csf and bfd)
  • Secure tmp partition (noexec)
  • rootkit scanning
  • PHP hardening
  • Apache hardening
  • Mod-security
  • Shell login notification
  • Share/Save/Bookmark

Troubleshooting Linux High CPU Utilization

troubleshooting linux high cpu utilization

1. us -> User CPU time: The time the CPU has spent running users’
processes that are not niced.
2. sy -> System CPU time: The time the CPU has spent running the
kernel and its processes.
3. ni -> Nice CPU time: The time the CPU has spent running users’
proccess that have been niced.
4. wa -> iowait: Amount of time the CPU has been waiting for I/O to complete.
5. hi -> Hardware IRQ: The amount of time the CPU has been servicing
hardware interrupts.
6. si -> Software Interrupts.: The amount of time the CPU has been
servicing software interrupts.

ps -eo pcpu,pid,user,args | sort -k 1 -r | head -10

  • Share/Save/Bookmark

Firefox Version 3.0.3 Self-signed Certificate Problem

I often upgrade Firefox to the latest versions with only conditions: google toolbar, Web Developer extension and Firebug extension supports.

I never ran into problems except with this latest version: 3.0.3

The problem: Websites with self-signed certificate are no longer working. It doesn’t give me the option to add exceptions like it used to be. (websites with exceptions added in previous versions are not effected.)

Tried this:
Go to Tools -> Option menu, select Advanced, on Encription tab click on View Certificates.
Go to Servers tab in Certificate Manager, click on Add Exception
Enter the host (https://localhost) then click on Get Certificate button.
Same problem

After some searching, some are saying to re-set one of Firefox settings in about:config. However it doesn’t work in my case.

I gave it another try in the Certification Manager by use the host name with port number. It worked!

I am glad it worked out and I don’t need to go back to 3.0.2 or wait for fix in the next version.

  • Share/Save/Bookmark

Blackberry Bold from Rogers finally!

After a long and delayed waiting, I finally got my hands on this so called “Monster Blackberry”. Yes, it’s the new Blackberry Bold 9000 from Rogers. Unfortunately this one is not mine, it’s my friend’s.

I’ve read so much about its new features. I know what to look into within limited couple hours review time.

Speed:

Yes, it’s lighteng fast. It’s fast everywhere. Open a browser, web page viewing, go back to the home screen, go back to playlist while playing a video in media player and etc.

Screen:

Very impressive hand held device LCD. It’s smaller compare to iphone, PSP but with resolution of 480×320, super bright LCD, I can watch some movies on a Blackberry!
Compare to my Blackberry Curve, Bold supports H264 at resolution 480×272 (only one I tested so far)! My Curve only supports H264@ 16x sth from the official spec. I did try H264 320×240 on Curve, only sound with no image.
Some WinMenc settings:
mencoder.exe “D:\Download\Video\169_diablo3_di_062908_hr.mp4″ -af volnorm -srate 48000 -vf-add scale=480:272,harddup -ofps 30000/1001 -oac faac -faacopts br=128:mpeg=4:object=2 -ovc x264 -ffourcc H264 -x264encopts bitrate=500:level_idc=13:nocabac -o “D:\Download\169_diablo3_di_062908_hr.x264.avi” 2> 2.txt
call “batch\mp4-avc.bat” “D:\Download\169_diablo3_di_062908_hr.x264.avi”

3G wireless:

Fast again! It takes seconds to download google map application. I don’t see the progress bar stops at all.

Things I don’t like:

The earbud comes with the package. I like earbud, however I found it doesn’t work well with the Bold. Even it’s fully plugged into the bold, if I turn the plugged-in earphone, it effects the sound. Sometimes it becomes one channel of sound. It may be caused by bad contact or a defective earbud.

Conclusion:

Before I can get my Bold (in one month or two, financial reasons), I will stick to my trusty Curve.

Hey, I just changed the theme on my Curve to Bold precision theme clone.

some images taken by using an iphone 3G. easy on the image quality

  • Share/Save/Bookmark