How to use ibus for inputting Chinese in Cinnamon on Fedora 19? By default, ibus is not started. If I manually start it by run $ ibus-daemon The ibus daemon is started and an icon appears in the tray area. However, no Chinese is inputted to the programs even it is turned on in the
Read more
Tag: Linux
How to convert seconds since the epoch to a date in Linux?
Posted onHow to convert seconds since the epoch (1970-01-01 UTC) to a date in Linux? For example, Convert the time stamp 1349361711.169942 to Thu Oct 4 22:41:51 HKT 2012 You can use the date command on Linux to convert the time formats. For converting the time stamp 1349361711.169942 to the normal data format: $ date -d
Read more
How to replace gdm with lightdm on Fedora
Posted onCinnamon does not work well with gdm. And there is no meaning to use gdm when using Cinnamon. On Fedora, the default one id gdm. How to replace gdm with lightdm on Fedora? First, install lightdm if it is not installed yet: # yum install lightdm lightdm-gtk Then, disable gdm service and make the lightdm
Read more
GUI tool to crop PDF file margins on Linux
Posted onAny GUI tools to crop PDF file margins on Linux? I use krop: http://arminstraub.com/computer/krop krop is a simple graphical tool to crop the pages of PDF files. To install krop on Fedora: # yum install krop
How to tell whether the shell is run in screen
Posted onHow to tell whether the shell is run in screen? For example, I run screen and it starts a bash environment. How to tell in the bash, whether it is run by screen or it is a normal bash environment? It can be identified by checking the TERM environment variable: In a bash in screen:
Read more
How to install Cinnamon on Fedora
Posted onHow to install the Cinnamon desktop environment on Fedora 19? On Fedora 19: # yum groupinstall ‘Cinnamon Desktop’ to install the packages needed for the Cinnamon desktop environment. Then, in the login screen, select ‘Cinnamon’ in the “Session” menu and you will start the Cinnamon desktop environment.
HTML form generation from the database and store value into the database
Posted onI have a “t_form” table and a “t_attribute” table. It looks a little bit like below. Form table form_id | form_name | description ———————————– 1 | Laptop | Possible attributes are Model, Screen Size, OS, Cd Player 2 | Mobile | Possible attributes are Model, OS 3 | Tablet | Possible attributes are Model, Screen
Read more
How to set the geometry for Gnome 3 under a VNC Server
Posted onWith Gnome 3, I try to start a vncserver with $ vncserver -geometry 1024×768 to start a vnc server with geometry 1024×768, which works well with Gnome 2 before. This also works for twm. However, after I connect to the vnc server, the resolution is not 1024×768. I change the geometry to other resolution and
Read more
How to make a static library (.a) on Linux
Posted onHow to make a static library (.a) on Linux? How to generate a library from C programs in files lib1.c and lib2.c: $ gcc -c lib1.c lib2.c Create a library “libmy.a” using ar: $ ar -cvq libmy.a lib1.o lib2.o You can also list the files in a library with ar: $ ar -t libmy.a You
Read more
How to install JRE for Chrome on Linux x86-64
Posted onHow to install JRE for Chrome on Linux x86-64? Use JRE from Oracle on Fedora Linux x86-64 as the example: Download jre from http://java.com/en/download/manual.jsp?locale=en#lin . Select Linux x64. Install it by # yum install jre-7u40-linux-x64.rpm (the downloaded rpm). Make a softlink of the plugin:$ cd ~/.mozilla/plugins/; ln -s /usr/java/jre1.7.0_40/lib/amd64/libnpjp2.so ./ Restart Chrome and browse chrome://plugins/
Read more
How to set and get an environment variable in C on Linux?
Posted onHow to set and get an environment variable in C on Linux? You can use the setenv and getenv POSIX APIs to set and get environment variables. To add or change environment variable: #include <stdlib.h> int setenv(const char *envname, const char *envval, int overwrite); To get value of an environment variable: #include <stdlib.h> char *getenv(const
Read more
How to pipe the stderr to less
Posted onFor example, try to less the error messages generated by the compiler with make | less Use this command: make 2>&1 | less or, if you want stderr only: make 2>&1 >/dev/null | less
How to list the functions in a .a library on Linux
Posted onHow to list the functions in a .a library on Linux? You can use the nm command: The nm utility shall display symbolic information appearing in the object file, executable file, or object-file library named by file. If no symbolic information is available for a valid input file, the nm utility shall report that fact,
Read more
Mount Ext4 Partitions in Windows in read-only mode
Posted onHow to mount Ext4 partitions from Linux in Windows in read-only mode? Read-only is required to ensure safety. Mounting is required so that traditional programs can use the partition without any changes. Ext2Fsd is a great tool for this. Ext2Fsd is a file system driver which allows accessing (both reading and writing) ext2, ext3 or
Read more
Run cron jobs with environmental variables for an account
Posted onA common error for configuring cron is to use environmental variables for an account in the cron command. However, cron will run the commands without these variables defined. In the crontab -e, adding . $HOME/.profile before the commands play the trick. For example: 0 */8 * * * . $HOME/.profile; ~/bin/my-command Cron is started by
Read more
Installing WordPress in a sub directory while working for the whole site
Posted onHow to install WordPress in a sub directory while working for the whole site? Putting the WordPress files in the root directory seems messy. A method is introduced here: http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory The process to move WordPress into its own directory is as follows: Create the new location for the core WordPress files to be stored (we
Read more
Vim Regular Expressions Tutorials
Posted onGood tutorials on Vim regular Expressions. Vim Regular Expressions: http://www.softpanorama.org/Editors/Vimorama/vim_regular_expressions.shtml Another good one in Chinese: http://www.study-area.org/tips/vim/Vim-10.html
Find out the number of CPU cores on Linux
Posted onHow to find out the number of CPU cores on a Linux host. Use the command nproc. $ nproc nproc – print the number of processing units available: man page of nproc.
Installing Fedora 19, Error “you have not created a bootloader stage1 target device”
Posted onInstalling Fedora 19, Error “you have not created a bootloader stage1 target device” . It seems appear from Fedora 15: http://forums.fedoraforum.org/showthread.php?t=271743 This can be solved by adding noefi nogpt to the kernel parameters when booting the Linux for installation in grub as follows. Note: the “_” between nogpt and root is the cursor, not the
Read more
How to change the maximum execution time and memory size allowed for PHP
Posted onI see this message in the error log of httpd: PHP Fatal error: Maximum execution time of 30 seconds exceeded in and PHP Fatal error: Allowed memory size of 268435456 bytes exhausted How to change them to a longer and larger value? To change the allowed maximum memory usage of PHP: Set memory_limit = 256M
Read more