导出 日记 到其他blog: 豆瓣日记 -> twitterfeed -> ping.fm -> blogger/wordpress 导出 广播 到twitter: 豆瓣广播 -> feedburner -> twitter (->facebook) 豆瓣广播 到 新浪微博: 豆瓣广播 -> google reader (add star) stared -> 新浪微博(关联博客) http://bit.ly/dpOErL
Friday, 26 February 2010
Monday, 11 January 2010
[Blog post] python reads excel
python reads excelcrossz | January 11, 2010 at 1:12 am | Tags: python tutorial howto | Categories: life | URL: http://wp.me/pthU9-hH |
Use the excellent xlrd package, which works on any platform. That means you can read Excel files from Python in Linux! Example usage:
Open the workbook
import xlrd wb = xlrd.open_workbook('myworkbook.xls') Check the sheet names
wb.sheet_names()
Get the first sheet either by index or by name
sh = wb.sheet_by_index(0) sh = wb.sheet_by_name(u'Sheet1')
Iterate through rows, returning each as a list that you can index:
for rownum in range(sh.nrows): print sh.row_values(rownum)
If you just want the first column:
first_column = sh.col_values(0)
Index individual cells:
cell_A1 = sh.cell(0,0).value cell_C4 = sh.cell(rowx=3,colx=2).value
(Note Python indices start at zero but Excel starts at one)

--
![]() | WordPress.com | Thanks for flying with WordPress! |
at
01:12
0
comments
Saturday, 5 December 2009
HOWTO: backup / resotre mysql database for drupal
To Backup:
- select the database need backup in phpMyAdmin
- select the tab of Export, and save as file in a sql format.
- upload the drupal installation files into the proper directory.
- copy the old director of /site/all, in which are the modules and themes to the new site directory. Otherwise some functionalities will miss.
- create the database you want in phpMyAdmin with proper database name.
- select the new database and Import.
- Install the new drupal site.
at
08:12
0
comments
Wednesday, 14 October 2009
HOWTO install egg file for python
Using easy_install, which is installed by setuptools (http://pypi.python.org/pypi/setuptools).
~$ easy_install XXXXX.egg
This is for binary egg file. While script egg file should be treated as normal shell script. To install:
~$ sh XXXXXX.egg
#######################
Another popular way to install python 'modules', is:
~$ python setup.py install
This is from python source. Normally third parties will provide such kind of source.
at
20:52
0
comments
labels: python
Thursday, 10 September 2009
HOWTO: screencast in Ubuntu
With recordmydesktop, ffmpeg, mencoder, libavcodec-unstripped-52 ( for aac audio encoder), ubuntu-restricted-extras installed. Run the following command to record and convert it to mp4 format, in order to upload to youtube.
recordmydesktopmencoder out.ogv -oac pcm -ovc lavc-lavcopts vcodec=mpeg4-o out.mp4
at
19:32
0
comments
Thursday, 20 August 2009
Matlab: Mex example in C way
There is a yprime.c for mex in Matlab. Here I translate to C, in order to understand mex better.
#include <math.h>#include <stdio.h>#include <string.h>#include <stdlib.h>static void yprime(
double* yp,
double* y
)
{
double r1,r2;
double mu = 1/82.45;
double mus = 1 - 1/82.45;
r1 = sqrt((y[0]+mu)*(y[0]+mu) + y[2]*y[2]);
r2 = sqrt((y[0]-mus)*(y[0]-mus) + y[2]*y[2]);
yp[0] = y[1];
yp[1] = 2*y[3]+y[0]-mus*(y[0]+mu)/(r1*r1*r1)-mu*(y[0]-mus)/(r2*r2*r2);
yp[2] = y[3];
yp[3] = -2*y[1] + y[2] - mus*y[2]/(r1*r1*r1) - mu*y[2]/(r2*r2*r2);
return;
}
int main(){
double yo[4];
double yi[4] = {100, 2, 3, 4};
yprime(yo, yi);
printf("print out %f",yo[0]);
// some conversion practice
double a = yi[0];
char t1[7],t2[8],t3[8];
*t1= (char) a;
strcpy(t2,t1);
printf(strcat(t1, t2));
gcvt(a,7,t3);
puts(t3);
// i = sprintf(str, "%d", 15); //for interger to string
return 0;
}
at
02:13
0
comments
Sunday, 16 August 2009
HOWTO: compile objective-c using gcc in Linux
to compile these examples of objective-c (install libobjc first) from objective-c on wikipedia.org
1) traditional:
gcc -c XX.m XXX.m -Wno-import
gcc -o prog XX.o XXX.o -lobjc -Wno-import
2) gcc *.m -lojbc -Wno-import
Note:
-Wno-import is because the maintainer of gcc doesn't like 'import';
-lobjc: -l(library) -L(libaray directory) -lobjc(for GNU objective-c libraray)
For those examples using GNUstep, most of the header files need to be changed from ' #import
More details: http://www.cs.indiana.edu/classes/c304/oop-intro.html
at
18:24
0
comments
labels: C/C++
Monday, 3 August 2009
HOWTO: Version control using BZR vs RCS
No matter programming or documents editing, BZR will work for you to provide easier and better version control.
Here are some simple steps for docs processing:
======================
- bzr init
create a folder, 'text', then create a file, 'test1.txt', in which we type in a paragraph. Then 'bzr init' to let bzr know this is the folder where bzr should monitor. - bzr add
'bzr add test1.txt'. Now bzr knows where and what to monitor. - bzr diff
add more text into the test1.txt, then run 'bzr diff' to test whether there is any changes. - bzr commit -m 'description'
if there are some changes, and you want to create another version for that for the current version backup. run 'bzr commint -m "some description"'. - bzr log
to check verisons.
...
more changes and more commits here.
... - bzr branch
-r
For example we just want to retrive the first version, run 'bzr branch `pwd` -r 1'. A new folder with the name of current folder 'text' will be created, in which our text1.txt 1st version is there.
===================
- create folder RCS
this step can be ignored, the rcs information will be saved in the same folder with the file you are editing. Otherwise, the file info file will be saved in the RCS folder. - ci -u test1.txt
ver 1.1 is created. RCS uses the concept of 'lock'. -l -r -u are similar, to keep the text file locked when new version is registered. - co -l test1.txt
(if without this step, new version can not be registered. because 'no lock', prompted by 'ci', is this for synchronization?) So to lock the text file to make it writable (very weird concept, locked == writable???). Then add more text in it. - rcsdiff test1.txt
To check what's different from the registered version. - ci -u test1.txt (same with step2)
The version number increment with 0.1.'ci -r2 -u test1.txt' to make the version increment by 1.0.
...
more changes and more commits here.
... - co -l1.1 test1.txt
Retrive version 1.1 to replace the current editing file. -l -r -u are similar, just -u makes the file non-writeable, while -l make the file writeable. Good practice is 'ci -u' and 'co -l', so that when the new version is registered by ci, the file will become 'non-writable'='can not modify'='No lock'. (weired)
Conclusion:
==================
BZR is more user friendly, and Ubuntu uses it on launchpad.net.
RCS is quite mature (old), LYX uses it as version control. So even I don't like it, but I have to still use it, because I love Lyx.
at
21:25
0
comments
Sunday, 2 August 2009
HOWTO: autoconf & automake HELLO WORLD
1) Create sources, “Makefile.am”
2) `autoscan`:create configure.scan
3) Rename “configure.scan” to “configure.ac”
4) `autoheader`:create config.h.in for automake
5) Add AM_INIT_AUTOMAKE to “configure.ac”, just after AC_INIT()
6) `aclocal`:create necessary macros in aclocal.m4 for automake.
7) `automake --add-missing --copy`: create Makefile.in from Makefile.am
8) `autoconf`:create configure
9) `./configure`:check and create Makefile
10) `make`
11) `make install`
if you modify your source...
1) Run `autoscan` again
2) Compare configure.scan with configure.ac
* Update configure.ac
3) Run `autoreconf`
***********************
# Makefile.am for hello.c
bin_PROGRAMS=hello
hello_SOURCES=hello.c
***********************
To simplify it:
===============
1) c/cc files, Makefile.am
2) autoscan => mv configure.scan configure.ac => add Add AM_INIT_AUTOMAKE after AC_INIT
3) autoheader
4) aclocal
5) automake
6) autoconf <=> autoscan,(compare configure.ac),autoreconf
7) ./configure && make && make install
Simplest 'make'
=====================
Hello.c:
#include
Makefile:
int main(int argc, char* argv[])
{
printf("Hello, world!\n");
return 0;
}
# Makefile: A standard Makefile for hello.c
Run: make, to create executable bin file.
all: hello
clean: rm -f hello
at
20:43
2
comments
HOWTO: autoconf & automake
- Write makefile.am templates.
- Write configure.in.
2.1 Use autoscan to generate a template.
2.2 Specialize the generated configure.scan to suit your project.
2.3 Rename configure.scan to configure.in. - Run automake to generate Makefile.in from Makefile.am (automake scans configure.in to find out more about the project).
- Run aclocal to make local copies of all autoconf macros. These macros are then included in the project.
- Run autoconf to generate configure.
=========================
automake
automake, when used in conjunction with autoconf, makes creating Makefiles easy. automake operates on a Makefile.am to generate Makefile.in . Makefile.in is then processed by the configure script to generate Makefile. Makefile.am has macros that are processed by automake. A sample Makefile.am is shown below. Variables surrounded by @'s are automatically propagated without change to Makefile.in. The configure script, when parsing Makefile.in into Makefile, makes the necessary substitutions (for example, @LDFLAGS@ may get expanded to "-lm -lthread).
bin_PROGRAMS = gpstat
gpstat_SOURCES = about.c interface.c multi-plot.c attach_process.c
gpstat_LDFLAGS = @LDFLAGS@ @GTK_LIBS@ -lgthread
INCLUDES = @GTK_CFLAGS@
automake knows the rules to create object files and executables for the platform it is running on. The above sets of macros tell automake that:
1. The final executable is to be named gpstat.
2. The sources for gpstat are the value of gpstat_SOURCES.
3. Add @LDFLAGS@, @GTK_LIBS@, and -lgthread to the link line. (The configure script will replace LD_FLAGS and GTK_LIBS with their proper values.)
4. Include the variable $INCLUDES in the compilation line.
=========================
autoconf
The configure script is generated from configure.in using autoconf. configure.in is a normal text file that contains several autoconf macros. These macros specify what tests to carry out. General uses of the configure script include:
1. Find machine information (Hostname, version...).
2. Find the path to a particular program (bison, lex, ...).
3. Find out if a tool supports a feature (for example, if the compiler supports bool).
4. Check if the required libraries are available on your system.
5. Process Makefile.in to generate Makefile.
=========================================
automake also provides autoscan, a utility script that will help you create a template configure.in. autoscan scans the program sources and adds suitable macros to configure.in. It creates configure.scan, which then should be renamed configure.in, after making suitable modifications.
automake also provides a program called aclocal. aclocal makes local copies of all autoconf macros, so that other developers can modify the configure.in file.
You can combine the invocation of automake, aclocal, and autoconf as follows:
foo@pastwatch$ aclocal&& automake && autoconf
Sample:
Comments can either begin with dnl or a #. The following is a small, well-documented, self-explanatory configure.in file.
#============================start configure.in============================
dnl Process this file with autoconf to produce a configure script.
dnl notice how comments are preceded by "dnl"
# comments can also begin with a #
dnl This macro is a must, and this tests if the configure
dnl script is running in the correct directory
AC_INIT(src/about.c)
dnl This macro tells the configure script to put
dnl "defines" in a file rather than the command line.
AM_CONFIG_HEADER(config.h)
dnl get the flags
CFLAGS="${CFLAGS=}"
dnl this macro is used to get the arguments supplied
dnl to the configure script (./configure --enable-debug)
dnl Check if we have enable debug support.
AC_MSG_CHECKING(whether to enable debugging)
debug_default="yes"
AC_ARG_ENABLE(debug, [ --enable-debug=[no/yes] turn on debugging
[default=$debug_default]],, enable_debug=$debug_default)
dnl Yes, shell scripts can be used
if test "x$enable_debug" = "xyes"; then
CFLAGS="$CFLAGS -g -DDEBUG"
AC_MSG_RESULT(yes)
else
CFLAGS="$CFLAGS -O3 -ffast-math -mcpu=v8 -mtune=ultrasparc"
AC_MSG_RESULT(no)
fi
dnl tells us that we require autoconf with version greater than
dnl 2.12 to generate configure
AC_PREREQ(2.12)
dnl get system information
AC_CANONICAL_SYSTEM
dnl Since foo is currently untested on any os other
dnl than solaris, so check the os and quit if not solaris.
UNSUPPORTED_OS="FOO is currently unsupported on your platform.
If you are interested in making it work on your platform, you are
more than *welcome*. Contact foo@bar.sun.com for details."
case "${target_os}" in
solaris*)
echo ===========================================================
echo Setting up build environment for ${target_cpu}${target_os}
echo ===========================================================
;;
*)
AC_MSG_ERROR($UNSUPPORTED_OS)
esac
# Build time sanity check...
AM_SANITY_CHECK
dnl get path to install program
AC_PROG_INSTALL
AC_ARG_PROGRAM
VERSION=0.1
PACKAGE=foo
dnl initialize automake
AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
dnl Checks for c compiler.
AC_PROG_CC
dnl check for standard c headers
AC_HEADER_STDC
dnl export these variable (so Makefile substitutions
dnl can be made.
AC_SUBST(CFLAGS)
AC_SUBST(LDFLAGS)
dnl Checks for libraries.
dnl AC_CHECK_LIB(gthread, g_thread_init)
dnl AC_CHECK_LIB(pthread, pthread_create)
dnl Check for /proc
AC_CHECK_FILE(/proc,,AC_MSG_ERROR(Cannot
find /proc. See the file 'README' for help.))
dnl check for procfs.h
AC_CHECK_HEADER(procfs.h,,
AC_MSG_ERROR(Cannot
find procfs.h. See the file 'README' for help.))
dnl Checks for header files.
AC_CHECK_HEADERS(fcntl.h)
AC_CHECK_HEADERS(time.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_PID_T
dnl Create these files, making substitutions if necessary
AC_OUTPUT([
src/Makefile
Makefile
]
)
#============================end configure.in============================
at
16:21
0
comments
Tuesday, 28 July 2009
HOWTO: get stdin from shell in Gedit External Tool
The following code can get the input from Gedit External Tool as you assigned for 'input'.
#!/bin/bashThe trick is the command of xargs.
search=`xargs`
echo $search
Also available Environment Variables in Gedit External Tool are:
=====================
GEDIT_CURRENT_DOCUMENT_URI
GEDIT_CURRENT_DOCUMENT_NAME
GEDIT_CURRENT_DOCUMENT_SCHEME
GEDIT_CURRENT_DOCUMENT_PATH
GEDIT_CURRENT_DOCUMENT_DIR
GEDIT_DOCUMENTS_URI
GEDIT_DOCUMENTS_PATH
An example: compile java file and run it
=========================
javac $GEDIT_CURRENT_DOCUMENT_NAME && java -cp . `echo $GEDIT_CURRENT_DOCUMENT_NAME | sed s/.java//`
at
00:56
0
comments
Wednesday, 22 July 2009
16-bit binary data interpreting difference between Java and Matlab
The 16-bit data will be interpreted as different values in Java and Matlab. WHY??
Here are some experiments: save number 15 to 8-bit and 16-bit binary files, and another 259 in 16-bit binary files (refer to : this post).
======================
In Matlab (fread(fid1, 'uint8');): 15
16 bit bin file containing 15:
In WinHex: 0F 00
In java (DataInputStream.readShort();): [3840, 0]
=> 3840/256=15;
=> so, it's a kind of [15 00]
In Matlab (fread(fid1, 'uint16');): 15
16 bit bin file containing 259:
In WinHex: 03 01
In java (DataInputStream.readShort();): [769, 0] //Note, for every byte, java can
contain a value larger than 256, while other programming language will increment.
=> 769%256 = 1; 769/256=3.0039;
=> so, it's a kind of [03 01]
In Matlab (fread(fid1, 'uint16');): 259
Therefore:
========================
Therefore, a integer value in the range of 16-bit, for example 41837. In Matlab,
it will be intepreted as 41837, mod(41837,256)=109, 41837/256=163.4. So 41837 can
be displayed as [163 109] = 163*256+109; while java intepret [163 109] as
163+109*256 = 28067;
Conclusion:
========================
This seems wrong inside Java, but Java know how to process such value and export
it correctly to another bin file, which one can be understood by Matlab, WinHex or
other programming languages or editor.
at
12:13
0
comments
Tuesday, 21 July 2009
Simplest procedure to TRIPLE BOOT on Macbook
The must:
- Only ONE partition for Linux; Only ONE partition for Windows. (to satisfy Windows)
- Windows must locates at the last partition. (to satisfy Macbook)
- Before installing, ensure the partitions are ready and good! (Disk Utility normally can not do this, or do half of this task. Because it will create several 'spare spaces' between each partitions made by it, these partitions always make the Windows installation fail due to more than 4 primary partitions existing. But Disk Utility can create one more partition from the original one whole partition, then split it using other ways, which includes 'diskutil' in Mac, 'gparted' from Linux Livecd or even the Windows installer during Windows setup). Any partitions modification will make Windows can not boot up even synced by rEfit.
- - If Windows has been installed by Boot Camp. Try to change boot.ini in my windows partition (disk util create a new partition between mac and windows and messed up my boot.ini, the partition it tried to boot (third) is now linux Hd instead of windows (become 4th. This might be your problem. It gave me BSoD right after splash screen)
So the procedure:
- Partitioning (DO NOT USE BOOT CAMP ASSISTANT)
- sync mbr/gpt using rEfit. (maybe can be ignored)
- Install Winxp on the 4th (last) partition.
- sync mbr/gpt using rEfit.(maybe can be ignored)
- Install Linux.
at
09:44
0
comments
labels: howto
Java/Matlab read and write 16-bit data file
- Read 16 bit binary file:
File file = new File("FILENAME.bin");
FileInputStream fis = new FileInputStream(file);
BufferedInputStream bis = new BufferedInputStream(fis);
DataInputStream dis = new DataInputStream( bis );
short[] myarray = new short[256000];
int cnt;
for (cnt = 0; cnt < 256000; cnt++) {
myarray[cnt] = dis.readShort();
}
fis.close();
Alternatively:RandomAccessFile dis = new RandomAccessFile(new File("FILENAME.bin"), "r");
Note:
1) bufferedInputStream can be ignored, but it will improve the performance 90% for large file operation.
2) RandomAccessFile works like a 'pointer', similar to fread in Matlab, offset or skip can be assign when data retrieving while not really load all the file. This class has both read and write methods, it is a convenience class, like filereader and filewriter, while the former method is kinda low level methods. - Write 16 bit binary file:
FileOutputStream fos = new FileOutputStream(new File("OUTPUT.bin"));
BufferedOutputStream bos = new BufferedOutputStream(fos);
DataOutputStream dos = new DataOutputStream(bos);
for (cnt = 0; cnt < 256000; cnt++) {
myarray[cnt] = dis.readShort();
}
bos.flush();
fos.close();
Alternatively:RandomAccessFile dos = new RandomAccessFile(new File("OUTPUT.bin"), "rw");
Note: The following step is essential!!!! Otherwise, there will be some data lost.bos.flush();
- Matlab:
fid1 = fopen('filename.bin', 'r');
A = fread(fid1, 100, 'uint16=>float32');
fclose(fid1);
fid2 = fopen('output.bin', 'w');
fwrite(fid2, A, 'uint16');
fclose(fid2);
at
00:32
0
comments
labels: java
Sunday, 19 July 2009
BUG, HOWTO: how java read 8-bit and 16-bit
you have to use twice as much memory, but there really is no other solution:
=======================
use a short to hold an unsigned byte, use a long to hold an unsigned int. (And use a char to hold an unsigned short.)
This example create a 16-bit file, which only contain a value, 15 in 16-bit (000f), This file can be viewed by Gedit. From Matlab, it can retrieve and display correctly as 15, but in Java, using DataInputStream.readShort(), it's 3840, which equals to 15*256.
Example 1: Using Matlab to generate a 16-bit data file.
================
clear;clc;%% create binA=15;fid = fopen('output.bin', 'w'); fwrite(fid, A, 'uint16');fclose(fid);%% read binfid1 = fopen('output.bin', 'r'); B = fread(fid1, 1, 'uint16')fclose(fid1);
Example 2: Using Java to retrive the 16-bit data from the bin file.
===========
import java.io.*;public class convbin { public static void main(String args[]) throws IOException { File file = new File("onev.bin"); FileInputStream fis = new FileInputStream(file); BufferedInputStream bis = new BufferedInputStream(fis); DataInputStream dis = new DataInputStream( bis );// RandomAccessFile dis = new RandomAccessFile(new File("fotech1.bin"), "r"); short[] myarray = new short[256000]; int cnt; for (cnt = 0; cnt < 1; cnt++) { myarray[cnt] = dis.readShort(); } fis.close(); System.out.println("Done."); FileOutputStream fos = new FileOutputStream(new File("o22.bin")); BufferedOutputStream bos = new BufferedOutputStream(fos); DataOutputStream dos = new DataOutputStream(bos);// RandomAccessFile dos = new RandomAccessFile(new File("o22.bin"), "rw"); for (cnt = 0; cnt < 1; cnt++) { dos.writeShort(myarray[cnt]); } System.out.println("Finish."); bos.flush(); fos.close(); }}
More details, except the example: http://www.darksleep.com/player/JavaAndUnsignedTypes.html
at
18:50
0
comments
labels: java
Friday, 17 July 2009
HOWTO: run remote X11 applications
The server is running on Linux. To run the remote server applications on my own machine:
- On Windows:
=======================
1. Install Xming as the X11 server.
2. Run Putty, as ssh client, with the X11 forwarding arguments: 'localhost:0' or ':0', or even with blank only enable forwarding. - On Mac OSX
=======================
1. run: ssh -X -l username 192.168.1.XXX
* using Putty: with the X11 forwarding arguments: ':0'!!!!!!!! - On Linux
=======================
1. run: ssh -X -l username 192.168.1.XXX
* using Putty: with the X11 forwarding arguments: ':0' or blank.
at
17:33
0
comments
Sunday, 12 July 2009
HOWTO: install Adobe Air on Feodra 11
Just guest Redhat developers want to improve the boot speed, they make the fedora 11 without some 'useful' packages by default. This makes some program can not installed properly, such as Adobe Air.
The fix:
================
yum -y install xterm gtk2-devel gnome-keyring libxml2-devel libxslt rpm-devel nssFrom: yum -y install xterm gtk2-devel gnome-keyring libxml2-devel libxslt rpm-devel nss
at
23:07
0
comments
放弃在Mac 10.5.7 上安装GNUstep 0.23
经过大半个星期的下班时间调试,尝试在Mac osx 10.5.7 (darwin 9.7)上安装GNUstep 0.23,最终没有成功,还把Mac弄残一次,我猜可能是由于compiling的时候出现的segmentation fault致使Kernel Panic。
- make的时候,常常是需要 $LDFLAG 比用到 $DYLD_LIBRARY_PATH 的时候多。后者貌似更像是运行程序的时候使用,而不是configure和make时候用。
- Mac作为操作系统,其界面无可争议,但是底层系统方面,我个人觉得还不如Linux。在最近的console下编译程序的时候,出现两次致使Mac不断重启的情况,而解决方法都是不得不重装系统后,第二次更离谱,连cmd+s的single user mode都无法进入。Mac啊,现在给我的感觉是典型的外强中干。
- GNUstep需要有gnu的objc runtime,如果用默认的设置,必然使得其调用mac自带的gcc和objc的库,这样肯定会带来些兼容性的问题。 我猜我弄出的两次mac无法开机不断重启,与此两种不兼容并冲突的objc有关系。因为GNUstep在ubuntu 9.04和fedora 11下编译运行的很好。如果想在Mac上安装,我觉得还得是要等macports提供,macports跟进的还算不错,对gnustep,和官方新版本放出的时间也就差2个星期左右。可是,macports下的objc目前还不能安装,等到这个出现后,可以再试编译gnustep源文件。
at
11:26
0
comments
Thursday, 9 July 2009
HOWTO: remove files older than N days
Command Syntax
find /path/to/files* -mtime +5 -exec rm {} \;
Note that there are spaces between rm, {}, and \;
Usage:
======================
Extremely useful for Miro, because it doesn't delete files unwatched. So with this command added in /usr/bin/miro, the Miro library will keep only latest videos no matter you watch it or not.
=======================
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.
Command from: http://www.howtogeek.com/howto/ubuntu/delete-files-older-than-x-days-on-linux/
at
00:07
0
comments
Tuesday, 7 July 2009
HOWTO: compile source code on MAC OS X
Conditions:
- For library invoking:
export LDFLAGS='-L/usr/local/lib -L/usr/lib -L/opt/local/lib -L/sw/lib'
- '-L/dir' is the convention to setup gcc switch, while -L for make is --check-symlink-times, useless for me :)
- Official way for invoking library is to setup $DYLD_LIBRARY_PATH (export DYLD_LIBRARY_PATH=/usr/local/lib:/usr/lib:/opt/local/lib:/sw/lib), which in Linux is $LD_LIBRARY_PATH by default.
- Normally lib path don't need specified, because the bin files (in /usr/bin or /opt/local/bin' will know where to get appropriate libraries, no matter bin files from Macports or Fink. - For header files invoking:
export CPPFLAGS='-I/usr/local/include -I/usr/include -I/opt/local/include -I/sw/include'
- This is the way to setup both 'make' and 'gcc' switch, which is 'make -I/usr/local/include'.
at
22:33
0
comments

