I want to attach a disk to a DomU. The Xen DomU is running and should not be rebooted. Hence, changing its configuration file is not an option. How to dynamically attach a disk to running DomU in Xen? To attach phy:vg_xen/vm-228-large to vm-228 as xvdb, run this on Dom0: # xl block-attach vm-228 phy:vg_xen/vm-228-large
Read more
Category: QA
Questions and answers.
How to make ctags recognize specific files with certain extensions as C source files?
Posted onHow to make ctags recognize specific files with certain extensions such as .c0 or .puc as C source files? You may add this line to your ~/.ctags: –langmap=c:+.c0,c:+.puc
How to make taglist recognize specific files with certain extensions as C source files?
Posted onHow to make taglist recognize specific files with certain extensions as C source files? You may try adding this line to your ~/.vimrc: autocmd BufRead,BufNewFile *.c0 set filetype=c Reference: https://stackoverflow.com/questions/9013263/vim-tagslist-plugin-not-detecting-custom-language-racket
How to create a git branch on remote git server
Posted onWe may need to maintain a dev-name branch on git remote server to share your codes. How to create the branch? 1, git checkout -b your_branch_name 2, Do your changes, add commit 3, git push origin your_branch_name References:http://stackoverflow.com/questions/1519006/how-do-you-create-a-remote-git-branch
Simple and Basic Image Editor in Linux
Posted onWhich simple and basic image editors are good on Linux like the paint program on Windows? GIMP is great but too high weighted for normal usage like resizing, cropping, image annotation with text. Pinta is a free and open source drawing/editing program that is easy to edit images. It is available on many Linux distros.
Read more
How to kick off a user on a Linux box?
Posted onI want to kick off a user such as “bob” on a Linux box which I managed remotely. How to do this? bob may log on the Linux box by various ways: Log on the screen on the Linux box (locally) with a X server. Log on remotely by a ssh shell. Log on by
Read more
How to force iPhone to reboot/restart/reset?
Posted onHow can I force iPhone to reboot/restart/reset when it locks up completely and does not response? To force an iPhone to restart: Press and hold the iPhone’s power key and home button together. Holding the two keys for around 10~15 seconds until the screen is turned off. Release the buttons once the screen lights up
Read more
How to suppress “Entering/Leaving…” messages when invoking make recursively?
Posted onThe “Entering/Leaving…” messages when invoking another make by a make is kind of annoying. Is it possible to suppress these messages and how to suppress them? For GNU make, it is controlled by options: -w, –print-directory Print a message containing the working directory before and after other processing. This may be useful for tracking down
Read more
How to add a new HDFS NameNode metadata directory to an existing cluster?
Posted onWe have a running HDFS cluster. Currently, the NameNode metadata data directory has only one directory configured in hdfs-site.xml: <property> <name>dfs.namenode.name.dir</name> <value>file:///home/hadoop/hdfs/</value> <description>NameNode directory for namespace and transaction logs storage.</description> </property> We would like to add a new directory for dfs.namenode.name.dir to make replicas of the metadata on a separated disk for higher data reliability.
Read more
How to resize a batch of images on Linux?
Posted onResizing images on Linux with gThumb is easy. However, I have a batch of images inside a folder. Manually resizing them will consume too much time. How to automatically resize them on Linux with a script? You can use convert from ImageMagick together with bash script to resize images inside a directory. mkdir resize; IFS=$(echo
Read more
Fixing “Remote Host Identification Has Changed” Error When SSH to a Server
Posted onIf you encounter an error message like the one below when attempting to SSH to a server: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! Someone could be eavesdropping on you right now (man-in-the-middle attack)! It is also possible that a host key has
Read more
How to add a “status bar” to screen on Linux?
Posted onI noticed that some guys’ screen console has a status bar with tab numbers. That will be very useful for 1) know you are using screen rather than a normal terminal. 2) which tab you are working in. Below is my ~/.screenrc: hardstatus alwayslastline hardstatus string ‘%{= kG}[ %{G}%H %{g}][%= %{=kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B}%Y-%m-%d %{W}%c %{g}]’ It
Read more
How to detect whether an image is almost blank on Linux?
Posted onHow to detect whether a .jpg image is almost blank/black on Linux? Here is a bash function that I used to detect whether an image is black on Linux: function isBlank () { mean=`convert $1 -format “%[mean]” info:` echo “$mean” } It uses ImageMagic to generate formatted image characteristics (the mean). If the mean is
Read more
How to check the replication factor of a file in HDFS?
Posted onA related question: how to find the replication factors of files in a HDFS cluster? method 1: You can use the HDFS command line to ls the file. The second column of the output will show the replication factor of the file. For example, $ hdfs dfs -ls /usr/GroupStorage/data1/out.txt -rw-r–r– 3 hadoop zma 11906625598 2014-10-22
Read more
List Files from a .deb Package in Ubuntu Linux
Posted onHow to list all files from a .deb package like rpm -ql on RPM based systems? Use this command dpkg -L pkg_name -L lists files: -L, –listfiles package-name… List files installed to your system from package-name. More on the dpkg command, check dpkg manual.
How to merge multiple jpg images to a pdf on Linux?
Posted onI have multiple jpg images as files like 001.jpg, 002.jpg … How to merge multiple jpg images to a pdf on Linux? convert is your good friend: convert *.jpg output.pdf
how to remove specific directories recursively
Posted onHow to remove .svn directories under hlfs dir recursively as follows. weiwei@weiwei-HP-Compaq-dx6128-MT-PX478AV:~/workshop1/hlfs > find ./ -name “.svn” ./test/build/.svn ./test/.svn ./output/conf/.svn ./output/lib32/.svn ./patches/.svn ./src/include/.svn ./src/include/api/.svn ./src/snapshot/.svn ./src/snapshot/unittest/build/.svn ./src/snapshot/unittest/.svn ./src/utils/.svn ./src/clean/Mapreducer/build/.svn ./src/clean/Mapreducer/.svn ./src/clean/.svn ./src/clean/unittest/.svn ./src/icache/.svn ./src/icache/unittest/.svn ./src/backend/.svn ./src/storage/.svn ./src/cache/.svn ./src/cache/unittest/.svn ./src/clone/.svn ./src/tools/.svn ./src/tools/unittest/.svn ./src/logger/.svn weiwei@weiwei-HP-Compaq-dx6128-MT-PX478AV:~/workshop1/hlfs > find ./ -name “.svn” | xargs rm -rf
How to download a rtmp stream on Linux?
Posted onHow to download a rtmp video stream on Linux? You can use mplayer to dump the rtmp stream like: mplayer -dumpstream rtmp://example.com/path/to/stream.mp4 It will generate ./stream.dump and you can rename it to the file with the extension you need like stream.mp4. The rtmp link usually can be found from the HTML or JavaScript source code
Read more
How to change an running HDFS cluster’s replication factor?
Posted onNow, I have a running HDFS cluster storing lost files. I want to change its default replication factor. How to change it? What will happen after it is changed? For example, I change from 2 to 3. Will HDFS automatically re-replicate the data chunks? First, the replication factor is client decided. Second, the replication factor
Read more
How to install latest version of Calibre?
Posted onHow to install latest version of Calibre? The version from my distro (Ubuntu, Linux Mint, Fedora) seem at 1.xx while the latest Calibre is already at 2.x. You may check Caibre website’s instruction: http://calibre-ebook.com/download_linux sudo -v && wget -nv -O- https://raw.githubusercontent.com/kovidgoyal/calibre/master/setup/linux-installer.py | sudo python -c “import sys; main=lambda:sys.stderr.write(‘Download failedn’); exec(sys.stdin.read()); main()”