assorted-commits Mailing List for Assorted projects (Page 39)
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...> - 2008-08-28 08:11:47
|
Revision: 952 http://assorted.svn.sourceforge.net/assorted/?rev=952&view=rev Author: yangzhang Date: 2008-08-28 08:11:56 +0000 (Thu, 28 Aug 2008) Log Message: ----------- added a publisher and published Added Paths: ----------- sharing-gateway/trunk/publish.bash Copied: sharing-gateway/trunk/publish.bash (from rev 936, scala-commons/trunk/publish.bash) =================================================================== --- sharing-gateway/trunk/publish.bash (rev 0) +++ sharing-gateway/trunk/publish.bash 2008-08-28 08:11:56 UTC (rev 952) @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +. common.bash || exit 1 + +fullname='Sharing Gateway' +version=0.1 +license=gpl3 +websrcs=( README ) +webfiles= +rels=( src-tgz: ) +. assorted.bash "$@" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-08-28 07:54:30
|
Revision: 951 http://assorted.svn.sourceforge.net/assorted/?rev=951&view=rev Author: yangzhang Date: 2008-08-28 07:54:39 +0000 (Thu, 28 Aug 2008) Log Message: ----------- added indexing Modified Paths: -------------- sharing-gateway/trunk/src/gateway.py sharing-gateway/trunk/src/index.pandoc Modified: sharing-gateway/trunk/src/gateway.py =================================================================== --- sharing-gateway/trunk/src/gateway.py 2008-08-28 07:30:00 UTC (rev 950) +++ sharing-gateway/trunk/src/gateway.py 2008-08-28 07:54:39 UTC (rev 951) @@ -9,7 +9,7 @@ from os import system from path import path from socket import gethostbyname -from subprocess import Popen +from subprocess import Popen, PIPE import yaml class my_exception( Exception ): pass @@ -19,6 +19,11 @@ if p.wait() != 0: raise my_exception( 'command failed with error code %s: %s' % ( p.returncode, cmd ) ) +def runout( cmd, f ): + p = Popen( cmd, stdout = f ) + if p.wait() != 0: + raise my_exception( 'command failed with error code %s: %s' % ( p.returncode, cmd ) ) + def main( argv ): parser = OptionParser( usage = '%prog [OPTIONS] start | stop' ) parser.add_option( '-c', '--config', @@ -29,6 +34,7 @@ cmd = args[-1] with file( opts.config ) as f: cfg = dicts2structs( yaml.load( f ) ) mountdir = path( cfg.gateway.mountdir ) + indexdir = path( cfg.gateway.indexdir ) if cmd == 'start': for s in cfg.shares: @@ -46,6 +52,16 @@ mountpt = mountdir / s.name run( [ 'sudo', 'umount', mountpt ] ) run( [ 'sudo', 'rmdir', mountpt ] ) + elif cmd == 'index': # requires super user + for s in cfg.shares: + print 'indexing', s.name + mountpt = mountdir / s.name + index = indexdir / s.name + try: + with file( index, 'w' ) as f: + runout( [ 'ls', '-lR', mountpt ], f ) + except: + pass else: raise my_exception( 'unknown command: %s' % cmd ) Modified: sharing-gateway/trunk/src/index.pandoc =================================================================== --- sharing-gateway/trunk/src/index.pandoc 2008-08-28 07:30:00 UTC (rev 950) +++ sharing-gateway/trunk/src/index.pandoc 2008-08-28 07:54:39 UTC (rev 951) @@ -7,4 +7,9 @@ [CA certificate]: http://zs.ath.cx/ca.crt -Then log in to <https://zs.ath.cx/gw/> using the login I provided you. +Then log in to the SSL-enabled site, <https://zs.ath.cx/gw/>, using the login I +provided you. + +Currently, we generate simple indexes so that you can search for files; these +are in <https://zs.ath.cx/gw/index/>. To browse/retrieve the actual files, go +to <https://zs.ath.cx/gw/raw/>. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-08-28 07:29:51
|
Revision: 950 http://assorted.svn.sourceforge.net/assorted/?rev=950&view=rev Author: yangzhang Date: 2008-08-28 07:30:00 +0000 (Thu, 28 Aug 2008) Log Message: ----------- added a little intro homepage Added Paths: ----------- sharing-gateway/trunk/src/index.pandoc Added: sharing-gateway/trunk/src/index.pandoc =================================================================== --- sharing-gateway/trunk/src/index.pandoc (rev 0) +++ sharing-gateway/trunk/src/index.pandoc 2008-08-28 07:30:00 UTC (rev 950) @@ -0,0 +1,10 @@ +Sharing Gateway +=============== + +Install my [CA certificate], so that you can trust without hassle all +certificates that I sign with it. (This website's certificate is the only one +for now.) + +[CA certificate]: http://zs.ath.cx/ca.crt + +Then log in to <https://zs.ath.cx/gw/> using the login I provided you. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-08-28 06:52:41
|
Revision: 949 http://assorted.svn.sourceforge.net/assorted/?rev=949&view=rev Author: yangzhang Date: 2008-08-28 06:52:50 +0000 (Thu, 28 Aug 2008) Log Message: ----------- added sharing gateway! Added Paths: ----------- sharing-gateway/ sharing-gateway/trunk/ sharing-gateway/trunk/README sharing-gateway/trunk/src/ sharing-gateway/trunk/src/gateway.py Added: sharing-gateway/trunk/README =================================================================== --- sharing-gateway/trunk/README (rev 0) +++ sharing-gateway/trunk/README 2008-08-28 06:52:50 UTC (rev 949) @@ -0,0 +1,158 @@ +Overview +-------- + +This is a simple tool for managing a collection of file shares/networks (FTP, +SSH, SMB/CIFS, etc.), conglomerating them into a single unified "gateway" that +can then be re-exported. + +Part of this acts like `mount -a` in mounting/unmounting a set of filesystems, +but features: + +- YAML configuration file format +- can handle hostnames instead of IPs for CIFS shares +- can create the mountpoint directories + +The rest of this is mostly documentation on how to configure your own servers +to do what you want. + +Setup +----- + +Requirements: + +- Python +- Python YAML + +### Web Frontend + +#### Create certificates + +The following is a summary of [Creating Certificate Authorities and self-signed +SSL certificates]. + +[Creating Certificate Authorities and self-signed SSL certificates]: http://www.tc.umn.edu/~brams006/selfsign.html + +Generate a CA: + + openssl genrsa -des3 -out ca.key 4096 + openssl req -new -x509 -days 3650 -key ca.key -out ca.crt + +Generate a certificate-signing request (CSR), using your server domain name as +the "common name" when prompted for it: + + openssl genrsa -des3 -out server.key 4096 + openssl req -new -key server.key -out server.csr + +Sign the certificate with the CA: + + openssl x509 -req -days 3650 -in server.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out server.crt + +Examine what you have so far: + + openssl rsa -noout -text -in server.key + openssl req -noout -text -in server.csr + openssl rsa -noout -text -in ca.key + openssl x509 -noout -text -in ca.crt + +Create insecure version of the key, so that you don't need to enter a password +when you start Apache: + + openssl rsa -in server.key -out server.key.insecure + mv server.key server.key.secure + mv server.key.insecure server.key + +Secure the keys: + + chmod 600 *.key + sudo chown root *.key + +By now you should have the following files; make all the .key files accessible +only to root! + +- ca.crt +- ca.key +- server.crt +- server.csr +- server-insecure.key +- server.key + +Allow users to download and install ca.crt, then you're set! + +#### Configure Apache for SSL + +[Setting up SSL: Ubuntu and Apache 2] is the continuation of the above guide. The following is the summary. + +[Setting up SSL: Ubuntu and Apache 2]: http://www.tc.umn.edu/~brams006/selfsign_ubuntu.html + +Duplicate the `default` site in `/etc/apache2/sites-available/` as site `ssl` +and edit it so that the argument to the `NameVirtualHost` and `VirtualHost` +elements are `*:443` instead of `*`. This causes this host to be effective +only on that port (`NameVirtualHost` and `VirtualHost` are always paired up). +Lastly, adjust the root directory to be something like `/var/www-ssl/` instead +of `/var/www/`. + +Insert the following incantation under `VirtualHost`, pointing to wherever you +put your certificates: + + SSLEngine On + SSLCertificateFile /etc/apache2/ssl/server.crt + SSLCertificateKeyFile /etc/apache2/ssl/server.key + SSLCertificateChainFile /etc/apache2/ssl/ca.crt + SSLCACertificateFile /etc/apache2/ssl/ca.crt + +Verify that a configuration file has `Listen 443`. Now, enable the SSL module +and the site we just configured, and reload Apache: + + sudo a2enmod ssl + sudo a2ensite ssl + sudo service apache2 reload + +If you see a warning about Apache being forced to resolve for its domain name, +you may get rid of it by providing the domain name explicitly in `apache2.conf` +with `ServerName www.mydomain.com`. + +Test out the site by going to <https://www.mydomain.com/>. + +Finally, make the CA certificate available to the world: + + sudo ln -s /etc/apache2/ssl/ca.crt /var/www/ + +Have your users visit <http://www.mydomain.com/ca.crt> to install your CA +certificate first---thereafter, they will encounter no warnings about visiting +your SSL sites. + +#### Configure Authentication + +Add something like the following to your `ssl` site configuration: + + <Directory /var/www-ssl/gw/> + AuthType Basic + AuthName "Login Required" + AuthUserFile /var/www-ssl/gw/.htpasswd + Require Valid-User + </Directory> + +Now create the `.htpasswd` file: + + sudo mkdir /var/www-ssl/gw/ + sudo htpasswd -c /var/www-ssl/gw/.htpasswd gw + sudo service apache2 reload + +#### Web Gateway + +Now simply create symlink to our gateway directory in `/var/www-ssl/`: + + ln -s /path/to/gateway/ /var/www-ssl/gw/raw + +<https://www.mydomain.com/gw/> should now show you the gateway! + +### FTP Frontend + +The FTP frontend means your users need to know how to use FTP, but there are +numerous benefits that come from using an FTP client, including: + +- batch downloads of directory trees +- FTP filesystems exist (in GNOME VFS, FUSE, etc.) +- uploads + +The FTP server we'll use is ProFTPD. Added: sharing-gateway/trunk/src/gateway.py =================================================================== --- sharing-gateway/trunk/src/gateway.py (rev 0) +++ sharing-gateway/trunk/src/gateway.py 2008-08-28 06:52:50 UTC (rev 949) @@ -0,0 +1,52 @@ +#!/usr/bin/env python + +'Manage a sharing gateway: enable/disable sharing networks.' + +from __future__ import with_statement +from commons.startup import run_main +from commons.structs import structs2dicts, dicts2structs +from optparse import OptionParser +from os import system +from path import path +from socket import gethostbyname +from subprocess import Popen +import yaml + +class my_exception( Exception ): pass + +def run( cmd ): + p = Popen( cmd ) + if p.wait() != 0: + raise my_exception( 'command failed with error code %s: %s' % ( p.returncode, cmd ) ) + +def main( argv ): + parser = OptionParser( usage = '%prog [OPTIONS] start | stop' ) + parser.add_option( '-c', '--config', + default = '/etc/sharing-gateway.yaml', + help = 'the YAML configuration file to read from' ) + opts, args = parser.parse_args( argv ) + + cmd = args[-1] + with file( opts.config ) as f: cfg = dicts2structs( yaml.load( f ) ) + mountdir = path( cfg.gateway.mountdir ) + + if cmd == 'start': + for s in cfg.shares: + if s.type == 'cifs': + d = structs2dicts( s ) + d[ 'ip' ] = gethostbyname( s.host ) + mountpt = mountdir / s.name + run( [ 'sudo', 'mkdir', '-p', mountpt ] ) + run( 'sudo mount -t cifs -o'.split() + + [ 'user=%(user)s,pass=%(pass)s,ip=%(ip)s' % d, s.share, mountpt ] ) + else: + raise my_exception( 'unknown share type: %s' % s.type ) + elif cmd == 'stop': + for s in cfg.shares: + mountpt = mountdir / s.name + run( [ 'sudo', 'umount', mountpt ] ) + run( [ 'sudo', 'rmdir', mountpt ] ) + else: + raise my_exception( 'unknown command: %s' % cmd ) + +run_main() Property changes on: sharing-gateway/trunk/src/gateway.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...> - 2008-08-27 22:36:49
|
Revision: 948 http://assorted.svn.sourceforge.net/assorted/?rev=948&view=rev Author: yangzhang Date: 2008-08-27 22:36:58 +0000 (Wed, 27 Aug 2008) Log Message: ----------- added picard plugins! Added Paths: ----------- picard-plugins/ picard-plugins/trunk/ picard-plugins/trunk/README picard-plugins/trunk/setup.bash picard-plugins/trunk/src/ picard-plugins/trunk/src/filetools.py Added: picard-plugins/trunk/README =================================================================== --- picard-plugins/trunk/README (rev 0) +++ picard-plugins/trunk/README 2008-08-27 22:36:58 UTC (rev 948) @@ -0,0 +1,13 @@ +Overview +-------- + +Tools for working with individual files: reloading, deleting, playing, etc. + +Setup +----- + +Requirements: + +- [Picard Tagger] 0.9 + +[Picard Tagger]: http://wiki.musicbrainz.org/PicardTagger Added: picard-plugins/trunk/setup.bash =================================================================== --- picard-plugins/trunk/setup.bash (rev 0) +++ picard-plugins/trunk/setup.bash 2008-08-27 22:36:58 UTC (rev 948) @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +pkg=picard-plugins +. simple-setup.bash || exit 1 +version=0.1 + +install ~/.config/MusicBrainz/Picard/plugins/ src/filetools.py Property changes on: picard-plugins/trunk/setup.bash ___________________________________________________________________ Added: svn:executable + * Added: picard-plugins/trunk/src/filetools.py =================================================================== --- picard-plugins/trunk/src/filetools.py (rev 0) +++ picard-plugins/trunk/src/filetools.py 2008-08-27 22:36:58 UTC (rev 948) @@ -0,0 +1,30 @@ +PLUGIN_NAME = 'File Tools' +PLUGIN_AUTHOR = 'Yang Zhang' +PLUGIN_DESCRIPTION = 'Tools for working with individual files: reloading, deleting, playing, etc.' +PLUGIN_VERSION = "0.1" +PLUGIN_API_VERSIONS = ["0.9.0", "0.10"] + +from os import remove +from subprocess import Popen +from picard.ui.itemviews import BaseAction, register_file_action + +class ReloadFile(BaseAction): + NAME = '&Reload' + def callback(self, objs): + self.tagger.remove(objs) + self.tagger.add_files([o.filename for o in objs]) + +class DeleteFile(BaseAction): + NAME = '&Delete Track From Disk' + def callback(self, objs): + self.tagger.remove(objs) + remove(objs[0].filename) + +class PlayFile(BaseAction): + NAME = '&Play Track (gmplayer)' + def callback(self, objs): + Popen(['gmplayer', objs[0].filename]) + +register_file_action(ReloadFile()) +register_file_action(DeleteFile()) +register_file_action(PlayFile()) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-08-22 07:02:46
|
Revision: 947 http://assorted.svn.sourceforge.net/assorted/?rev=947&view=rev Author: yangzhang Date: 2008-08-22 07:02:56 +0000 (Fri, 22 Aug 2008) Log Message: ----------- updated the readme/site Modified Paths: -------------- java-reactor/trunk/README Modified: java-reactor/trunk/README =================================================================== --- java-reactor/trunk/README 2008-08-20 18:35:53 UTC (rev 946) +++ java-reactor/trunk/README 2008-08-22 07:02:56 UTC (rev 947) @@ -13,11 +13,17 @@ Aside from its simplicity, efficiency, and support for scheduled tasks, it also has no dependencies except for Java 6. Currently only UDP is supported. +Usage +----- + +For an example of how to use the reactor, please refer to `ReactorTest.java`. + Related Work ------------ -- [Apache Mina]: we originally used this for [SRON], but it lacked efficiency - and scheduled tasks, and also requires at least [slf4j]. +- [Apache Mina]: we originally used this for [SRON], but it is not as + lightweight, lacked select-based time-scheduling, and also requires at least + [slf4j]. - [SRON]: The project from which Java Reactor was born. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-08-20 18:35:53
|
Revision: 946 http://assorted.svn.sourceforge.net/assorted/?rev=946&view=rev Author: yangzhang Date: 2008-08-20 18:35:53 +0000 (Wed, 20 Aug 2008) Log Message: ----------- added collapse script Added Paths: ----------- sandbox/trunk/src/one-off-scripts/collapse/ sandbox/trunk/src/one-off-scripts/collapse/collapse.py Added: sandbox/trunk/src/one-off-scripts/collapse/collapse.py =================================================================== --- sandbox/trunk/src/one-off-scripts/collapse/collapse.py (rev 0) +++ sandbox/trunk/src/one-off-scripts/collapse/collapse.py 2008-08-20 18:35:53 UTC (rev 946) @@ -0,0 +1,36 @@ +""" +Collapses long runs of similar lines with "...[delay]...". +""" + +from __future__ import with_statement +from collections import deque + +def collapse(lines): + for line in lines: + yield line + if not line.endswith('site iterating'): break + +def g(lines): + leading = 0 + for line in lines: + if line.endswith('site iterating'): + if leading < 5: + yield line + leading += 1 + else: + sublines = list(collapse(lines)) + if len(sublines) > 6: + yield '...[delay]...' + for subline in sublines[-6:]: + yield subline + leading = 0 + else: + yield line + leading = 0 + +def ls(): + for line in stdin.read().split('\n'): + yield line + +for line in g(ls()): + print line Property changes on: sandbox/trunk/src/one-off-scripts/collapse/collapse.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...> - 2008-08-17 08:20:27
|
Revision: 945 http://assorted.svn.sourceforge.net/assorted/?rev=945&view=rev Author: yangzhang Date: 2008-08-17 08:20:36 +0000 (Sun, 17 Aug 2008) Log Message: ----------- added one-off scripts directory - this is probably temporary Modified Paths: -------------- sandbox/trunk/src/py/makodemo.py Added Paths: ----------- sandbox/trunk/src/one-off-scripts/ sandbox/trunk/src/one-off-scripts/someecards/ sandbox/trunk/src/one-off-scripts/someecards/label.py Added: sandbox/trunk/src/one-off-scripts/someecards/label.py =================================================================== --- sandbox/trunk/src/one-off-scripts/someecards/label.py (rev 0) +++ sandbox/trunk/src/one-off-scripts/someecards/label.py 2008-08-17 08:20:36 UTC (rev 945) @@ -0,0 +1,17 @@ +#!/usr/bin/env python + +from urllib import urlopen +from sys import stdin +from BeautifulSoup import BeautifulSoup +from commons.startup import run_main + +def main(argv): + for line in stdin: + line = line.strip() + if line == '' or ' ' in line: + print line + else: + title = BeautifulSoup(urlopen(line).read()).head.title.string.split(' | ')[-1] + print line, title + +run_main() Property changes on: sandbox/trunk/src/one-off-scripts/someecards/label.py ___________________________________________________________________ Added: svn:executable + * Modified: sandbox/trunk/src/py/makodemo.py =================================================================== --- sandbox/trunk/src/py/makodemo.py 2008-08-13 06:09:50 UTC (rev 944) +++ sandbox/trunk/src/py/makodemo.py 2008-08-17 08:20:36 UTC (rev 945) @@ -1,5 +1,7 @@ #!/usr/bin/env python +# Note that $what does not get expanded. + from mako.template import Template doc = r""" @@ -15,7 +17,7 @@ <%def name="makerow(row)"> <tr> % for name in row: - <td>${name} ${foo.pop()}</td>\ + <td>${name} ${foo.pop()} $what</td>\ % endfor </tr> </%def> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-08-13 06:09:44
|
Revision: 944 http://assorted.svn.sourceforge.net/assorted/?rev=944&view=rev Author: yangzhang Date: 2008-08-13 06:09:50 +0000 (Wed, 13 Aug 2008) Log Message: ----------- added .project.vim files to ignore list Modified Paths: -------------- configs/trunk/src/subversion/config Modified: configs/trunk/src/subversion/config =================================================================== --- configs/trunk/src/subversion/config 2008-08-13 06:09:34 UTC (rev 943) +++ configs/trunk/src/subversion/config 2008-08-13 06:09:50 UTC (rev 944) @@ -67,7 +67,7 @@ [miscellany] ### Set global-ignores to a set of whitespace-delimited globs ### which Subversion will ignore in its 'status' output. -global-ignores = tags cscope.* *.aux *.aux *.elc *.ml[io] *.hi .*.sw? *.class *.pyc *.o *.lo *.la #*# .*.rej *.rej .*~ *~ .#* .DS_Store +global-ignores = tags cscope.* *.aux *.aux *.elc *.ml[io] *.hi .*.sw? *.class *.pyc *.o *.lo *.la #*# .*.rej *.rej .*~ *~ .#* .DS_Store .project.vim ### Set log-encoding to the default encoding for log messages # log-encoding = latin1 ### Set use-commit-times to make checkout/update/switch/revert This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-08-13 06:09:24
|
Revision: 943 http://assorted.svn.sourceforge.net/assorted/?rev=943&view=rev Author: yangzhang Date: 2008-08-13 06:09:34 +0000 (Wed, 13 Aug 2008) Log Message: ----------- fixed last-chats, EMAIL 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 2008-08-11 19:10:14 UTC (rev 942) +++ shell-tools/trunk/src/bash-commons/bashrc.bash 2008-08-13 06:09:34 UTC (rev 943) @@ -31,6 +31,9 @@ # ################################################################ +# personal environment variables (TODO somehow factor this out) +export EMAIL='Yang Zhang <y_...@mi...>' + # TODO this is from sht; mv it to a mini-commons # TODO is this necessary in light of advanced var expansions? is_declared() { @@ -586,7 +589,7 @@ # purple chat logs from today last-chats() { - find /home/yang/.purple/logs/ -mtime -1 | + find "$HOME/.purple/logs/" -mtime -1 | fgrep -v .system | fgrep "$( date +%Y-%m-%d )" } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-08-11 19:10:14
|
Revision: 942 http://assorted.svn.sourceforge.net/assorted/?rev=942&view=rev Author: yangzhang Date: 2008-08-11 19:10:14 +0000 (Mon, 11 Aug 2008) Log Message: ----------- fixed user-local python paths 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 2008-08-11 19:09:37 UTC (rev 941) +++ shell-tools/trunk/src/bash-commons/bashrc.bash 2008-08-11 19:10:14 UTC (rev 942) @@ -148,7 +148,7 @@ pythonpath_prepend= for ver in 2.5 ; do # 2.4 ; do # 2.3 2.4 2.5 '' ; do pythonpath_prepend="$USER_PREFIX/lib/python$ver/site-packages:$pythonpath_prepend" - pythonpath_prepend="$USER_PKG/assorted-python/lib/python$ver/site-packages:$pythonpath_prepend" + pythonpath_prepend="$USER_TOAST_PREFIX/lib/python$ver/site-packages:$pythonpath_prepend" pythonpath_prepend="/usr/local/lib/python$ver/site-packages:$pythonpath_prepend" pythonpath_prepend="$GLOBAL_PREFIX/lib/python$ver/site-packages:$pythonpath_prepend" done This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-08-11 19:09:37
|
Revision: 941 http://assorted.svn.sourceforge.net/assorted/?rev=941&view=rev Author: yangzhang Date: 2008-08-11 19:09:37 +0000 (Mon, 11 Aug 2008) Log Message: ----------- silenced the taglist plugin warning Modified Paths: -------------- configs/trunk/src/vim/plugin/taglist.vim Modified: configs/trunk/src/vim/plugin/taglist.vim =================================================================== --- configs/trunk/src/vim/plugin/taglist.vim 2008-08-11 14:59:07 UTC (rev 940) +++ configs/trunk/src/vim/plugin/taglist.vim 2008-08-11 19:09:37 UTC (rev 941) @@ -94,8 +94,8 @@ elseif executable('tags') let Tlist_Ctags_Cmd = 'tags' else - echomsg 'Taglist: Exuberant ctags (http://ctags.sf.net) ' . - \ 'not found in PATH. Plugin is not loaded.' +" echomsg 'Taglist: Exuberant ctags (http://ctags.sf.net) ' . +" \ 'not found in PATH. Plugin is not loaded.' " Skip loading the plugin let loaded_taglist = 'no' let &cpo = s:cpo_save This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-08-11 14:59:01
|
Revision: 940 http://assorted.svn.sourceforge.net/assorted/?rev=940&view=rev Author: yangzhang Date: 2008-08-11 14:59:07 +0000 (Mon, 11 Aug 2008) Log Message: ----------- removed office phone Modified Paths: -------------- personal-site/trunk/src/index.txt Modified: personal-site/trunk/src/index.txt =================================================================== --- personal-site/trunk/src/index.txt 2008-08-11 14:58:56 UTC (rev 939) +++ personal-site/trunk/src/index.txt 2008-08-11 14:59:07 UTC (rev 940) @@ -40,8 +40,8 @@ item( 'Yahoo', 'ymsgr:sendIM?', 'overbored' ); item( 'Jabber (Google)', 'xmpp:', 'gmail.com', 'yaaang' ); item( 'Skype', 'callto://', 'yaaang' ); - item( 'FreeNode', 'irc://irc.freenode.org/', 'zeeee' ); // TODO fix - item( '"Office"', 'MIT/CSAIL <a href="http://whereis.mit.edu/map-jpg?selection=32&Buildings=go">32</a>-<a href="http://www.csail.mit.edu/resources/maps/9G/G908.gif">G908</a>, <a href="http://www.eecs.mit.edu/stata-link.html">Stata Center</a>, <a href="http://maps.google.com/maps?f=q&hl=en&geocode=&q=32+Vassar+St,+Cambridge,+MA+02139&sll=42.357926,-71.093616&sspn=0.00842,0.01575&ie=UTF8&ll=42.362682,-71.093495&spn=0.008419,0.01575&z=16&iwloc=addr">32 Vassar St., Cambridge, MA 02139</a>, <a href="callto://+1-617-253-6015">(617) 253-6015</a>' ); + item( 'FreeNode', 'irc://irc.freenode.org/', 'zeeee' ); + item( '"Office"', 'MIT/CSAIL <a href="http://whereis.mit.edu/map-jpg?selection=32&Buildings=go">32</a>-<a href="http://www.csail.mit.edu/resources/maps/9G/G908.gif">G908</a>, <a href="http://www.eecs.mit.edu/stata-link.html">Stata Center</a>, <a href="http://maps.google.com/maps?f=q&hl=en&geocode=&q=32+Vassar+St,+Cambridge,+MA+02139&sll=42.357926,-71.093616&sspn=0.00842,0.01575&ie=UTF8&ll=42.362682,-71.093495&spn=0.008419,0.01575&z=16&iwloc=addr">32 Vassar St., Cambridge, MA 02139</a>' ); item( 'GPG public key', '<a href="yang.gpg.asc">yang.gpg.asc</a> (<a href="http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xB1E65B60">MIT PKS entry</a>)' ); document.write( '</ul>' ); // ]]> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-08-11 14:58:48
|
Revision: 939 http://assorted.svn.sourceforge.net/assorted/?rev=939&view=rev Author: yangzhang Date: 2008-08-11 14:58:56 +0000 (Mon, 11 Aug 2008) Log Message: ----------- new backups/wp subdir Modified Paths: -------------- configs/trunk/src/cron/backup-blog.bash Modified: configs/trunk/src/cron/backup-blog.bash =================================================================== --- configs/trunk/src/cron/backup-blog.bash 2008-08-10 22:43:31 UTC (rev 938) +++ configs/trunk/src/cron/backup-blog.bash 2008-08-11 14:58:56 UTC (rev 939) @@ -2,5 +2,6 @@ FORCE_BASHRC=1 . ~/.bashrc && . common.bash || exit 1 +mkdir -p ~/personal/backups/wp/ exec mysqldump --defaults-extra-file=$HOME/.y_z.cnf -h sql.mit.edu y_z+wp | -bzip2 -c > ~/personal/backups/wp-$( date +%Y%m%d ).mysqldump.bz2 +bzip2 -c > ~/personal/backups/wp/$( date +%Y%m%d ).mysqldump.bz2 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-08-10 22:43:22
|
Revision: 938 http://assorted.svn.sourceforge.net/assorted/?rev=938&view=rev Author: yangzhang Date: 2008-08-10 22:43:31 +0000 (Sun, 10 Aug 2008) Log Message: ----------- - added custom checks - moved the CUI frontend to cmdline to get a core zdb package - added phonesync (another frontend) to analyze nokia exported csv files - added a google calendar client; this should eventually become another frontend Modified Paths: -------------- simple-zdb/trunk/src/zdb.py Added Paths: ----------- simple-zdb/trunk/src/cal.py simple-zdb/trunk/src/cmdline.py simple-zdb/trunk/src/phonesync.py Added: simple-zdb/trunk/src/cal.py =================================================================== --- simple-zdb/trunk/src/cal.py (rev 0) +++ simple-zdb/trunk/src/cal.py 2008-08-10 22:43:31 UTC (rev 938) @@ -0,0 +1,88 @@ +#!/usr/bin/env python + +from __future__ import with_statement +from atom import Content, Title, Summary +from path import path +from commons.startup import run_main +from time import gmtime, strftime, time +from gdata.calendar.service import CalendarService +from gdata.calendar import ( + CalendarEventEntry, + CalendarListEntry, + Color, + Hidden, + Timezone, + When, + Where, +) + +def main( argv ): + + print_calendars = True + print_events = True + + # authentication + + with file( path( '~/.google.auth' ).expanduser() ) as f: + user, pw = f.read().split('\n')[:2] + + cal = CalendarService( email = user, password = pw, source = 'zdb' ) + cal.ProgrammaticLogin() + + # get feed of user-owned calendars + + cs = cal.GetOwnCalendarsFeed() + + # print own calendars + + if print_calendars: + print cs.title.text + for i,c in enumerate(cs.entry): + print ' %2d. %s' % (i, c.title.text,) + + # create zdb calendar if necessary + + if 'zdb' not in ( c.title.text for c in cs.entry ): + cle = CalendarListEntry() + cle.title = Title( text = 'zdb' ) + cle.summary = Summary( text = 'Google Calendar frontend to zdb' ) + cle.where = Where( value_string = '' ) + cle.color = Color( value = '#2952A3' ) + cle.timezone = Timezone( value = 'America/New_York' ) + cle.hidden = Hidden( value = 'false' ) + zdbcal = cal.InsertCalendar( new_calendar = cle ) + # XXX THE UNTAKEN PATH + else: + zdbcal = ( c for c in cs.entry if c.title.text == 'zdb' ).next() + + # get feed of events on zdb calendar + + zdburi = ( l.href for l in zdbcal.link if l.rel == 'alternate' ).next() + es = cal.GetCalendarEventFeed( uri = zdburi ) + + # print events on zdb calendar + + if print_events: + print 'Events for calendar: %s' % (es.title.text,) + for i,e in enumerate(es.entry): + print ' %2d. %s (%s - %s)' % (i, e.title.text, e.when[0].start_time, e.when[0].end_time) + + return es + + # parse events + + for e in es.entry: + pass + + # create event on default calendar + + if False: + event = CalendarEventEntry() + event.title = Title( text = 'testing' ) + event.content = Content( text = 'my content' ) + event.when.append( When( + start_time = strftime('%Y-%m-%dT%H:%M:%S.000Z', gmtime()), + end_time = strftime('%Y-%m-%dT%H:%M:%S.000Z', gmtime(time() + 3600)) ) ) + new_event = cal.InsertEvent( event, zdburi ) + +run_main() Property changes on: simple-zdb/trunk/src/cal.py ___________________________________________________________________ Added: svn:executable + * Added: simple-zdb/trunk/src/cmdline.py =================================================================== --- simple-zdb/trunk/src/cmdline.py (rev 0) +++ simple-zdb/trunk/src/cmdline.py 2008-08-10 22:43:31 UTC (rev 938) @@ -0,0 +1,38 @@ +#!/usr/bin/env python + +from __future__ import with_statement +from commons.exceps import handle_exceptions +from commons.log import config_logging +from commons.startup import run_main +from sys import stdin, stdout +from zdb import * + +def main( argv ): + config_logging( do_console = True ) + + try: loaddb() + except zdb_exception: createdb( True ) + + while True: + stdout.write( '>>> ' ) + line = stdin.readline() + if line == '': print; break + words = line.split() + if words != []: + cmd, params = words[0], words[1:] + try: + if False: pass + elif cmd == 'add': thedb().add( *params ) + elif cmd == 'del': thedb().rm( *params ) + elif cmd == 'set': thedb().set( *params ) + elif cmd == 'dump': thedb().dump( *params ) + elif cmd == 'load': importdb( *params ) + elif cmd == 'quit': break + else: raise zdb_exception( 'bad command: ' + cmd ) + except Exception, ex: + # print >> stderr, ex + handle_exceptions() + + savedb() + +run_main( handle_exceptions = False ) Property changes on: simple-zdb/trunk/src/cmdline.py ___________________________________________________________________ Added: svn:executable + * Added: simple-zdb/trunk/src/phonesync.py =================================================================== --- simple-zdb/trunk/src/phonesync.py (rev 0) +++ simple-zdb/trunk/src/phonesync.py 2008-08-10 22:43:31 UTC (rev 938) @@ -0,0 +1,63 @@ +#!/usr/bin/env python + +from __future__ import with_statement +from commons.log import config_logging +from commons.startup import run_main +from csv import reader +from itertools import chain, imap +from re import compile +from sys import stdin, stdout +from zdb import * + +pat = compile( r'[\s-]+' ) + +def simplify( x ): + return pat.sub( '', x.lower() ) + +def findperson( first, last ): + first, last = map( simplify, [ first, last ] ) + for k in thedb().name2obj.iterkeys(): + words = map( simplify, k.split() ) + if ( first == words[0] and + ( last == words[-1] or + len( last ) == 0 or + len( last ) == 1 and last[0] == words[-1][0] ) ): + yield k + +def main( argv ): + config_logging( do_console = True ) + + try: loaddb() + except zdb_exception: createdb( True ) + + lines = stdin.read().decode('utf16').strip().split('\n') + + for row in list( reader( lines ) )[1:]: + phonevals = filter( lambda x: x != '', row[4:] ) + if row[1] == '' and row[3] == '': + print 'cannot handle: %s' % ( row, ) + else: + matches = list( findperson( row[1], row[3] ) ) + if len( matches ) > 1: + raise zdb_exception( 'more than one match for %s %s: %s' % + ( row[1], row[3], ', '.join(matches) ) ) + elif matches == []: + print 'no match found for', row[1], row[3] + print 'values:', ', '.join( phonevals ) + print + elif len( matches ) == 1: + o = thedb().get( matches[0] ) + zdbvals = set( imap( simplify, chain( *o.props.itervalues() ) ) ) + failed = False + for cell in phonevals: + if simplify(cell) not in zdbvals: + failed = True + break + if failed: + print 'phonevals:', ', '.join( phonevals ) + print 'zdbvals:', ', '.join( zdbvals ) + o.dump( stdout ) + print + else: assert False + +run_main() Property changes on: simple-zdb/trunk/src/phonesync.py ___________________________________________________________________ Added: svn:executable + * Modified: simple-zdb/trunk/src/zdb.py =================================================================== --- simple-zdb/trunk/src/zdb.py 2008-08-10 21:41:42 UTC (rev 937) +++ simple-zdb/trunk/src/zdb.py 2008-08-10 22:43:31 UTC (rev 938) @@ -4,17 +4,16 @@ from cPickle import load, dump, dumps from cStringIO import StringIO -from commons.log import info, config_logging -from commons.exceps import handle_exceptions +from commons.log import info from commons.files import soft_makedirs from commons.startup import run_main from commons.structs import free_struct from os import rename from path import path from re import match -from sys import stdin, stdout, stderr +from sys import stderr from time import time -from unittest import TestCase, main as test_main +from unittest import TestCase from functools import partial info = partial( info, '' ) @@ -43,6 +42,8 @@ # User-facing functions (these are the console commands) def add( self, name, parents, props ): self.addobj( obj( name, parents, props ) ) + def get( self, name ): + return self.name2obj[ name ] def set( self, name, field, value ): self.name2obj[ name ].addprop( field, value ) def rm( self, name ): @@ -77,6 +78,21 @@ assert p in self.name2obj, 'parent doesnt exist: %s' % p # TODO make sure there are no cycles in the parent graph and that # everything terminates at root 'concept' + + # perform custom checks + def get(k): return o.props.get(k, []) + if 'person' in o.parents: + for spousename in get( 'spouse' ): + spouse = self.name2obj[ spousename ] + assert name in spouse.props.get( 'spouse', [] ) and spouse.parents == [ 'person' ] + elif 'event' in o.parents: + for placename in get( 'place' ): + place = self.name2obj[ placename ] + assert place.parents == [ 'place' ] + for personname in get( 'people' ): + person = self.name2obj[ personname ] + assert person.parents == [ 'person' ] + except AssertionError, ex: print >> stderr, o.name raise @@ -160,6 +176,10 @@ # db.add( 'event', [ 'concept' ], [ 'date/time' ] ) # db.add( 'group', [ 'concept' ], [ 'cell' ] ) +def thedb(): + global db + return db + # # parser # @@ -233,39 +253,3 @@ expected[1].addprop( 'email', 'mj...@ne...' ) expected[1].addprop( 'notes', '- loves kids' ) self.assertEqual( parsed, expected ) - -# -# main -# - -def main( argv ): - global db - - config_logging( do_console = True ) - - try: loaddb() - except zdb_exception: createdb( True ) - - while True: - stdout.write( '>>> ' ) - line = stdin.readline() - if line == '': print; break - words = line.split() - if words != []: - cmd, params = words[0], words[1:] - try: - if False: pass - elif cmd == 'add': db.add( *params ) - elif cmd == 'del': db.rm( *params ) - elif cmd == 'set': db.set( *params ) - elif cmd == 'dump': db.dump( *params ) - elif cmd == 'load': importdb( *params ) - elif cmd == 'quit': break - else: raise zdb_exception( 'bad command: ' + cmd ) - except Exception, ex: - # print >> stderr, ex - handle_exceptions() - - savedb() - -run_main( handle_exceptions = False ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-08-10 21:41:34
|
Revision: 937 http://assorted.svn.sourceforge.net/assorted/?rev=937&view=rev Author: yangzhang Date: 2008-08-10 21:41:42 +0000 (Sun, 10 Aug 2008) Log Message: ----------- added module globals demo Added Paths: ----------- sandbox/trunk/src/py/module-globals/ sandbox/trunk/src/py/module-globals/globs.py sandbox/trunk/src/py/module-globals/main.py Added: sandbox/trunk/src/py/module-globals/globs.py =================================================================== --- sandbox/trunk/src/py/module-globals/globs.py (rev 0) +++ sandbox/trunk/src/py/module-globals/globs.py 2008-08-10 21:41:42 UTC (rev 937) @@ -0,0 +1,3 @@ +def foo(): + global x + x = 'hello' Added: sandbox/trunk/src/py/module-globals/main.py =================================================================== --- sandbox/trunk/src/py/module-globals/main.py (rev 0) +++ sandbox/trunk/src/py/module-globals/main.py 2008-08-10 21:41:42 UTC (rev 937) @@ -0,0 +1,23 @@ +#!/usr/bin/env python + +# Demonstrates that an imported module cannot affect the globals seen by the +# outer (importing) modules. + +from globs import * + +def bar(): + global x + x = 3 + +def main(): + global x + + # This doesn't work: + # foo() + # print x + + # Only this works: + bar() + print x + +main() Property changes on: sandbox/trunk/src/py/module-globals/main.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...> - 2008-08-08 22:08:49
|
Revision: 936 http://assorted.svn.sourceforge.net/assorted/?rev=936&view=rev Author: yangzhang Date: 2008-08-08 22:08:58 +0000 (Fri, 08 Aug 2008) Log Message: ----------- added hz to config; hopefully a more versatile default.bashrc Modified Paths: -------------- configs/trunk/src/default.bashrc configs/trunk/src/ssh/config Modified: configs/trunk/src/default.bashrc =================================================================== --- configs/trunk/src/default.bashrc 2008-08-08 21:02:03 UTC (rev 935) +++ configs/trunk/src/default.bashrc 2008-08-08 22:08:58 UTC (rev 936) @@ -1,2 +1,2 @@ -export PATH="/opt/armed/bin:$PATH" +export PATH="$HOME/.local/armed/bin:/opt/armed/bin:$PATH" . bashrc.bash Modified: configs/trunk/src/ssh/config =================================================================== --- configs/trunk/src/ssh/config 2008-08-08 21:02:03 UTC (rev 935) +++ configs/trunk/src/ssh/config 2008-08-08 22:08:58 UTC (rev 936) @@ -5,6 +5,14 @@ # StrictHostKeyChecking no +Host hz + HostName hzproject.com + User yzhang + +Host icfp + HostName 128.30.79.174 + User knoppix + Host rem HostName remote.mit.edu User root This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-08-08 21:01:57
|
Revision: 935 http://assorted.svn.sourceforge.net/assorted/?rev=935&view=rev Author: yangzhang Date: 2008-08-08 21:02:03 +0000 (Fri, 08 Aug 2008) Log Message: ----------- added ant sandbox Added Paths: ----------- sandbox/trunk/src/ant/ sandbox/trunk/src/ant/system-property-propagation/ sandbox/trunk/src/ant/system-property-propagation/SystemPropertyTest.java sandbox/trunk/src/ant/system-property-propagation/build.xml Added: sandbox/trunk/src/ant/system-property-propagation/SystemPropertyTest.java =================================================================== --- sandbox/trunk/src/ant/system-property-propagation/SystemPropertyTest.java (rev 0) +++ sandbox/trunk/src/ant/system-property-propagation/SystemPropertyTest.java 2008-08-08 21:02:03 UTC (rev 935) @@ -0,0 +1,6 @@ +public class SystemPropertyTest { + public static void main(String[] args) { + System.out.println(System.getProperties().containsKey("nojsampler")); + System.out.println(System.getProperties().containsKey("nojsampler") && !System.getProperty("nojsampler").equals("")); + } +} Copied: sandbox/trunk/src/ant/system-property-propagation/build.xml (from rev 923, sandbox/trunk/src/java/java-from-c/build.xml) =================================================================== --- sandbox/trunk/src/ant/system-property-propagation/build.xml (rev 0) +++ sandbox/trunk/src/ant/system-property-propagation/build.xml 2008-08-08 21:02:03 UTC (rev 935) @@ -0,0 +1,14 @@ +<?xml version="1.0" ?> +<project default="all"> + <!-- properties set from the command line get the same treatment as the ones + set in property tasks here --> + <!-- this doesn't get propagated --> + <property name="nojsampler" value="asdf"/> + <target name="all"> + <javac target="1.6" srcdir="." destdir="."/> + <java fork="yes" classname="SystemPropertyTest"> + <!-- only this works --> + <sysproperty key="nojsampler" value="${nojsampler}"/> + </java> + </target> +</project> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-08-08 20:42:41
|
Revision: 934 http://assorted.svn.sourceforge.net/assorted/?rev=934&view=rev Author: yangzhang Date: 2008-08-08 20:42:50 +0000 (Fri, 08 Aug 2008) Log Message: ----------- added int types demo Added Paths: ----------- sandbox/trunk/src/c/inttypes.c Added: sandbox/trunk/src/c/inttypes.c =================================================================== --- sandbox/trunk/src/c/inttypes.c (rev 0) +++ sandbox/trunk/src/c/inttypes.c 2008-08-08 20:42:50 UTC (rev 934) @@ -0,0 +1,11 @@ +#include <stdint.h> +#include <stdio.h> + +int +main() +{ + printf("%lld\n", INT64_C(0)); + printf("%lld\n", INT64_C(-9223372036854775807)-1); + printf("%lld\n", INT64_MIN); + return 0; +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-08-08 13:47:39
|
Revision: 933 http://assorted.svn.sourceforge.net/assorted/?rev=933&view=rev Author: yangzhang Date: 2008-08-08 13:47:49 +0000 (Fri, 08 Aug 2008) Log Message: ----------- added mako demo Added Paths: ----------- sandbox/trunk/src/py/makodemo.py Added: sandbox/trunk/src/py/makodemo.py =================================================================== --- sandbox/trunk/src/py/makodemo.py (rev 0) +++ sandbox/trunk/src/py/makodemo.py 2008-08-08 13:47:49 UTC (rev 933) @@ -0,0 +1,24 @@ +#!/usr/bin/env python + +from mako.template import Template + +doc = r""" +<% + rows = [[v for v in range(0,10)] for row in range(0,10)] +%> +<table> + % for row in rows: + ${makerow(row)} + % endfor +</table> + +<%def name="makerow(row)"> + <tr> + % for name in row: + <td>${name} ${foo.pop()}</td>\ + % endfor + </tr> +</%def> +""" + +print Template(doc).render(foo = range(10000)) Property changes on: sandbox/trunk/src/py/makodemo.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...> - 2008-08-07 01:59:28
|
Revision: 932 http://assorted.svn.sourceforge.net/assorted/?rev=932&view=rev Author: yangzhang Date: 2008-08-07 01:59:37 +0000 (Thu, 07 Aug 2008) Log Message: ----------- added (a working) hzrun; tweaks, renames, cleanup Modified Paths: -------------- sandbox/trunk/src/java/java-from-c/Makefile Added Paths: ----------- sandbox/trunk/src/java/java-from-c/Hello.java sandbox/trunk/src/java/java-from-c/hzrun.cc sandbox/trunk/src/java/java-from-c/jnilib.cc sandbox/trunk/src/java/java-from-c/jnitest.cc Removed Paths: ------------- sandbox/trunk/src/java/java-from-c/jnilib.cpp sandbox/trunk/src/java/java-from-c/jnitest.cpp Added: sandbox/trunk/src/java/java-from-c/Hello.java =================================================================== --- sandbox/trunk/src/java/java-from-c/Hello.java (rev 0) +++ sandbox/trunk/src/java/java-from-c/Hello.java 2008-08-07 01:59:37 UTC (rev 932) @@ -0,0 +1,5 @@ +public class Hello { + public static void main(String[] args) { + System.out.println("hello, world!"); + } +} Modified: sandbox/trunk/src/java/java-from-c/Makefile =================================================================== --- sandbox/trunk/src/java/java-from-c/Makefile 2008-08-06 08:10:02 UTC (rev 931) +++ sandbox/trunk/src/java/java-from-c/Makefile 2008-08-07 01:59:37 UTC (rev 932) @@ -1,3 +1,4 @@ +CLASSPATH := . CPATH := $(JAVA_HOME)/include:$(JAVA_HOME)/include/linux:$(CPATH) LIBRARY_PATH := $(JAVA_LIBRARY_PATH) LD_LIBRARY_PATH := $(JAVA_LIBRARY_PATH):. @@ -2,8 +3,12 @@ -all: test +all: test hzrun Hello.class + ./hzrun Hello ./test -dbg: test - gdb test +Hello.class: Hello.java + javac $< +hzrun: hzrun.cc + g++ -g3 -o $@ $^ -ljava + # Two modes of building this. The first is the more direct way for Linux, and @@ -14,22 +19,22 @@ ifeq ($(mode),) -test: JniTest.h jnitest.cpp libjnitest.so - g++ -g3 -o test jnitest.cpp libjnitest.so -ljava +test: jnitest.cc JniTest.h libjnitest.so + g++ -g3 -o $@ $< libjnitest.so -ljava -libjnitest.so: jnilib.cpp JniTest.h - g++ -g3 -shared -fPIC -o libjnitest.so jnilib.cpp +libjnitest.so: jnilib.cc JniTest.h + g++ -g3 -shared -fPIC -o $@ $< else -test: JniTest.h jnitest.cpp libjnitest.so - g++ -g3 -o test jnitest.cpp librealjnitest.so -ljava +test: jnitest.cc JniTest.h libjnitest.so + g++ -g3 -o $@ $< librealjnitest.so -ljava libjnitest.so: librealjnitest.so - g++ -g3 -shared -fPIC -o libjnitest.so librealjnitest.so + g++ -g3 -shared -fPIC -o $@ $< -librealjnitest.so: jnilib.cpp JniTest.h - g++ -g3 -shared -fPIC -o librealjnitest.so jnilib.cpp +librealjnitest.so: jnilib.cc JniTest.h + g++ -g3 -shared -fPIC -o $@ $< endif @@ -39,8 +44,8 @@ JniTest.class: JniTest.java javac JniTest.java -.PHONY: clean +.PHONY: all dbg clean clean: - rm -f test JniTest.h *.so *.class + rm -f test JniTest.h *.so *.class hzrun Added: sandbox/trunk/src/java/java-from-c/hzrun.cc =================================================================== --- sandbox/trunk/src/java/java-from-c/hzrun.cc (rev 0) +++ sandbox/trunk/src/java/java-from-c/hzrun.cc 2008-08-07 01:59:37 UTC (rev 932) @@ -0,0 +1,97 @@ +#include <iostream> +#include <string> +#include <jni.h> +#include <cassert> +#include <cstring> +#include <cstdlib> + +using namespace std; + +int main(int argc, char* argv[]) { + string classname = "com/horizontica/TPCCServer"; + if (argc != 2) { + cout << "Usage: hzrun javaclassname" << endl; + } else { + classname = argv[1]; + } + + JavaVMOption options[2]; + JavaVMInitArgs vm_args; + JavaVM *jvm; + JNIEnv *env; + long status; + + cout << "CLASSPATH: " << getenv("CLASSPATH") << endl; + options[0].optionString = strdup((string("-Djava.class.path=") + string(getenv("CLASSPATH"))).c_str()); + options[1].optionString = strdup("-verbose:jni"); + + memset(&vm_args, 0, sizeof(vm_args)); + vm_args.version = JNI_VERSION_1_6; + vm_args.nOptions = 1; + vm_args.options = options; + + status = JNI_CreateJavaVM(&jvm, (void**) &env, &vm_args); + if (status == JNI_ERR) { + fprintf(stderr, "Error creating VM\n"); + return 1; + } + + jclass class_MainClass; + + jthrowable e; + cout << "Looking for class: " << classname << endl; + class_MainClass = env->FindClass(classname.c_str()); + e = env->ExceptionOccurred(); + if (e) { + cout << "\n**********************exception found****************\n"; + env->ExceptionDescribe(); + return 1; + } else { + cout << "Found class\n"; + } + + assert(class_MainClass != NULL); + jmethodID id_main = env->GetStaticMethodID(class_MainClass, "main", "([Ljava/lang/String;)V"); + e = env->ExceptionOccurred(); + if (e) { + cout << "\n**********************exception found****************\n"; + env->ExceptionDescribe(); + return 1; + } else { + cout << "Found main method\n"; + } + + assert(id_main != NULL); + jclass class_String = env->FindClass("java/lang/String"); + e = env->ExceptionOccurred(); + if (e) { + cout << "\n**********************exception found****************\n"; + env->ExceptionDescribe(); + return 1; + } else { + cout << "Found string\n"; + } + + jobjectArray array_s = env->NewObjectArray(0, class_String, NULL); + e = env->ExceptionOccurred(); + if (e) { + cout << "\n**********************exception found****************\n"; + env->ExceptionDescribe(); + return 1; + } else { + cout << "Created Array\n"; + } + + env->CallStaticVoidMethod(class_MainClass, id_main, array_s); + e = env->ExceptionOccurred(); + if (e) { + cout << "\n**********************exception found****************\n"; + env->ExceptionDescribe(); + return 1; + } else { + cout << "called main\n"; + } + + cout << "success" << endl; +} + Copied: sandbox/trunk/src/java/java-from-c/jnilib.cc (from rev 931, sandbox/trunk/src/java/java-from-c/jnilib.cpp) =================================================================== --- sandbox/trunk/src/java/java-from-c/jnilib.cc (rev 0) +++ sandbox/trunk/src/java/java-from-c/jnilib.cc 2008-08-07 01:59:37 UTC (rev 932) @@ -0,0 +1,15 @@ +#include "JniTest.h" +#include <iostream> +#include <jni.h> +#include <cassert> +using namespace std; + +JNIEXPORT void JNICALL Java_JniTest_printNativeValue(JNIEnv *env, jobject obj, jint x) { + for (int i = 0; i < 1000000; i++) + double x = 13 / 5.5; + if (x % 1000 == 0) { + cout << "native: " << x << endl; + cout.flush(); + } +} + Deleted: sandbox/trunk/src/java/java-from-c/jnilib.cpp =================================================================== --- sandbox/trunk/src/java/java-from-c/jnilib.cpp 2008-08-06 08:10:02 UTC (rev 931) +++ sandbox/trunk/src/java/java-from-c/jnilib.cpp 2008-08-07 01:59:37 UTC (rev 932) @@ -1,15 +0,0 @@ -#include "JniTest.h" -#include <iostream> -#include <jni.h> -#include <cassert> -using namespace std; - -JNIEXPORT void JNICALL Java_JniTest_printNativeValue(JNIEnv *env, jobject obj, jint x) { - for (int i = 0; i < 1000000; i++) - double x = 13 / 5.5; - if (x % 1000 == 0) { - cout << "native: " << x << endl; - cout.flush(); - } -} - Copied: sandbox/trunk/src/java/java-from-c/jnitest.cc (from rev 931, sandbox/trunk/src/java/java-from-c/jnitest.cpp) =================================================================== --- sandbox/trunk/src/java/java-from-c/jnitest.cc (rev 0) +++ sandbox/trunk/src/java/java-from-c/jnitest.cc 2008-08-07 01:59:37 UTC (rev 932) @@ -0,0 +1,74 @@ +#include "JniTest.h" +#include <cstdio> +#include <iostream> +#include <jni.h> +#include <cassert> + +using namespace std; + +int main(int argc, char* argv[]) { + + Java_JniTest_printNativeValue(NULL, NULL, 5); + + JavaVMOption options[2]; + JavaVMInitArgs vm_args; + JavaVM *jvm; + JNIEnv *env; + long status; + + options[0].optionString = strdup("-Djava.class.path=."); + options[1].optionString = strdup("-verbose:jni"); + //options[2].optionString = strdup("-Xverbose:class"); + + memset(&vm_args, 0, sizeof(vm_args)); + vm_args.version = JNI_VERSION_1_6; + vm_args.nOptions = 1; + vm_args.options = options; + + status = JNI_CreateJavaVM(&jvm, (void**) &env, &vm_args); + if (status == JNI_ERR) + { + fprintf(stderr, "Error creating VM\n"); + return 1; + } + + jclass class_JniTest; + + jthrowable e; + class_JniTest = env->FindClass("JniTest"); + e = env->ExceptionOccurred(); + if(e) { + cout<<"\n**********************exception found****************\n"; + env->ExceptionDescribe(); + } else { + cout<<"Found class\n"; + } + + + assert(class_JniTest != NULL); + jmethodID id_print = env->GetMethodID(class_JniTest, "printValue", "(I)V"); + e = env->ExceptionOccurred(); + if(e) { + cout<<"\n**********************exception found****************\n"; + env->ExceptionDescribe(); + } else { + cout<<"Found method 1\n"; + } + jmethodID id_construct = env->GetMethodID(class_JniTest, "<init>", "()V"); + e = env->ExceptionOccurred(); + if(e) { + cout<<"\n**********************exception found****************\n"; + env->ExceptionDescribe(); + } else { + cout<<"Found method 2\n"; + } + jobject obj = env->NewObject(class_JniTest, id_construct); + for (int i = 0; i < 100000; i++) + env->CallVoidMethod(obj, id_print, i); + + cout << "This is some output." << endl; + + jvm->DestroyJavaVM(); + return 0; +} + Deleted: sandbox/trunk/src/java/java-from-c/jnitest.cpp =================================================================== --- sandbox/trunk/src/java/java-from-c/jnitest.cpp 2008-08-06 08:10:02 UTC (rev 931) +++ sandbox/trunk/src/java/java-from-c/jnitest.cpp 2008-08-07 01:59:37 UTC (rev 932) @@ -1,78 +0,0 @@ -#include "JniTest.h" -#include <cstdio> -#include <iostream> -#include <jni.h> -#include <cassert> - -using namespace std; - -int main(int argc, char* argv[]) { - - Java_JniTest_printNativeValue(NULL, NULL, 5); - - JavaVMOption options[2]; - JavaVMInitArgs vm_args; - JavaVM *jvm; - JNIEnv *env; - long status; - - options[0].optionString = strdup("-Djava.class.path=."); - options[1].optionString = strdup("-verbose:jni"); - //options[2].optionString = strdup("-Xverbose:class"); - - memset(&vm_args, 0, sizeof(vm_args)); - vm_args.version = JNI_VERSION_1_6; - vm_args.nOptions = 2; - vm_args.options = options; - - status = JNI_CreateJavaVM(&jvm, (void**) &env, &vm_args); - if (status == JNI_ERR) - { - fprintf(stderr, "Error creating VM\n"); - return 1; - } - - jclass class_JniTest; - jint value; - - jthrowable e; - class_JniTest = env->FindClass("JniTest"); - e = env->ExceptionOccurred(); - if(e) { - cout<<"\n**********************exception found****************\n"; - env->ExceptionDescribe(); - } - else{ - cout<<"Found class\n"; - } - - - assert(class_JniTest != NULL); - jmethodID id_print = env->GetMethodID(class_JniTest, "printValue", "(I)V"); - e = env->ExceptionOccurred(); - if(e) { - cout<<"\n**********************exception found****************\n"; - env->ExceptionDescribe(); - } - else{ - cout<<"Found method 1\n"; - } - jmethodID id_construct = env->GetMethodID(class_JniTest, "<init>", "()V"); - e = env->ExceptionOccurred(); - if(e) { - cout<<"\n**********************exception found****************\n"; - env->ExceptionDescribe(); - } - else{ - cout<<"Found method 2\n"; - } - jobject obj = env->NewObject(class_JniTest, id_construct); - for (int i = 0; i < 100000; i++) - env->CallVoidMethod(obj, id_print, i); - - cout << "This is some output." << endl; - - jvm->DestroyJavaVM(); - return 0; -} - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-08-06 08:09:53
|
Revision: 931 http://assorted.svn.sourceforge.net/assorted/?rev=931&view=rev Author: yangzhang Date: 2008-08-06 08:10:02 +0000 (Wed, 06 Aug 2008) Log Message: ----------- - added gcc sandbox - added profile-guided optimization demo Added Paths: ----------- sandbox/trunk/src/gcc/ sandbox/trunk/src/gcc/pgo/ sandbox/trunk/src/gcc/pgo/Makefile sandbox/trunk/src/gcc/pgo/README sandbox/trunk/src/gcc/pgo/pgodemo.cc Added: sandbox/trunk/src/gcc/pgo/Makefile =================================================================== --- sandbox/trunk/src/gcc/pgo/Makefile (rev 0) +++ sandbox/trunk/src/gcc/pgo/Makefile 2008-08-06 08:10:02 UTC (rev 931) @@ -0,0 +1,14 @@ +all: out/pgodemo-gen + +out/pgodemo-gen: pgodemo.cc + mkdir -p $(@D) + g++ -Wall -O3 -fprofile-generate -o $@ $^ + +out/pgodemo-use: pgodemo.cc + mkdir -p $(@D) + g++ -Wall -O3 -fprofile-use -o $@ $^ + +clean: + rm -rf out/ pgodemo.gc* + +.PHONY: all clean Added: sandbox/trunk/src/gcc/pgo/README =================================================================== --- sandbox/trunk/src/gcc/pgo/README (rev 0) +++ sandbox/trunk/src/gcc/pgo/README 2008-08-06 08:10:02 UTC (rev 931) @@ -0,0 +1,20 @@ +Demo of profile-guided optimization. + +`make pgodemo-gen` produces the executable along with `pgodemo.gcno`, whose +purpose is unclear to me at the moment (removing it doesn't seem to affect any +future step), but `.gcno` and `.gcda` files appear to be gcov-related. + +At this point, you may run the executable, which will produce a `pgodemo.gcda` +file back in the original build directory (the location of the executable, your +current working directory at the time of execution, etc. are all irrelevant). + +'make pgodemo-use` produces the optimized version of the executable by +consuming `pgodemo.gcda`. This will reproduce a new `pgodemo.gcno`. + +If you try to build pgodemo-use without the `.gcda` file, you'll get: + + $ make out/pgodemo-use + mkdir -p out + g++ -Wall -O3 -fprofile-use -o out/pgodemo-use pgodemo.cc + pgodemo.cc: In function ‘(static initializers for pgodemo.cc)’: + pgodemo.cc:11: note: file pgodemo.gcda not found, execution counts estimated Added: sandbox/trunk/src/gcc/pgo/pgodemo.cc =================================================================== --- sandbox/trunk/src/gcc/pgo/pgodemo.cc (rev 0) +++ sandbox/trunk/src/gcc/pgo/pgodemo.cc 2008-08-06 08:10:02 UTC (rev 931) @@ -0,0 +1,10 @@ +#include <iostream> + +using namespace std; + +int +main() +{ + cout << "hello" << endl; + return 0; +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-08-05 19:50:07
|
Revision: 930 http://assorted.svn.sourceforge.net/assorted/?rev=930&view=rev Author: yangzhang Date: 2008-08-05 19:50:15 +0000 (Tue, 05 Aug 2008) Log Message: ----------- added shell variable expansion demo Added Paths: ----------- sandbox/trunk/src/make/shell-var-expansion.mk Added: sandbox/trunk/src/make/shell-var-expansion.mk =================================================================== --- sandbox/trunk/src/make/shell-var-expansion.mk (rev 0) +++ sandbox/trunk/src/make/shell-var-expansion.mk 2008-08-05 19:50:15 UTC (rev 930) @@ -0,0 +1,4 @@ +# demonstrates that you can delay variable expansion for the shell + +all: + @echo \$$HOME: $$HOME This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-08-05 19:29:29
|
Revision: 929 http://assorted.svn.sourceforge.net/assorted/?rev=929&view=rev Author: yangzhang Date: 2008-08-05 19:29:36 +0000 (Tue, 05 Aug 2008) Log Message: ----------- added flock() on read-only fd Modified Paths: -------------- sandbox/trunk/src/py/flocking.py Modified: sandbox/trunk/src/py/flocking.py =================================================================== --- sandbox/trunk/src/py/flocking.py 2008-08-05 19:28:45 UTC (rev 928) +++ sandbox/trunk/src/py/flocking.py 2008-08-05 19:29:36 UTC (rev 929) @@ -1,11 +1,13 @@ #!/usr/bin/env python -# Demo of flock. Try running this concurrently from two shells. +# Demo of flock. Try running this concurrently from two shells. Also try +# running this with an arg if you want to open the file in read mode. from __future__ import with_statement from fcntl import * +from sys import argv -with file('/tmp/mylock', 'w') as f: +with file('/tmp/mylock', 'w' if len(argv) == 1 else 'r') as f: print 'locking' flock(f, LOCK_EX) print 'locked' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-08-05 19:28:38
|
Revision: 928 http://assorted.svn.sourceforge.net/assorted/?rev=928&view=rev Author: yangzhang Date: 2008-08-05 19:28:45 +0000 (Tue, 05 Aug 2008) Log Message: ----------- tweaked persistent-fsc, persistent-pidgin Modified Paths: -------------- shell-tools/trunk/src/bash-commons/bashrc.bash shell-tools/trunk/src/bash-commons/common.bash Modified: shell-tools/trunk/src/bash-commons/bashrc.bash =================================================================== --- shell-tools/trunk/src/bash-commons/bashrc.bash 2008-08-03 23:11:11 UTC (rev 927) +++ shell-tools/trunk/src/bash-commons/bashrc.bash 2008-08-05 19:28:45 UTC (rev 928) @@ -601,10 +601,12 @@ persistent-pidgin() { while true ; do - date + echo "=== $(date) ===" time gdb -batch -ex 'handle SIGPIPE nostop' -ex 'run' -ex 'bt full' -ex 'q' pidgin echo "exit status: $?" trace sleep 1 + echo + echo done } Modified: shell-tools/trunk/src/bash-commons/common.bash =================================================================== --- shell-tools/trunk/src/bash-commons/common.bash 2008-08-03 23:11:11 UTC (rev 927) +++ shell-tools/trunk/src/bash-commons/common.bash 2008-08-05 19:28:45 UTC (rev 928) @@ -333,7 +333,7 @@ "$@" } -persist-fsc() { +persistent-fsc() { local output="$(fsc "$@")" || status="$$" #echo "GOT OUTPUT 1:" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |