assorted-commits Mailing List for Assorted projects (Page 11)
Brought to you by:
yangzhang
You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(9) |
Dec
(12) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(86) |
Feb
(265) |
Mar
(96) |
Apr
(47) |
May
(136) |
Jun
(28) |
Jul
(57) |
Aug
(42) |
Sep
(20) |
Oct
(67) |
Nov
(37) |
Dec
(34) |
2009 |
Jan
(39) |
Feb
(85) |
Mar
(96) |
Apr
(24) |
May
(82) |
Jun
(13) |
Jul
(10) |
Aug
(8) |
Sep
(2) |
Oct
(20) |
Nov
(31) |
Dec
(17) |
2010 |
Jan
(16) |
Feb
(11) |
Mar
(17) |
Apr
(53) |
May
(31) |
Jun
(13) |
Jul
(3) |
Aug
(6) |
Sep
(11) |
Oct
(4) |
Nov
(17) |
Dec
(17) |
2011 |
Jan
(3) |
Feb
(19) |
Mar
(5) |
Apr
(17) |
May
(3) |
Jun
(4) |
Jul
(14) |
Aug
(3) |
Sep
(2) |
Oct
(1) |
Nov
(3) |
Dec
(2) |
2012 |
Jan
(3) |
Feb
(7) |
Mar
(1) |
Apr
|
May
(1) |
Jun
|
Jul
(4) |
Aug
(5) |
Sep
(2) |
Oct
(3) |
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
(9) |
Apr
(5) |
May
|
Jun
(2) |
Jul
(1) |
Aug
(10) |
Sep
(1) |
Oct
(2) |
Nov
|
Dec
|
2014 |
Jan
(1) |
Feb
(3) |
Mar
(3) |
Apr
(1) |
May
(4) |
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
2016 |
Jan
(1) |
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
2017 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(5) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(2) |
2018 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <yan...@us...> - 2010-05-14 18:53:46
|
Revision: 1652 http://assorted.svn.sourceforge.net/assorted/?rev=1652&view=rev Author: yangzhang Date: 2010-05-14 18:53:39 +0000 (Fri, 14 May 2010) Log Message: ----------- added hiddensections.tex Added Paths: ----------- sandbox/trunk/src/tex/hiddensections.tex Added: sandbox/trunk/src/tex/hiddensections.tex =================================================================== --- sandbox/trunk/src/tex/hiddensections.tex (rev 0) +++ sandbox/trunk/src/tex/hiddensections.tex 2010-05-14 18:53:39 UTC (rev 1652) @@ -0,0 +1,28 @@ +% Thanks to mariano|syzygy on #latex. +% http://gist.github.com/55492 + +\documentclass{article} +\usepackage{lipsum} % Generates dummy text. + +\makeatletter +\let\old@addcontentsline\addcontentsline +\def\trivial@addcontentsline#1#2#3{} +% Can also use \newcommand here +\def\Subsubsection#1{% + \let\addcontentsline\trivial@addcontentsline + \subsubsection{#1} + \let\addcontentsline\old@addcontentsline +} +\makeatother + +\begin{document} + +\tableofcontents + +\section{alpha} +\subsection{subalpha} +\subsubsection{first} \lipsum[1] +\Subsubsection{second}\lipsum[2] +\subsubsection{third} \lipsum[3] + +\end{document} \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2010-05-14 18:52:36
|
Revision: 1651 http://assorted.svn.sourceforge.net/assorted/?rev=1651&view=rev Author: yangzhang Date: 2010-05-14 18:52:30 +0000 (Fri, 14 May 2010) Log Message: ----------- Forgot to add subprocess sub.bash Added Paths: ----------- sandbox/trunk/src/nix/buffer/sub.bash Added: sandbox/trunk/src/nix/buffer/sub.bash =================================================================== --- sandbox/trunk/src/nix/buffer/sub.bash (rev 0) +++ sandbox/trunk/src/nix/buffer/sub.bash 2010-05-14 18:52:30 UTC (rev 1651) @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +./gen | cat | cat Property changes on: sandbox/trunk/src/nix/buffer/sub.bash ___________________________________________________________________ Added: svn:executable + * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2010-05-14 18:47:07
|
Revision: 1650 http://assorted.svn.sourceforge.net/assorted/?rev=1650&view=rev Author: yangzhang Date: 2010-05-14 18:47:01 +0000 (Fri, 14 May 2010) Log Message: ----------- Demo of using tokyo cabinet Added Paths: ----------- sandbox/trunk/src/py/tc.py Added: sandbox/trunk/src/py/tc.py =================================================================== --- sandbox/trunk/src/py/tc.py (rev 0) +++ sandbox/trunk/src/py/tc.py 2010-05-14 18:47:01 UTC (rev 1650) @@ -0,0 +1,23 @@ +#!/usr/bin/env python + +from tokyocabinet import btree + +db = btree.BTree() +db.open('/tmp/test.tcb', btree.BDBOWRITER | btree.BDBOCREAT) +db['loves spam'] = 'Vikings' +db['parrot'] = 'not dead' +print len(db) +print db['parrot'] +db['apples'] = '' +db['apprehend'] = '' +db['arrogant'] = '' +print db.fwmkeys('a') +print db.fwmkeys('ap') +try: print db['orcs'] +except KeyError: pass +cur = db.cursor() +print cur.first() +print cur.rec() +print cur.last() +try: print cur.next() +except KeyError: pass Property changes on: sandbox/trunk/src/py/tc.py ___________________________________________________________________ Added: svn:executable + * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2010-05-14 18:45:16
|
Revision: 1649 http://assorted.svn.sourceforge.net/assorted/?rev=1649&view=rev Author: yangzhang Date: 2010-05-14 18:45:10 +0000 (Fri, 14 May 2010) Log Message: ----------- boost_any demo Added Paths: ----------- sandbox/trunk/src/cc/boost_any.cc Added: sandbox/trunk/src/cc/boost_any.cc =================================================================== --- sandbox/trunk/src/cc/boost_any.cc (rev 0) +++ sandbox/trunk/src/cc/boost_any.cc 2010-05-14 18:45:10 UTC (rev 1649) @@ -0,0 +1,14 @@ +#include <boost/any.hpp> +#include <iostream> +#include <vector> +using namespace boost; +using namespace std; +int main() { + any a = 3; + any b = (const char *) "hello"; + vector<any> c; + c.push_back(1); + c.push_back((const char*) "hi"); + c.push_back(vector<any>()); + return 0; +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2010-05-14 18:44:17
|
Revision: 1648 http://assorted.svn.sourceforge.net/assorted/?rev=1648&view=rev Author: yangzhang Date: 2010-05-14 18:44:11 +0000 (Fri, 14 May 2010) Log Message: ----------- Illustration of non-C++-0x moveable ptr Added Paths: ----------- sandbox/trunk/src/cc/moveable_ptr.cc Added: sandbox/trunk/src/cc/moveable_ptr.cc =================================================================== --- sandbox/trunk/src/cc/moveable_ptr.cc (rev 0) +++ sandbox/trunk/src/cc/moveable_ptr.cc 2010-05-14 18:44:11 UTC (rev 1648) @@ -0,0 +1,24 @@ +template<typename T> +class moveable_ptr { + T *p; + + // Disable copying from lvalues. + moveable_ptr(moveable_ptr<T> &o) : p(nullptr) {} + +public: + moveable_ptr(T *p) : p(p) {} + + // In C++0x: + // moveable_ptr(moveable_ptr<T> &&o) : p(o.p) { + // o.p = nullptr; + // } + + // In C++03, settle with: + moveable_ptr(const moveable_ptr<T> &o) : p(o.p) { + const_cast<T*>(o.p) = nullptr; + } + + ~moveable_ptr() { if (p) delete p; } + T *get() const { return p; } + ... +}; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2010-05-14 18:43:11
|
Revision: 1647 http://assorted.svn.sourceforge.net/assorted/?rev=1647&view=rev Author: yangzhang Date: 2010-05-14 18:43:05 +0000 (Fri, 14 May 2010) Log Message: ----------- Forgot to add build file for streambufs Added Paths: ----------- sandbox/trunk/src/cc/streambufs.mk Added: sandbox/trunk/src/cc/streambufs.mk =================================================================== --- sandbox/trunk/src/cc/streambufs.mk (rev 0) +++ sandbox/trunk/src/cc/streambufs.mk 2010-05-14 18:43:05 UTC (rev 1647) @@ -0,0 +1,3 @@ +all: streambufs +%.cc: %.cc.cog + cog.py $< > $@ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2010-05-14 18:40:35
|
Revision: 1646 http://assorted.svn.sourceforge.net/assorted/?rev=1646&view=rev Author: yangzhang Date: 2010-05-14 18:40:29 +0000 (Fri, 14 May 2010) Log Message: ----------- Removed overflow directory Removed Paths: ------------- sandbox/trunk/src/c/overflow/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2010-05-14 18:37:54
|
Revision: 1645 http://assorted.svn.sourceforge.net/assorted/?rev=1645&view=rev Author: yangzhang Date: 2010-05-14 18:37:48 +0000 (Fri, 14 May 2010) Log Message: ----------- removed permissions Property Changed: ---------------- sandbox/trunk/src/java/Ipconfig.java Property changes on: sandbox/trunk/src/java/Ipconfig.java ___________________________________________________________________ Deleted: svn:executable - * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2010-05-14 18:32:34
|
Revision: 1644 http://assorted.svn.sourceforge.net/assorted/?rev=1644&view=rev Author: yangzhang Date: 2010-05-14 18:32:28 +0000 (Fri, 14 May 2010) Log Message: ----------- Updated homepage Modified Paths: -------------- assorted-site/trunk/index.txt Modified: assorted-site/trunk/index.txt =================================================================== --- assorted-site/trunk/index.txt 2010-05-14 18:14:03 UTC (rev 1643) +++ assorted-site/trunk/index.txt 2010-05-14 18:32:28 UTC (rev 1644) @@ -183,7 +183,7 @@ Copyright 2008 [Yang Zhang]. All rights reserved. -[Yang Zhang]: http://www.mit.edu/~y_z/ +[Yang Zhang]: http://yz.mit.edu/ <a href="http://sourceforge.net/projects/assorted"><img src="http://sflogo.sourceforge.net/sflogo.php?group_id=172932&type=10" width="80" height="15" alt="Get Assorted mini-projects at SourceForge.net. Fast, secure and Free Open Source software downloads" /></a> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2010-05-14 18:14:09
|
Revision: 1643 http://assorted.svn.sourceforge.net/assorted/?rev=1643&view=rev Author: yangzhang Date: 2010-05-14 18:14:03 +0000 (Fri, 14 May 2010) Log Message: ----------- Updated sync-bookmarks for new gbookmark2delicious Modified Paths: -------------- configs/trunk/src/cron/sync-bookmarks.bash Modified: configs/trunk/src/cron/sync-bookmarks.bash =================================================================== --- configs/trunk/src/cron/sync-bookmarks.bash 2010-05-08 23:14:22 UTC (rev 1642) +++ configs/trunk/src/cron/sync-bookmarks.bash 2010-05-14 18:14:03 UTC (rev 1643) @@ -1,5 +1,3 @@ #!/usr/bin/env bash - -FORCE_BASHRC=1 . ~/.bashrc && . common.bash || exit 1 - -exec gbookmark2delicious +PS1='$' . ~/.bashrc && . common.bash || exit 1 +exec gbookmark2delicious >> /tmp/gbookmark2delicious.log 2>&1 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2010-05-08 23:14:28
|
Revision: 1642 http://assorted.svn.sourceforge.net/assorted/?rev=1642&view=rev Author: yangzhang Date: 2010-05-08 23:14:22 +0000 (Sat, 08 May 2010) Log Message: ----------- added apache2 site conf Added Paths: ----------- configs/trunk/src/apache2/ configs/trunk/src/apache2/site.conf Added: configs/trunk/src/apache2/site.conf =================================================================== --- configs/trunk/src/apache2/site.conf (rev 0) +++ configs/trunk/src/apache2/site.conf 2010-05-08 23:14:22 UTC (rev 1642) @@ -0,0 +1,9 @@ + RedirectMatch permanent ^/notes([/]*)$ /notes/ + + <Location /notes/> + ProxyPass http://127.0.0.1:5001/ + SetOutputFilter proxy-html + ProxyPassReverse / + ProxyHTMLURLMap / /notes/ + RequestHeader unset Accept-Encoding + </Location> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2010-05-02 16:20:47
|
Revision: 1641 http://assorted.svn.sourceforge.net/assorted/?rev=1641&view=rev Author: yangzhang Date: 2010-05-02 16:20:41 +0000 (Sun, 02 May 2010) Log Message: ----------- resurrection demo Added Paths: ----------- sandbox/trunk/src/java/Resurrection.java Added: sandbox/trunk/src/java/Resurrection.java =================================================================== --- sandbox/trunk/src/java/Resurrection.java (rev 0) +++ sandbox/trunk/src/java/Resurrection.java 2010-05-02 16:20:41 UTC (rev 1641) @@ -0,0 +1,20 @@ +class Impossible { + public Impossible() { + throw new AssertionError("you cannot instantiate me"); + } + + public void foo() { + System.out.println("The impossible is possible!"); + } +} + +public class Resurrection { + public static void main(String[] args) { + ReflectionFactory rf = ReflectionFactory.getReflectionFactory(); + Constructor objDef = parent.getDeclaredConstructor(); + Constructor intConstr = rf.newConstructorForSerialization(clazz, objDef); + return clazz.cast(intConstr.newInstance()); + } +} + +// <http://blog.publicobject.com/2010/04/java-objects-back-from-dead.html> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2010-05-01 19:39:01
|
Revision: 1640 http://assorted.svn.sourceforge.net/assorted/?rev=1640&view=rev Author: yangzhang Date: 2010-05-01 19:38:55 +0000 (Sat, 01 May 2010) Log Message: ----------- nostdlib demo Added Paths: ----------- sandbox/trunk/src/c/nostdlib.c Added: sandbox/trunk/src/c/nostdlib.c =================================================================== --- sandbox/trunk/src/c/nostdlib.c (rev 0) +++ sandbox/trunk/src/c/nostdlib.c 2010-05-01 19:38:55 UTC (rev 1640) @@ -0,0 +1,8 @@ +// compile with gcc -nostdlib +// see also <http://blog.ksplice.com/2010/04/libc-free-world-2/> +void _start() { + /* exit system call */ + asm("movl $1,%eax;" + "xorl %ebx,%ebx;" + "int $0x80"); +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2010-04-29 20:49:53
|
Revision: 1639 http://assorted.svn.sourceforge.net/assorted/?rev=1639&view=rev Author: yangzhang Date: 2010-04-29 20:49:46 +0000 (Thu, 29 Apr 2010) Log Message: ----------- added demo of mmap-ing null Added Paths: ----------- sandbox/trunk/src/c/mmap_null.c Added: sandbox/trunk/src/c/mmap_null.c =================================================================== --- sandbox/trunk/src/c/mmap_null.c (rev 0) +++ sandbox/trunk/src/c/mmap_null.c 2010-04-29 20:49:46 UTC (rev 1639) @@ -0,0 +1,24 @@ +// <http://blog.ksplice.com/2010/03/null-pointers-part-i/> + +// (Note that most modern systems actually specifically disallow mapping the +// NULL page, out of security concerns. To run the following example on a +// recent Linux machine at home, you’ll need to run # echo 0 > +// /proc/sys/vm/mmap_min_addr as root, first.) + +#include <sys/mman.h> +#include <stdio.h> + +int main() { + int *ptr = NULL; + if (mmap(0, 4096, PROT_READ|PROT_WRITE, + MAP_PRIVATE|MAP_ANONYMOUS|MAP_FIXED, -1, 0) + == MAP_FAILED) { + perror("Unable to mmap(NULL)"); + fprintf(stderr, "Is /proc/sys/vm/mmap_min_addr non-zero?\n"); + return 1; + } + printf("Dereferencing my NULL pointer yields: %d\n", *ptr); + *ptr = 17; + printf("Now it's: %d\n", *ptr); + return 0; +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2010-04-28 19:54:10
|
Revision: 1638 http://assorted.svn.sourceforge.net/assorted/?rev=1638&view=rev Author: yangzhang Date: 2010-04-28 19:54:03 +0000 (Wed, 28 Apr 2010) Log Message: ----------- fixed email munging code to handle new pandoc output format Modified Paths: -------------- personal-site/trunk/Makefile Modified: personal-site/trunk/Makefile =================================================================== --- personal-site/trunk/Makefile 2010-04-28 16:45:14 UTC (rev 1637) +++ personal-site/trunk/Makefile 2010-04-28 19:54:03 UTC (rev 1638) @@ -1,4 +1,3 @@ -MUNGEMAIL := sed 's/><body$$/><body onload="javascript:body_onload();"/' PLAIN := out/plain.html INDEX := out/index.html REDIR := out-redir/index.html @@ -20,9 +19,8 @@ ln -sf plain.html $(INDEX) $(PLAIN): src/index.txt src/header.html out src/footer.html - pandoc -s -S --tab-stop=2 -H src/header.html -A src/footer.html src/index.txt \ - -c plain.css | \ - $(MUNGEMAIL) > $(PLAIN) + pandoc -s -S --tab-stop=2 -H src/header.html -A src/footer.html src/index.txt -c plain.css | \ + sed 's/<body>/<body onload="javascript:body_onload();">/' > $(PLAIN) publish: all scp -o CompressionLevel=9 -r out/* nr:/var/www/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2010-04-28 16:45:21
|
Revision: 1637 http://assorted.svn.sourceforge.net/assorted/?rev=1637&view=rev Author: yangzhang Date: 2010-04-28 16:45:14 +0000 (Wed, 28 Apr 2010) Log Message: ----------- handle id_rsa as well as id_dsa Modified Paths: -------------- shell-tools/trunk/src/bash-commons/bashrc.bash Modified: shell-tools/trunk/src/bash-commons/bashrc.bash =================================================================== --- shell-tools/trunk/src/bash-commons/bashrc.bash 2010-04-28 16:35:40 UTC (rev 1636) +++ shell-tools/trunk/src/bash-commons/bashrc.bash 2010-04-28 16:45:14 UTC (rev 1637) @@ -816,16 +816,26 @@ # <http://www.ibm.com/developerworks/linux/library/l-tip-prompt/> } +# +# Setup keychain +# + # -t 1 checks if fd 1 (stdout) is a terminal; if so then we're running # interactively. if [[ -t 1 ]] then keychain_flags= else keychain_flags=--noask fi - -if have keychain -then eval `keychain --eval --nogui $keychain_flags id_dsa 2> /dev/null` +# Prefer RSA keys +if [[ -f ~/.ssh/id_rsa ]] +then keyfile=id_rsa +elif [[ -f ~/.ssh/id_dsa ]] +then keyfile=id_dsa +else keyfile= fi +if have keychain && [[ $keyfile ]] +then eval `keychain --eval --nogui $keychain_flags $keyfile 2> /dev/null` +fi # TODO note that bash_completion usually does a ton of stuff (and in # particular it re/undefines `have`), so it's best to move this near the This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2010-04-28 16:35:46
|
Revision: 1636 http://assorted.svn.sourceforge.net/assorted/?rev=1636&view=rev Author: yangzhang Date: 2010-04-28 16:35:40 +0000 (Wed, 28 Apr 2010) Log Message: ----------- updated/simplified sync-bookmarks cron job Modified Paths: -------------- configs/trunk/src/cron/sync-bookmarks.bash Modified: configs/trunk/src/cron/sync-bookmarks.bash =================================================================== --- configs/trunk/src/cron/sync-bookmarks.bash 2010-04-28 16:35:24 UTC (rev 1635) +++ configs/trunk/src/cron/sync-bookmarks.bash 2010-04-28 16:35:40 UTC (rev 1636) @@ -2,4 +2,4 @@ FORCE_BASHRC=1 . ~/.bashrc && . common.bash || exit 1 -exec gbookmark2delicious --debug main --debug compare --underscores +exec gbookmark2delicious This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2010-04-28 16:35:31
|
Revision: 1635 http://assorted.svn.sourceforge.net/assorted/?rev=1635&view=rev Author: yangzhang Date: 2010-04-28 16:35:24 +0000 (Wed, 28 Apr 2010) Log Message: ----------- updated gitit config for reverse proxying Modified Paths: -------------- configs/trunk/src/gitit/config Modified: configs/trunk/src/gitit/config =================================================================== --- configs/trunk/src/gitit/config 2010-04-28 05:19:15 UTC (rev 1634) +++ configs/trunk/src/gitit/config 2010-04-28 16:35:24 UTC (rev 1635) @@ -126,7 +126,7 @@ debug-mode: no # if "yes", causes debug information to be logged while gitit is running. -compress-responses: yes +compress-responses: no # specifies whether HTTP responses should be compressed. mime-types-file: /etc/mime.types @@ -170,7 +170,7 @@ > Dear $username$: > > To reset your password, please follow the link below: - > http://$hostname$:$port$$resetlink$ + > http://$hostname$/notes$resetlink$ > > Yours sincerely, > The Wiki Master @@ -187,7 +187,7 @@ # hashed password. If your gitit wiki is being proxied to a location # other than the root path of $port$, you should change the link to # reflect this: for example, to -# http://$hostname$/path/to/wiki$resetlink$ or +# http://$hostname$/path/to/notes$resetlink$ or # http://gitit.$hostname$$resetlink$ use-feed: yes This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2010-04-28 05:19:21
|
Revision: 1634 http://assorted.svn.sourceforge.net/assorted/?rev=1634&view=rev Author: yangzhang Date: 2010-04-28 05:19:15 +0000 (Wed, 28 Apr 2010) Log Message: ----------- updated notes/ link and profile blurb Modified Paths: -------------- personal-site/trunk/src/index.txt Modified: personal-site/trunk/src/index.txt =================================================================== --- personal-site/trunk/src/index.txt 2010-04-25 19:19:33 UTC (rev 1633) +++ personal-site/trunk/src/index.txt 2010-04-28 05:19:15 UTC (rev 1634) @@ -21,7 +21,7 @@ </div> I'm a graduate student working with Prof. [Sam Madden] in [CSAIL] at [MIT] -doing research for high-scaling distributed database systems. I graduated from +doing research in high-scaling distributed database systems. I graduated from [UC Berkeley] in 2005 with a BS in Electrical Engineering and Computer Science. [Sam Madden]: http://db.csail.mit.edu/madden/ @@ -45,7 +45,7 @@ [Google (Buzz) profile]: http://www.google.com/profiles/yaaang [Blog]: http://yz.mit.edu/wp/ -[Notes Wiki]: http://zs.ath.cx:5001/ +[Notes Wiki]: http://yz.mit.edu/notes/ [Delicious Bookmarks]: http://del.icio.us/yaaang/ [gbookmark2delicious]: http://gbookmark2delicious.googlecode.com/ [GPG Key]: yang.gpg.asc This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2010-04-25 19:19:39
|
Revision: 1633 http://assorted.svn.sourceforge.net/assorted/?rev=1633&view=rev Author: yangzhang Date: 2010-04-25 19:19:33 +0000 (Sun, 25 Apr 2010) Log Message: ----------- changed web server to nr.ath.cx Modified Paths: -------------- personal-site/trunk/Makefile Modified: personal-site/trunk/Makefile =================================================================== --- personal-site/trunk/Makefile 2010-04-25 19:19:16 UTC (rev 1632) +++ personal-site/trunk/Makefile 2010-04-25 19:19:33 UTC (rev 1633) @@ -25,13 +25,14 @@ $(MUNGEMAIL) > $(PLAIN) publish: all - scp -o CompressionLevel=9 -r out/* lin:web_scripts/ + scp -o CompressionLevel=9 -r out/* nr:/var/www/ publish-redir: $(REDIR) scp $(REDIR) cs:public_html/ scp $(REDIR) ocf:public_html/ scp $(REDIR) pdos:public_html/ scp $(REDIR) lin:www/ + scp $(REDIR) lin:web_scripts/ scp $(REDIR) nms:public_html/ scp $(REDIR) hv:public_html/ scp $(REDIR) zs:public_html/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2010-04-25 19:19:25
|
Revision: 1632 http://assorted.svn.sourceforge.net/assorted/?rev=1632&view=rev Author: yangzhang Date: 2010-04-25 19:19:16 +0000 (Sun, 25 Apr 2010) Log Message: ----------- updated site url to yz.mit.edu; added link to relcloud; added details on my research; added buzz button Modified Paths: -------------- personal-site/trunk/src/index.txt Modified: personal-site/trunk/src/index.txt =================================================================== --- personal-site/trunk/src/index.txt 2010-04-18 00:46:17 UTC (rev 1631) +++ personal-site/trunk/src/index.txt 2010-04-25 19:19:16 UTC (rev 1632) @@ -5,21 +5,24 @@ <span id="email"></span> | [Google (Buzz) Profile] | [Blog] </div> -[Google (Buzz) Profile]: http://www.google.com/profiles/yaaang/ -[Blog]: http://yz.mit.edu/wp/ - <a name="about"></a> About me -------- -<img src="http://www.gravatar.com/avatar/e17a97a879e919ebc943bfb9d3fec409.png" - alt="Tim the Beaver and me" - style="box-shadow: 3px 3px 10px black; -webkit-box-shadow: 3px 3px 10px black; float: right;"/> +<div style="float: right; text-align: center;"> + <div style="padding: 1em;"> + <img src="http://www.gravatar.com/avatar/e17a97a879e919ebc943bfb9d3fec409.png" + alt="Tim the Beaver and me" + style="box-shadow: 3px 3px 10px black; -webkit-box-shadow: 3px 3px 10px black;"/> + </div> + <a target="_blank" title="Follow on Google Buzz" class="google-buzz-button" href="http://www.google.com/profiles/yaaang" data-button-style="follow">Follow on Buzz</a> + <script type="text/javascript" src="http://www.google.com/buzz/api/button.js"></script> +</div> -I'm a graduate student working with Prof. [Sam Madden] in [CSAIL] at [MIT]. I -graduated from [UC Berkeley] in 2005 with a BS in Electrical Engineering and -Computer Science. +I'm a graduate student working with Prof. [Sam Madden] in [CSAIL] at [MIT] +doing research for high-scaling distributed database systems. I graduated from +[UC Berkeley] in 2005 with a BS in Electrical Engineering and Computer Science. [Sam Madden]: http://db.csail.mit.edu/madden/ [CSAIL]: http://www.csail.mit.edu/ @@ -41,7 +44,7 @@ - [GPG Key] ([MIT PKS entry]) [Google (Buzz) profile]: http://www.google.com/profiles/yaaang -[Blog]: http://y_z.scripts.mit.edu/wp/ +[Blog]: http://yz.mit.edu/wp/ [Notes Wiki]: http://zs.ath.cx:5001/ [Delicious Bookmarks]: http://del.icio.us/yaaang/ [gbookmark2delicious]: http://gbookmark2delicious.googlecode.com/ @@ -56,8 +59,10 @@ Here are the (non-confidential) projects in which I've been involved. More details when I have time! +- [Relational Cloud]: database as a service that provides transparent + scalability and partitioning that maximizes the locality of co-accessed data. - Hedwig: a topic-based publish-subscribe wide-area messaging system designed - as a replication service in distributed systems like Yahoo [PNUTS] + as a replication service in distributed systems like Yahoo [PNUTS]. - [H-Store]: a distributed main-memory relational database management system for on-line transaction processing workloads. - [Invirt]: [SIPB]'s virtual machine management system. The name of the MIT @@ -95,6 +100,7 @@ - [Recovery-Oriented Computing] (ROC). - [Microsoft Search] and [Microsoft SharePoint Portal Server]. +[Relational Cloud]: http://www.relationalcloud.com/ [PNUTS]: http://research.yahoo.com/project/212 [Invirt]: http://invirt.mit.edu/ [SIPB]: http://sipb.mit.edu/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2010-04-18 00:46:23
|
Revision: 1631 http://assorted.svn.sourceforge.net/assorted/?rev=1631&view=rev Author: yangzhang Date: 2010-04-18 00:46:17 +0000 (Sun, 18 Apr 2010) Log Message: ----------- tagged 0.7 release Added Paths: ----------- python-commons/tags/0.7/ python-commons/tags/0.7/README python-commons/tags/0.7/publish.bash python-commons/tags/0.7/setup.py python-commons/tags/0.7/src/commons/__init__.py python-commons/tags/0.7/src/commons/files.py Removed Paths: ------------- python-commons/tags/0.7/README python-commons/tags/0.7/publish.bash python-commons/tags/0.7/setup.py python-commons/tags/0.7/src/commons/__init__.py python-commons/tags/0.7/src/commons/files.py Deleted: python-commons/tags/0.7/README =================================================================== --- python-commons/trunk/README 2010-04-18 00:18:13 UTC (rev 1625) +++ python-commons/tags/0.7/README 2010-04-18 00:46:17 UTC (rev 1631) @@ -1,93 +0,0 @@ -[documentation](doc) - -Overview --------- - -Python Commons is a general-purpose library for Python. To get a sense of -what it provides, please glance over the [documentation](doc). - -Requirements ------------- - -- [Python](http://python.org/) 2.5 -- [setuptools](http://peak.telecommunity.com/DevCenter/setuptools) 0.6 - -Certain sub-modules have extra requirements: - -- `async` requires [Twisted](http://twistedmatrix.com/trac/) 2.5 -- `files` requires [path](http://www.jorendorff.com/articles/python/path/) 2.2 - -This library has only been tested on Linux. - -Setup ------ - -To install, run `easy_install python-commons`, or download the source tarball -and run `python setup.py install`. - -Related Work ------------- - -- [ASPN Cookbook]: a valuable repository of Python snippets -- [AIMA Utilities]: accompaniment to a popular AI textbook - -[ASPN Cookbook]: http://aspn.activestate.com/ASPN/Cookbook/Python -[AIMA Utilities]: http://aima.cs.berkeley.edu/python/utils.py - -Changes -------- - -version 0.6, 2008-10-?? - -- to strs added unwrap, indent, unindent, remove_empty_lines, underline, - dos2unix, quotejs, unicode2html, html2unicode, nat_lang_join, or_join, - and_join -- to misc added sendmail, days, settimeout, run, TerminalController -- imported and updated jorendorff's path.py -- to startup added command_name -- to files added read_file, write_file, write_or_rm, is_nonempty_file -- added sqlhash and sqlhash backend for shelf -- to structs added dicts2structs, structs2dicts; FreeStruct renamed to - free_struct -- to seqs added span, group_as_subseqs -- decs.pickle_memoized uses protocol 2 -- general tweaks; epydoc fixes -- python 2.6-ready -- released for [Mailing List Filter], [MIT 6.00] courseware - -[Mailing List Filter]: http://assorted.sourceforge.net/mailing-list-filter/ -[MIT 6.00]: http://web.mit.edu/~6.00/ - -version 0.5, 2008-05-14 - -- added `cp1252_to_unicode()` -- made `setup()` more flexible -- released for - [gbookmark2delicious](http://gbookmark2delicious.googlecode.com/) - -version 0.4, 2008-05-08 - -- removed extraneous debug print statements -- added `logout()` context manager -- added `seq()`, `default_if_none()` -- fixed missing `import` bug -- released for [Mailing List - Filter](http://assorted.sf.net/mailing-list-filter/) - -version 0.3, 2008-04-30 - -- added versioned guards -- added file memoization -- added retry with exp backoff -- added `countstep()` -- released for - [gbookmark2delicious](http://gbookmark2delicious.googlecode.com/) - -version 0.2, 2008-02-04 - -- added `clients`, `setup` -- released for [icedb](http://cartel.csail.mit.edu/icedb/) - -version 0.1, 2007-03-24 - -- initial release Copied: python-commons/tags/0.7/README (from rev 1627, python-commons/trunk/README) =================================================================== --- python-commons/tags/0.7/README (rev 0) +++ python-commons/tags/0.7/README 2010-04-18 00:46:17 UTC (rev 1631) @@ -0,0 +1,117 @@ +[documentation](doc) + +Overview +======== + +Python Commons is a general-purpose library for Python. To get a sense of +what it provides, please glance over the [documentation](doc). + +Requirements +============ + +- [Python](http://python.org/) 2.6 +- [setuptools](http://peak.telecommunity.com/DevCenter/setuptools) 0.6 + +Certain sub-modules have extra requirements: + +- `async` requires [Twisted](http://twistedmatrix.com/trac/) 2.5 + +This library has only been tested on Linux. + +Setup +===== + +To install, run `easy_install python-commons`, or download the source tarball +and run `python setup.py install`. + +Related +======= + +The code here generally tries to complement the code already available in a +number of other general-purpose utility libraries for Python: + +- [AIMA Utilities]: accompanies a popular AI textbook +- [itools] +- [Grizzled] +- [PyUtilib] +- [Py] + +See also: + +- [ASPN Cookbook]: a valuable repository of Python snippets + +[ASPN Cookbook]: http://aspn.activestate.com/ASPN/Cookbook/Python +[AIMA Utilities]: http://aima.cs.berkeley.edu/python/utils.py +[itools]: http://www.hforge.org/itools +[Grizzled]: http://bmc.github.com/grizzled/ +[PyUtilib]: https://software.sandia.gov/trac/pyutilib +[Py]: http://codespeak.net/py/dist/ + +Changes +======= + +version 0.7, 2010-04-17 + +- released for gbookmark2delicious +- enhanced free_struct +- added recursion_guard decorator +- complete html2unicode +- wrap keys and values as strings in sqlhash +- logger should append by default +- added inet_nltoa, inet_hltoa +- internally use commons.path instead of (unmaintained) path.py + +version 0.6, 2009-06-03 + +- to strs added unwrap, indent, unindent, remove_empty_lines, underline, + dos2unix, quotejs, unicode2html, html2unicode, nat_lang_join, or_join, + and_join +- to misc added sendmail, days, settimeout, run, TerminalController +- imported and updated jorendorff's path.py +- to startup added command_name +- to files added read_file, write_file, write_or_rm, is_nonempty_file +- added sqlhash and sqlhash backend for shelf +- to structs added dicts2structs, structs2dicts; FreeStruct renamed to + free_struct +- to seqs added span, group_as_subseqs +- decs.pickle_memoized uses protocol 2 +- general tweaks; epydoc fixes +- python 2.6-ready +- released for [Mailing List Filter], [MIT 6.00] courseware + +[Mailing List Filter]: http://assorted.sourceforge.net/mailing-list-filter/ +[MIT 6.00]: http://web.mit.edu/~6.00/ + +version 0.5, 2008-05-14 + +- added `cp1252_to_unicode()` +- made `setup()` more flexible +- released for + [gbookmark2delicious](http://gbookmark2delicious.googlecode.com/) + +version 0.4, 2008-05-08 + +- removed extraneous debug print statements +- added `logout()` context manager +- added `seq()`, `default_if_none()` +- fixed missing `import` bug +- released for [Mailing List + Filter](http://assorted.sf.net/mailing-list-filter/) + +version 0.3, 2008-04-30 + +- added versioned guards +- added file memoization +- added retry with exp backoff +- added `countstep()` +- released for + [gbookmark2delicious](http://gbookmark2delicious.googlecode.com/) + +version 0.2, 2008-02-04 + +- added `clients`, `setup` +- released for [icedb](http://cartel.csail.mit.edu/icedb/) + +version 0.1, 2007-03-24 + +- initial release Deleted: python-commons/tags/0.7/publish.bash =================================================================== --- python-commons/trunk/publish.bash 2010-04-18 00:18:13 UTC (rev 1625) +++ python-commons/tags/0.7/publish.bash 2010-04-18 00:46:17 UTC (rev 1631) @@ -1,15 +0,0 @@ -#!/usr/bin/env bash - -post-stage() { - epydoc -v -o $stagedir/doc src/commons/ -} - -echo 'Remember to keep versions in sync in all three locations:' -echo '__init__.py, README (Changes), setup.bash, and setup.py' - -fullname='Python Commons' -version=0.6 -license=psf -websrcs=( README ) -rels=( pypi: ) -. assorted.bash "$@" Copied: python-commons/tags/0.7/publish.bash (from rev 1630, python-commons/trunk/publish.bash) =================================================================== --- python-commons/tags/0.7/publish.bash (rev 0) +++ python-commons/tags/0.7/publish.bash 2010-04-18 00:46:17 UTC (rev 1631) @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +post-stage() { + epydoc -v -o $stagedir/doc src/commons/ +} + +echo 'Remember to keep versions in sync in all three locations:' +echo '__init__.py, README (Changes), setup.bash, and setup.py' + +fullname='Python Commons' +version=0.7 +license=psf +websrcs=( README ) +rels=( pypi: ) +. assorted.bash "$@" Deleted: python-commons/tags/0.7/setup.py =================================================================== --- python-commons/trunk/setup.py 2010-04-18 00:18:13 UTC (rev 1625) +++ python-commons/tags/0.7/setup.py 2010-04-18 00:46:17 UTC (rev 1631) @@ -1,43 +0,0 @@ -#!/usr/bin/env python -# -*- mode: python; tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4; -*- -# vim:ft=python:et:sw=4:ts=4 - -import os,sys -sys.path.insert( 0, os.path.join( os.path.dirname( sys.argv[0] ), 'src' ) ) -from commons import setup - -pkg_info_text = """ -Metadata-Version: 1.1 -Name: python-commons -Version: 0.6 -Author: Yang Zhang -Author-email: yaaang NOSPAM at REMOVECAPS gmail -Home-page: http://assorted.sourceforge.net/python-commons -Summary: Python Commons -License: Python Software Foundation License -Description: General-purpose library of utilities and extensions to the - standard library. -Keywords: Python,common,commons,utility,utilities,library,libraries -Platform: any -Provides: commons -Classifier: Development Status :: 4 - Beta -Classifier: Environment :: No Input/Output (Daemon) -Classifier: Intended Audience :: Developers -Classifier: License :: OSI Approved :: Python Software Foundation License -Classifier: Operating System :: OS Independent -Classifier: Programming Language :: Python -Classifier: Topic :: Communications -Classifier: Topic :: Database -Classifier: Topic :: Internet -Classifier: Topic :: Software Development :: Libraries :: Python Modules -Classifier: Topic :: System -Classifier: Topic :: System :: Filesystems -Classifier: Topic :: System :: Logging -Classifier: Topic :: System :: Networking -Classifier: Topic :: Text Processing -Classifier: Topic :: Utilities -""" - -setup.run_setup( pkg_info_text, - #scripts = ['frontend/py_hotshot.py'], - ) Copied: python-commons/tags/0.7/setup.py (from rev 1628, python-commons/trunk/setup.py) =================================================================== --- python-commons/tags/0.7/setup.py (rev 0) +++ python-commons/tags/0.7/setup.py 2010-04-18 00:46:17 UTC (rev 1631) @@ -0,0 +1,43 @@ +#!/usr/bin/env python +# -*- mode: python; tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4; -*- +# vim:ft=python:et:sw=4:ts=4 + +import os,sys +sys.path.insert( 0, os.path.join( os.path.dirname( sys.argv[0] ), 'src' ) ) +from commons import setup + +pkg_info_text = """ +Metadata-Version: 1.1 +Name: python-commons +Version: 0.7 +Author: Yang Zhang +Author-email: yaaang NOSPAM at REMOVECAPS gmail +Home-page: http://assorted.sourceforge.net/python-commons +Summary: Python Commons +License: Python Software Foundation License +Description: General-purpose library of utilities and extensions to the + standard library. +Keywords: Python,common,commons,utility,utilities,library,libraries +Platform: any +Provides: commons +Classifier: Development Status :: 4 - Beta +Classifier: Environment :: No Input/Output (Daemon) +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: Python Software Foundation License +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Python +Classifier: Topic :: Communications +Classifier: Topic :: Database +Classifier: Topic :: Internet +Classifier: Topic :: Software Development :: Libraries :: Python Modules +Classifier: Topic :: System +Classifier: Topic :: System :: Filesystems +Classifier: Topic :: System :: Logging +Classifier: Topic :: System :: Networking +Classifier: Topic :: Text Processing +Classifier: Topic :: Utilities +""" + +setup.run_setup( pkg_info_text, + #scripts = ['frontend/py_hotshot.py'], + ) Deleted: python-commons/tags/0.7/src/commons/__init__.py =================================================================== --- python-commons/trunk/src/commons/__init__.py 2010-04-18 00:18:13 UTC (rev 1625) +++ python-commons/tags/0.7/src/commons/__init__.py 2010-04-18 00:46:17 UTC (rev 1631) @@ -1,40 +0,0 @@ -# -*- mode: python; tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4; -*- -# vim:ft=python:et:sw=4:ts=4 - -""" -U{Python Commons<http://assorted.sf.net/python-commons>} is a -general-purpose library. - -@author: Yang Zhang -@copyright: Yang Zhang unless otherwise noted -@license: PSF -""" - -__version__ = ( 0, 6, 0 ) -__all__ = [ 'async', - 'control', - 'decs', - 'environ', - 'exceps', - 'files', - 'interp', - 'log', - 'misc', - 'networking', - 'progress', - 'seqs', - 'servers', - 'startup', - 'strs', - 'structs', - 'threads', - 'trace' ] - -# TODO more resources: -# http://aima.cs.berkeley.edu/python/utils.py -# http://aspn.activestate.com/ASPN/Cookbook/Python -# http://aspn.activestate.com/ASPN/Cookbook/Python?&recipe_status=editors -# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/413486 -# interesting: -# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/259174 -# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/473790 Copied: python-commons/tags/0.7/src/commons/__init__.py (from rev 1629, python-commons/trunk/src/commons/__init__.py) =================================================================== --- python-commons/tags/0.7/src/commons/__init__.py (rev 0) +++ python-commons/tags/0.7/src/commons/__init__.py 2010-04-18 00:46:17 UTC (rev 1631) @@ -0,0 +1,28 @@ +""" +U{Python Commons<http://assorted.sf.net/python-commons>} is a +general-purpose library. + +@author: Yang Zhang +@copyright: Yang Zhang unless otherwise noted +@license: PSF +""" + +__version__ = ( 0, 7, 0 ) +__all__ = [ 'async', + 'control', + 'decs', + 'environ', + 'exceps', + 'files', + 'interp', + 'log', + 'misc', + 'networking', + 'progress', + 'seqs', + 'servers', + 'startup', + 'strs', + 'structs', + 'threads', + 'trace' ] Deleted: python-commons/tags/0.7/src/commons/files.py =================================================================== --- python-commons/trunk/src/commons/files.py 2010-04-18 00:18:13 UTC (rev 1625) +++ python-commons/tags/0.7/src/commons/files.py 2010-04-18 00:46:17 UTC (rev 1631) @@ -1,205 +0,0 @@ -# -*- mode: python; tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4; -*- -# vim:ft=python:et:sw=4:ts=4 - -""" -File and directory manipulation. - -@var invalid_filename_chars: The characters which are usually -prohibited on most modern file systems. - -@var invalid_filename_chars_regex: A regex character class constructed -from L{invalid_filename_chars}. -""" - -from __future__ import with_statement - -__all__ = ''' -soft_makedirs -temp_dir -cleanse_filename -invalid_filename_chars -invalid_filename_chars_regex -disk_double_buffer -versioned_guard -versioned_cache -read_file -write_file -write_or_rm -is_nonempty_file -'''.split() - -import os, re, tempfile -from cPickle import * -from path import path - -def soft_makedirs( path ): - """ - Emulate C{mkdir -p} (doesn't complain if it already exists). - - @param path: The path of the directory to create. - @type path: str - - @raise OSError: If it cannot create the directory. It only - swallows OS error 17. - """ - try: - os.makedirs( path ) - except OSError, ex: - if ex.errno == 17: - pass - else: - raise - -def temp_dir( base_dir_name, do_create_subdir = True ): - """ - Get a temporary directory without polluting top-level /tmp. This follows - Ubuntu's conventions, choosing a temporary directory name based on - the given name plus the user name to avoid user conflicts. - - @param base_dir_name: The "name" of the temporary directory. This - is usually identifies the purpose of the directory, or the - application to which the temporary directory belongs. E.g., if joe - calls passes in C{"ssh-agent"} on a standard Linux/Unix system, - then the full path of the temporary directory will be - C{"/tmp/ssh-agent-joe"}. - @type base_dir_name: str - - @param do_create_subdir: If C{True}, then creates a - sub-sub-directory within the temporary sub-directory (and returns - the path to that). The sub-sub-directory's name is randomized - (uses C{tempfile.mkdtemp}). - @type do_create_subdir: bool - - @return: The path to the temporary (sub-)sub-directory. - @rtype: str - """ - base_dir_name += '-' + os.environ[ 'USER' ] - base_dir = path( tempfile.gettempdir() ) / base_dir_name - soft_makedirs( base_dir ) - if do_create_subdir: - return tempfile.mkdtemp( dir = base_dir ) - else: - return base_dir - -invalid_filename_chars = r'*|\/:<>?' -invalid_filename_chars_regex = r'[*|\\\/:<>?]' - -def cleanse_filename( filename ): - """ - Replaces all problematic characters in a filename with C{"_"}, as - specified by L{invalid_filename_chars}. - - @param filename: The filename to cleanse. - @type filename: str - """ - pattern = invalid_filename_chars_regex - return re.sub( pattern, '_', filename ) - -class disk_double_buffer( object ): - """ - A simple disk double-buffer. One file is for reading, the other is for - writing, and a facility for swapping the two roles is provided. - """ - def __init__( self, path_base, do_persist = True ): - self.paths = map( path, [ path_base + '.0', path_base + '.1' ] ) - self.do_persist = do_persist - self.switch_status = path( path_base + '.switched' ) - if not do_persist or not self.switch_status.exists(): - self.w, self.r = 0, 1 # default - else: - self.w, self.r = 1, 0 - self.reload_files() - def reload_files( self ): - self.writer = file( self.paths[ self.w ], 'w' ) - if not self.paths[ self.r ].exists(): - self.paths[ self.r ].touch() - self.reader = file( self.paths[ self.r ] ) - def switch( self ): - self.close() - if self.do_persist: - if self.w == 0: self.switch_status.touch() - else: self.switch_status.remove() - self.r, self.w = self.w, self.r - self.reload_files() - def write( self, x ): - self.writer.write( x ) - def read( self, len = 8192 ): - return self.reader.read( len ) - def close( self ): - self.reader.close() - self.writer.close() - -def versioned_guard(path, fresh_version): - """ - Maintain a version object. This is useful for working with versioned - caches. - - @param path: The path to the file containing the cached version object. - @type path: str - - @param fresh_version: The actual latest version that the cached version - should be compared against. - @type fresh_version: object (any type that can be compared) - - @return: True iff the cached version is obsolete (less than the fresh - version or doesn't exist). - @rtype: bool - """ - cache_version = None - try: - with file( path ) as f: cache_version = load(f) - except IOError, (errno, errstr): - if errno != 2: raise - if cache_version is None or fresh_version > cache_version: - with file( path, 'w' ) as f: dump(fresh_version, f) - return True - else: - return False - -def versioned_cache(version_path, fresh_version, cache_path, cache_func): - """ - If fresh_version is newer than the version in version_path, then invoke - cache_func and cache the result in cache_path (using pickle). - - Note the design flaw with L{versioned_guard}: the updated version value is - stored immediately, rather than after updating the cache. - - @param version_path: The path to the file version. - @type version_path: str - - @param fresh_version: The actual, up-to-date version value. - @type fresh_version: object (any type that can be compared) - - @param cache_path: The path to the cached data. - @type cache_path: str - - @param cache_func: The function that produces the fresh data to be cached. - @type cache_func: function (no arguments) - """ - if versioned_guard( version_path, fresh_version ): - # cache obsolete, force-fetch new data - result = cache_func() - with file(cache_path, 'w') as f: dump(result, f) - return result - else: - # cache up-to-date (should be available since dlcs-timestamp exists!) - with file(cache_path) as f: return load(f) - -def read_file(path): - f = file(path) - try: return f.read() - finally: f.close() - -def write_file(path, contents): - f = file(path,'w') - try: f.write(contents) - finally: f.close() - -def write_or_rm(p, contents): - 'Write the file or remove it if contents is empty.' - p = path(p) - if contents.strip(): write_file(p, contents) - elif p.isfile(): p.remove() - -def is_nonempty_file(path): - return path.isfile() and read_file(path).strip() != '' Copied: python-commons/tags/0.7/src/commons/files.py (from rev 1626, python-commons/trunk/src/commons/files.py) =================================================================== --- python-commons/tags/0.7/src/commons/files.py (rev 0) +++ python-commons/tags/0.7/src/commons/files.py 2010-04-18 00:46:17 UTC (rev 1631) @@ -0,0 +1,205 @@ +# -*- mode: python; tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4; -*- +# vim:ft=python:et:sw=4:ts=4 + +""" +File and directory manipulation. + +@var invalid_filename_chars: The characters which are usually +prohibited on most modern file systems. + +@var invalid_filename_chars_regex: A regex character class constructed +from L{invalid_filename_chars}. +""" + +from __future__ import with_statement + +__all__ = ''' +soft_makedirs +temp_dir +cleanse_filename +invalid_filename_chars +invalid_filename_chars_regex +disk_double_buffer +versioned_guard +versioned_cache +read_file +write_file +write_or_rm +is_nonempty_file +'''.split() + +import os, re, tempfile +from cPickle import * +from commons.path import path + +def soft_makedirs( path ): + """ + Emulate C{mkdir -p} (doesn't complain if it already exists). + + @param path: The path of the directory to create. + @type path: str + + @raise OSError: If it cannot create the directory. It only + swallows OS error 17. + """ + try: + os.makedirs( path ) + except OSError, ex: + if ex.errno == 17: + pass + else: + raise + +def temp_dir( base_dir_name, do_create_subdir = True ): + """ + Get a temporary directory without polluting top-level /tmp. This follows + Ubuntu's conventions, choosing a temporary directory name based on + the given name plus the user name to avoid user conflicts. + + @param base_dir_name: The "name" of the temporary directory. This + is usually identifies the purpose of the directory, or the + application to which the temporary directory belongs. E.g., if joe + calls passes in C{"ssh-agent"} on a standard Linux/Unix system, + then the full path of the temporary directory will be + C{"/tmp/ssh-agent-joe"}. + @type base_dir_name: str + + @param do_create_subdir: If C{True}, then creates a + sub-sub-directory within the temporary sub-directory (and returns + the path to that). The sub-sub-directory's name is randomized + (uses C{tempfile.mkdtemp}). + @type do_create_subdir: bool + + @return: The path to the temporary (sub-)sub-directory. + @rtype: str + """ + base_dir_name += '-' + os.environ[ 'USER' ] + base_dir = path( tempfile.gettempdir() ) / base_dir_name + soft_makedirs( base_dir ) + if do_create_subdir: + return tempfile.mkdtemp( dir = base_dir ) + else: + return base_dir + +invalid_filename_chars = r'*|\/:<>?' +invalid_filename_chars_regex = r'[*|\\\/:<>?]' + +def cleanse_filename( filename ): + """ + Replaces all problematic characters in a filename with C{"_"}, as + specified by L{invalid_filename_chars}. + + @param filename: The filename to cleanse. + @type filename: str + """ + pattern = invalid_filename_chars_regex + return re.sub( pattern, '_', filename ) + +class disk_double_buffer( object ): + """ + A simple disk double-buffer. One file is for reading, the other is for + writing, and a facility for swapping the two roles is provided. + """ + def __init__( self, path_base, do_persist = True ): + self.paths = map( path, [ path_base + '.0', path_base + '.1' ] ) + self.do_persist = do_persist + self.switch_status = path( path_base + '.switched' ) + if not do_persist or not self.switch_status.exists(): + self.w, self.r = 0, 1 # default + else: + self.w, self.r = 1, 0 + self.reload_files() + def reload_files( self ): + self.writer = file( self.paths[ self.w ], 'w' ) + if not self.paths[ self.r ].exists(): + self.paths[ self.r ].touch() + self.reader = file( self.paths[ self.r ] ) + def switch( self ): + self.close() + if self.do_persist: + if self.w == 0: self.switch_status.touch() + else: self.switch_status.remove() + self.r, self.w = self.w, self.r + self.reload_files() + def write( self, x ): + self.writer.write( x ) + def read( self, len = 8192 ): + return self.reader.read( len ) + def close( self ): + self.reader.close() + self.writer.close() + +def versioned_guard(path, fresh_version): + """ + Maintain a version object. This is useful for working with versioned + caches. + + @param path: The path to the file containing the cached version object. + @type path: str + + @param fresh_version: The actual latest version that the cached version + should be compared against. + @type fresh_version: object (any type that can be compared) + + @return: True iff the cached version is obsolete (less than the fresh + version or doesn't exist). + @rtype: bool + """ + cache_version = None + try: + with file( path ) as f: cache_version = load(f) + except IOError, (errno, errstr): + if errno != 2: raise + if cache_version is None or fresh_version > cache_version: + with file( path, 'w' ) as f: dump(fresh_version, f) + return True + else: + return False + +def versioned_cache(version_path, fresh_version, cache_path, cache_func): + """ + If fresh_version is newer than the version in version_path, then invoke + cache_func and cache the result in cache_path (using pickle). + + Note the design flaw with L{versioned_guard}: the updated version value is + stored immediately, rather than after updating the cache. + + @param version_path: The path to the file version. + @type version_path: str + + @param fresh_version: The actual, up-to-date version value. + @type fresh_version: object (any type that can be compared) + + @param cache_path: The path to the cached data. + @type cache_path: str + + @param cache_func: The function that produces the fresh data to be cached. + @type cache_func: function (no arguments) + """ + if versioned_guard( version_path, fresh_version ): + # cache obsolete, force-fetch new data + result = cache_func() + with file(cache_path, 'w') as f: dump(result, f) + return result + else: + # cache up-to-date (should be available since dlcs-timestamp exists!) + with file(cache_path) as f: return load(f) + +def read_file(path): + f = file(path) + try: return f.read() + finally: f.close() + +def write_file(path, contents): + f = file(path,'w') + try: f.write(contents) + finally: f.close() + +def write_or_rm(p, contents): + 'Write the file or remove it if contents is empty.' + p = path(p) + if contents.strip(): write_file(p, contents) + elif p.isfile(): p.remove() + +def is_nonempty_file(path): + return path.isfile() and read_file(path).strip() != '' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2010-04-18 00:44:03
|
Revision: 1630 http://assorted.svn.sourceforge.net/assorted/?rev=1630&view=rev Author: yangzhang Date: 2010-04-18 00:43:57 +0000 (Sun, 18 Apr 2010) Log Message: ----------- updated version numbers for 0.7 release Modified Paths: -------------- python-commons/trunk/publish.bash Modified: python-commons/trunk/publish.bash =================================================================== --- python-commons/trunk/publish.bash 2010-04-18 00:43:20 UTC (rev 1629) +++ python-commons/trunk/publish.bash 2010-04-18 00:43:57 UTC (rev 1630) @@ -8,7 +8,7 @@ echo '__init__.py, README (Changes), setup.bash, and setup.py' fullname='Python Commons' -version=0.6 +version=0.7 license=psf websrcs=( README ) rels=( pypi: ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2010-04-18 00:43:26
|
Revision: 1629 http://assorted.svn.sourceforge.net/assorted/?rev=1629&view=rev Author: yangzhang Date: 2010-04-18 00:43:20 +0000 (Sun, 18 Apr 2010) Log Message: ----------- cleaned up __init__.py Modified Paths: -------------- python-commons/trunk/src/commons/__init__.py Modified: python-commons/trunk/src/commons/__init__.py =================================================================== --- python-commons/trunk/src/commons/__init__.py 2010-04-18 00:41:16 UTC (rev 1628) +++ python-commons/trunk/src/commons/__init__.py 2010-04-18 00:43:20 UTC (rev 1629) @@ -1,6 +1,3 @@ -# -*- mode: python; tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4; -*- -# vim:ft=python:et:sw=4:ts=4 - """ U{Python Commons<http://assorted.sf.net/python-commons>} is a general-purpose library. @@ -29,12 +26,3 @@ 'structs', 'threads', 'trace' ] - -# TODO more resources: -# http://aima.cs.berkeley.edu/python/utils.py -# http://aspn.activestate.com/ASPN/Cookbook/Python -# http://aspn.activestate.com/ASPN/Cookbook/Python?&recipe_status=editors -# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/413486 -# interesting: -# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/259174 -# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/473790 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2010-04-18 00:41:22
|
Revision: 1628 http://assorted.svn.sourceforge.net/assorted/?rev=1628&view=rev Author: yangzhang Date: 2010-04-18 00:41:16 +0000 (Sun, 18 Apr 2010) Log Message: ----------- updated version numbers for 0.7 release Modified Paths: -------------- python-commons/trunk/setup.py python-commons/trunk/src/commons/__init__.py Modified: python-commons/trunk/setup.py =================================================================== --- python-commons/trunk/setup.py 2010-04-18 00:39:48 UTC (rev 1627) +++ python-commons/trunk/setup.py 2010-04-18 00:41:16 UTC (rev 1628) @@ -9,7 +9,7 @@ pkg_info_text = """ Metadata-Version: 1.1 Name: python-commons -Version: 0.6 +Version: 0.7 Author: Yang Zhang Author-email: yaaang NOSPAM at REMOVECAPS gmail Home-page: http://assorted.sourceforge.net/python-commons Modified: python-commons/trunk/src/commons/__init__.py =================================================================== --- python-commons/trunk/src/commons/__init__.py 2010-04-18 00:39:48 UTC (rev 1627) +++ python-commons/trunk/src/commons/__init__.py 2010-04-18 00:41:16 UTC (rev 1628) @@ -10,7 +10,7 @@ @license: PSF """ -__version__ = ( 0, 6, 0 ) +__version__ = ( 0, 7, 0 ) __all__ = [ 'async', 'control', 'decs', This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |