2014-03-21

Patching bugs with SVN

I'm using Suds to work with SharePoint, but it was terribly slow due to broken caching, so i patched it:
I:\>cd temp

I:\temp>mkdir sudssvn

I:\temp>cd sudssvn

I:\temp\sudssvn>svn co http://svn.fedorahosted.org/svn/suds/trunk
A    trunk\LICENSE
A    trunk\tests
A    trunk\tests\rhq.py
A    trunk\tests\public.py
...

I:\temp\sudssvn>"C:\Program Files (x86)\Notepad++\notepad++.exe" trunk\suds\cache.py

I:\temp\sudssvn>svn di trunk
Index: trunk/suds/cache.py
===================================================================
--- trunk/suds/cache.py (revision 712)
+++ trunk/suds/cache.py (working copy)
@@ -190,7 +190,7 @@
     def put(self, id, bfr):
         try:
             fn = self.__fn(id)
-            f = self.open(fn, 'w')
+            f = self.open(fn, 'wb')
             f.write(bfr)
             f.close()
             return bfr
@@ -223,7 +223,7 @@
         try:
             fn = self.__fn(id)
             self.validate(fn)
-            return self.open(fn)
+            return self.open(fn, 'rb')
         except:
             pass

I:\temp\sudssvn>svn ci trunk
svn: E205007: Commit failed (details follow):
svn: E205007: Could not use external editor to fetch log message; consider setting the $SVN_EDITOR environment variable or using the --message (-m) or --file (-F) options
svn: E205007: None of the environment variables SVN_EDITOR, VISUAL or EDITOR are set, and no 'editor-cmd' run-time configuration option was found

I:\temp\sudssvn> ...TortoiseSVN GUI:

Commit
Commit failed (details follow):
Can't create directory '/svn/suds/db/transactions/712-1.txn': Permission denied
Alas, a lack of project time/leadership stifles progress, but at least open source and free speech allows one to fork unmaintained projects. Torvalds' Git (simple guide) was made for decentralized development like that.

A Google result (and on closer inspection, previous error) tells me that instead of the GUI, i could've used the -m switch of svn:
I:\temp\sudssvn>svn ci trunk -m "fix caching on Windows"
svn: E000013: Commit failed (details follow):
svn: E000013: Can't create directory '/svn/suds/db/transactions/712-1.txn': Permission denied
The system environment variable PATH gives me easy access to "C:\Program Files\TortoiseSVN\bin\svn.exe".

2014-03-01

Genderswap any webpage!

After trying to read the dismal The Claiming of Sleeping Beauty again, i thought it might be interesting to see whether it'd be more palatable with reversed genders. A difficult experience. Here's the code, which you can set as a bookmark location, then click the bookmark to transform the current page:

javascript:(function(){function swap(txt, a, b){return txt.split(a).join("SWPTMP").split(b).join(a).split("SWPTMP").join(b)};var subs=[[' he ',' she '],[' he\'',' she\''],['He ','She '],[' man ',' woman '],[' men',' women'],['boy','girl'],['King','Queen'],['Lord','Lady'],[' daughter',' son'],['father','mother'],['uncle','aunt'],['Prince','Princess'],[' herself',' himself'],[' her.',' him.'],[' her,',' him,'],[' her a ',' him a '],[' her an ',' him an '],[' her and ',' him and '],[' him to',' her to'],[' him up',' her up'],[' him down',' her down'],[' him again',' her again'],[' him until',' her until'],[' him w',' her w'],[' him by',' her by'],[' her ',' his '],['His ', 'Her ']];t=document.body.innerHTML;for(var i=0;i<subs.length;++i)t=swap(t, subs[i][0], subs[i][1]);document.body.innerHTML=t.replace('Princessss','Prince')})()