Monday, March 30, 2009

Delete Files Older Than x Days on Linux

Delete Files Older Than x Days on Linux

The find utility on linux allows you to pass in a bunch of interesting arguments, including one to execute another command on each file. We'll use this in order to figure out what files are older than a certain number of days, and then use the rm command to delete them.

Command Syntax

find /path/to/files* -mtime +5 -exec rm {} \;

Note that there are spaces between rm, {}, and \;

Explanation

  • The first argument is the path to the files. This can be a path, a directory, or a wildcard as in the example above. I would recommend using the full path, and make sure that you run the command without the exec rm to make sure you are getting the right results.
  • The second argument, -mtime, is used to specify the number of days old that the file is. If you enter +5, it will find files older than 5 days.
  • The third argument, -exec, allows you to pass in a command such as rm. The {} \; at the end is required to end the command.

This should work on Ubuntu, Suse, Redhat, or pretty much any version of linux.

Thursday, March 19, 2009

Juice for Firefox vs 火狐魔镜



Juice is a Firefox extension by a chinese group in Beijing, which can show the video or picture in your right side bar of Firefox. At the same time, there is a special version of Firefox for China named 火狐魔镜, which offer the similar features. But, this version also have some other buildin extension, among which is the stocks market link, online music, online game. Some of the functions are not avilable outside of China.

How to fix the Firefox memory leak

Original at

http://internetducttape.com/2006/12/02/how-to-fix-the-firefox-memory-leak-firefox-hack/

Firefox memory leak? It doesn’t have one. Unfortunately, because of the way it’s configured to run out of the box it *looks* like it has one.

Follow these simple steps to get your Firefox memory usage under control.

#1: about:config

Type “about:config” into your address bar to access the hidden configuration options for Firefox.

firefox-memory-leak.png

#2: browser.cache.memory.capacity

Controls how much memory is used to cache pages.

Right click on the page and choose New then Integer and create an integer called browser.cache.memory.capacity and set it to a low number. This controls how many kilobytes of memory are used for the browser’s cache.

NOTE: number in screenshot is too small. Aim for 80% of whatever the default is.

firefox-memory-leak3.png

#3: browser.cache.disk.capacity

Controls how much disk space is used to cache pages in kilobytes.

Set browser.cache.disk.capacity to between 5000 or 15000.

128MB to 512M -> 5000.
512BM to 1GB of RAM -> use 15000

firefox-memory-leak6.png

#4: config.trim_on_minimize (optional)

Configure Firefox to swap memory to disk when minimized. This will make Firefox less responsive if you minimize/maximize a lot, but it is good if you need to free memory while multi-tasking to other applications.

Right click on the page and choose New then Boolean and create a boolean called config.trim_on_minimize and set it to true. Now when you minimize the window it will free up memory.

firefox-memory-leak4.png

#5: network.prefetch-next

Network link prefetch will download all pages with the rel=”prefetch” tag. This uses up more memory than you would otherwise think.

Set network.prefetch-next to false.

firefox-memory-leak2.png

#6: browser.sessionhistory.max_total_viewers

This controls how many pages of history are kept in the back/forward buttons. Lower the value to something acceptable. If you do not use back/forward often then you can set this very low.
Set browser.sessionhistory.max_total_viewers to a low number.

firefox-memory-leak5.png

How to fix the Firefox memory leak

Original at

http://internetducttape.com/2006/12/02/how-to-fix-the-firefox-memory-leak-firefox-hack/

Firefox memory leak? It doesn’t have one. Unfortunately, because of the way it’s configured to run out of the box it *looks* like it has one.

Follow these simple steps to get your Firefox memory usage under control.

These configuration changes are a trade-off between internet browsing speed and memory usage. They are most useful if you are multitasking and need Firefox to be less of a memory hog while using other applications.

#1: about:config

Type “about:config” into your address bar to access the hidden configuration options for Firefox.

firefox-memory-leak.png

#2: browser.cache.memory.capacity

Controls how much memory is used to cache pages.

Right click on the page and choose New then Integer and create an integer called browser.cache.memory.capacity and set it to a low number. This controls how many kilobytes of memory are used for the browser’s cache.

NOTE: number in screenshot is too small. Aim for 80% of whatever the default is.

firefox-memory-leak3.png

#3: browser.cache.disk.capacity

Controls how much disk space is used to cache pages in kilobytes.

Set browser.cache.disk.capacity to between 5000 or 15000.

128MB to 512M -> 5000.
512BM to 1GB of RAM -> use 15000

firefox-memory-leak6.png

#4: config.trim_on_minimize (optional)

Configure Firefox to swap memory to disk when minimized. This will make Firefox less responsive if you minimize/maximize a lot, but it is good if you need to free memory while multi-tasking to other applications.

Right click on the page and choose New then Boolean and create a boolean called config.trim_on_minimize and set it to true. Now when you minimize the window it will free up memory.

firefox-memory-leak4.png

#5: network.prefetch-next

Network link prefetch will download all pages with the rel=”prefetch” tag. This uses up more memory than you would otherwise think.

Set network.prefetch-next to false.

firefox-memory-leak2.png

#6: browser.sessionhistory.max_total_viewers

This controls how many pages of history are kept in the back/forward buttons. Lower the value to something acceptable. If you do not use back/forward often then you can set this very low.
Set browser.sessionhistory.max_total_viewers to a low number.

firefox-memory-leak5.png

Monday, March 09, 2009

First picture by my new tablet.

Using my new tablet. Hanvon 0806

Friday, February 27, 2009

Windows XP Shortcuts

Windows XP Shortcuts:

ALT+- (ALT+hyphen) Displays the Multiple Document Interface (MDI) child window's System menu
ALT+ENTER View properties for the selected item
ALT+ESC Cycle through items in the order they were opened
ALT+F4 Close the active item, or quit the active program
ALT+SPACEBAR Display the System menu for the active window
ALT+TAB Switch between open items
ALT+Underlined letter Display the corresponding menu
BACKSPACE View the folder one level up in My Computer or Windows Explorer


CTRL+A Select all
CTRL+B Bold
CTRL+C Copy
CTRL+I Italics
CTRL+O Open an item
CTRL+U Underline
CTRL+V Paste
CTRL+X Cut
CTRL+Z Undo
CTRL+F4 Close the active document
CTRL while dragging Copy selected item
CTRL+SHIFT while dragging Create shortcut to selected iteM
CTRL+RIGHT ARROW Move the insertion point to the beginning of the next word
CTRL+LEFT ARROW Move the insertion point to the beginning of the previous word
CTRL+DOWN ARROW Move the insertion point to the beginning of the next paragraph
CTRL+UP ARROW Move the insertion point to the beginning of the previous paragraph
SHIFT+DELETE Delete selected item permanently without placing the item in the Recycle Bin
ESC Cancel the current task


F1 Displays Help
F2 Rename selected item
F3 Search for a file or folder
F4 Display the Address bar list in My Computer or Windows Explorer
F5 Refresh the active window
F6 Cycle through screen elements in a window or on the desktop
F10 Activate the menu bar in the active program
SHIFT+F10 Display the shortcut menu for the selected item
CTRL+ESC Display the Start menu
SHIFT+CTRL+ESC Launches Task Manager
SHIFT when you insert a CD Prevent the CD from automatically playing


WIN Display or hide the Start menu
WIN+BREAK Display the System Properties dialog box
WIN+D Minimizes all Windows and shows the Desktop
WIN+E Open Windows Explorer
WIN+F Search for a file or folder
WIN+F+CTRL Search for computers
WIN+L Locks the desktop
WIN+M Minimize or restore all windows
WIN+R Open the Run dialog box
WIN+TAB Switch between open items

Wednesday, February 11, 2009

Some awesome Linux Application

fsview a graphic disk usage viewer.

elisa Linux media center

banshee music application.

Friday, February 06, 2009

Hope the winter will be ended soon




It is too cold during the last monthes. It was about zero degree this Tuesday.

Tuesday, December 16, 2008

Ubuntu is really nice release

I installed Ubuntu in my old latop several days ago. It works really fine on this 2.5 years old TOSHIBA M50 laptop, with 1.87GHZ CPU and 1G DDR. There are no error during the OS installation, all the drivers for this laptop were installed automatically without any problem, by the way, I installed the system with the burned 8.10 CD. Ubuntu gives easy way to install needed application. Package installed in my system are
  • Openoffice: office
  • firefox : browser
  • evince: pdf, djvu viewer
  • totem: media player
  • scilib: free scientific package as Matlab
  • Latex
  • vim
  • Amule
  • Wine
  • Urban terror: A Counter-Strike like FPS game. Free

Tuesday, November 11, 2008

Code to replace KVM hub

Find a very useful tools today named SYNERGY, which provide the possiblity to share single input device (mouse, keyboard) between several PCs or laptops with various operate systems. I currently use the Suse as the Synergy server and Windows XP laptop as the client, it works greatly. So for people with several PCs on your desktop, this is the easiest solution without any additional device.

Tuesday, June 10, 2008

Tips for Excel VBA

In a small Excel document, the input data need to be validated before saving. That is why a VBA code is needed. I hope this can also be done using formula, but a short VBA code look more sophisticated.

Firstly, Target is a range variable where the just input data located, it is a cell, generally. Secondly, I need to autofill or change some cells according to the new input data, I have to call the subroutine from the Change event, but, of cause, we can not modify the cell directly, otherwise, it will call such subroutine continously into a endless loop. What we need is inserting the code between
Application.EnableEvents = False
....
Application.EnableEvents = True

Finnally, to check if a cell is empty or not can be done by built-in function IsEmpty().

Sunday, June 08, 2008

08 端午


一糯一菰一角黍,
一羹一箸一望乡。
屈子无意随波去,
我辈怎可妄退耕。

Tuesday, June 03, 2008

Forecastfox™ 0.9.7.5 bug in status bar

With the new update of great extension Forecastfox for Firefox, there is a bug in status bar, error message is:

_______<label
id="ff-load-label" value="&ff.preview.loading.label;"/>

----------^




In order to sovle it, one need to do the following (Original from Forecastfox office support forum)

  • Close firefox.
  • Go to C:\Documents and Settings\[your user name]\Application Data\Mozilla\Firefox\Profiles\[some random string].default\extensions
  • view the folder in detaild mode and order by change date. Open the last changed folder.. Which probably is the forecastfox's folder...
  • Open the chrome folder..
  • open the forecastfox.jar with winrar...
  • Goto locale and select the language your using under forecastfox folder you will find forecastfox.dtd extract it and add

    <!ENTITY ff.preview.loading.label
    "Loading...">

Forecastfox™ 0.9.7.5 bug in status bar

With the new update of great extension Forecastfox for Firefox, there is a bug in status bar, error message is:

_______
----------^

In order to sovle it, one need to do the following (Original from Forecastfox office support forum)

  • Close firefox.
  • Go to C:\Documents and Settings\[your user name]\Application Data\Mozilla\Firefox\Profiles\[some random string].default\extensions
  • view the folder in detaild mode and order by change date. Open the last changed folder.. Which probably is the forecastfox's folder...
  • Open the chrome folder..
  • open the forecastfox.jar with winrar...
  • Goto locale and select the language your using under forecastfox folder you will find forecastfox.dtd extract it and add

Thursday, May 29, 2008

Mechenosets 捧剑者

一部很不错的俄罗斯电影,故事一般般,不过摄影相当出色。

男主角是极修长的那种精肉男子和印象中的好运种俄国大力士相去甚远,不过很符合这几年的影视风格,已经过了Stallone 和 Arnold 这种肌肉男的时代了,Arnold 从政了,Stallone 到缅甸了,也不敢露肉了,是这种干瘦的人精出来的时候了,就象 Adrien Brody这样的,主角和他还真有几分相似。

女主角是一个初看不怎么漂亮的姑娘,不过当她一笑,那双大眼立刻风情万种,再一查,原来好了 说是出演《再见列宁》的Chulpan Khamatova, 越看越有味道,尤其是那一段侧卧的镜头,加上摄影的高超水准,造就一幅古典的艺术画章。

片子的摄影很棒,每个场景都给人相当的视觉冲击和享受,颓废的、深远的、迷惑的、华丽的、深情的、黑暗的、无一不让人沉迷回味,要学摄影,这个电影可以成一个典范的。

至于故事本身,不能说上乘,立意有些意思,象那种X-men,只是经常失控,以致于自我毁灭都不行,右手无敌,不知道是不是得益于周星星的《新精武门》。其它比较一般,开始挺乱,后来才慢慢看出来门道,乱是一种风格,就看用得好不好了。血是给足了,只是有些细节特技做的不够好。

不管怎么说还算是部不错的片子,好象号称与《守日者》《守夜者》相承的作品,推荐看看。
IMDB 7/10 http://us.imdb.com/mymovies/list?l=6416408