assorted-commits Mailing List for Assorted projects (Page 44)
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-05-16 00:39:59
|
Revision: 827 http://assorted.svn.sourceforge.net/assorted/?rev=827&view=rev Author: yangzhang Date: 2008-05-15 17:40:06 -0700 (Thu, 15 May 2008) Log Message: ----------- added some instructions Added Paths: ----------- configs/trunk/src/topcoder/README Added: configs/trunk/src/topcoder/README =================================================================== --- configs/trunk/src/topcoder/README (rev 0) +++ configs/trunk/src/topcoder/README 2008-05-16 00:40:06 UTC (rev 827) @@ -0,0 +1,3 @@ +- simple-build +- make -s +- ./setup.py ~/work/topcoder/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-05-16 00:38:56
|
Revision: 826 http://assorted.svn.sourceforge.net/assorted/?rev=826&view=rev Author: yangzhang Date: 2008-05-15 17:38:51 -0700 (Thu, 15 May 2008) Log Message: ----------- picking up topcoder again... Added Paths: ----------- problems/topcoder/Bonuses/ problems/topcoder/Bonuses/Bonuses.cc problems/topcoder/Lottery/Lottery2.cc problems/topcoder/PenLift/PenLift.top Added: problems/topcoder/Bonuses/Bonuses.cc =================================================================== --- problems/topcoder/Bonuses/Bonuses.cc (rev 0) +++ problems/topcoder/Bonuses/Bonuses.cc 2008-05-16 00:38:51 UTC (rev 826) @@ -0,0 +1,297 @@ +// vim:et:sw=2:ts=2 + +// TODO +// - strip out all comments +// - trim the unused includes/macros/typedefs/code + +// $BEGINREUSE$ +#include <algorithm> +#include <cassert> +#include <cctype> +#include <cmath> +#include <cstdio> +#include <cstdlib> +#include <deque> +#include <functional> +#include <iostream> +#include <map> +#include <queue> +#include <set> +#include <sstream> +#include <stack> +#include <string> +#include <vector> +using namespace std; + +#define dd(x) cout << #x << " = " << x << endl +#define len length() +#define sz size() +#define pb(x) push_back((x)); +#define all(A) (A).begin(), (A).end() +#define rall(A) (A).rbegin(), (A).rend() +#define each(it,xs) for (typeof(xs.begin()) it = xs.begin(); it != xs.end(); it++) +#define bounds(i,xs) for (typeof((xs).size()) i = 0; i < (xs).size(); i++) +#define range(i,l,h) for (typeof(l) i = (l); i < (h); i++) +#define event(x) { cout << __FILE__ << ":" << __LINE__ << ": " << #x << endl; x; } +#define trace(x) { cout << __FILE__ << ":" << __LINE__ << ": "; pp(x); x; } +#define ping cout << "ping" << endl; +#define pong cout << "pong" << endl; + +// CHOOSE +//int dx[] = {1,0,-1,0}, dy[] = {0,1,0,-1}; +//int dx[] = {1,1,1,0,0,-1,-1,-1}, dy[] = {1,0,-1,1,-1,1,0,-1}; + +typedef vector<int> vi; +typedef vector<string> vs; +typedef vector<bool> vb; +typedef vector<vi> vvi; +typedef vector<vs> vvs; +typedef vector<vb> vvb; +typedef long long ll; +#define vec(x...) vector< x > +typedef string str; + +template<typename T> inline T mod(T a, T b) { return (a % b + b) % b; } +template<typename T> inline void rev(T xs) { std::reverse(all(xs)); } +template<typename T> inline void sort(T xs) { std::sort(all(xs)); } +template<typename T> inline void ssort(T & xs) { std::stable_sort(all(xs)); } +template<typename T> inline void unique(T xs) { std::unique(all(xs)); } +template<typename T> inline void uniq(T xs) { xs.erase( std::unique(all(xs)), xs.end() ); } +template<typename T, typename U> inline void fill(T xs, U x) { std::fill(all(xs), x); } +template<typename T, typename U> inline U minim(const T xs) { return *std::min_element(all(xs)); } +template<typename T, typename U> inline U maxim(const T xs) { return *std::max_element(all(xs)); } +template<typename T> inline void nextp(T xs) { return std::next_permutation(all(xs)); } +template<typename T> inline void prevp(T xs) { return std::prev_permutation(all(xs)); } +template<typename T> inline string tos(T x) { stringstream s; s << x; return s.str(); } +inline int powi(int a, int b) { return int( std::pow(double(a), double(b)) ); } +inline int powl(ll a, ll b) { return ll( std::pow(double(a), double(b)) ); } +template<typename T> inline void pl(const T & x) { cout << x << endl; } +#define pp(x) cout << #x << ' ' << x << endl; + +inline ll gcd(ll a, ll b) { + if (a < 0 && b < 0) return gcd(-a,-b); + if (a == 0) return b; + if (b == 0) return a; + if (a > b) return gcd(b, a); + if (!(b % a)) return a; + return gcd(a, b % a); +} + +// TODO merge the following two pieces of code together + +template <typename T> +inline ostream& operator << (ostream& os, const set<T> & xs) { + bounds(i,xs) os << i ? ", " : "{ " << xs[i]; + return os << " }"; +} + +template <typename T> +inline ostream& operator << (ostream& os, const vector<T> & xs) { + bounds(i,xs) os << (i ? ", " : "{ " )<< xs[i]; + return os << " }"; +} + +template<class S,class T> +inline ostream & operator << (ostream & os, const pair<S,T> & a) { + os << "(" << a.first << ", " << a.second << ")"; + return os; +} + +vs split( const string & s, const string & delim = " " ) { + vs res; + string t; + each(c,s) { + if ( delim.find( *c ) != string::npos ) { + if ( !t.empty() ) { + res.pb( t ); + t = ""; + } + } else { + t += *c; + } + } + if ( ! t.empty() ) { + res.push_back(t); + } + return res; +} + +vi ints( const str & s, const str & delim = " " ) { + vs ss = split( s, delim ); + vi is; + each(s,ss) is.push_back( atoi( s->c_str() ) ); + return is; +} + +string vi2str( const vi xs ) { + string s(xs.sz, '\0'); + bounds(i,xs) s[i] = xs[i] + '0'; + return s; +} + +// following is needed for 'main' +#define ARRSIZE(x) (sizeof(x)/sizeof(x[0])) +// $ENDREUSE$ + + + + + + + +// BEGIN CUT HERE +template<typename T> void print( T a ) { + cerr << a; +} +void print( long long a ) { + cerr << a << "L"; +} +void print( string a ) { + cerr << '"' << a << '"'; +} +template<typename T> void print( vector<T> a ) { + cerr << "{"; + bounds(i,a) { + if ( i != 0 ) cerr << ", "; + print( a[i] ); + } + cerr << "}" << endl; +} +template<typename T> void eq( int n, T have, T need ) { + if ( have == need ) { + cerr << "Case " << n << " passed." << endl; + } else { + cerr << "Case " << n << " failed: expected "; + print( need ); + cerr << " received "; + print( have ); + cerr << "." << endl; + } +} +template<typename T> void eq( int n, vector<T> have, vector<T> need ) { + if( have.size() != need.size() ) { + cerr << "Case " << n << " failed: returned " << have.size() << " elements; expected " << need.size() << " elements." << endl; + cerr << " have: "; print( have ); + cerr << " need: "; print( need ); + return; + } + for( size_t i= 0; i < have.size(); i++ ) { + if( have[i] != need[i] ) { + cerr << "Case " << n << " failed. Expected and returned array differ in position " << i << "." << endl; + cerr << " have: "; print( have ); + cerr << " need: "; print( need ); + return; + } + } + cerr << "Case " << n << " passed." << endl; +} +void eq( int n, string have, string need ) { + if ( have == need ) { + cerr << "Case " << n << " passed." << endl; + } else { + cerr << "Case " << n << " failed: expected "; + print( need ); + cerr << " received "; + print( have ); + cerr << "." << endl; + } +} +// END CUT HERE + + + + + + + + + + + + + +// asdf +// sum +class Bonuses { + public: + vector <int> getDivision(vector <int> points) { + vector <int> res(points.sz); + int tot = 0; + bounds(i,points) tot += points[i]; + int rem = 100; + vec(pair<int,int>) pairs(points.sz); + int n = points.sz; + vi per(n); + bounds(i,points) { + int p = floor(100.0 * points[i] / double(tot)); + pairs[i] = make_pair(-points[i],i); + per[i] = p; + rem -= p; + } +#if 1 + assert(rem>=0 && rem<points.sz); + ssort(pairs); + bounds(i,pairs) { + if (rem == 0) break; + per[pairs[i].second] += 1; + rem -= 1; + } + bounds(i,pairs) res[i] = per[i]; +#endif +#if 0 + vb done(n); + while (rem-- > 0) { + int h=1,b=0; + for(int i=0;i<n;i++) + if (!done[i] && points[i] > h) { + h = points[i]; + b = i; + } + done[b] = true; + pairs[b].first--; + } + bounds(i,pairs) res[pairs[i].second] = -pairs[i].first; +#endif + return res; + } +}; + + + + + + + +// BEGIN CUT HERE +int main() { + { + int pointsARRAY[] = {1,2,3,4,5}; + vector <int> points( pointsARRAY, pointsARRAY+ARRSIZE(pointsARRAY) ); + int retrunValueARRAY[] = { 6, 13, 20, 27, 34 }; + vector <int> retrunValue( retrunValueARRAY, retrunValueARRAY+ARRSIZE(retrunValueARRAY) ); + Bonuses theObject; + eq(0, theObject.getDivision(points),retrunValue); + } + { + int pointsARRAY[] = {5,5,5,5,5,5}; + vector <int> points( pointsARRAY, pointsARRAY+ARRSIZE(pointsARRAY) ); + int retrunValueARRAY[] = { 17, 17, 17, 17, 16, 16 }; + vector <int> retrunValue( retrunValueARRAY, retrunValueARRAY+ARRSIZE(retrunValueARRAY) ); + Bonuses theObject; + eq(1, theObject.getDivision(points),retrunValue); + } + { + int pointsARRAY[] = {485, 324, 263, 143, 470, 292, 304, 188, 100, 254, 296, + 255, 360, 231, 311, 275, 93, 463, 115, 366, 197, 470}; + vector <int> points( pointsARRAY, pointsARRAY+ARRSIZE(pointsARRAY) ); + int retrunValueARRAY[] = { 8, 6, 4, 2, 8, 5, 5, 3, 1, 4, 5, 4, 6, 3, 5, 4, 1, 8, 1, 6, 3, 8 }; + vector <int> retrunValue( retrunValueARRAY, retrunValueARRAY+ARRSIZE(retrunValueARRAY) ); + Bonuses theObject; + eq(2, theObject.getDivision(points),retrunValue); + } +#ifdef WIN32 + cin.get(); +#endif + return 0; +} +// END CUT HERE Added: problems/topcoder/Lottery/Lottery2.cc =================================================================== --- problems/topcoder/Lottery/Lottery2.cc (rev 0) +++ problems/topcoder/Lottery/Lottery2.cc 2008-05-16 00:38:51 UTC (rev 826) @@ -0,0 +1,338 @@ +// vim:et:sw=2:ts=2 + +// TODO +// - strip out all comments +// - trim the unused includes/macros/typedefs/code + +// $BEGINREUSE$ +#include <algorithm> +#include <cassert> +#include <cctype> +#include <cmath> +#include <cstdio> +#include <cstdlib> +#include <deque> +#include <functional> +#include <iostream> +#include <map> +#include <queue> +#include <set> +#include <sstream> +#include <stack> +#include <string> +#include <utility> +#include <vector> +using namespace std; + +#define dd(x) cout << #x << " = " << x << endl +#define len length() +#define sz size() +#define pb(x) push_back((x)); +#define all(A) (A).begin(), (A).end() +#define rall(A) (A).rbegin(), (A).rend() +#define each(it,xs) for (typeof(xs.begin()) it = xs.begin(); it != xs.end(); it++) +#define bounds(i,xs) for (typeof((xs).size()) i = 0; i < (xs).size(); i++) +#define range(i,l,h) for (typeof(l) i = (l); i < (h); i++) +#define event(x) { cout << __FILE__ << ":" << __LINE__ << ": " << #x << endl; x; } +#define trace(x) { \ + typeof(x) __x = x; \ + cout << __FILE__ << ":" << __LINE__ << ": " << #x << " = " << __x << endl; \ + __x; \ +} +#define ping cout << "ping" << endl; +#define pong cout << "pong" << endl; + +// CHOOSE +//int dx[] = {1,0,-1,0}, dy[] = {0,1,0,-1}; +//int dx[] = {1,1,1,0,0,-1,-1,-1}, dy[] = {1,0,-1,1,-1,1,0,-1}; + +typedef vector<int> vi; +typedef vector<string> vs; +typedef vector<bool> vb; +typedef vector<vi> vvi; +typedef vector<vs> vvs; +typedef vector<vb> vvb; +typedef long long ll; +#define vec(x...) vector< x > +typedef string str; + +template<typename T> inline T mod(T a, T b) { return (a % b + b) % b; } +template<typename T> inline void rev(T & xs) { std::reverse(all(xs)); } +template<typename T> inline void sort(T & xs) { std::sort(all(xs)); } +template<typename T> inline void ssort(T & xs) { std::stable_sort(all(xs)); } +template<typename T> inline void unique(T & xs) { std::unique(all(xs)); } +template<typename T> inline void uniq(T & xs) { xs.erase( std::unique(all(xs)), xs.end() ); } +template<typename T, typename U> inline void fill(T & xs, U & x) { std::fill(all(xs), x); } +template<typename T, typename U> inline U minim(const T & xs) { return *std::min_element(all(xs)); } +template<typename T, typename U> inline U maxim(const T & xs) { return *std::max_element(all(xs)); } +template<typename T> inline void nextp(T & xs) { return std::next_permutation(all(xs)); } +template<typename T> inline void prevp(T & xs) { return std::prev_permutation(all(xs)); } +template<typename T> inline string tos(T & x) { stringstream s; s << x; return s.str(); } +// pow, powl, powf are std +inline double powd(double a, double b) { return std::pow(a, b); } +inline int powi(int a, int b) { return int( std::pow(double(a), double(b)) ); } +inline int powll(ll a, ll b) { return ll( std::pow(double(a), double(b)) ); } +template<typename T> inline void print(const T & x) { cout << x << endl; } +template<typename T, typename U> inline pair<T,U> mkpair(T t, U u) { return make_pair(t,u); } +#define pp(x) cout << #x << " = " << x << endl; + +inline ll gcd(ll a, ll b) { + if (a < 0 && b < 0) return gcd(-a,-b); + if (a == 0) return b; + if (b == 0) return a; + if (a > b) return gcd(b, a); + if (!(b % a)) return a; + return gcd(a, b % a); +} + +// TODO merge the following two pieces of code together + +template <typename T> +inline ostream& operator << (ostream& os, const set<T> & xs) { + os << "{ "; + bounds(i,xs) os << (i ? ", " : "") << xs[i]; + return os << " }"; +} + +template <typename T> +inline ostream& operator << (ostream& os, const vector<T> & xs) { + os << "[ "; + bounds(i,xs) os << (i ? ", " : "") << xs[i]; + return os << " ]"; +} + +template<class S,class T> +inline ostream & operator << (ostream & os, const pair<S,T> & a) { + os << "(" << a.first << ", " << a.second << ")"; + return os; +} + +vs split( const string & s, const string & delim = " " ) { + vs res; + string t; + each(c,s) { + if ( delim.find( *c ) != string::npos ) { + if ( !t.empty() ) { + res.pb( t ); + t = ""; + } + } else { + t += *c; + } + } + if ( ! t.empty() ) { + res.push_back(t); + } + return res; +} + +vs splitstr( const str & s, const str & glue = " " ) { + vs res; + str::size_type i = 0; + str::size_type ln = glue.sz; + while (true) { + str::size_type pos = s.find(glue, i); + res.push_back(string(s, i, pos)); + if (pos == str::npos) break; + i = pos + ln; + } + return res; +} + +vi ints( const str & s, const str & delim = " " ) { + vs ss = split( s, delim ); + vi is; + each(s,ss) is.push_back( atoi( s->c_str() ) ); + return is; +} + +string vi2str( const vi xs ) { + string s(xs.sz, '\0'); + bounds(i,xs) s[i] = xs[i] + '0'; + return s; +} + +template<typename T, typename U> inline U realfact(T x) { + ll f = 1; + range(i,1,x+1) f *= i; + return f; +} + +template<typename T> inline ll factl(T x) { return realfact<T,ll>(x); } +template<typename T> inline int facti(T x) { return realfact<T,int>(x); } + +ll perms(ll n, ll r) { + assert(n >= r); + ll p = 1; + for (ll i = n; i > n-r; i--) p *= i; + return p; +} + +ll combs(ll n, ll k) { + return perms(n,k) / factl(k); +} + +// following is needed for 'main' +#define ARRSIZE(x) (sizeof(x)/sizeof(x[0])) +// $ENDREUSE$ + + + + + + + +// BEGIN CUT HERE +template<typename T> void print( T a ) { + cerr << a; +} +void print( long long a ) { + cerr << a << "L"; +} +void print( string a ) { + cerr << '"' << a << '"'; +} +template<typename T> void print( vector<T> a ) { + cerr << "{"; + bounds(i,a) { + if ( i != 0 ) cerr << ", "; + print( a[i] ); + } + cerr << "}" << endl; +} +template<typename T> void eq( int n, T have, T need ) { + if ( have == need ) { + cerr << "Case " << n << " passed." << endl; + } else { + cerr << "Case " << n << " failed: expected "; + print( need ); + cerr << " received "; + print( have ); + cerr << "." << endl; + } +} +template<typename T> void eq( int n, vector<T> have, vector<T> need ) { + if( have.size() != need.size() ) { + cerr << "Case " << n << " failed: returned " << have.size() << " elements; expected " << need.size() << " elements." << endl; + cerr << " have: "; print( have ); + cerr << " need: "; print( need ); + return; + } + for( size_t i= 0; i < have.size(); i++ ) { + if( have[i] != need[i] ) { + cerr << "Case " << n << " failed. Expected and returned array differ in position " << i << "." << endl; + cerr << " have: "; print( have ); + cerr << " need: "; print( need ); + return; + } + } + cerr << "Case " << n << " passed." << endl; +} +void eq( int n, string have, string need ) { + if ( have == need ) { + cerr << "Case " << n << " passed." << endl; + } else { + cerr << "Case " << n << " failed: expected "; + print( need ); + cerr << " received "; + print( have ); + cerr << "." << endl; + } +} +// END CUT HERE + + + + + + + + + + + + + +// asdf +class Lottery { + public: + vector <string> sortByOdds(vector <string> rules) { + vector <string> res; + vec(pair<double, str>) pairs; + each(rule,rules) { + vs parts = splitstr(*rule, ": "); + string name = parts[0]; + vs attrs = split(parts[1]); + int choi = atoi(attrs[0].c_str()); + int blan = atoi(attrs[1].c_str()); + bool sort = attrs[2] == "T"; + bool uniq = attrs[3] == "T"; + pp(choi); + pp(blan); + pp(sort); + pp(uniq); + double poss = -1; + if (!sort && !uniq) { + trace(poss = powd(choi, blan)); + } else if (!sort && uniq) { + trace(poss = perms(choi, blan)); + } else if (sort && !uniq) { + trace(poss = combs(choi + blan - 1, blan)); + } else if (sort && uniq) { + trace(poss = combs(choi, blan)); + } else { + assert(false); + } + pairs.push_back(mkpair(poss, name)); + } + sort(pairs); + pp(pairs); + bounds(i,pairs) res.push_back(pairs[i].second); + return res; + } +}; + + + + + + + +// BEGIN CUT HERE +int main() { + { + string rulesARRAY[] = {"PICK ANY TWO: 10 2 F F" + ,"PICK TWO IN ORDER: 10 2 T F" + ,"PICK TWO DIFFERENT: 10 2 F T" + ,"PICK TWO LIMITED: 10 2 T T"}; + vector <string> rules( rulesARRAY, rulesARRAY+ARRSIZE(rulesARRAY) ); + string retrunValueARRAY[] = { "PICK TWO LIMITED", "PICK TWO IN ORDER", "PICK TWO DIFFERENT", "PICK ANY TWO" }; + vector <string> retrunValue( retrunValueARRAY, retrunValueARRAY+ARRSIZE(retrunValueARRAY) ); + Lottery theObject; + eq(0, theObject.sortByOdds(rules),retrunValue); + } + { + string rulesARRAY[] = {"INDIGO: 93 8 T F", + "ORANGE: 29 8 F T", + "VIOLET: 76 6 F F", + "BLUE: 100 8 T T", + "RED: 99 8 T T", + "GREEN: 78 6 F T", + "YELLOW: 75 6 F F"} + ; + vector <string> rules( rulesARRAY, rulesARRAY+ARRSIZE(rulesARRAY) ); + string retrunValueARRAY[] = { "RED", "ORANGE", "YELLOW", "GREEN", "BLUE", "INDIGO", "VIOLET" }; + vector <string> retrunValue( retrunValueARRAY, retrunValueARRAY+ARRSIZE(retrunValueARRAY) ); + Lottery theObject; + eq(1, theObject.sortByOdds(rules),retrunValue); + } + { + Lottery theObject; + eq(2, theObject.sortByOdds(vector <string>()),vector <string>()); + } +#ifdef WIN32 + cin.get(); +#endif + return 0; +} +// END CUT HERE Added: problems/topcoder/PenLift/PenLift.top =================================================================== --- problems/topcoder/PenLift/PenLift.top (rev 0) +++ problems/topcoder/PenLift/PenLift.top 2008-05-16 00:38:51 UTC (rev 826) @@ -0,0 +1,56 @@ +class PenLift + int numTimes(str* segments, int n) + // init + var xs={} ys={} + var segs = for seg in segments + int a b c d + seg ~ "a b c d" + xs ++= [a c] + ys ++= [b d] + (a b c d) + var packs = for zs in [xs ys] + var pack = {} + var j = 0 + for v in zs + pack(v) = j++ + assert j < 100 + pack + + // adj + var adj = arr((200,200),{}) + for (a b c d) in segs + [a c] = [a c] map packs(0) + [b d] = [b d] map packs(1) + if a == c + var x = a + if b > d: swap b d + for y in [b,d) + adj(x,y) += (x,y+1) + adj(x,y+1) += (x,y) + else b == d + var y = b + order a c // if a > c: swap a c + for x in [a,c) + adj(x,y) += (x+1,y) + adj(x+1,y) += (x,y) + + // search + var num = -1 + for x to 100 + for y to 100 + if adj(x y) not empty + var q = Q() + q push (x y) + var odds = 0 + while q not empty + (x y) = x pop + var ps = adj(x y) + if ps % 2 == 1: odds++ + for p=(x y) in ps + if adj(p) not empty + q push p + ps clear + if n % 2 == 0 or odds <= 2: odds = 2 + num += odds / 2 + + num This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-05-15 06:27:06
|
Revision: 825 http://assorted.svn.sourceforge.net/assorted/?rev=825&view=rev Author: yangzhang Date: 2008-05-14 23:27:13 -0700 (Wed, 14 May 2008) Log Message: ----------- fixed and enhanced c++ template Modified Paths: -------------- configs/trunk/src/topcoder/template.cpp Modified: configs/trunk/src/topcoder/template.cpp =================================================================== --- configs/trunk/src/topcoder/template.cpp 2008-05-15 00:04:24 UTC (rev 824) +++ configs/trunk/src/topcoder/template.cpp 2008-05-15 06:27:13 UTC (rev 825) @@ -29,9 +29,13 @@ #define pb(x) push_back((x)); #define all(A) (A).begin(), (A).end() #define rall(A) (A).rbegin(), (A).rend() -#define forea(it,xs) for (typeof(xs.begin()) it = xs.begin(); it != xs.end(); it++) -#define FOR(i,xs) for (typeof((xs).size()) i = 0; i < (xs).size(); i++) -#define FOR(i,l,h) for (typeof(l) i = (l); i < (h); i++) +#define each(it,xs) for (typeof(xs.begin()) it = xs.begin(); it != xs.end(); it++) +#define bounds(i,xs) for (typeof((xs).size()) i = 0; i < (xs).size(); i++) +#define range(i,l,h) for (typeof(l) i = (l); i < (h); i++) +#define event(x) { cout << __FILE__ << ":" << __LINE__ << ": " << #x << endl; x; } +#define trace(x) { cout << __FILE__ << ":" << __LINE__ << ": "; pp(x); x; } +#define ping cout << "ping" << endl; +#define pong cout << "pong" << endl; // CHOOSE //int dx[] = {1,0,-1,0}, dy[] = {0,1,0,-1}; @@ -44,7 +48,7 @@ typedef vector<vs> vvs; typedef vector<vb> vvb; typedef long long ll; -typedef vector vec; // XXX +#define vec(x) vector< x > typedef string str; template<typename T> inline T mod(T a, T b) { return (a % b + b) % b; } @@ -61,7 +65,8 @@ template<typename T> inline string tos(T x) { stringstream s; s << x; return s.str(); } inline int powi(int a, int b) { return int( std::pow(double(a), double(b)) ); } inline int powl(ll a, ll b) { return ll( std::pow(double(a), double(b)) ); } -template<typename T> inline void pp(const T & x) { cout << x << endl; } +template<typename T> inline void print(const T & x) { cout << x << endl; } +#define pp(x) cout << #x << ' ' << x << endl; inline ll gcd(ll a, ll b) { if (a < 0 && b < 0) return gcd(-a,-b); @@ -76,13 +81,13 @@ template <typename T> inline ostream& operator << (ostream& os, const set<T> & xs) { - FOR(i,xs) os << i ? ", " : "{ " << xs[i]; + bounds(i,xs) os << i ? ", " : "{ " << xs[i]; return os << " }"; } template <typename T> inline ostream& operator << (ostream& os, const vector<T> & xs) { - FOR(i,xs) os << i ? ", " : "{ " << xs[i]; + bounds(i,xs) os << i ? ", " : "{ " << xs[i]; return os << " }"; } @@ -95,14 +100,14 @@ vs split( const string & s, const string & delim = " " ) { vs res; string t; - forea(c,s) { - if ( delim.find( c ) != string::npos ) { + each(c,s) { + if ( delim.find( *c ) != string::npos ) { if ( !t.empty() ) { res.pb( t ); t = ""; } } else { - t += c; + t += *c; } } if ( ! t.empty() ) { @@ -114,10 +119,16 @@ vi ints( const str & s, const str & delim = " " ) { vs ss = split( s, delim ); vi is; - forea(s,ss) is.push_back( atoi( s.c_str() ) ); + each(s,ss) is.push_back( atoi( s->c_str() ) ); return is; } +string vi2str( const vi xs ) { + string s(xs.sz, '\0'); + bounds(i,xs) s[i] = xs[i] + '0'; + return s; +} + // following is needed for 'main' #define ARRSIZE(x) (sizeof(x)/sizeof(x[0])) // $ENDREUSE$ @@ -132,15 +143,15 @@ template<typename T> void print( T a ) { cerr << a; } -static void print( long long a ) { +void print( long long a ) { cerr << a << "L"; } -static void print( string a ) { +void print( string a ) { cerr << '"' << a << '"'; } template<typename T> void print( vector<T> a ) { cerr << "{"; - for ( int i = 0 ; i != a.size() ; i++ ) { + bounds(i,a) { if ( i != 0 ) cerr << ", "; print( a[i] ); } @@ -174,7 +185,7 @@ } cerr << "Case " << n << " passed." << endl; } -static void eq( int n, string have, string need ) { +void eq( int n, string have, string need ) { if ( have == need ) { cerr << "Case " << n << " passed." << endl; } else { @@ -199,6 +210,7 @@ +// asdf class $CLASSNAME$ { public: $RC$ $METHODNAME$($METHODPARMS$) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-05-15 00:05:45
|
Revision: 824 http://assorted.svn.sourceforge.net/assorted/?rev=824&view=rev Author: yangzhang Date: 2008-05-14 17:04:24 -0700 (Wed, 14 May 2008) Log Message: ----------- moved new template.cpp Added Paths: ----------- configs/trunk/src/topcoder/template.cpp Removed Paths: ------------- configs/trunk/src/contestapplet.conf Deleted: configs/trunk/src/contestapplet.conf =================================================================== --- configs/trunk/src/contestapplet.conf 2008-05-15 00:04:02 UTC (rev 823) +++ configs/trunk/src/contestapplet.conf 2008-05-15 00:04:24 UTC (rev 824) @@ -1,225 +0,0 @@ -// vim:et:sw=2:ts=2 - -// TODO -// - strip out all comments -// - trim the unused includes/macros/typedefs/code - -// $BEGINREUSE$ -#include <algorithm> -#include <cassert> -#include <cctype> -#include <cmath> -#include <cstdio> -#include <cstdlib> -#include <deque> -#include <functional> -#include <iostream> -#include <map> -#include <queue> -#include <set> -#include <sstream> -#include <stack> -#include <string> -#include <vector> -using namespace std; - -#define dd(x) cout << #x << " = " << x << endl -#define len length() -#define sz size() -#define pb(x) push_back((x)); -#define all(A) (A).begin(), (A).end() -#define rall(A) (A).rbegin(), (A).rend() -#define forea(it,xs) for (typeof(xs.begin()) it = xs.begin(); it != xs.end(); it++) -#define FOR(i,xs) for (typeof((xs).size()) i = 0; i < (xs).size(); i++) -#define FOR(i,l,h) for (typeof(l) i = (l); i < (h); i++) - -// CHOOSE -//int dx[] = {1,0,-1,0}, dy[] = {0,1,0,-1}; -//int dx[] = {1,1,1,0,0,-1,-1,-1}, dy[] = {1,0,-1,1,-1,1,0,-1}; - -typedef vector<int> vi; -typedef vector<string> vs; -typedef vector<bool> vb; -typedef vector<vi> vvi; -typedef vector<vs> vvs; -typedef vector<vb> vvb; -typedef long long ll; -typedef vector vec; // XXX -typedef string str; - -template<typename T> inline T mod(T a, T b) { return (a % b + b) % b; } -template<typename T> inline void rev(T xs) { std::reverse(all(xs)); } -template<typename T> inline void sort(T xs) { std::sort(all(xs)); } -template<typename T> inline void ssort(T xs) { std::stable_sort(all(xs)); } -template<typename T> inline void unique(T xs) { std::unique(all(xs)); } -template<typename T> inline void uniq(T xs) { xs.erase( std::unique(all(xs)), xs.end() ); } -template<typename T, typename U> inline void fill(T xs, U x) { std::fill(all(xs), x); } -template<typename T, typename U> inline U minim(const T xs) { return *std::min_element(all(xs)); } -template<typename T, typename U> inline U maxim(const T xs) { return *std::max_element(all(xs)); } -template<typename T> inline void nextp(T xs) { return std::next_permutation(all(xs)); } -template<typename T> inline void prevp(T xs) { return std::prev_permutation(all(xs)); } -template<typename T> inline string tos(T x) { stringstream s; s << x; return s.str(); } -inline int powi(int a, int b) { return int( std::pow(double(a), double(b)) ); } -inline int powl(ll a, ll b) { return ll( std::pow(double(a), double(b)) ); } -template<typename T> inline void pp(const T & x) { cout << x << endl; } - -inline ll gcd(ll a, ll b) { - if (a < 0 && b < 0) return gcd(-a,-b); - if (a == 0) return b; - if (b == 0) return a; - if (a > b) return gcd(b, a); - if (!(b % a)) return a; - return gcd(a, b % a); -} - -// TODO merge the following two pieces of code together - -template <typename T> -inline ostream& operator << (ostream& os, const set<T> & xs) { - FOR(i,xs) os << i ? ", " : "{ " << xs[i]; - return os << " }"; -} - -template <typename T> -inline ostream& operator << (ostream& os, const vector<T> & xs) { - FOR(i,xs) os << i ? ", " : "{ " << xs[i]; - return os << " }"; -} - -template<class S,class T> -inline ostream & operator << (ostream & os, const pair<S,T> & a) { - os << "(" << a.first << ", " << a.second << ")"; - return os; -} - -vs split( const string & s, const string & delim = " " ) { - vs res; - string t; - forea(c,s) { - if ( delim.find( c ) != string::npos ) { - if ( !t.empty() ) { - res.pb( t ); - t = ""; - } - } else { - t += c; - } - } - if ( ! t.empty() ) { - res.push_back(t); - } - return res; -} - -vi ints( const str & s, const str & delim = " " ) { - vs ss = split( s, delim ); - vi is; - forea(s,ss) is.push_back( atoi( s.c_str() ) ); - return is; -} - -// following is needed for 'main' -#define ARRSIZE(x) (sizeof(x)/sizeof(x[0])) -// $ENDREUSE$ - - - - - - - -$BEGINCUT$ -template<typename T> void print( T a ) { - cerr << a; -} -static void print( long long a ) { - cerr << a << "L"; -} -static void print( string a ) { - cerr << '"' << a << '"'; -} -template<typename T> void print( vector<T> a ) { - cerr << "{"; - for ( int i = 0 ; i != a.size() ; i++ ) { - if ( i != 0 ) cerr << ", "; - print( a[i] ); - } - cerr << "}" << endl; -} -template<typename T> void eq( int n, T have, T need ) { - if ( have == need ) { - cerr << "Case " << n << " passed." << endl; - } else { - cerr << "Case " << n << " failed: expected "; - print( need ); - cerr << " received "; - print( have ); - cerr << "." << endl; - } -} -template<typename T> void eq( int n, vector<T> have, vector<T> need ) { - if( have.size() != need.size() ) { - cerr << "Case " << n << " failed: returned " << have.size() << " elements; expected " << need.size() << " elements." << endl; - cerr << " have: "; print( have ); - cerr << " need: "; print( need ); - return; - } - for( size_t i= 0; i < have.size(); i++ ) { - if( have[i] != need[i] ) { - cerr << "Case " << n << " failed. Expected and returned array differ in position " << i << "." << endl; - cerr << " have: "; print( have ); - cerr << " need: "; print( need ); - return; - } - } - cerr << "Case " << n << " passed." << endl; -} -static void eq( int n, string have, string need ) { - if ( have == need ) { - cerr << "Case " << n << " passed." << endl; - } else { - cerr << "Case " << n << " failed: expected "; - print( need ); - cerr << " received "; - print( have ); - cerr << "." << endl; - } -} -$ENDCUT$ - - - - - - - - - - - - - -class $CLASSNAME$ { - public: - $RC$ $METHODNAME$($METHODPARMS$) { - $RC$ res; - return res; - } -}; - - - - - - - -$BEGINCUT$ -int main() { -$MAINBODY$ -#ifdef WIN32 - cin.get(); -#endif - return 0; -} -$ENDCUT$ - Copied: configs/trunk/src/topcoder/template.cpp (from rev 821, configs/trunk/src/contestapplet.conf) =================================================================== --- configs/trunk/src/topcoder/template.cpp (rev 0) +++ configs/trunk/src/topcoder/template.cpp 2008-05-15 00:04:24 UTC (rev 824) @@ -0,0 +1,225 @@ +// vim:et:sw=2:ts=2 + +// TODO +// - strip out all comments +// - trim the unused includes/macros/typedefs/code + +// $BEGINREUSE$ +#include <algorithm> +#include <cassert> +#include <cctype> +#include <cmath> +#include <cstdio> +#include <cstdlib> +#include <deque> +#include <functional> +#include <iostream> +#include <map> +#include <queue> +#include <set> +#include <sstream> +#include <stack> +#include <string> +#include <vector> +using namespace std; + +#define dd(x) cout << #x << " = " << x << endl +#define len length() +#define sz size() +#define pb(x) push_back((x)); +#define all(A) (A).begin(), (A).end() +#define rall(A) (A).rbegin(), (A).rend() +#define forea(it,xs) for (typeof(xs.begin()) it = xs.begin(); it != xs.end(); it++) +#define FOR(i,xs) for (typeof((xs).size()) i = 0; i < (xs).size(); i++) +#define FOR(i,l,h) for (typeof(l) i = (l); i < (h); i++) + +// CHOOSE +//int dx[] = {1,0,-1,0}, dy[] = {0,1,0,-1}; +//int dx[] = {1,1,1,0,0,-1,-1,-1}, dy[] = {1,0,-1,1,-1,1,0,-1}; + +typedef vector<int> vi; +typedef vector<string> vs; +typedef vector<bool> vb; +typedef vector<vi> vvi; +typedef vector<vs> vvs; +typedef vector<vb> vvb; +typedef long long ll; +typedef vector vec; // XXX +typedef string str; + +template<typename T> inline T mod(T a, T b) { return (a % b + b) % b; } +template<typename T> inline void rev(T xs) { std::reverse(all(xs)); } +template<typename T> inline void sort(T xs) { std::sort(all(xs)); } +template<typename T> inline void ssort(T xs) { std::stable_sort(all(xs)); } +template<typename T> inline void unique(T xs) { std::unique(all(xs)); } +template<typename T> inline void uniq(T xs) { xs.erase( std::unique(all(xs)), xs.end() ); } +template<typename T, typename U> inline void fill(T xs, U x) { std::fill(all(xs), x); } +template<typename T, typename U> inline U minim(const T xs) { return *std::min_element(all(xs)); } +template<typename T, typename U> inline U maxim(const T xs) { return *std::max_element(all(xs)); } +template<typename T> inline void nextp(T xs) { return std::next_permutation(all(xs)); } +template<typename T> inline void prevp(T xs) { return std::prev_permutation(all(xs)); } +template<typename T> inline string tos(T x) { stringstream s; s << x; return s.str(); } +inline int powi(int a, int b) { return int( std::pow(double(a), double(b)) ); } +inline int powl(ll a, ll b) { return ll( std::pow(double(a), double(b)) ); } +template<typename T> inline void pp(const T & x) { cout << x << endl; } + +inline ll gcd(ll a, ll b) { + if (a < 0 && b < 0) return gcd(-a,-b); + if (a == 0) return b; + if (b == 0) return a; + if (a > b) return gcd(b, a); + if (!(b % a)) return a; + return gcd(a, b % a); +} + +// TODO merge the following two pieces of code together + +template <typename T> +inline ostream& operator << (ostream& os, const set<T> & xs) { + FOR(i,xs) os << i ? ", " : "{ " << xs[i]; + return os << " }"; +} + +template <typename T> +inline ostream& operator << (ostream& os, const vector<T> & xs) { + FOR(i,xs) os << i ? ", " : "{ " << xs[i]; + return os << " }"; +} + +template<class S,class T> +inline ostream & operator << (ostream & os, const pair<S,T> & a) { + os << "(" << a.first << ", " << a.second << ")"; + return os; +} + +vs split( const string & s, const string & delim = " " ) { + vs res; + string t; + forea(c,s) { + if ( delim.find( c ) != string::npos ) { + if ( !t.empty() ) { + res.pb( t ); + t = ""; + } + } else { + t += c; + } + } + if ( ! t.empty() ) { + res.push_back(t); + } + return res; +} + +vi ints( const str & s, const str & delim = " " ) { + vs ss = split( s, delim ); + vi is; + forea(s,ss) is.push_back( atoi( s.c_str() ) ); + return is; +} + +// following is needed for 'main' +#define ARRSIZE(x) (sizeof(x)/sizeof(x[0])) +// $ENDREUSE$ + + + + + + + +$BEGINCUT$ +template<typename T> void print( T a ) { + cerr << a; +} +static void print( long long a ) { + cerr << a << "L"; +} +static void print( string a ) { + cerr << '"' << a << '"'; +} +template<typename T> void print( vector<T> a ) { + cerr << "{"; + for ( int i = 0 ; i != a.size() ; i++ ) { + if ( i != 0 ) cerr << ", "; + print( a[i] ); + } + cerr << "}" << endl; +} +template<typename T> void eq( int n, T have, T need ) { + if ( have == need ) { + cerr << "Case " << n << " passed." << endl; + } else { + cerr << "Case " << n << " failed: expected "; + print( need ); + cerr << " received "; + print( have ); + cerr << "." << endl; + } +} +template<typename T> void eq( int n, vector<T> have, vector<T> need ) { + if( have.size() != need.size() ) { + cerr << "Case " << n << " failed: returned " << have.size() << " elements; expected " << need.size() << " elements." << endl; + cerr << " have: "; print( have ); + cerr << " need: "; print( need ); + return; + } + for( size_t i= 0; i < have.size(); i++ ) { + if( have[i] != need[i] ) { + cerr << "Case " << n << " failed. Expected and returned array differ in position " << i << "." << endl; + cerr << " have: "; print( have ); + cerr << " need: "; print( need ); + return; + } + } + cerr << "Case " << n << " passed." << endl; +} +static void eq( int n, string have, string need ) { + if ( have == need ) { + cerr << "Case " << n << " passed." << endl; + } else { + cerr << "Case " << n << " failed: expected "; + print( need ); + cerr << " received "; + print( have ); + cerr << "." << endl; + } +} +$ENDCUT$ + + + + + + + + + + + + + +class $CLASSNAME$ { + public: + $RC$ $METHODNAME$($METHODPARMS$) { + $RC$ res; + return res; + } +}; + + + + + + + +$BEGINCUT$ +int main() { +$MAINBODY$ +#ifdef WIN32 + cin.get(); +#endif + return 0; +} +$ENDCUT$ + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-05-15 00:04:00
|
Revision: 823 http://assorted.svn.sourceforge.net/assorted/?rev=823&view=rev Author: yangzhang Date: 2008-05-14 17:04:02 -0700 (Wed, 14 May 2008) Log Message: ----------- making way for new template.cpp Removed Paths: ------------- configs/trunk/src/topcoder/template.cpp Deleted: configs/trunk/src/topcoder/template.cpp =================================================================== --- configs/trunk/src/topcoder/template.cpp 2008-05-14 23:20:40 UTC (rev 822) +++ configs/trunk/src/topcoder/template.cpp 2008-05-15 00:04:02 UTC (rev 823) @@ -1,171 +0,0 @@ -// vim:et:sw=2:ts=2 - -$BEGINCUT$ -#if 0 -$PROBLEMDESC$ -#endif -$ENDCUT$ - - - - - - - -//#line $NEXTLINENUMBER$ "$FILENAME$" -#include <algorithm> -#include <cassert> -#include <cctype> -#include <cmath> -#include <cstdio> -#include <cstdlib> -#include <deque> -#include <iostream> -#include <map> -#include <queue> -#include <set> -#include <sstream> -#include <stack> -#include <string> -#include <vector> -using namespace std; - -#define ARRSIZE(x) (sizeof(x)/sizeof(x[0])) - - - - - - - -$BEGINCUT$ -template<typename T> void print( T a ) { - cerr << a; -} -static void print( long long a ) { - cerr << a << "L"; -} -static void print( string a ) { - cerr << '"' << a << '"'; -} -template<typename T> void print( vector<T> a ) { - cerr << "{"; - for ( int i = 0 ; i != a.size() ; i++ ) { - if ( i != 0 ) cerr << ", "; - print( a[i] ); - } - cerr << "}" << endl; -} -template<typename T> void eq( int n, T have, T need ) { - if ( have == need ) { - cerr << "Case " << n << " passed." << endl; - } else { - cerr << "Case " << n << " failed: expected "; - print( need ); - cerr << " received "; - print( have ); - cerr << "." << endl; - } -} -template<typename T> void eq( int n, vector<T> have, vector<T> need ) { - if( have.size() != need.size() ) { - cerr << "Case " << n << " failed: returned " << have.size() << " elements; expected " << need.size() << " elements." << endl; - cerr << " have: "; print( have ); - cerr << " need: "; print( need ); - return; - } - for( size_t i= 0; i < have.size(); i++ ) { - if( have[i] != need[i] ) { - cerr << "Case " << n << " failed. Expected and returned array differ in position " << i << "." << endl; - cerr << " have: "; print( have ); - cerr << " need: "; print( need ); - return; - } - } - cerr << "Case " << n << " passed." << endl; -} -static void eq( int n, string have, string need ) { - if ( have == need ) { - cerr << "Case " << n << " passed." << endl; - } else { - cerr << "Case " << n << " failed: expected "; - print( need ); - cerr << " received "; - print( have ); - cerr << "." << endl; - } -} -$ENDCUT$ - - - - - - - -$BEGINCUT$ -#if 0 -template<typename T> void pp(const T & xs) { - for (typename T::const_iterator it = xs.begin(); - it != xs.end(); - it++) - cout << *it << " "; - cout << endl; -} - -vector<string> split( const string& s, const string& delim =" " ) { - vector<string> res; - string t; - for ( int i = 0 ; i != s.size() ; i++ ) { - if ( delim.find( s[i] ) != string::npos ) { - if ( !t.empty() ) { - res.push_back( t ); - t = ""; - } - } else { - t += s[i]; - } - } - if ( !t.empty() ) { - res.push_back(t); - } - return res; -} - -vector<int> splitInt( const string& s, const string& delim =" " ) { - vector<string> tok = split( s, delim ); - vector<int> res; - for ( int i = 0 ; i != tok.size(); i++ ) - res.push_back( atoi( tok[i].c_str() ) ); - return res; -} -#endif -$ENDCUT$ - - - - - - - -class $CLASSNAME$ { - public: - $RC$ $METHODNAME$($METHODPARMS$) { - $RC$ res; - return res; - } -}; - - - - - - - -$BEGINCUT$ -int main() { - $MAINBODY$ - cin.get(); - return 0; -} -$ENDCUT$ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-05-14 23:20:33
|
Revision: 822 http://assorted.svn.sourceforge.net/assorted/?rev=822&view=rev Author: yangzhang Date: 2008-05-14 16:20:40 -0700 (Wed, 14 May 2008) Log Message: ----------- fixed python/scala interaction Modified Paths: -------------- configs/trunk/src/topcoder/setup.py Modified: configs/trunk/src/topcoder/setup.py =================================================================== --- configs/trunk/src/topcoder/setup.py 2008-05-14 22:57:50 UTC (rev 821) +++ configs/trunk/src/topcoder/setup.py 2008-05-14 23:20:40 UTC (rev 822) @@ -53,5 +53,5 @@ urlretrieve(url, path) # Generate the final configuration file from the template. -call( [ 'scala', '-classpath', 'bin', 'TopCoderSetup', 'load', +call( [ 'scala', '-classpath', 'out/topcodersetup.jar', 'TopCoderSetup', 'load', pathsep.join(paths), userdir ] ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-05-14 22:57:44
|
Revision: 821 http://assorted.svn.sourceforge.net/assorted/?rev=821&view=rev Author: yangzhang Date: 2008-05-14 15:57:50 -0700 (Wed, 14 May 2008) Log Message: ----------- added f7 date insertion Modified Paths: -------------- configs/trunk/src/vim/plugin/_yang.vim Modified: configs/trunk/src/vim/plugin/_yang.vim =================================================================== --- configs/trunk/src/vim/plugin/_yang.vim 2008-05-14 22:57:35 UTC (rev 820) +++ configs/trunk/src/vim/plugin/_yang.vim 2008-05-14 22:57:50 UTC (rev 821) @@ -26,6 +26,7 @@ map <s-space> <c-b> imap <f6> <c-r>=system("date")[0:-2]<cr> +imap <f7> <c-r>=strftime("%Y-%m-%d")<cr> " imap <f6> <c-r>=strftime("%d/%m/%Y %H:%M:%S")<cr> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-05-14 22:57:28
|
Revision: 820 http://assorted.svn.sourceforge.net/assorted/?rev=820&view=rev Author: yangzhang Date: 2008-05-14 15:57:35 -0700 (Wed, 14 May 2008) Log Message: ----------- added check_private() Modified Paths: -------------- shell-tools/trunk/src/bash-commons/common.bash Modified: shell-tools/trunk/src/bash-commons/common.bash =================================================================== --- shell-tools/trunk/src/bash-commons/common.bash 2008-05-14 22:57:12 UTC (rev 819) +++ shell-tools/trunk/src/bash-commons/common.bash 2008-05-14 22:57:35 UTC (rev 820) @@ -434,6 +434,12 @@ PYTHONPATH="$pkgdir:$PYTHONPATH" ./setup.py install --prefix "$prefix" } +# Check that a file exists and has private permissions. +check_private() { + local path="$@" + (( "$( find "$path" -perm u=rw | wc -l )" == 1 )) +} + #if ! is_declared indent ; then # noindent #else This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-05-14 22:57:14
|
Revision: 819 http://assorted.svn.sourceforge.net/assorted/?rev=819&view=rev Author: yangzhang Date: 2008-05-14 15:57:12 -0700 (Wed, 14 May 2008) Log Message: ----------- added cprestore() Modified Paths: -------------- shell-tools/trunk/src/bash-commons/common.bash Modified: shell-tools/trunk/src/bash-commons/common.bash =================================================================== --- shell-tools/trunk/src/bash-commons/common.bash 2008-05-14 22:56:50 UTC (rev 818) +++ shell-tools/trunk/src/bash-commons/common.bash 2008-05-14 22:57:12 UTC (rev 819) @@ -115,6 +115,15 @@ done } +cprestore() { + eval "$get_all_opts" + for file in "$@" ; do + file="$( echo "$file" | sed 's/\/\+$//' )" + echo cp $opts "$file" "${file%.backup}" + cp $opts "$file" "${file%.backup}" + done +} + # backup file(s) by moving bkup() { eval "$get_all_opts" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-05-14 22:56:42
|
Revision: 818 http://assorted.svn.sourceforge.net/assorted/?rev=818&view=rev Author: yangzhang Date: 2008-05-14 15:56:50 -0700 (Wed, 14 May 2008) Log Message: ----------- fixed target ordering Modified Paths: -------------- simple-build/trunk/src/Makefile Modified: simple-build/trunk/src/Makefile =================================================================== --- simple-build/trunk/src/Makefile 2008-05-14 22:56:35 UTC (rev 817) +++ simple-build/trunk/src/Makefile 2008-05-14 22:56:50 UTC (rev 818) @@ -1,13 +1,13 @@ JYAML := jyaml-1.3.jar SCALA_COMMONS := ~/scom/src +all: meta/SimpleBuild.class + -include site.mk jyaml-1.3.jar: wget 'http://downloads.sourceforge.net/jyaml/jyaml-1.3.jar' -all: meta/SimpleBuild.class - meta/SimpleBuild.class: SimpleBuild.scala $(JYAML) mkdir -p meta fsc -deprecation -unchecked -d meta -cp $(JYAML) \ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-05-14 22:56:36
|
Revision: 817 http://assorted.svn.sourceforge.net/assorted/?rev=817&view=rev Author: yangzhang Date: 2008-05-14 15:56:35 -0700 (Wed, 14 May 2008) Log Message: ----------- renamed template to contestapplet.conf Modified Paths: -------------- configs/trunk/src/topcoder/setup.py configs/trunk/src/topcoder/setup.scala Added Paths: ----------- configs/trunk/src/topcoder/contestapplet.conf Removed Paths: ------------- configs/trunk/src/topcoder/contestapplet.conf.template Copied: configs/trunk/src/topcoder/contestapplet.conf (from rev 815, configs/trunk/src/topcoder/contestapplet.conf.template) =================================================================== --- configs/trunk/src/topcoder/contestapplet.conf (rev 0) +++ configs/trunk/src/topcoder/contestapplet.conf 2008-05-14 22:56:35 UTC (rev 817) @@ -0,0 +1,199 @@ +#TopCoder ContestApplet Preferences File +#Thu Sep 13 01:33:13 EDT 2007 +com.topcoder.client.contestApplet.common.LocalPreferences.menufont=Arial +com.topcoder.client.contestApplet.common.LocalPreferences.menufontsize=10 +com.topcoder.client.contestApplet.common.LocalPreferences.commonclasspath= +com.topcoder.client.contestApplet.common.LocalPreferences.chatpanelback=-16777216 +com.topcoder.client.contestApplet.common.LocalPreferences.chatfindhighlight=-8355712 +com.topcoder.client.contestApplet.common.LocalPreferences.chatfindback=-16776961 +com.topcoder.client.contestApplet.common.LocalPreferences.chatfont=Monospaced +com.topcoder.client.contestApplet.common.LocalPreferences.chatfontsize=12 +com.topcoder.client.contestApplet.common.LocalPreferences.keysubmit=Alt+U +com.topcoder.client.contestApplet.common.LocalPreferences.edstdkeyfind=Alt+F +com.topcoder.client.contestApplet.common.LocalPreferences.keycompile=Alt+C +com.topcoder.client.contestApplet.common.LocalPreferences.edstdkeyredo=Ctrl+Y +com.topcoder.client.contestApplet.common.LocalPreferences.edstdkeyundo=Ctrl+Z +com.topcoder.client.contestApplet.common.LocalPreferences.edstdkeygoto=Alt+G +com.topcoder.client.contestApplet.common.LocalPreferences.keytest=Alt+T +com.topcoder.client.contestApplet.common.LocalPreferences.keysave=Alt+S +com.topcoder.client.contestApplet.common.LocalPreferences.edstdselb=-16751104 +com.topcoder.client.contestApplet.common.LocalPreferences.edstdselt=-1 +com.topcoder.client.contestApplet.common.LocalPreferences.edstdsyntaxkeywords=-6710785 +com.topcoder.client.contestApplet.common.LocalPreferences.edstdsyntaxliterals=-65281 +com.topcoder.client.contestApplet.common.LocalPreferences.edstdback=-16777216 +com.topcoder.client.contestApplet.common.LocalPreferences.edstdsyntaxcomments=-16724992 +com.topcoder.client.contestApplet.common.LocalPreferences.edstdsyntaxdefault=-1 +com.topcoder.client.contestApplet.common.LocalPreferences.edstdfore=-1 +com.topcoder.client.contestApplet.common.LocalPreferences.edstdfont=Monospaced +com.topcoder.client.contestApplet.common.LocalPreferences.edstdfontsize=12 +com.topcoder.client.contestApplet.common.LocalPreferences.edstdtabsize=4 +com.topcoder.client.contestApplet.common.LocalPreferences.problemback=-16777216 +com.topcoder.client.contestApplet.common.LocalPreferences.problemfore=-1 +com.topcoder.client.contestApplet.common.LocalPreferences.messagefore=-1 +com.topcoder.client.contestApplet.common.LocalPreferences.messageback=-16777216 +com.topcoder.client.contestApplet.common.LocalPreferences.problemfont=Monospaced +com.topcoder.client.contestApplet.common.LocalPreferences.problemfontsize=12 +com.topcoder.client.contestApplet.common.LocalPreferences.problemfixedfont=Monospaced +com.topcoder.client.contestApplet.common.LocalPreferences.problemfixedfontsize=12 +com.topcoder.client.contestApplet.common.LocalPreferences.messagefont=Monospaced +com.topcoder.client.contestApplet.common.LocalPreferences.messagefontsize=12 +com.topcoder.client.contestApplet.common.LocalPreferences.chalsrcback=-16777216 +com.topcoder.client.contestApplet.common.LocalPreferences.chalprobback=-16777216 +com.topcoder.client.contestApplet.common.LocalPreferences.chalsrcfore=-1 +com.topcoder.client.contestApplet.common.LocalPreferences.chalprobfore=-1 +com.topcoder.client.contestApplet.common.LocalPreferences.chalprobfont=Monospaced +com.topcoder.client.contestApplet.common.LocalPreferences.chalprobontsize=12 +com.topcoder.client.contestApplet.common.LocalPreferences.chalprobfixedfont=Monospaced +com.topcoder.client.contestApplet.common.LocalPreferences.chalprobfixedfontsize=12 +com.topcoder.client.contestApplet.common.LocalPreferences.chalsrcfont=Monospaced +com.topcoder.client.contestApplet.common.LocalPreferences.chalsrcfontsize=12 +com.topcoder.client.contestApplet.common.LocalPreferences.summaryunopened.color=-1 +com.topcoder.client.contestApplet.common.LocalPreferences.summaryunopened.bold=false +com.topcoder.client.contestApplet.common.LocalPreferences.summaryunopened.italic=false +com.topcoder.client.contestApplet.common.LocalPreferences.summaryopened.color=-1 +com.topcoder.client.contestApplet.common.LocalPreferences.summaryopened.bold=false +com.topcoder.client.contestApplet.common.LocalPreferences.summaryopened.italic=false +com.topcoder.client.contestApplet.common.LocalPreferences.summarycompiled.color=-1 +com.topcoder.client.contestApplet.common.LocalPreferences.summarycompiled.bold=false +com.topcoder.client.contestApplet.common.LocalPreferences.summarycompiled.italic=false +com.topcoder.client.contestApplet.common.LocalPreferences.summaryjavapoints.color=-16711936 +com.topcoder.client.contestApplet.common.LocalPreferences.summaryjavapoints.bold=false +com.topcoder.client.contestApplet.common.LocalPreferences.summaryjavapoints.italic=false +com.topcoder.client.contestApplet.common.LocalPreferences.summaryjavachlpassed.color=-16711936 +com.topcoder.client.contestApplet.common.LocalPreferences.summaryjavachlpassed.bold=true +com.topcoder.client.contestApplet.common.LocalPreferences.summaryjavachlpassed.italic=true +com.topcoder.client.contestApplet.common.LocalPreferences.summaryjavachlfailed.color=-16711936 +com.topcoder.client.contestApplet.common.LocalPreferences.summaryjavachlfailed.bold=false +com.topcoder.client.contestApplet.common.LocalPreferences.summaryjavachlfailed.italic=false +com.topcoder.client.contestApplet.common.LocalPreferences.summaryjavasyspassed.color=-16711936 +com.topcoder.client.contestApplet.common.LocalPreferences.summaryjavasyspassed.bold=true +com.topcoder.client.contestApplet.common.LocalPreferences.summaryjavasyspassed.italic=true +com.topcoder.client.contestApplet.common.LocalPreferences.summaryjavasysfailed.color=-65485 +com.topcoder.client.contestApplet.common.LocalPreferences.summaryjavasysfailed.bold=false +com.topcoder.client.contestApplet.common.LocalPreferences.summaryjavasysfailed.italic=true +com.topcoder.client.contestApplet.common.LocalPreferences.summarycpppoints.color=-103 +com.topcoder.client.contestApplet.common.LocalPreferences.summarycpppoints.bold=false +com.topcoder.client.contestApplet.common.LocalPreferences.summarycpppoints.italic=false +com.topcoder.client.contestApplet.common.LocalPreferences.summarycppchlpassed.color=-103 +com.topcoder.client.contestApplet.common.LocalPreferences.summarycppchlpassed.bold=true +com.topcoder.client.contestApplet.common.LocalPreferences.summarycppchlpassed.italic=true +com.topcoder.client.contestApplet.common.LocalPreferences.summarycppchlfailed.color=-103 +com.topcoder.client.contestApplet.common.LocalPreferences.summarycppchlfailed.bold=false +com.topcoder.client.contestApplet.common.LocalPreferences.summarycppchlfailed.italic=false +com.topcoder.client.contestApplet.common.LocalPreferences.summarycppsyspassed.color=-103 +com.topcoder.client.contestApplet.common.LocalPreferences.summarycppsyspassed.bold=true +com.topcoder.client.contestApplet.common.LocalPreferences.summarycppsyspassed.italic=true +com.topcoder.client.contestApplet.common.LocalPreferences.summarycppsysfailed.color=-65485 +com.topcoder.client.contestApplet.common.LocalPreferences.summarycppsysfailed.bold=false +com.topcoder.client.contestApplet.common.LocalPreferences.summarycppsysfailed.italic=true +com.topcoder.client.contestApplet.common.LocalPreferences.summarycsharppoints.color=-10066177 +com.topcoder.client.contestApplet.common.LocalPreferences.summarycsharppoints.bold=false +com.topcoder.client.contestApplet.common.LocalPreferences.summarycsharppoints.italic=false +com.topcoder.client.contestApplet.common.LocalPreferences.summarycsharpchlpassed.color=-10066177 +com.topcoder.client.contestApplet.common.LocalPreferences.summarycsharpchlpassed.bold=true +com.topcoder.client.contestApplet.common.LocalPreferences.summarycsharpchlpassed.italic=true +com.topcoder.client.contestApplet.common.LocalPreferences.summarycsharpchlfailed.color=-10066177 +com.topcoder.client.contestApplet.common.LocalPreferences.summarycsharpchlfailed.bold=false +com.topcoder.client.contestApplet.common.LocalPreferences.summarycsharpchlfailed.italic=false +com.topcoder.client.contestApplet.common.LocalPreferences.summarycsharpsyspassed.color=-10066177 +com.topcoder.client.contestApplet.common.LocalPreferences.summarycsharpsyspassed.bold=true +com.topcoder.client.contestApplet.common.LocalPreferences.summarycsharpsyspassed.italic=true +com.topcoder.client.contestApplet.common.LocalPreferences.summarycsharpsysfailed.color=-65485 +com.topcoder.client.contestApplet.common.LocalPreferences.summarycsharpsysfailed.bold=false +com.topcoder.client.contestApplet.common.LocalPreferences.summarycsharpsysfailed.italic=true +com.topcoder.client.contestApplet.common.LocalPreferences.summaryvbpoints.color=-8267265 +com.topcoder.client.contestApplet.common.LocalPreferences.summaryvbpoints.bold=false +com.topcoder.client.contestApplet.common.LocalPreferences.summaryvbpoints.italic=false +com.topcoder.client.contestApplet.common.LocalPreferences.summaryvbchlpassed.color=-8267265 +com.topcoder.client.contestApplet.common.LocalPreferences.summaryvbchlpassed.bold=true +com.topcoder.client.contestApplet.common.LocalPreferences.summaryvbchlpassed.italic=true +com.topcoder.client.contestApplet.common.LocalPreferences.summaryvbchlfailed.color=-8267265 +com.topcoder.client.contestApplet.common.LocalPreferences.summaryvbchlfailed.bold=false +com.topcoder.client.contestApplet.common.LocalPreferences.summaryvbchlfailed.italic=false +com.topcoder.client.contestApplet.common.LocalPreferences.summaryvbsyspassed.color=-8267265 +com.topcoder.client.contestApplet.common.LocalPreferences.summaryvbsyspassed.bold=true +com.topcoder.client.contestApplet.common.LocalPreferences.summaryvbsyspassed.italic=true +com.topcoder.client.contestApplet.common.LocalPreferences.summaryvbsysfailed.color=-65485 +com.topcoder.client.contestApplet.common.LocalPreferences.summaryvbsysfailed.bold=false +com.topcoder.client.contestApplet.common.LocalPreferences.summaryvbsysfailed.italic=true +com.topcoder.client.contestApplet.common.LocalPreferences.summarypythonpoints.color=-39169 +com.topcoder.client.contestApplet.common.LocalPreferences.summarypythonpoints.bold=false +com.topcoder.client.contestApplet.common.LocalPreferences.summarypythonpoints.italic=false +com.topcoder.client.contestApplet.common.LocalPreferences.summarypythonchlpassed.color=-39169 +com.topcoder.client.contestApplet.common.LocalPreferences.summarypythonchlpassed.bold=true +com.topcoder.client.contestApplet.common.LocalPreferences.summarypythonchlpassed.italic=true +com.topcoder.client.contestApplet.common.LocalPreferences.summarypythonchlfailed.color=-39169 +com.topcoder.client.contestApplet.common.LocalPreferences.summarypythonchlfailed.bold=false +com.topcoder.client.contestApplet.common.LocalPreferences.summarypythonchlfailed.italic=false +com.topcoder.client.contestApplet.common.LocalPreferences.summarypythonsyspassed.color=-39169 +com.topcoder.client.contestApplet.common.LocalPreferences.summarypythonsyspassed.bold=true +com.topcoder.client.contestApplet.common.LocalPreferences.summarypythonsyspassed.italic=true +com.topcoder.client.contestApplet.common.LocalPreferences.summarypythonsysfailed.color=-65485 +com.topcoder.client.contestApplet.common.LocalPreferences.summarypythonsysfailed.bold=false +com.topcoder.client.contestApplet.common.LocalPreferences.summarypythonsysfailed.italic=true +com.topcoder.client.contestApplet.common.LocalPreferences.usertablefont=Arial +com.topcoder.client.contestApplet.common.LocalPreferences.usertablefontsize=12 +com.topcoder.client.contestApplet.common.LocalPreferences.summaryfont=Arial +com.topcoder.client.contestApplet.common.LocalPreferences.summaryfontsize=12 +com.topcoder.client.contestApplet.common.LocalPreferences.edstdsyntaxcommentsstyle=0 +com.topcoder.client.contestApplet.common.LocalPreferences.edstdsyntaxliteralsstyle=0 +com.topcoder.client.contestApplet.common.LocalPreferences.edstdsyntaxkeywordsstyle=0 +com.topcoder.client.contestApplet.common.LocalPreferences.edstdsyntaxdefaultstyle=0 +com.topcoder.client.contestApplet.common.LocalPreferences.chalsrcsyntaxhighlight=true +com.topcoder.client.contestApplet.common.LocalPlight=true +com.topcoder.client.contestApplet.LocalPreferences.connectionType=DIRECT +com.topcoder.client.contestApplet.panels.ChatPanel.generalback=-16777216 +com.topcoder.client.contestApplet.panels.ChatPanel.whispertoback=-65536 +com.topcoder.client.contestApplet.panels.ChatPanel.meback=-16777216 +com.topcoder.client.contestApplet.panels.ChatPanel.systemfore=-16711936 +com.topcoder.client.contestApplet.panels.ChatPanel.whisperback=-16777216 +com.topcoder.client.contestApplet.panels.ChatPanel.whispertofore=-6710887 +com.topcoder.client.contestApplet.panels.ChatPanel.whisperfore=-6710887 +com.topcoder.client.contestApplet.panels.ChatPanel.generaltoback=-65536 +com.topcoder.client.contestApplet.panels.ChatPanel.emphsystemfore=-16711936 +com.topcoder.client.contestApplet.panels.ChatPanel.emphsystemback=-16777216 +com.topcoder.client.contestApplet.panels.ChatPanel.systemback=-16777216 +com.topcoder.client.contestApplet.panels.ChatPanel.generaltofore=-1 +com.topcoder.client.contestApplet.panels.ChatPanel.handleback=-16777216 +com.topcoder.client.contestApplet.panels.ChatPanel.mefore=-6710887 +com.topcoder.client.contestApplet.panels.ChatPanel.generalfore=-1 +com.topcoder.client.contentApplet.panels.ChatPanel.moderatedChatQuestionFore=-16711936 +com.topcoder.client.contentApplet.panels.ChatPanel.moderatedChatSpeakerFore=-1 +com.topcoder.client.contentApplet.panels.ChatPanel.moderatedChatSpeakerBack=-16777216 +com.topcoder.client.contentApplet.panels.ChatPanel.moderatedChatQuestionBack=-16777216 +com.topcoder.jmaContestApplet.frames.codingframe.location=0\:0 +com.topcoder.jmaContestApplet.frames.codingframe.size=1024\:746 +com.topcoder.jmaContestApplet.frames.codingframe.dividerloc=319 +com.topcoder.jmaContesntApplet.ContestApplet.enableTimestamps=true +fileeditor.config.dirName= +fileeditor.config.fileName=Program +fileeditor.config.beginCut=//\ BEGIN\ CUT\ HERE +fileeditor.config.endCut=//\ END\ CUT\ HERE +fileeditor.config.probdescfileextnsion=txignaturefilename\= +fileeditor.config.lineComments=true +fileeditor.config.overrideFileName=true +fileeditor.config.provideBreaks=false +fileeditor.config.probdescfilewrite=false +fileeditor.config.breakAt=60 +fileeditor.config.htmldesc=false +fileeditor.config.backup=true +fileeditor.config.javatemplate= +fileeditor.config.cpptemplate= +fileeditor.config.csharptemplate= +fileeditor.config.javaextension=java +fileeditor.config.cppextension=cpp +fileeditor.config.csharpextension=cs +editor.defaultname=ExampleBuilder +editor.1.name=ExampleBuilder +editor.1.entrypoint=codeprocessor.EntryPoint +editor.1.classpath= +editor.1.eager=1 +editor.numplugins=1 +editor.2.name=ExampleBuilder +editor.2.entrypoint=codeprocessor.EntryPoint +editor.2.classpath= +editor.2.eager=1 +codeprocessor.config.pluginentrypoint=fileedit.EntryPoint +codeprocessor.ExampleBuildercodeprocessor.config.pluginentrypoint=fileedit.EntryPoint +codeprocessor.ExampleBuildercodeprocessor.config.codeprocessor#0=tc_plugin.ExampleBuilder +codeprocessor.ExampleBuildercodeprocessor.config.numofcodeprocessors=1 Deleted: configs/trunk/src/topcoder/contestapplet.conf.template =================================================================== --- configs/trunk/src/topcoder/contestapplet.conf.template 2008-05-14 22:55:53 UTC (rev 816) +++ configs/trunk/src/topcoder/contestapplet.conf.template 2008-05-14 22:56:35 UTC (rev 817) @@ -1,199 +0,0 @@ -#TopCoder ContestApplet Preferences File -#Thu Sep 13 01:33:13 EDT 2007 -com.topcoder.client.contestApplet.common.LocalPreferences.menufont=Arial -com.topcoder.client.contestApplet.common.LocalPreferences.menufontsize=10 -com.topcoder.client.contestApplet.common.LocalPreferences.commonclasspath= -com.topcoder.client.contestApplet.common.LocalPreferences.chatpanelback=-16777216 -com.topcoder.client.contestApplet.common.LocalPreferences.chatfindhighlight=-8355712 -com.topcoder.client.contestApplet.common.LocalPreferences.chatfindback=-16776961 -com.topcoder.client.contestApplet.common.LocalPreferences.chatfont=Monospaced -com.topcoder.client.contestApplet.common.LocalPreferences.chatfontsize=12 -com.topcoder.client.contestApplet.common.LocalPreferences.keysubmit=Alt+U -com.topcoder.client.contestApplet.common.LocalPreferences.edstdkeyfind=Alt+F -com.topcoder.client.contestApplet.common.LocalPreferences.keycompile=Alt+C -com.topcoder.client.contestApplet.common.LocalPreferences.edstdkeyredo=Ctrl+Y -com.topcoder.client.contestApplet.common.LocalPreferences.edstdkeyundo=Ctrl+Z -com.topcoder.client.contestApplet.common.LocalPreferences.edstdkeygoto=Alt+G -com.topcoder.client.contestApplet.common.LocalPreferences.keytest=Alt+T -com.topcoder.client.contestApplet.common.LocalPreferences.keysave=Alt+S -com.topcoder.client.contestApplet.common.LocalPreferences.edstdselb=-16751104 -com.topcoder.client.contestApplet.common.LocalPreferences.edstdselt=-1 -com.topcoder.client.contestApplet.common.LocalPreferences.edstdsyntaxkeywords=-6710785 -com.topcoder.client.contestApplet.common.LocalPreferences.edstdsyntaxliterals=-65281 -com.topcoder.client.contestApplet.common.LocalPreferences.edstdback=-16777216 -com.topcoder.client.contestApplet.common.LocalPreferences.edstdsyntaxcomments=-16724992 -com.topcoder.client.contestApplet.common.LocalPreferences.edstdsyntaxdefault=-1 -com.topcoder.client.contestApplet.common.LocalPreferences.edstdfore=-1 -com.topcoder.client.contestApplet.common.LocalPreferences.edstdfont=Monospaced -com.topcoder.client.contestApplet.common.LocalPreferences.edstdfontsize=12 -com.topcoder.client.contestApplet.common.LocalPreferences.edstdtabsize=4 -com.topcoder.client.contestApplet.common.LocalPreferences.problemback=-16777216 -com.topcoder.client.contestApplet.common.LocalPreferences.problemfore=-1 -com.topcoder.client.contestApplet.common.LocalPreferences.messagefore=-1 -com.topcoder.client.contestApplet.common.LocalPreferences.messageback=-16777216 -com.topcoder.client.contestApplet.common.LocalPreferences.problemfont=Monospaced -com.topcoder.client.contestApplet.common.LocalPreferences.problemfontsize=12 -com.topcoder.client.contestApplet.common.LocalPreferences.problemfixedfont=Monospaced -com.topcoder.client.contestApplet.common.LocalPreferences.problemfixedfontsize=12 -com.topcoder.client.contestApplet.common.LocalPreferences.messagefont=Monospaced -com.topcoder.client.contestApplet.common.LocalPreferences.messagefontsize=12 -com.topcoder.client.contestApplet.common.LocalPreferences.chalsrcback=-16777216 -com.topcoder.client.contestApplet.common.LocalPreferences.chalprobback=-16777216 -com.topcoder.client.contestApplet.common.LocalPreferences.chalsrcfore=-1 -com.topcoder.client.contestApplet.common.LocalPreferences.chalprobfore=-1 -com.topcoder.client.contestApplet.common.LocalPreferences.chalprobfont=Monospaced -com.topcoder.client.contestApplet.common.LocalPreferences.chalprobontsize=12 -com.topcoder.client.contestApplet.common.LocalPreferences.chalprobfixedfont=Monospaced -com.topcoder.client.contestApplet.common.LocalPreferences.chalprobfixedfontsize=12 -com.topcoder.client.contestApplet.common.LocalPreferences.chalsrcfont=Monospaced -com.topcoder.client.contestApplet.common.LocalPreferences.chalsrcfontsize=12 -com.topcoder.client.contestApplet.common.LocalPreferences.summaryunopened.color=-1 -com.topcoder.client.contestApplet.common.LocalPreferences.summaryunopened.bold=false -com.topcoder.client.contestApplet.common.LocalPreferences.summaryunopened.italic=false -com.topcoder.client.contestApplet.common.LocalPreferences.summaryopened.color=-1 -com.topcoder.client.contestApplet.common.LocalPreferences.summaryopened.bold=false -com.topcoder.client.contestApplet.common.LocalPreferences.summaryopened.italic=false -com.topcoder.client.contestApplet.common.LocalPreferences.summarycompiled.color=-1 -com.topcoder.client.contestApplet.common.LocalPreferences.summarycompiled.bold=false -com.topcoder.client.contestApplet.common.LocalPreferences.summarycompiled.italic=false -com.topcoder.client.contestApplet.common.LocalPreferences.summaryjavapoints.color=-16711936 -com.topcoder.client.contestApplet.common.LocalPreferences.summaryjavapoints.bold=false -com.topcoder.client.contestApplet.common.LocalPreferences.summaryjavapoints.italic=false -com.topcoder.client.contestApplet.common.LocalPreferences.summaryjavachlpassed.color=-16711936 -com.topcoder.client.contestApplet.common.LocalPreferences.summaryjavachlpassed.bold=true -com.topcoder.client.contestApplet.common.LocalPreferences.summaryjavachlpassed.italic=true -com.topcoder.client.contestApplet.common.LocalPreferences.summaryjavachlfailed.color=-16711936 -com.topcoder.client.contestApplet.common.LocalPreferences.summaryjavachlfailed.bold=false -com.topcoder.client.contestApplet.common.LocalPreferences.summaryjavachlfailed.italic=false -com.topcoder.client.contestApplet.common.LocalPreferences.summaryjavasyspassed.color=-16711936 -com.topcoder.client.contestApplet.common.LocalPreferences.summaryjavasyspassed.bold=true -com.topcoder.client.contestApplet.common.LocalPreferences.summaryjavasyspassed.italic=true -com.topcoder.client.contestApplet.common.LocalPreferences.summaryjavasysfailed.color=-65485 -com.topcoder.client.contestApplet.common.LocalPreferences.summaryjavasysfailed.bold=false -com.topcoder.client.contestApplet.common.LocalPreferences.summaryjavasysfailed.italic=true -com.topcoder.client.contestApplet.common.LocalPreferences.summarycpppoints.color=-103 -com.topcoder.client.contestApplet.common.LocalPreferences.summarycpppoints.bold=false -com.topcoder.client.contestApplet.common.LocalPreferences.summarycpppoints.italic=false -com.topcoder.client.contestApplet.common.LocalPreferences.summarycppchlpassed.color=-103 -com.topcoder.client.contestApplet.common.LocalPreferences.summarycppchlpassed.bold=true -com.topcoder.client.contestApplet.common.LocalPreferences.summarycppchlpassed.italic=true -com.topcoder.client.contestApplet.common.LocalPreferences.summarycppchlfailed.color=-103 -com.topcoder.client.contestApplet.common.LocalPreferences.summarycppchlfailed.bold=false -com.topcoder.client.contestApplet.common.LocalPreferences.summarycppchlfailed.italic=false -com.topcoder.client.contestApplet.common.LocalPreferences.summarycppsyspassed.color=-103 -com.topcoder.client.contestApplet.common.LocalPreferences.summarycppsyspassed.bold=true -com.topcoder.client.contestApplet.common.LocalPreferences.summarycppsyspassed.italic=true -com.topcoder.client.contestApplet.common.LocalPreferences.summarycppsysfailed.color=-65485 -com.topcoder.client.contestApplet.common.LocalPreferences.summarycppsysfailed.bold=false -com.topcoder.client.contestApplet.common.LocalPreferences.summarycppsysfailed.italic=true -com.topcoder.client.contestApplet.common.LocalPreferences.summarycsharppoints.color=-10066177 -com.topcoder.client.contestApplet.common.LocalPreferences.summarycsharppoints.bold=false -com.topcoder.client.contestApplet.common.LocalPreferences.summarycsharppoints.italic=false -com.topcoder.client.contestApplet.common.LocalPreferences.summarycsharpchlpassed.color=-10066177 -com.topcoder.client.contestApplet.common.LocalPreferences.summarycsharpchlpassed.bold=true -com.topcoder.client.contestApplet.common.LocalPreferences.summarycsharpchlpassed.italic=true -com.topcoder.client.contestApplet.common.LocalPreferences.summarycsharpchlfailed.color=-10066177 -com.topcoder.client.contestApplet.common.LocalPreferences.summarycsharpchlfailed.bold=false -com.topcoder.client.contestApplet.common.LocalPreferences.summarycsharpchlfailed.italic=false -com.topcoder.client.contestApplet.common.LocalPreferences.summarycsharpsyspassed.color=-10066177 -com.topcoder.client.contestApplet.common.LocalPreferences.summarycsharpsyspassed.bold=true -com.topcoder.client.contestApplet.common.LocalPreferences.summarycsharpsyspassed.italic=true -com.topcoder.client.contestApplet.common.LocalPreferences.summarycsharpsysfailed.color=-65485 -com.topcoder.client.contestApplet.common.LocalPreferences.summarycsharpsysfailed.bold=false -com.topcoder.client.contestApplet.common.LocalPreferences.summarycsharpsysfailed.italic=true -com.topcoder.client.contestApplet.common.LocalPreferences.summaryvbpoints.color=-8267265 -com.topcoder.client.contestApplet.common.LocalPreferences.summaryvbpoints.bold=false -com.topcoder.client.contestApplet.common.LocalPreferences.summaryvbpoints.italic=false -com.topcoder.client.contestApplet.common.LocalPreferences.summaryvbchlpassed.color=-8267265 -com.topcoder.client.contestApplet.common.LocalPreferences.summaryvbchlpassed.bold=true -com.topcoder.client.contestApplet.common.LocalPreferences.summaryvbchlpassed.italic=true -com.topcoder.client.contestApplet.common.LocalPreferences.summaryvbchlfailed.color=-8267265 -com.topcoder.client.contestApplet.common.LocalPreferences.summaryvbchlfailed.bold=false -com.topcoder.client.contestApplet.common.LocalPreferences.summaryvbchlfailed.italic=false -com.topcoder.client.contestApplet.common.LocalPreferences.summaryvbsyspassed.color=-8267265 -com.topcoder.client.contestApplet.common.LocalPreferences.summaryvbsyspassed.bold=true -com.topcoder.client.contestApplet.common.LocalPreferences.summaryvbsyspassed.italic=true -com.topcoder.client.contestApplet.common.LocalPreferences.summaryvbsysfailed.color=-65485 -com.topcoder.client.contestApplet.common.LocalPreferences.summaryvbsysfailed.bold=false -com.topcoder.client.contestApplet.common.LocalPreferences.summaryvbsysfailed.italic=true -com.topcoder.client.contestApplet.common.LocalPreferences.summarypythonpoints.color=-39169 -com.topcoder.client.contestApplet.common.LocalPreferences.summarypythonpoints.bold=false -com.topcoder.client.contestApplet.common.LocalPreferences.summarypythonpoints.italic=false -com.topcoder.client.contestApplet.common.LocalPreferences.summarypythonchlpassed.color=-39169 -com.topcoder.client.contestApplet.common.LocalPreferences.summarypythonchlpassed.bold=true -com.topcoder.client.contestApplet.common.LocalPreferences.summarypythonchlpassed.italic=true -com.topcoder.client.contestApplet.common.LocalPreferences.summarypythonchlfailed.color=-39169 -com.topcoder.client.contestApplet.common.LocalPreferences.summarypythonchlfailed.bold=false -com.topcoder.client.contestApplet.common.LocalPreferences.summarypythonchlfailed.italic=false -com.topcoder.client.contestApplet.common.LocalPreferences.summarypythonsyspassed.color=-39169 -com.topcoder.client.contestApplet.common.LocalPreferences.summarypythonsyspassed.bold=true -com.topcoder.client.contestApplet.common.LocalPreferences.summarypythonsyspassed.italic=true -com.topcoder.client.contestApplet.common.LocalPreferences.summarypythonsysfailed.color=-65485 -com.topcoder.client.contestApplet.common.LocalPreferences.summarypythonsysfailed.bold=false -com.topcoder.client.contestApplet.common.LocalPreferences.summarypythonsysfailed.italic=true -com.topcoder.client.contestApplet.common.LocalPreferences.usertablefont=Arial -com.topcoder.client.contestApplet.common.LocalPreferences.usertablefontsize=12 -com.topcoder.client.contestApplet.common.LocalPreferences.summaryfont=Arial -com.topcoder.client.contestApplet.common.LocalPreferences.summaryfontsize=12 -com.topcoder.client.contestApplet.common.LocalPreferences.edstdsyntaxcommentsstyle=0 -com.topcoder.client.contestApplet.common.LocalPreferences.edstdsyntaxliteralsstyle=0 -com.topcoder.client.contestApplet.common.LocalPreferences.edstdsyntaxkeywordsstyle=0 -com.topcoder.client.contestApplet.common.LocalPreferences.edstdsyntaxdefaultstyle=0 -com.topcoder.client.contestApplet.common.LocalPreferences.chalsrcsyntaxhighlight=true -com.topcoder.client.contestApplet.common.LocalPlight=true -com.topcoder.client.contestApplet.LocalPreferences.connectionType=DIRECT -com.topcoder.client.contestApplet.panels.ChatPanel.generalback=-16777216 -com.topcoder.client.contestApplet.panels.ChatPanel.whispertoback=-65536 -com.topcoder.client.contestApplet.panels.ChatPanel.meback=-16777216 -com.topcoder.client.contestApplet.panels.ChatPanel.systemfore=-16711936 -com.topcoder.client.contestApplet.panels.ChatPanel.whisperback=-16777216 -com.topcoder.client.contestApplet.panels.ChatPanel.whispertofore=-6710887 -com.topcoder.client.contestApplet.panels.ChatPanel.whisperfore=-6710887 -com.topcoder.client.contestApplet.panels.ChatPanel.generaltoback=-65536 -com.topcoder.client.contestApplet.panels.ChatPanel.emphsystemfore=-16711936 -com.topcoder.client.contestApplet.panels.ChatPanel.emphsystemback=-16777216 -com.topcoder.client.contestApplet.panels.ChatPanel.systemback=-16777216 -com.topcoder.client.contestApplet.panels.ChatPanel.generaltofore=-1 -com.topcoder.client.contestApplet.panels.ChatPanel.handleback=-16777216 -com.topcoder.client.contestApplet.panels.ChatPanel.mefore=-6710887 -com.topcoder.client.contestApplet.panels.ChatPanel.generalfore=-1 -com.topcoder.client.contentApplet.panels.ChatPanel.moderatedChatQuestionFore=-16711936 -com.topcoder.client.contentApplet.panels.ChatPanel.moderatedChatSpeakerFore=-1 -com.topcoder.client.contentApplet.panels.ChatPanel.moderatedChatSpeakerBack=-16777216 -com.topcoder.client.contentApplet.panels.ChatPanel.moderatedChatQuestionBack=-16777216 -com.topcoder.jmaContestApplet.frames.codingframe.location=0\:0 -com.topcoder.jmaContestApplet.frames.codingframe.size=1024\:746 -com.topcoder.jmaContestApplet.frames.codingframe.dividerloc=319 -com.topcoder.jmaContesntApplet.ContestApplet.enableTimestamps=true -fileeditor.config.dirName= -fileeditor.config.fileName=Program -fileeditor.config.beginCut=//\ BEGIN\ CUT\ HERE -fileeditor.config.endCut=//\ END\ CUT\ HERE -fileeditor.config.probdescfileextnsion=txignaturefilename\= -fileeditor.config.lineComments=true -fileeditor.config.overrideFileName=true -fileeditor.config.provideBreaks=false -fileeditor.config.probdescfilewrite=false -fileeditor.config.breakAt=60 -fileeditor.config.htmldesc=false -fileeditor.config.backup=true -fileeditor.config.javatemplate= -fileeditor.config.cpptemplate= -fileeditor.config.csharptemplate= -fileeditor.config.javaextension=java -fileeditor.config.cppextension=cpp -fileeditor.config.csharpextension=cs -editor.defaultname=ExampleBuilder -editor.1.name=ExampleBuilder -editor.1.entrypoint=codeprocessor.EntryPoint -editor.1.classpath= -editor.1.eager=1 -editor.numplugins=1 -editor.2.name=ExampleBuilder -editor.2.entrypoint=codeprocessor.EntryPoint -editor.2.classpath= -editor.2.eager=1 -codeprocessor.config.pluginentrypoint=fileedit.EntryPoint -codeprocessor.ExampleBuildercodeprocessor.config.pluginentrypoint=fileedit.EntryPoint -codeprocessor.ExampleBuildercodeprocessor.config.codeprocessor#0=tc_plugin.ExampleBuilder -codeprocessor.ExampleBuildercodeprocessor.config.numofcodeprocessors=1 Modified: configs/trunk/src/topcoder/setup.py =================================================================== --- configs/trunk/src/topcoder/setup.py 2008-05-14 22:55:53 UTC (rev 816) +++ configs/trunk/src/topcoder/setup.py 2008-05-14 22:56:35 UTC (rev 817) @@ -55,9 +55,3 @@ # Generate the final configuration file from the template. call( [ 'scala', '-classpath', 'bin', 'TopCoderSetup', 'load', pathsep.join(paths), userdir ] ) -#with file( 'contestapplet.conf.template' ) as template: -# contents = template.read() -#contents = sub( '`CLASSPATH`', esc( pathsep.join( paths ) ), contents ) -#contents = sub( '`USERDIR`', esc( userdir ), contents ) -#with file( homedir + 'contestapplet.conf', 'w' ) as output: -# output.write( contents ) Modified: configs/trunk/src/topcoder/setup.scala =================================================================== --- configs/trunk/src/topcoder/setup.scala 2008-05-14 22:55:53 UTC (rev 816) +++ configs/trunk/src/topcoder/setup.scala 2008-05-14 22:56:35 UTC (rev 817) @@ -8,7 +8,7 @@ def main(args: Array[String]) { val cmd = args(0) val homedir = System getenv "HOME" - val srcconf = "contestapplet.conf.template" + val srcconf = "contestapplet.conf" val dstconf = homedir / "contestapplet.conf" // List of language names (identifying the properties) and their source // file extensions. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-05-14 22:55:47
|
Revision: 816 http://assorted.svn.sourceforge.net/assorted/?rev=816&view=rev Author: yangzhang Date: 2008-05-14 15:55:53 -0700 (Wed, 14 May 2008) Log Message: ----------- added simple-build Added Paths: ----------- configs/trunk/src/topcoder/build Added: configs/trunk/src/topcoder/build =================================================================== --- configs/trunk/src/topcoder/build (rev 0) +++ configs/trunk/src/topcoder/build 2008-05-14 22:55:53 UTC (rev 816) @@ -0,0 +1,2 @@ +topcodersetup: + srcs: [setup.scala] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-05-14 22:55:37
|
Revision: 815 http://assorted.svn.sourceforge.net/assorted/?rev=815&view=rev Author: yangzhang Date: 2008-05-14 15:55:40 -0700 (Wed, 14 May 2008) Log Message: ----------- added proper properties-file manipulation; allowed me to separate out the language template files Modified Paths: -------------- configs/trunk/src/topcoder/contestapplet.conf.template configs/trunk/src/topcoder/setup.py Added Paths: ----------- configs/trunk/src/topcoder/setup.scala configs/trunk/src/topcoder/template.cpp configs/trunk/src/topcoder/template.cs configs/trunk/src/topcoder/template.java Modified: configs/trunk/src/topcoder/contestapplet.conf.template =================================================================== --- configs/trunk/src/topcoder/contestapplet.conf.template 2008-05-14 18:00:58 UTC (rev 814) +++ configs/trunk/src/topcoder/contestapplet.conf.template 2008-05-14 22:55:40 UTC (rev 815) @@ -2,7 +2,7 @@ #Thu Sep 13 01:33:13 EDT 2007 com.topcoder.client.contestApplet.common.LocalPreferences.menufont=Arial com.topcoder.client.contestApplet.common.LocalPreferences.menufontsize=10 -com.topcoder.client.contestApplet.common.LocalPreferences.commonclasspath=`CLASSPATH` +com.topcoder.client.contestApplet.common.LocalPreferences.commonclasspath= com.topcoder.client.contestApplet.common.LocalPreferences.chatpanelback=-16777216 com.topcoder.client.contestApplet.common.LocalPreferences.chatfindhighlight=-8355712 com.topcoder.client.contestApplet.common.LocalPreferences.chatfindback=-16776961 @@ -139,8 +139,8 @@ com.topcoder.client.contestApplet.common.LocalPreferences.edstdsyntaxliteralsstyle=0 com.topcoder.client.contestApplet.common.LocalPreferences.edstdsyntaxkeywordsstyle=0 com.topcoder.client.contestApplet.common.LocalPreferences.edstdsyntaxdefaultstyle=0 +com.topcoder.client.contestApplet.common.LocalPreferences.chalsrcsyntaxhighlight=true com.topcoder.client.contestApplet.common.LocalPlight=true -com.topcoder.client.contestApplet.common.LocalPreferences.chalsrcsyntaxhighlight=true com.topcoder.client.contestApplet.LocalPreferences.connectionType=DIRECT com.topcoder.client.contestApplet.panels.ChatPanel.generalback=-16777216 com.topcoder.client.contestApplet.panels.ChatPanel.whispertoback=-65536 @@ -165,11 +165,11 @@ com.topcoder.jmaContestApplet.frames.codingframe.size=1024\:746 com.topcoder.jmaContestApplet.frames.codingframe.dividerloc=319 com.topcoder.jmaContesntApplet.ContestApplet.enableTimestamps=true -fileeditor.config.dirName=`USERDIR` +fileeditor.config.dirName= fileeditor.config.fileName=Program -fileeditor.config.beginCut=// BEGIN CUT HERE -fileeditor.config.endCut=// END CUT HERE -fileeditor.config.probdescfileextnsion=txignaturefilename= +fileeditor.config.beginCut=//\ BEGIN\ CUT\ HERE +fileeditor.config.endCut=//\ END\ CUT\ HERE +fileeditor.config.probdescfileextnsion=txignaturefilename\= fileeditor.config.lineComments=true fileeditor.config.overrideFileName=true fileeditor.config.provideBreaks=false @@ -177,9 +177,9 @@ fileeditor.config.breakAt=60 fileeditor.config.htmldesc=false fileeditor.config.backup=true -fileeditor.config.javatemplate=$BEGINCUT$\n$PROBLEMDESC$\n$ENDCUT$\nimport java.util.*;\npublic class $CLASSNAME$ {\n\tpublic $RC$ $METHODNAME$($METHODPARMS$) {\n\t\t\n\t}\n\tpublic static void main(String[] args) {\n\t\t$CLASSNAME$ temp \= new $CLASSNAME$();\n\t\tSystem.out.println(temp.$METHODNAME$($METHODPARMS$));\n\t}\n} -fileeditor.config.cpptemplate=// vim\:et\:sw\=2\:ts\=2\n\n$BEGINCUT$\n\#if 0\n$PROBLEMDESC$\n\#endif\n$ENDCUT$\n\n\n\n\n\n\n\n//\#line $NEXTLINENUMBER$ "$FILENAME$"\n\#include <algorithm>\n\#include <cassert>\n\#include <cctype>\n\#include <cmath>\n\#include <cstdio>\n\#include <cstdlib>\n\#include <deque>\n\#include <iostream>\n\#include <map>\n\#include <queue>\n\#include <set>\n\#include <sstream>\n\#include <stack>\n\#include <string>\n\#include <vector>\nusing namespace std;\n\n\#define ARRSIZE(x) (sizeof(x)/sizeof(x[0]))\n\n\n\n\n\n\n\n$BEGINCUT$\ntemplate<typename T> void print( T a ) {\n\tcerr << a;\n}\nstatic void print( long long a ) {\n\tcerr << a << "L";\n}\nstatic void print( string a ) {\n\tcerr << '"' << a << '"';\n}\ntemplate<typename T> void print( vector<T> a ) {\n\tcerr << "{";\n\tfor ( int i \= 0 ; i \!\= a.size() ; i++ ) {\n\t\tif ( i \!\= 0 ) cerr << ", ";\n\t\tprint( a[i] );\n\t}\n\tcerr << "}" << endl;\n}\ntemplate<typename T> void eq( int n, T have, T need ) {\n\tif ( have \=\= need ) {\n\t\tcerr << "Case " << n << " passed." << endl;\n\t} else {\n\t\tcerr << "Case " << n << " failed\: expected ";\n\t\tprint( need );\n\t\tcerr << " received ";\n\t\tprint( have );\n\t\tcerr << "." << endl;\n\t}\n}\ntemplate<typename T> void eq( int n, vector<T> have, vector<T> need ) {\n\tif( have.size() \!\= need.size() ) {\n\t\tcerr << "Case " << n << " failed\: returned " << have.size() << " elements; expected " << need.size() << " elements." << endl;\n\t\tcerr << " have\: "; print( have );\n\t\tcerr << " need\: "; print( need );\n\t\treturn;\n\t}\n\tfor( size_t i\= 0; i < have.size(); i++ ) {\n\t\tif( have[i] \!\= need[i] ) {\n\t\t\tcerr << "Case " << n << " failed. Expected and returned array differ in position " << i << "." << endl;\n\t\t\tcerr << " have\: "; print( have );\n\t\t\tcerr << " need\: "; print( need );\n\t\t\treturn;\n\t\t}\n\t}\n\tcerr << "Case " << n << " passed." << endl;\n}\nstatic void eq( int n, string have, string need ) {\n\tif ( have \=\= need ) {\n\t\tcerr << "Case " << n << " passed." << endl;\n\t} else {\n\t\tcerr << "Case " << n << " failed\: expected ";\n\t\tprint( need );\n\t\tcerr << " received ";\n\t\tprint( have );\n\t\tcerr << "." << endl;\n\t}\n}\n$ENDCUT$\n\n\n\n\n\n\n\n$BEGINCUT$\n\#if 0\ntemplate<typename T> void pp(const T & xs) {\n\tfor (typename T\:\:const_iterator it \= xs.begin();\n\t\tit \!\= xs.end();\n\t\tit++)\n\t\tcout << *it << " ";\n\tcout << endl;\n}\n\nvector<string> split( const string& s, const string& delim \=" " ) {\n\tvector<string> res;\n\tstring t;\n\tfor ( int i \= 0 ; i \!\= s.size() ; i++ ) {\n\t\tif ( delim.find( s[i] ) \!\= string\:\:npos ) {\n\t\t\tif ( \!t.empty() ) {\n\t\t\t\tres.push_back( t );\n\t\t\t\tt \= "";\n\t\t\t}\n\t\t} else {\n\t\t\tt +\= s[i];\n\t\t}\n\t}\n\tif ( \!t.empty() ) {\n\t\tres.push_back(t);\n\t}\n\treturn res;\n}\n\nvector<int> splitInt( const string& s, const string& delim \=" " ) {\n\tvector<string> tok \= split( s, delim );\n\tvector<int> res;\n\tfor ( int i \= 0 ; i \!\= tok.size(); i++ )\n\t\tres.push_back( atoi( tok[i].c_str() ) );\n\treturn res;\n}\n\#endif\n$ENDCUT$\n\n\n\n\n\n\n\nclass $CLASSNAME$ {\n\tpublic\:\n\t$RC$ $METHODNAME$($METHODPARMS$) {\n\t\t$RC$ res;\n\t\treturn res;\n\t}\n};\n\n\n\n\n\n\n\n$BEGINCUT$\nint main() {\n$MAINBODY$\n\tcin.get();\n\treturn 0;\n}\n$ENDCUT$\n -fileeditor.config.csharptemplate=using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\npublic class $CLASSNAME$ {\n\tpublic $RC$ $METHODNAME$($METHODPARMS$) {\n\t}\n\n\n\n\n\n\n\tpublic void pp<T>(T x) { Console.WriteLine(x); }\n\n\n\n\n\n\n\n\n\t$BEGINCUT$\n\tpublic static void Main(string[] args) {\n\t\t$MAINBODY$\n\t\tConsole.WriteLine("done\!");\n\t\tConsole.Read();\n\t}\n private static void eq( int n, object have, object need) {\n if( eq( have, need ) ) {\n Console.WriteLine( "Case "+n+" passed." );\n } else {\n Console.Write( "Case "+n+" failed\: expected " );\n print( need );\n Console.Write( ", received " );\n print( have );\n Console.WriteLine();\n }\n }\n private static void eq( int n, Array have, Array need) {\n if( have \=\= null || have.Length \!\= need.Length ) {\n Console.WriteLine("Case "+n+" failed\: returned "+have.Length+" elements; expected "+need.Length+" elements.");\n print( have );\n print( need );\n return;\n }\n for( int i\= 0; i < have.Length; i++ ) {\n if( \! eq( have.GetValue(i), need.GetValue(i) ) ) {\n Console.WriteLine( "Case "+n+" failed. Expected and returned array differ in position "+i );\n print( have );\n print( need );\n return;\n }\n }\n Console.WriteLine("Case "+n+" passed.");\n }\n private static bool eq( object a, object b ) {\n if ( a is double && b is double ) {\n return Math.Abs((double)a-(double)b) < 1E-9;\n } else {\n return a\!\=null && b\!\=null && a.Equals(b);\n }\n }\n private static void print( object a ) {\n if ( a is string ) {\n Console.Write("\\"{0}\\"", a);\n } else if ( a is long ) {\n Console.Write("{0}L", a);\n } else {\n Console.Write(a);\n }\n }\n private static void print( Array a ) {\n if ( a \=\= null) {\n Console.WriteLine("<NULL>");\n;\n for ( int i\= 0; i < a.Length; i++ ) {\n print( a.GetValue(i) );\n if( i \!\= a.Length-1 ) {\n Console.Write(", ");\n }\n }\n Console.WriteLine( '}' );\n }\n\t$ENDCUT$\n}\n +fileeditor.config.javatemplate= +fileeditor.config.cpptemplate= +fileeditor.config.csharptemplate= fileeditor.config.javaextension=java fileeditor.config.cppextension=cpp fileeditor.config.csharpextension=cs @@ -194,4 +194,6 @@ editor.2.classpath= editor.2.eager=1 codeprocessor.config.pluginentrypoint=fileedit.EntryPoint -codeprocessor.config.codeprocessor=tc_plugin.ExampleBuilder +codeprocessor.ExampleBuildercodeprocessor.config.pluginentrypoint=fileedit.EntryPoint +codeprocessor.ExampleBuildercodeprocessor.config.codeprocessor#0=tc_plugin.ExampleBuilder +codeprocessor.ExampleBuildercodeprocessor.config.numofcodeprocessors=1 Modified: configs/trunk/src/topcoder/setup.py =================================================================== --- configs/trunk/src/topcoder/setup.py 2008-05-14 18:00:58 UTC (rev 814) +++ configs/trunk/src/topcoder/setup.py 2008-05-14 22:55:40 UTC (rev 815) @@ -11,12 +11,12 @@ """ from __future__ import with_statement -from contextlib import * -from os import * -from os.path import * -from re import * -from sys import * -from urllib import * +from os import environ, makedirs +from os.path import basename, exists, pathsep, sep +from re import sub +from subprocess import call +from sys import argv, platform +from urllib import urlretrieve # Utilities. def esc( s ): return sub( r'([\\:])', r'\\\1', s ) @@ -53,9 +53,11 @@ urlretrieve(url, path) # Generate the final configuration file from the template. -with file( 'contestapplet.conf.template' ) as template: - contents = template.read() -contents = sub( '`CLASSPATH`', esc( pathsep.join( paths ) ), contents ) -contents = sub( '`USERDIR`', esc( userdir ), contents ) -with file( homedir + 'contestapplet.conf', 'w' ) as output: - output.write( contents ) +call( [ 'scala', '-classpath', 'bin', 'TopCoderSetup', 'load', + pathsep.join(paths), userdir ] ) +#with file( 'contestapplet.conf.template' ) as template: +# contents = template.read() +#contents = sub( '`CLASSPATH`', esc( pathsep.join( paths ) ), contents ) +#contents = sub( '`USERDIR`', esc( userdir ), contents ) +#with file( homedir + 'contestapplet.conf', 'w' ) as output: +# output.write( contents ) Added: configs/trunk/src/topcoder/setup.scala =================================================================== --- configs/trunk/src/topcoder/setup.scala (rev 0) +++ configs/trunk/src/topcoder/setup.scala 2008-05-14 22:55:40 UTC (rev 815) @@ -0,0 +1,46 @@ +import java.util.Properties +import java.io.{FileInputStream, FileOutputStream} +import commons.Control._ +import commons.Io._ +import commons.Path._ + +object TopCoderSetup { + def main(args: Array[String]) { + val cmd = args(0) + val homedir = System getenv "HOME" + val srcconf = "contestapplet.conf.template" + val dstconf = homedir / "contestapplet.conf" + // List of language names (identifying the properties) and their source + // file extensions. + val langs = List(("cpp", "cpp"), ("java", "java"), ("csharp", "cs")) + + val ps = new Properties + val fis = new FileInputStream(srcconf) + try { ps.load(fis) } + finally { fis.close } + + cmd match { + case "dump" => { + for ((lang, ext) <- langs) { + val src = ps.getProperty("fileeditor.config." + lang + "template") + using (TextWriter("template." + ext)) (_ write src) + } + } + case "load" => { + for ((lang, ext) <- langs) { + val src = using (TextReader("template." + ext)) (_ read) + ps.setProperty("fileeditor.config." + lang + "template", src) + } + + val (classpath, userdir) = (args(1), args(2)) + ps.setProperty("com.topcoder.client.contestApplet.common.LocalPreferences.commonclasspath", + classpath) + ps.setProperty("fileeditor.config.dirName", userdir) + + val fos = new FileOutputStream(dstconf) + try { ps.store(fos, "TopCoder ContestApplet Preferences File") } + finally { fos.close } + } + } + } +} Added: configs/trunk/src/topcoder/template.cpp =================================================================== --- configs/trunk/src/topcoder/template.cpp (rev 0) +++ configs/trunk/src/topcoder/template.cpp 2008-05-14 22:55:40 UTC (rev 815) @@ -0,0 +1,171 @@ +// vim:et:sw=2:ts=2 + +$BEGINCUT$ +#if 0 +$PROBLEMDESC$ +#endif +$ENDCUT$ + + + + + + + +//#line $NEXTLINENUMBER$ "$FILENAME$" +#include <algorithm> +#include <cassert> +#include <cctype> +#include <cmath> +#include <cstdio> +#include <cstdlib> +#include <deque> +#include <iostream> +#include <map> +#include <queue> +#include <set> +#include <sstream> +#include <stack> +#include <string> +#include <vector> +using namespace std; + +#define ARRSIZE(x) (sizeof(x)/sizeof(x[0])) + + + + + + + +$BEGINCUT$ +template<typename T> void print( T a ) { + cerr << a; +} +static void print( long long a ) { + cerr << a << "L"; +} +static void print( string a ) { + cerr << '"' << a << '"'; +} +template<typename T> void print( vector<T> a ) { + cerr << "{"; + for ( int i = 0 ; i != a.size() ; i++ ) { + if ( i != 0 ) cerr << ", "; + print( a[i] ); + } + cerr << "}" << endl; +} +template<typename T> void eq( int n, T have, T need ) { + if ( have == need ) { + cerr << "Case " << n << " passed." << endl; + } else { + cerr << "Case " << n << " failed: expected "; + print( need ); + cerr << " received "; + print( have ); + cerr << "." << endl; + } +} +template<typename T> void eq( int n, vector<T> have, vector<T> need ) { + if( have.size() != need.size() ) { + cerr << "Case " << n << " failed: returned " << have.size() << " elements; expected " << need.size() << " elements." << endl; + cerr << " have: "; print( have ); + cerr << " need: "; print( need ); + return; + } + for( size_t i= 0; i < have.size(); i++ ) { + if( have[i] != need[i] ) { + cerr << "Case " << n << " failed. Expected and returned array differ in position " << i << "." << endl; + cerr << " have: "; print( have ); + cerr << " need: "; print( need ); + return; + } + } + cerr << "Case " << n << " passed." << endl; +} +static void eq( int n, string have, string need ) { + if ( have == need ) { + cerr << "Case " << n << " passed." << endl; + } else { + cerr << "Case " << n << " failed: expected "; + print( need ); + cerr << " received "; + print( have ); + cerr << "." << endl; + } +} +$ENDCUT$ + + + + + + + +$BEGINCUT$ +#if 0 +template<typename T> void pp(const T & xs) { + for (typename T::const_iterator it = xs.begin(); + it != xs.end(); + it++) + cout << *it << " "; + cout << endl; +} + +vector<string> split( const string& s, const string& delim =" " ) { + vector<string> res; + string t; + for ( int i = 0 ; i != s.size() ; i++ ) { + if ( delim.find( s[i] ) != string::npos ) { + if ( !t.empty() ) { + res.push_back( t ); + t = ""; + } + } else { + t += s[i]; + } + } + if ( !t.empty() ) { + res.push_back(t); + } + return res; +} + +vector<int> splitInt( const string& s, const string& delim =" " ) { + vector<string> tok = split( s, delim ); + vector<int> res; + for ( int i = 0 ; i != tok.size(); i++ ) + res.push_back( atoi( tok[i].c_str() ) ); + return res; +} +#endif +$ENDCUT$ + + + + + + + +class $CLASSNAME$ { + public: + $RC$ $METHODNAME$($METHODPARMS$) { + $RC$ res; + return res; + } +}; + + + + + + + +$BEGINCUT$ +int main() { + $MAINBODY$ + cin.get(); + return 0; +} +$ENDCUT$ Added: configs/trunk/src/topcoder/template.cs =================================================================== --- configs/trunk/src/topcoder/template.cs (rev 0) +++ configs/trunk/src/topcoder/template.cs 2008-05-14 22:55:40 UTC (rev 815) @@ -0,0 +1,89 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.Text.RegularExpressions; + +public class $CLASSNAME$ { + public $RC$ $METHODNAME$($METHODPARMS$) { + // asdf + } + + + + + + + public void pp<T>(T x) { Console.WriteLine(x); } + + + + + + + + + $BEGINCUT$ + public static void Main(string[] args) { + $MAINBODY$ + Console.WriteLine("done!"); + Console.Read(); + } + private static void eq( int n, object have, object need) { + if( eq( have, need ) ) { + Console.WriteLine( "Case "+n+" passed." ); + } else { + Console.Write( "Case "+n+" failed: expected " ); + print( need ); + Console.Write( ", received " ); + print( have ); + Console.WriteLine(); + } + } + private static void eq( int n, Array have, Array need) { + if( have == null || have.Length != need.Length ) { + Console.WriteLine("Case "+n+" failed: returned "+have.Length+" elements; expected "+need.Length+" elements."); + print( have ); + print( need ); + return; + } + for( int i= 0; i < have.Length; i++ ) { + if( ! eq( have.GetValue(i), need.GetValue(i) ) ) { + Console.WriteLine( "Case "+n+" failed. Expected and returned array differ in position "+i ); + print( have ); + print( need ); + return; + } + } + Console.WriteLine("Case "+n+" passed."); + } + private static bool eq( object a, object b ) { + if ( a is double && b is double ) { + return Math.Abs((double)a-(double)b) < 1E-9; + } else { + return a!=null && b!=null && a.Equals(b); + } + } + private static void print( object a ) { + if ( a is string ) { + Console.Write("\"{0}\"", a); + } else if ( a is long ) { + Console.Write("{0}L", a); + } else { + Console.Write(a); + } + } + private static void print( Array a ) { + if ( a == null) { + Console.WriteLine("<NULL>"); + for ( int i= 0; i < a.Length; i++ ) { + print( a.GetValue(i) ); + if( i != a.Length-1 ) { + Console.Write(", "); + } + } + Console.WriteLine( '}' ); + } + $ENDCUT$ + } +} Added: configs/trunk/src/topcoder/template.java =================================================================== --- configs/trunk/src/topcoder/template.java (rev 0) +++ configs/trunk/src/topcoder/template.java 2008-05-14 22:55:40 UTC (rev 815) @@ -0,0 +1,15 @@ +$BEGINCUT$ +$PROBLEMDESC$ +$ENDCUT$ +import java.util.*; +public class $CLASSNAME$ { + public $RC$ $METHODNAME$($METHODPARMS$) { + // asdf + } + public static void main(String[] args) { + $CLASSNAME$ temp = new $CLASSNAME$(); + System.out.println(temp.$METHODNAME$($METHODPARMS$)); + } +} + +// vim:et:sw=2:ts=2 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-05-14 18:02:58
|
Revision: 814 http://assorted.svn.sourceforge.net/assorted/?rev=814&view=rev Author: yangzhang Date: 2008-05-14 11:00:58 -0700 (Wed, 14 May 2008) Log Message: ----------- tagged 0.5 release! Modified Paths: -------------- python-commons/tags/0.5/publish.bash python-commons/tags/0.5/setup.py python-commons/tags/0.5/src/commons/__init__.py Added Paths: ----------- python-commons/tags/0.5/ python-commons/tags/0.5/README python-commons/tags/0.5/src/commons/setup.py python-commons/tags/0.5/src/commons/strs.py Removed Paths: ------------- python-commons/tags/0.5/README python-commons/tags/0.5/src/commons/setup.py python-commons/tags/0.5/src/commons/strs.py Copied: python-commons/tags/0.5 (from rev 791, python-commons/trunk) Deleted: python-commons/tags/0.5/README =================================================================== --- python-commons/trunk/README 2008-05-10 05:46:06 UTC (rev 791) +++ python-commons/tags/0.5/README 2008-05-14 18:00:58 UTC (rev 814) @@ -1,65 +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.4 - -- 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 - -- added versioned guards -- added file memoization -- added retry with exp backoff -- added `countstep()` -- released for - [gbookmark2delicious](http://gbookmark2delicious.googlecode.com/) - -version 0.2 - -- added `clients`, `setup` -- released for [icedb](http://cartel.csail.mit.edu/icedb/) - -version 0.1 - -- initial release Copied: python-commons/tags/0.5/README (from rev 812, python-commons/trunk/README) =================================================================== --- python-commons/tags/0.5/README (rev 0) +++ python-commons/tags/0.5/README 2008-05-14 18:00:58 UTC (rev 814) @@ -0,0 +1,72 @@ +[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.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 Modified: python-commons/tags/0.5/publish.bash =================================================================== --- python-commons/trunk/publish.bash 2008-05-10 05:46:06 UTC (rev 791) +++ python-commons/tags/0.5/publish.bash 2008-05-14 18:00:58 UTC (rev 814) @@ -4,8 +4,11 @@ epydoc -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.4 +version=0.5 license=psf websrcs=( README ) rels=( pypi: ) Modified: python-commons/tags/0.5/setup.py =================================================================== --- python-commons/trunk/setup.py 2008-05-10 05:46:06 UTC (rev 791) +++ python-commons/tags/0.5/setup.py 2008-05-14 18:00:58 UTC (rev 814) @@ -9,7 +9,7 @@ pkg_info_text = """ Metadata-Version: 1.1 Name: python-commons -Version: 0.4 +Version: 0.5 Author: Yang Zhang Author-email: yaaang NOSPAM at REMOVECAPS gmail Home-page: http://assorted.sourceforge.net/python-commons Modified: python-commons/tags/0.5/src/commons/__init__.py =================================================================== --- python-commons/trunk/src/commons/__init__.py 2008-05-10 05:46:06 UTC (rev 791) +++ python-commons/tags/0.5/src/commons/__init__.py 2008-05-14 18:00:58 UTC (rev 814) @@ -10,7 +10,7 @@ @license: PSF """ -__version__ = ( 0, 2, 0 ) +__version__ = ( 0, 5, 0 ) __all__ = [ 'async', 'control', 'decs', Deleted: python-commons/tags/0.5/src/commons/setup.py =================================================================== --- python-commons/trunk/src/commons/setup.py 2008-05-10 05:46:06 UTC (rev 791) +++ python-commons/tags/0.5/src/commons/setup.py 2008-05-14 18:00:58 UTC (rev 814) @@ -1,100 +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 - -""" -Common code for setup.py files. Details about the Trove classifiers are -available at -U{http://pypi.python.org/pypi?%3Aaction=list_classifiers}. -""" - -arg_keys = """ -name -version -author -author_email -description: Summary -download_url: Download-url -long_description: Description -keywords: Keywords -url: Home-page -license -classifiers: Classifier -platforms: Platform -""" - -import sys -if not hasattr(sys, "version_info") or sys.version_info < (2, 3): - from distutils.core import setup - _setup = setup - def setup(**kwargs): - for key in [ - # distutils >= Python 2.3 args - # XXX probably download_url came in earlier than 2.3 - "classifiers", "download_url", - # setuptools args - "install_requires", "zip_safe", "test_suite", - ]: - if kwargs.has_key(key): - del kwargs[key] - # Only want packages keyword if this is a package, - # only want py_modules keyword if this is a single-file module, - # so get rid of packages or py_modules keyword as appropriate. - if kwargs["packages"] is None: - del kwargs["packages"] - else: - del kwargs["py_modules"] - apply(_setup, (), kwargs) -else: - from setuptools import setup, find_packages - -def run_setup( pkg_info_text, *orig_args, **orig_kwargs ): - list_keys = set( [ 'Classifier' ] ) - pkg_info = {} - for line in pkg_info_text.split( '\n' ): - if line.strip() != '': - if line.startswith( ' '*8 ): - pkg_info[ key ] += line[ 7 : ] - else: - key, value = line.split( ': ', 1 ) - if key in list_keys: - try: - pkg_info[ key ].append( value ) - except: - pkg_info[ key ] = [ value ] - else: - pkg_info[ key ] = value - - args_nontranslations = set() - args_translations = {} - for line in arg_keys.split( '\n' ): - if line.strip() != '': - splitted = line.split( ': ', 1 ) - dest_name = splitted[ 0 ] - if len( splitted ) == 2: - source_name = splitted[ 1 ] - args_translations[ source_name ] = dest_name - else: - args_nontranslations.add( dest_name ) - - args = {} - for key, value in pkg_info.iteritems(): - dest_name = None - try: - dest_name = args_translations[ key ] - except KeyError: - key = key.lower().replace('-','_') - if key in args_nontranslations: - dest_name = key - if dest_name is not None: - args[ dest_name ] = value - - # this also allows user to override our args - args.update( orig_kwargs ) - args.update( { - 'package_dir': {'':'src'}, - 'packages': find_packages('src'), - 'zip_safe': True, - } ) - - setup( *orig_args, **args ) Copied: python-commons/tags/0.5/src/commons/setup.py (from rev 805, python-commons/trunk/src/commons/setup.py) =================================================================== --- python-commons/tags/0.5/src/commons/setup.py (rev 0) +++ python-commons/tags/0.5/src/commons/setup.py 2008-05-14 18:00:58 UTC (rev 814) @@ -0,0 +1,100 @@ +#!/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 + +""" +Common code for setup.py files. Details about the Trove classifiers are +available at +U{http://pypi.python.org/pypi?%3Aaction=list_classifiers}. +""" + +arg_keys = """ +name +version +author +author_email +description: Summary +download_url: Download-url +long_description: Description +keywords: Keywords +url: Home-page +license +classifiers: Classifier +platforms: Platform +""" + +import sys +if not hasattr(sys, "version_info") or sys.version_info < (2, 3): + from distutils.core import setup + _setup = setup + def setup(**kwargs): + for key in [ + # distutils >= Python 2.3 args + # XXX probably download_url came in earlier than 2.3 + "classifiers", "download_url", + # setuptools args + "install_requires", "zip_safe", "test_suite", + ]: + if kwargs.has_key(key): + del kwargs[key] + # Only want packages keyword if this is a package, + # only want py_modules keyword if this is a single-file module, + # so get rid of packages or py_modules keyword as appropriate. + if kwargs["packages"] is None: + del kwargs["packages"] + else: + del kwargs["py_modules"] + apply(_setup, (), kwargs) +else: + from setuptools import setup, find_packages + +def run_setup( pkg_info_text, srcdir = 'src', *orig_args, **orig_kwargs ): + list_keys = set( [ 'Classifier' ] ) + pkg_info = {} + for line in pkg_info_text.split( '\n' ): + if line.strip() != '': + if line.startswith( ' '*8 ): + pkg_info[ key ] += line[ 7 : ] + else: + key, value = line.split( ': ', 1 ) + if key in list_keys: + try: + pkg_info[ key ].append( value ) + except: + pkg_info[ key ] = [ value ] + else: + pkg_info[ key ] = value + + args_nontranslations = set() + args_translations = {} + for line in arg_keys.split( '\n' ): + if line.strip() != '': + splitted = line.split( ': ', 1 ) + dest_name = splitted[ 0 ] + if len( splitted ) == 2: + source_name = splitted[ 1 ] + args_translations[ source_name ] = dest_name + else: + args_nontranslations.add( dest_name ) + + args = {} + for key, value in pkg_info.iteritems(): + dest_name = None + try: + dest_name = args_translations[ key ] + except KeyError: + key = key.lower().replace('-','_') + if key in args_nontranslations: + dest_name = key + if dest_name is not None: + args[ dest_name ] = value + + # this also allows user to override our args + args.update( orig_kwargs ) + args.update( { + 'package_dir': {'':srcdir}, + 'packages': find_packages(srcdir), + 'zip_safe': True, + } ) + + setup( *orig_args, **args ) Deleted: python-commons/tags/0.5/src/commons/strs.py =================================================================== --- python-commons/trunk/src/commons/strs.py 2008-05-10 05:46:06 UTC (rev 791) +++ python-commons/tags/0.5/src/commons/strs.py 2008-05-14 18:00:58 UTC (rev 814) @@ -1,20 +0,0 @@ -# -*- mode: python; tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4; -*- -# vim:ft=python:et:sw=4:ts=4 - -""" -String formatting. -""" - -import itertools - -def format( *args ): - """Formats the args as they would be by the C{print} built-in.""" - return ' '.join( itertools.imap( str, args ) ) - -def safe_ascii( s ): - """Casts a Unicode string to a regular ASCCII string. This may be - lossy.""" - if isinstance( s, unicode ) and s == str( s ): - return str( s ) - else: - return s Copied: python-commons/tags/0.5/src/commons/strs.py (from rev 804, python-commons/trunk/src/commons/strs.py) =================================================================== --- python-commons/tags/0.5/src/commons/strs.py (rev 0) +++ python-commons/tags/0.5/src/commons/strs.py 2008-05-14 18:00:58 UTC (rev 814) @@ -0,0 +1,58 @@ +# -*- mode: python; tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4; -*- +# vim:ft=python:et:sw=4:ts=4 + +""" +String formatting. +""" + +import itertools + +def format( *args ): + """Formats the args as they would be by the C{print} built-in.""" + return ' '.join( itertools.imap( str, args ) ) + +def safe_ascii( s ): + """Casts a Unicode string to a regular ASCCII string. This may be + lossy.""" + if isinstance( s, unicode ) and s == str( s ): + return str( s ) + else: + return s + +cp1252_to_unicode_translations = [ (u'\x80',u'\u20AC'), + (u'\x82',u'\u201A'), + (u'\x83',u'\u0192'), + (u'\x84',u'\u201E'), + (u'\x85',u'\u2026'), + (u'\x86',u'\u2020'), + (u'\x87',u'\u2021'), + (u'\x88',u'\u02C6'), + (u'\x89',u'\u2030'), + (u'\x8A',u'\u0160'), + (u'\x8B',u'\u2039'), + (u'\x8C',u'\u0152'), + (u'\x8E',u'\u017D'), + (u'\x91',u'\u2018'), + (u'\x92',u'\u2019'), + (u'\x93',u'\u201C'), + (u'\x94',u'\u201D'), + (u'\x95',u'\u2022'), + (u'\x96',u'\u2013'), + (u'\x97',u'\u2014'), + (u'\x98',u'\u02DC'), + (u'\x99',u'\u2122'), + (u'\x9A',u'\u0161'), + (u'\x9B',u'\u203A'), + (u'\x9C',u'\u0153'), + (u'\x9E',u'\u017E'), + (u'\x9F',u'\u0178') ] + +def cp1252_to_unicode(x): + """Converts characters 0x80 through 0x9f to their proper Unicode + equivalents. See + U{http://www.intertwingly.net/stories/2004/04/14/i18n.html} for the nice + translation table on which this is based.""" + for a,b in cp1252_to_unicode_translations: + x = x.replace(a,b) + return x + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-05-14 18:00:07
|
Revision: 813 http://assorted.svn.sourceforge.net/assorted/?rev=813&view=rev Author: yangzhang Date: 2008-05-14 10:56:42 -0700 (Wed, 14 May 2008) Log Message: ----------- updated version numbers Modified Paths: -------------- python-commons/trunk/publish.bash python-commons/trunk/setup.py python-commons/trunk/src/commons/__init__.py Modified: python-commons/trunk/publish.bash =================================================================== --- python-commons/trunk/publish.bash 2008-05-14 17:47:51 UTC (rev 812) +++ python-commons/trunk/publish.bash 2008-05-14 17:56:42 UTC (rev 813) @@ -4,8 +4,11 @@ epydoc -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.4 +version=0.5 license=psf websrcs=( README ) rels=( pypi: ) Modified: python-commons/trunk/setup.py =================================================================== --- python-commons/trunk/setup.py 2008-05-14 17:47:51 UTC (rev 812) +++ python-commons/trunk/setup.py 2008-05-14 17:56:42 UTC (rev 813) @@ -9,7 +9,7 @@ pkg_info_text = """ Metadata-Version: 1.1 Name: python-commons -Version: 0.4 +Version: 0.5 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 2008-05-14 17:47:51 UTC (rev 812) +++ python-commons/trunk/src/commons/__init__.py 2008-05-14 17:56:42 UTC (rev 813) @@ -10,7 +10,7 @@ @license: PSF """ -__version__ = ( 0, 2, 0 ) +__version__ = ( 0, 5, 0 ) __all__ = [ 'async', 'control', 'decs', This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-05-14 17:52:41
|
Revision: 812 http://assorted.svn.sourceforge.net/assorted/?rev=812&view=rev Author: yangzhang Date: 2008-05-14 10:47:51 -0700 (Wed, 14 May 2008) Log Message: ----------- added release dates and 0.5 to changelog Modified Paths: -------------- python-commons/trunk/README Modified: python-commons/trunk/README =================================================================== --- python-commons/trunk/README 2008-05-14 07:26:30 UTC (rev 811) +++ python-commons/trunk/README 2008-05-14 17:47:51 UTC (rev 812) @@ -37,8 +37,15 @@ Changes ------- -version 0.4 +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()` @@ -46,7 +53,7 @@ - released for [Mailing List Filter](http://assorted.sf.net/mailing-list-filter/) -version 0.3 +version 0.3, 2008-04-30 - added versioned guards - added file memoization @@ -55,11 +62,11 @@ - released for [gbookmark2delicious](http://gbookmark2delicious.googlecode.com/) -version 0.2 +version 0.2, 2008-02-04 - added `clients`, `setup` - released for [icedb](http://cartel.csail.mit.edu/icedb/) -version 0.1 +version 0.1, 2007-03-24 - initial release This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-05-14 07:26:24
|
Revision: 811 http://assorted.svn.sourceforge.net/assorted/?rev=811&view=rev Author: yangzhang Date: 2008-05-14 00:26:30 -0700 (Wed, 14 May 2008) Log Message: ----------- added check for .googlecode.auth Modified Paths: -------------- shell-tools/trunk/src/bash-commons/assorted.bash Modified: shell-tools/trunk/src/bash-commons/assorted.bash =================================================================== --- shell-tools/trunk/src/bash-commons/assorted.bash 2008-05-14 07:26:07 UTC (rev 810) +++ shell-tools/trunk/src/bash-commons/assorted.bash 2008-05-14 07:26:30 UTC (rev 811) @@ -278,9 +278,9 @@ file=$stagedir/$package.jar ;; pypi ) ( - [ -f ~/.pypirc ] || + check_private ~/.pypirc || die "$( cat << "EOF" -You should have a .pypirc file containing your credentials. E.g.: +You should have a ~/.pypirc file containing your credentials. E.g.: [server-login] username:yang @@ -293,6 +293,13 @@ continue ;; * ) die "unknown dst type: $dst" ;; esac + check_private ~/.googlecode.auth || die "$( cat << "EOF" +You should have a ~/.googlecode.auth file containing your credentials. E.g.: + +yanghatespam +your-googlecode-password +EOF +)" googlecode_upload -p assorted -s "$summary" -l "$labels" $file done This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-05-14 07:26:03
|
Revision: 810 http://assorted.svn.sourceforge.net/assorted/?rev=810&view=rev Author: yangzhang Date: 2008-05-14 00:26:07 -0700 (Wed, 14 May 2008) Log Message: ----------- added xmap.lzz demo Added Paths: ----------- sandbox/trunk/src/cc/lzz/ sandbox/trunk/src/cc/lzz/xmap.lzz sandbox/trunk/src/cc/lzz/xmap.mk Added: sandbox/trunk/src/cc/lzz/xmap.lzz =================================================================== --- sandbox/trunk/src/cc/lzz/xmap.lzz (rev 0) +++ sandbox/trunk/src/cc/lzz/xmap.lzz 2008-05-14 07:26:07 UTC (rev 810) @@ -0,0 +1,104 @@ +#hdr +#include <iostream> +#include <map> + +#include <pthread.h> + +#include <boost/bind.hpp> + +#include <commons/st/st.h> +#include <commons/boost/threads.h> + +using namespace boost; +using namespace commons; +using namespace std; +#end + +/** + * A thin wrapper around the map class. + */ +class xmap +{ + public: + // Note: map::operator[] is not a const method, so we use map::find(). + void * const & operator[](int k) const { return m.find(k)->second; } + void * & operator[](int k) { return m[k]; } + private: + map<int, void*> m; +}; + +/** + * A server that handles requests to read or update an xmap. + */ +class xmap_server(int port = 17000) +{ + public: + /** + * The main accept loop. + */ + void + serve() + { + st_netfd_t listener = st_tcp_listen(port); + while (true) { + st_netfd_t client = st_accept(listener, NULL, 0, ST_UTIME_NO_TIMEOUT); + st_spawn(boost::bind(&xmap_server::handle, this, client)); + } + } + + private: + /** + * Handle a client. + */ + void + handle(st_netfd_t client) + { + cout << "handling a client " << errno << endl; + string msg("hello\n"); + checkeq(st_write(client, msg.c_str(), msg.size(), ST_UTIME_NO_TIMEOUT), + static_cast<ssize_t>(msg.size())); + check0x(st_netfd_close(client)); + cout << errno << endl; + } + + xmap m; +}; + +void +st_bg() +{ + cout << errno << endl; + while (true) { + cout << "hello st_bg " << errno << endl; + st_sleep(1); + } +} + +void +worker(int i, cqueue<int> queue) +{ + string worker = "worker " + lexical_cast<string>(i) + ": "; + while (true) { + queue.pop(); + cout << worker << "got work" << endl; + cout << worker << "calculating for conn " << errno << endl; + sleep(1); + } + st_call(bind(st_write, fd)); +} + +int +main() +{ + const int nworkers = 5; + vector<pthread_t> workers(nworkers); + for (int i = 0; i < nworkers; i++) { + workers[i] = checknneg(spawn(bind(worker, i))); + } + check0x(pthread_join(workers[i], NULL)); + check0x(st_init()); + check(st_spawn(bind(st_bg))); + xmap_server s; + s.serve(); + return 0; +} Added: sandbox/trunk/src/cc/lzz/xmap.mk =================================================================== --- sandbox/trunk/src/cc/lzz/xmap.mk (rev 0) +++ sandbox/trunk/src/cc/lzz/xmap.mk 2008-05-14 07:26:07 UTC (rev 810) @@ -0,0 +1,32 @@ +TARGET := xmap +LZZS := $(wildcard *.lzz) +SRCS := $(foreach lzz,$(LZZS),$(patsubst %.lzz,%.o,$(lzz))) +HDRS := $(foreach lzz,$(LZZS),$(patsubst %.lzz,%.hh,$(lzz))) +OBJS := $(foreach lzz,$(LZZS),$(patsubst %.lzz,%.cc,$(lzz))) +LDFLAGS := -lstx -lst -lresolv -lpthread +CXXFLAGS := -g3 -Wall -Werror + +all: $(TARGET) + +$(TARGET): $(OBJS) + $(CXX) -o $@ $< $(LDFLAGS) + +%.o: %.cc + wtf $(CXX) $(CXXFLAGS) -c -o $@ $< + +%.cc: %.lzz + lzz -hx hh -sx cc -hl -sl -hd -sd $< + +%.hh: %.lzz + lzz -hx hh -sx cc -hl -sl -hd -sd $< + +clean: + rm -f *.cc *.hh *.o xmap + +doc: $(SRCS) $(HDRS) + doxygen + +.PHONY: clean + +# %.cc doesn't work +.SECONDARY: main.cc This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-05-14 01:59:17
|
Revision: 809 http://assorted.svn.sourceforge.net/assorted/?rev=809&view=rev Author: yangzhang Date: 2008-05-13 18:59:23 -0700 (Tue, 13 May 2008) Log Message: ----------- more informative error Modified Paths: -------------- simple-build/trunk/src/googlecode_upload.py Modified: simple-build/trunk/src/googlecode_upload.py =================================================================== --- simple-build/trunk/src/googlecode_upload.py 2008-05-13 22:47:02 UTC (rev 808) +++ simple-build/trunk/src/googlecode_upload.py 2008-05-14 01:59:23 UTC (rev 809) @@ -254,6 +254,7 @@ # credentials as of 2007-07-17. if status in [httplib.FORBIDDEN, httplib.UNAUTHORIZED]: # Rest for another try. + print 'failed once' user_name = password = None tries = tries - 1 else: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-05-13 22:46:59
|
Revision: 808 http://assorted.svn.sourceforge.net/assorted/?rev=808&view=rev Author: yangzhang Date: 2008-05-13 15:47:02 -0700 (Tue, 13 May 2008) Log Message: ----------- added some documentation to shell tools; removed indent etc Modified Paths: -------------- shell-tools/trunk/src/bash-commons/common.bash Modified: shell-tools/trunk/src/bash-commons/common.bash =================================================================== --- shell-tools/trunk/src/bash-commons/common.bash 2008-05-13 22:43:21 UTC (rev 807) +++ shell-tools/trunk/src/bash-commons/common.bash 2008-05-13 22:47:02 UTC (rev 808) @@ -161,18 +161,6 @@ silence type "$@" } -#indent() { -# let ++indent || true -#} -# -#deindent() { -# let --indent || true -#} -# -#noindent() { -# indent=0 -#} - log() { echo "$@" } @@ -265,8 +253,9 @@ rsync -e ssh -u -a --delete "$@" } +# Find and remove all broken links in the given directory (and subdirs). rm-broken-symlinks() { - find . -type l | + find "$@" -type l | while read file ; do if [ ! -e "$file" ] ; then sudo -u pkg rm "$file" @@ -274,6 +263,7 @@ done } +# XXX figure out wtf this is for. make this more general? populate-prefix-dir() { local target="$1" for j in bin info lib man src usr ; do @@ -294,6 +284,8 @@ # the GNU version: sed ':a; $!N; s/\n/ /; ta' } +# Parses a classpath from an Eclipse .classpath file (first arg) and sets the +# CLASSPATH variable accordingly for the subsequent command. get-classpath() { local classpath_file="$1" shift @@ -301,6 +293,7 @@ join-lines : ):$CLASSPATH" "$@" } +# Find the first available DNS name. XXX make this more general find-first-avail-name() { for i in {a..z}; do for j in {a..z}; do @@ -406,13 +399,12 @@ sort -u } +# bbfix, by Patrick Reynolds (reynolds .at. cs duke edu) +# Too trivial to copyright. It's in the public domain! +# +# Usage: +# ./bbfix foo.eps bbfix() { - # bbfix, by Patrick Reynolds (reynolds .at. cs duke edu) - # Too trivial to copyright. It's in the public domain! - # - # Usage: - # ./bbfix foo.eps - if [ $# = 0 ]; then echo "Usage:" echo " $0 file.eps [file.eps [file.eps [...]]]" @@ -425,6 +417,8 @@ done } +# Install a python package to the specified directory. Takes care of creating +# the dir and setting the PYTHONPATH appropriately for the setup process. pyinstall() { local prefix="$1" pkgdir="$1/lib/python2.5/site-packages" mkdir -p $pkgdir This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-05-13 22:43:14
|
Revision: 807 http://assorted.svn.sourceforge.net/assorted/?rev=807&view=rev Author: yangzhang Date: 2008-05-13 15:43:21 -0700 (Tue, 13 May 2008) Log Message: ----------- added pyinstall() Modified Paths: -------------- shell-tools/trunk/src/bash-commons/common.bash Modified: shell-tools/trunk/src/bash-commons/common.bash =================================================================== --- shell-tools/trunk/src/bash-commons/common.bash 2008-05-13 22:43:13 UTC (rev 806) +++ shell-tools/trunk/src/bash-commons/common.bash 2008-05-13 22:43:21 UTC (rev 807) @@ -425,6 +425,12 @@ done } +pyinstall() { + local prefix="$1" pkgdir="$1/lib/python2.5/site-packages" + mkdir -p $pkgdir + PYTHONPATH="$pkgdir:$PYTHONPATH" ./setup.py install --prefix "$prefix" +} + #if ! is_declared indent ; then # noindent #else This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-05-13 22:43:08
|
Revision: 806 http://assorted.svn.sourceforge.net/assorted/?rev=806&view=rev Author: yangzhang Date: 2008-05-13 15:43:13 -0700 (Tue, 13 May 2008) Log Message: ----------- added error about missing ~/.pypirc Modified Paths: -------------- shell-tools/trunk/src/bash-commons/assorted.bash Modified: shell-tools/trunk/src/bash-commons/assorted.bash =================================================================== --- shell-tools/trunk/src/bash-commons/assorted.bash 2008-05-13 22:42:27 UTC (rev 805) +++ shell-tools/trunk/src/bash-commons/assorted.bash 2008-05-13 22:43:13 UTC (rev 806) @@ -278,6 +278,15 @@ file=$stagedir/$package.jar ;; pypi ) ( + [ -f ~/.pypirc ] || + die "$( cat << "EOF" +You should have a .pypirc file containing your credentials. E.g.: + +[server-login] +username:yang +password:your-pypi-password +EOF + )" cd $stagedir/$package-py ./setup.py register sdist bdist_egg upload ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-05-13 22:42:19
|
Revision: 805 http://assorted.svn.sourceforge.net/assorted/?rev=805&view=rev Author: yangzhang Date: 2008-05-13 15:42:27 -0700 (Tue, 13 May 2008) Log Message: ----------- added srcdir param to setup Modified Paths: -------------- python-commons/trunk/src/commons/setup.py Modified: python-commons/trunk/src/commons/setup.py =================================================================== --- python-commons/trunk/src/commons/setup.py 2008-05-13 22:42:19 UTC (rev 804) +++ python-commons/trunk/src/commons/setup.py 2008-05-13 22:42:27 UTC (rev 805) @@ -48,7 +48,7 @@ else: from setuptools import setup, find_packages -def run_setup( pkg_info_text, *orig_args, **orig_kwargs ): +def run_setup( pkg_info_text, srcdir = 'src', *orig_args, **orig_kwargs ): list_keys = set( [ 'Classifier' ] ) pkg_info = {} for line in pkg_info_text.split( '\n' ): @@ -92,8 +92,8 @@ # this also allows user to override our args args.update( orig_kwargs ) args.update( { - 'package_dir': {'':'src'}, - 'packages': find_packages('src'), + 'package_dir': {'':srcdir}, + 'packages': find_packages(srcdir), 'zip_safe': True, } ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-05-13 22:42:15
|
Revision: 804 http://assorted.svn.sourceforge.net/assorted/?rev=804&view=rev Author: yangzhang Date: 2008-05-13 15:42:19 -0700 (Tue, 13 May 2008) Log Message: ----------- added cp1252_to_unicode() Modified Paths: -------------- python-commons/trunk/src/commons/strs.py Modified: python-commons/trunk/src/commons/strs.py =================================================================== --- python-commons/trunk/src/commons/strs.py 2008-05-13 07:44:44 UTC (rev 803) +++ python-commons/trunk/src/commons/strs.py 2008-05-13 22:42:19 UTC (rev 804) @@ -18,3 +18,41 @@ return str( s ) else: return s + +cp1252_to_unicode_translations = [ (u'\x80',u'\u20AC'), + (u'\x82',u'\u201A'), + (u'\x83',u'\u0192'), + (u'\x84',u'\u201E'), + (u'\x85',u'\u2026'), + (u'\x86',u'\u2020'), + (u'\x87',u'\u2021'), + (u'\x88',u'\u02C6'), + (u'\x89',u'\u2030'), + (u'\x8A',u'\u0160'), + (u'\x8B',u'\u2039'), + (u'\x8C',u'\u0152'), + (u'\x8E',u'\u017D'), + (u'\x91',u'\u2018'), + (u'\x92',u'\u2019'), + (u'\x93',u'\u201C'), + (u'\x94',u'\u201D'), + (u'\x95',u'\u2022'), + (u'\x96',u'\u2013'), + (u'\x97',u'\u2014'), + (u'\x98',u'\u02DC'), + (u'\x99',u'\u2122'), + (u'\x9A',u'\u0161'), + (u'\x9B',u'\u203A'), + (u'\x9C',u'\u0153'), + (u'\x9E',u'\u017E'), + (u'\x9F',u'\u0178') ] + +def cp1252_to_unicode(x): + """Converts characters 0x80 through 0x9f to their proper Unicode + equivalents. See + U{http://www.intertwingly.net/stories/2004/04/14/i18n.html} for the nice + translation table on which this is based.""" + for a,b in cp1252_to_unicode_translations: + x = x.replace(a,b) + return x + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2008-05-13 07:44:45
|
Revision: 803 http://assorted.svn.sourceforge.net/assorted/?rev=803&view=rev Author: yangzhang Date: 2008-05-13 00:44:44 -0700 (Tue, 13 May 2008) Log Message: ----------- fixed for stripped binary Modified Paths: -------------- configs/trunk/src/cron/sync-bookmarks.bash Modified: configs/trunk/src/cron/sync-bookmarks.bash =================================================================== --- configs/trunk/src/cron/sync-bookmarks.bash 2008-05-13 07:44:31 UTC (rev 802) +++ configs/trunk/src/cron/sync-bookmarks.bash 2008-05-13 07:44:44 UTC (rev 803) @@ -2,4 +2,4 @@ FORCE_BASHRC=1 . ~/.bashrc && . common.bash || exit 1 -exec gbookmark2delicious.py --debug main --debug compare --underscores +exec gbookmark2delicious --debug main --debug compare --underscores This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |