python numpy/matplotlib绘制生物节律曲线

import numpy as np
import matplotlib.pyplot as plt
import matplotlib.image as mpimg

import datetime
import math

def daysnow(birthdate):
return (datetime.date.today() – birthdate).days

def clockwise(days, p):
return math.sin(2*math.pi *(days % p) / p)

def clockwise_2(date, birthdate, p):
return math.sin(2*math.pi*((date – birthdate).days % p) / p)

base = datetime.date.today()
birthdate = datetime.date(年, 月, 日)
datelist = [base + datetime.timedelta(days=x) for x in range(-15, 15)]

dla = np.array(datelist)
dlb = np.array([clockwise_2(x, birthdate, 23) for x in datelist])
dlc = np.array([clockwise_2(x, birthdate, 28) for x in datelist])
dld = np.array([clockwise_2(x, birthdate, 33) for x in datelist])

plt.plot(dla, dlb, dla, dlc, dla, dld)
plt.show()

java/ruby unzip

http://www.java2s.com/Tutorial/Java/0180__File/UnzipusingtheZipInputStream.htm

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;

public class MainClass {

public static void main(String[] args) throws IOException {

for (int i = 0; i < args.length; i++) { FileInputStream fin = new FileInputStream(args[i]); ZipInputStream zin = new ZipInputStream(fin); ZipEntry ze = null; while ((ze = zin.getNextEntry()) != null) { System.out.println("Unzipping " + ze.getName()); FileOutputStream fout = new FileOutputStream(ze.getName()); for (int c = zin.read(); c != -1; c = zin.read()) { fout.write(c); } zin.closeEntry(); fout.close(); } zin.close(); } } } http://www.kodejava.org/examples/334.html package org.kodejava.example.util.zip; import java.io.*; import java.util.zip.ZipInputStream; import java.util.zip.ZipEntry; public class UnzipDemo { public static void main(String[] args) { String zipname = "data.zip"; try { FileInputStream fis = new FileInputStream(zipname); ZipInputStream zis = new ZipInputStream(new BufferedInputStream(fis)); ZipEntry entry; // // Read each entry from the ZipInputStream until no more entry found // indicated by a null return value of the getNextEntry() method. // while ((entry = zis.getNextEntry()) != null) { System.out.println("Unzipping: " + entry.getName()); int size; byte[] buffer = new byte[2048]; FileOutputStream fos = new FileOutputStream(entry.getName()); BufferedOutputStream bos = new BufferedOutputStream(fos, buffer.length); while ((size = zis.read(buffer, 0, buffer.length)) != -1) { bos.write(buffer, 0, size); } bos.flush(); bos.close(); } zis.close(); fis.close(); } catch (IOException e) { e.printStackTrace(); } } } http://www.markhneedham.com/blog/2008/10/02/ruby-unzipping-a-file-using-rubyzip/ require 'rubygems' require 'zip/zip' def unzip_file (file, destination) Zip::ZipFile.open(file) { |zip_file| zip_file.each { |f| f_path=File.join(destination, f.name) FileUtils.mkdir_p(File.dirname(f_path)) zip_file.extract(f, f_path) unless File.exist?(f_path) } } http://stackoverflow.com/questions/856891/unzip-zip-tar-tag-gz-files-with-ruby http://www.anyang-window.com.cn/tag/ava-zip/page/3/ http://www.iteye.com/topic/626705

Oracle on Ubuntu Linux

http://blogs.oracle.com/toxophily/entry/installing_oracle_11g_db_on

http://www.linuxidc.com/Linux/2011-03/32807.htm

http://www.pythian.com/news/13291/installing-oracle-11gr2-enterprise-edition-on-ubuntu-10-04-lucid-lynx/

https://forums.oracle.com/forums/thread.jspa?threadID=954055

1.

Update Packages

apt-get update
apt-get update

apt-get install elfutils libaio1 libaio-dev libstdc++6-4.4-dev numactl pdksh sysstat unixODBC-dev unixODBC build-essential libaio1 gawk ksh libmotif3 alien libtool lsb-rpm

2.

Create Groups

groupadd oinstall
groupadd dba
groupadd nobody

usermod -g nobody nobody

3.

Create / Update oracle User

useradd -s /bin/bash -m -g oinstall -G dba oracle

passwd oracle

4.

The following command is required to successfully run the installer.

xhost local:oracle

5.

Configure Limits for oracle

sudo gedit /etc/security/limits.conf

Add :

oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536

6.

Configure System

sudo gedit /etc/sysctl.conf

Add :

fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
net.ipv4.tcp_wmem = 262144 262144 262144
net.ipv4.tcp_rmem = 4194304 4194304 4194304

7.

Make Directories

mkdir -p /u01/app/oracle
chown -R oracle:oinstall /u01/app/oracle
chmod -R 775 /u01/app/oracle
mkdir -p /u01/app/oraInventory
chown -R oracle:oinstall /u01/app/oraInventory
chmod -R 775 /u01/app/oraInventory

8.

Link command to location expected by oracle installer

ln -s /usr/bin/awk /bin/awk
ln -s /usr/bin/rpm /bin/rpm
ln -s /usr/bin/basename /bin/basename

9

Run Installer

I assume here that the user has previously installed the oracle database. If not simply follow the default options when the database installer executes.

./runInstaller

https://localhost:1158/em

Invalid source path ‘../stage/Components/oracle.jdk/1.5.0.17.0/1/DataFiles’ specified for unzip.

问题,第二张盘没有解压

http://www.oracle.com/technetwork/developer-tools/sql-developer/downloads/index.html

http://www.oracle.com/technetwork/developer-tools/jdev/overview/index.html

mysql 123456

自启动

Post Install

Add the following to /etc/profile

export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export ORACLE_OWNR=oracle
export
PATH=$PATH:$ORACLE_HOME/bin

Start Script

Create /etc/init.d/oracledb with the following contents:

#!/bin/bash
#
# Run-level Startup script for the Oracle Listener and Instances
# It relies on the information on /etc/oratab
#
export ORACLE_OWNR=oracle
export ORACLE_OWNER=oracle
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export PATH=$PATH:$ORACLE_HOME/bin

if [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME ]
then
echo “Oracle startup: cannot start”
exit 1
fi

case “$1” in
start)
# Oracle listener and instance startup
echo -n “Starting Oracle: ”
su $ORACLE_OWNR -c “$ORACLE_HOME/bin/lsnrctl start”
su $ORACLE_OWNR -c “$ORACLE_HOME/bin/dbstart $ORACLE_HOME”
touch /var/lock/oracle
echo “OK”
;;
stop)
# Oracle listener and instance shutdown
echo -n “Shutdown Oracle: ”
su $ORACLE_OWNR -c “$ORACLE_HOME/bin/lsnrctl stop”
su $ORACLE_OWNR -c “$ORACLE_HOME/bin/dbshut $ORACLE_HOME”
rm -f /var/lock/oracle
echo “OK”
;;
reload|restart)
$0 stop
$0 start
;;
\*)
echo “Usage: `basename $0` start|stop|restart|reload”
exit 1
esac

exit 0

Execute :

cd /etc/init.d
update-rc.d oracledb defaults 99

The above will create links within the rc\*.d directories.

TNS:net service name is incorrectly specified

http://space.itpub.net/519536/viewspace-672034

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC=(
(SID_NAME=orcl)
(GLOBAL_DBNAME=orcl)
(ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1/)
)
)
)

NL-00303: syntax error in NV string

alert.log文件位置
unix下在:$ORACLE_BASE/admin/sid/bdump下
windows:%ORACLE_BASE%/admin/sid/bdump下

在使用emctl的时候碰到了ulimit: 25: bad number.的错误
这是因为Ubuntu默认把/bin/sh指向了dash,通过修改emctl脚本的头部,将/bin/sh改成/bin/bash即解决问题。

emctl stop dbconsole

d0

连理枝

天色多变幻,人生爱高洁。
惊龙隽彩,斜阳清丽,有凤初歇。
前一夜金风只送爽,恰如冷冰泄。

畅怀无限好,快意伴轻歌。
无需多言,把手弄脏,哪听评说。
做一事便遂了心愿,管他成几何?

+++仿佛轻云应笑我–相携水岸弄朝霞–此生只为听天籁–坐拥书城看落花+++