manuals for life
a shenie production
set showplan on\nset fmt on\n\nexec <your stored procedure>
[[Home]]\n[[apple]]\n[[unix]]\n[[ruby]]\n[[rails]]\n[[java]]\n[[database]]\n[[howto]]\n[[finance]]\n[[goals]]\n[[todo]]\n[[work]]\n\n[[format]]
Welcome to my wiki
Useful command that you can use to monitor CPU load, status & etc.\n* {{{ps}}}\n* {{{prstat}}} (availability depends on the OS)\n* {{{pstree}}}\n* {{{top -a -o cpu}}}
{{{\nIF EXISTS (SELECT * FROM sysindexes WHERE id=OBJECT_ID('table') AND name='index_name')\nBEGIN\n DROP INDEX table.index_name\nEND\n}}}
http://manuals.sybase.com/onlinebooks\n[[How to connect to Sybase on OSX|http://www.omnis.net/technotes/tnsq0009.html]]\n[[Sybase on Mac|http://www.sybase.com/partner/mac]]\n{{{\nsp_helpdb\nsp_help\nsp_dbspace\nsp_helpuser\n}}}
Home\n[[todo]]\n
[[Tab completion in IRB|http://www.epistemologic.com/articles/2005/12/23/irb-tab-completion]]
* Hibernate properties keys: net.sf.hibernate.cfg.Environment
* [[Spring constants|http://static.springframework.org/docs/api/constant-values.html]]\n* org.springframework.util.~ResourceUtils specifies prefixes that can be used when specifying Resource object in configuration.\n* org.springframework.core.io.~ResourceLoader\n* org.springframework.beans.factory.config.~PropertyPlaceholderConfigurer loads properties file and replaces placeholder with values loaded from properties file.\n* This [[page|http://forum.springframework.org/archive/index.php/t-12575.html]] contains a clever way of managing ~ThreadLocals by wrapping it in a context object and inject it with Spring.\n
Use & #42; no spaces
{{{\n.table - show tables\n.schema txns - show fields in txns table\n.headers ON - show column headings in results\n}}}
{{{\nmysqldump -uxxx -pxxx mydatabase | \s\n ssh user@destinationserver "mysql -uxxx -pxxx mydatabase"\n}}}
{{{\nalter table [table name] drop column [column name];\nalter table [table name] add column [new column name] varchar (20);\nalter table [table name] change [old column name] [new column name] varchar (50);\nalter table [table name] add unique ([column name]);\nalter table [table name] modify [column name] VARCHAR(3);\nalter table [table name] drop index [colmn name];\nalter table [table name] change column [old colmn name] [new colmn name] [type]\n\nconvert(expr, type)\ne.g. convert(id, char)\ntype can be: binary, char, date, datetime, signed [integer], time, unsigned [integer]\n\ngrant all on depot_development.* to 'dave'@'localhost'; \ngrant all on depot_test.* to 'dave'@'localhost'; \ngrant all on depot_production.* to 'prod'@'localhost' identified by 'wibble'; \n\nshow columns from [table name]\nshow table status\nshow tables (like 'str')\nshow processlist\nkill 769\n\ncreate user 'rails'@'localhost';\n}}}
To use isql you will have to setup the SYBASE and ~LD_LIBRARY_PATH variables to point to correct path.\n{{{\ne.g.\nSYBASE = /dba/sybase/ase/12.0\nLD_LIBRARY_PATH=/dba/sybase/ase/12.0/ASE-12_0/lib\n}}}
To find out how many connections are open in database using isql you need to look in the sysprocesses table.\n{{{\nselect suser_name(suid), count(*) \nfrom sysprocesses \ngroup by suser_name(suid) \norder by 2\n}}}\nThe interesting bit is order by 2 where the 2 is the column number in this case the count.\n
{{{\nsvn status -u\n}}}\nlet you see what is incoming and\n\n{{{\nsvn diff -r BASE:HEAD\n}}}\nlet you see the actual differences.\n\nAn alternative command to see what's incoming is \n{{{\nsvn merge --dry-run -r BASE:HEAD .\n}}}\nNote you should be in the working directory and the dot is necessary.
.bash_profile runs once every time you open a new Terminal. While .bashrc is loaded by every script you execute.\n\nNote when you open new Terminal .bashrc is loaded before .bash_profile, if .bash_profile does not exists then OSX will try .bash_login then .profile. It will stop and use the first one it finds, i.e. .bash_profile -> .bash_login -> .profile\n\n.bash_profile is used in interactive shell. This is important to remember because when you run command remotely via ssh, it is non-interactive therefore does not inherit your .bash_profile settings. Issues can arise such as PATH is different so certain command that you normally have access to is not in path in ssh.
Rubygems 0.9 is said to work behind authenticated proxy, but due to a bug in rubygems, it only works if you specified ~HTTP_PROXY, ~HTTP_PROXY_USER & ~HTTP_USER_PASS environment variable. \n\nThe -p http://user:password@proxy.address.com:8080 option is broken because remote_installer.rb forgets to use the user and password attribute when it starts downloading gems.\n\nBest option to use is set ~HTTP_PROXY either in command prompt or as an env variable to\n{{{\nhttp://user:pass@proxy:port\n}}}
Specify the port in server listen directive.\n\nUse the location directive to set the port number in HTTP header so any redirect in the Rails app will work. e.g.\n{{{\nlocation / {\n proxy_pass http://mongrel;\n proxy_redirect off;\n proxy_set_header Host $host:$server_port;\n proxy_set_header X-Real-IP $remote_addr;\n proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n}\n}}}
[[See thread|http://groups.google.com/group/comp.lang.ruby/browse_thread/thread/c71026c79d97f6f2/a42f84abdb8cbedf%23a42f84abdb8cbedf]]\n\n
It is funny how the source code is not installed be default even when the JDK was installed.\n\nAfter some research I found that the source code is a file called src.jar inside /System/Library/Frameworks/~JavaVM.framework/Versions/1.4.2/Home, or replace 1.4.2 with another version.\nYou can install the 1.4.2 source code by installing the following using Tiger DVD:\n~XCode Tools/Packages/~Java14Documentation.pkg\n\nFor JDK 1.5 the source code can be downloaded at http://connect.apple.com/. You will need to register but it is free to do so. Then just download Developer Documentation under the 1.5 section.
I have been trying to learn how to get Rails to work with Sybase for a while because Sybase is predominantly the database at my work.\n\nSince I am not exactly free nor allowed to spend chunks of my time working on this stuff at work I haven't had much success. For some reason, there isn't as much resource on getting Rails to work with Sybase compared to say, ~MySQL or ~PosgreSQL.\n\nSo every now and then I'd google a bit to see if anything new in the field comes up that might help, I noticed a [[new link|http://wiki.rubyonrails.com/rails/pages/HowToSetupSybaseAdapterOnRails]] on [[Sybase Rails wiki|http://wiki.rubyonrails.com/rails/pages/Sybase]]. It is the instructions for Suse 7.3, and during my research I learn that I can install [[Sybase on OS X|http://www.sybase.com/partner/mac]] so I thought it was worth to give the instructions a try.\n\nOverall the process wasn't too bad, I skipped step 4 & 5 (but later I had to setup SYBASE environment, something complained about it). Also was quite lucky the extconfig.rb (step 7) in [[Ruby Sybase Library|http://raa.ruby-lang.org/project/sybase-ctlib/]] already contains a commented out section for OS X configuration (it was written for Panther but it worked for me on Tiger). I can't remember for sure if step 7 was when I was faced with the problem of missing libraries but either way I was able to google the missing library name and [[found the answer|http://www.omnis.net/technotes/tnsq0009.html]] (I picked the Symbolic Links solution).\n{{{\ncd /usr/lib\nsudo ln -s /Applications/Sybase/System/OCS-12_5/lib/libsybtcl.dylib libsybtcl.dylib\nsudo ln -s /Applications/Sybase/System/OCS-12_5/lib/libsybdb.dylib libsybdb.dylib\nsudo ln -s /Applications/Sybase/System/OCS-12_5/lib/libsybintl.dylib libsybintl.dylib\nsudo ln -s /Applications/Sybase/System/OCS-12_5/lib/libsybct.dylib libsybct.dylib\nsudo ln -s /Applications/Sybase/System/OCS-12_5/lib/libsybcs.dylib libsybcs.dylib\nsudo ln -s /Applications/Sybase/System/OCS-12_5/lib/libsybcomn.dylib libsybcomn.dylib\n}}}\n\nAfter step 7 (create Makefile & compile by running make) I tested Ruby Sybase Library in the local folder by running sqlsample.rb against Sybase and it all worked so things were looking promising.\n\nHowever step 8 expects step 7 to have created 4 files which are to be installed in system directory (any ruby load path). But since it had already passed the test I didn't think too much of it and just copied the only 3 out of 4 files that I could find, created a new project (running on edge rails) configure database.yml to run against sybase adapter then test it using script/console. Unfortunately that wasn't enough. What made it worse was that the error message was really not helpful because it said "database configuration specifies nonexistent sybase adapter", by running console with --trace I found the line that raised the error and the condition that caused the error. I was still confused after I found the line because it was testing if the class has a method called sybase_connection, which I know for sure existed in sybase_adapter.rb. After a while I finally noticed that sybase_adapter.rb starts a begin block then require 'sybsql' (which is one of the 3 files I installed) and that require statement is throwing an error which is rescued right at the end of the file and the catch block doesn't do anything (no logging of any sort). So after I modified it to printed out the error, I finally found out the real reason why sybase adapter isn't loaded properly. The error turned out to be "unable to load sybct.o".\n\nThe error seems strange because I already tested the library with sqlsample.rb so something that was in the local library directory when running sqlsample.rb is also needed to be installed in system directory. A couple of trial and error the 4th file that is needed turns out to be sybct.bundle. After installing that file I finally got rails to run on Sybase, wahoo!!!\n\nI grew a bit more comfortable about ~ActiveRecord during this experience, get to install Sybase locally (so I'll get a chance to learn about Sybase admin functions) and get a little bit closer to getting Rails to work with Sybase at work :)
By using getUserAttributes() on ReflectiveMethodInvocation\n\np.s. you have to cast MethodInvocation to ReflectiveMethodInvocation to be able to use the method.\n
{{{\nosascript -e "set volume 6"\n}}}\nThe value range from 0 to 6 with 6 the loudest.
Use {{{~/.MacOSX/environment.plist}}} e.g.\n{{{\n<?xml version="1.0" encoding="UTF-8"?>\n<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"\n "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n<plist version="1.0">\n<dict>\n <key>DISPLAY</key>\n <string>:0.0</string>\n <key>SSH</key>\n <string>ssh -i ~/.ssh/some_other_key</string>\n</dict>\n</plist>\n}}}\n
Run {{{sudo postfix start}}}\nNote you need sudo to run postfix.
Use {{{/Developer/Tools/SetFile -a l}}} to unlock the file\ne.g.\n{{{\n/Developer/Tools/SetFile -a l ~/.Trash/*\n}}}\nNote the command is not recursive.\n\nThen just proceed to rm the files.
The preferences files are stored in ~/Library/Preferences/~IntelliJIDEA50, assuming IDEA 5
\nThere are simpler ways to do find out what process is listening/bind to the port according to google, e.g. fuser, lsof, unfortunately they are not available to my environment. So here's a work around to the problem.\n\n!! Requirement\n\n* List of suspecious process ID\n\n!! Solution\n\nFor each of the PID in your list run the following:\n{{{pfiles | fgrep}}}\n\np.s. pfiles lives in /usr/bin or /usr/proc/bin\np.s.s. you have to be the owner of PID to run pfiles against it
Use a tool called [[mp3again|http://mp3gain.sourceforge.net/]]. Unfortunately it only works on windows.
Log4j 1.3 has the capability but it is not released yet.\n\nIt is easy to create your own appender to do both. Have a look at rollOver() ~DailyRollingFileAppender and ~RollingFileAppender.\n\nUsing ~DailyRollingFileAppender as base is easier. Keeping in mind the following:\n* In ~DailyRollingFileAppender overwrite setQWForFiles to use ~CountingQuietWriter\n* Make sure you call closeFile() before rolling the file\n* Lastly just add the configuration values as fields in your patched appender so it can be configured by log4j.xml\n* For every instance of ~DailyRollingFileAppender you need to have same instance of ~RollingFileAppender
!! Syntax\nAll lines between Section 1 and Section 2, non-inclusively, \ni.e. the lines containing Section 1 and Section 2 will not be affected. \n{{{\n/Section 1/+,/Section 2/-\n}}}\n\n!! References\n# http://www.geocities.com/volontir/
[[See here|http://manuals.sybase.com/onlinebooks/group-as/asg1250e/refman/@Generic__BookTextView/142470;pt=142286]] and [[here|http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.help.ase_15.0.tables/html/tables/tables50.htm]]
{{{\nypcat hosts\n}}}
!!! Add new files\n{{{\nsvn st | egrep "^\s?" | while read st file; do svn add $file; done;\n}}}\n\n!!! Revert modified files\n{{{\nsvn st | egrep "^M" | while read st file; do svn revert $file; done;\n}}}\n\n//p.s. create unix aliases for the above commands makes them easily accessible//
The following 2 issues were discovered which I then created patches and sent to Josh.\n!! Status\nAccepted\n!! Cannot delete tiddlers with '&' character in title\nThe & symbol needed to be escaped before passed to AJAX request.\nInstead of escape() the patch should probably use encodeURIComponent() so it's consistent with how saveTiddlerText() encodes titles as there are [[differences between each encode method|http://xkr.us/articles/javascript/encode-compare/]]\n\n{{{\nIndex: serverside_9_6.js\n===================================================================\n--- serverside_9_6.js (revision 17)\n+++ serverside_9_6.js (working copy)\n@@ -920,7 +920,7 @@\n if (!store.tiddlers[title])\n return closeTiddler(title,false);\n \n- req= new Ajax.Request('/wiki/destroy', {asynchronous:true, parameters:"id=" +title, \nonSuccess:function(request){AJAX_DeleteTiddlerSuccess(request)}, \nonFailure:function(request){AJAX_DeleteTiddlerError(request)}});\n+ req= new Ajax.Request('/wiki/destroy', {asynchronous:true, parameters:"id=" +escape(title), \nonSuccess:function(request){AJAX_DeleteTiddlerSuccess(request)}, \nonFailure:function(request){AJAX_DeleteTiddlerError(request)}});\n // IE doesn't support attributes on XHMLHTTPrequest\n if (navigator.userAgent.indexOf("MSIE")==-1) \n req.transport.TiddlerTitle=title\n}}}\n//p.s. I manually wrapped the lines in the above patch to make it look nicer//\n\n!! Deleting tiddler does not delete associated record in tiddler_versions table\nIt might be intentional as acts_as_versioned codebase only deletes versioned records when they go over max limit.\nThis is how I patched the problem based on [[Rick's suggestion|http://rails.techno-weenie.net/forums/1/topics/67?page=1]]\n{{{\nIndex: app/models/tiddler.rb\n===================================================================\n--- app/models/tiddler.rb (revision 17)\n+++ app/models/tiddler.rb (working copy)\n@@ -3,6 +3,8 @@\n acts_as_versioned :limit => 10, :if => Proc.new { |t| !t.recently_revised? }, :if_changed => [ :body ]\n \n validates_presence_of :title\n+ \n+ after_destroy { |tiddler| self.versioned_class.delete_all ['tiddler_id', tiddler.id] }\n \n def recently_revised?; \n return false if new_record? or versions.length==0\n}}}\n\nI [[found|How to recreate SoloWiki tiddler versions?]] tiddler_versions were all deleted when a tiddler is deleted. Not sure when it started happening but I've further patched tiddler.rb to the following.\n{{{\nafter_destroy {|tiddler| self.versioned_class.delete_all "tiddler_id = #{tiddler.id}" }\n}}}
Ruby can run OS commands, the OS can be any OS that has Ruby.\n\nThere are a few ways of running OS commands but only {{{Kernel.system}}} will return true or false exit status of the OS command executed.\n\n!!! List of way to execute OS commands in Ruby\n* %x{} or %x[]\n* `` (backticks)\n* Kernel.exec\n* Kernel.system\n\nNote Kernel.exec replaces the Ruby process that called it. i.e. in irb, run {{{exec 'ls'}}} will terminate the irb session.\n
I [[discovered|http://forum.springframework.org/showthread.php?t=21881]] there was a [[problem with Spring wiring byType|http://opensource.atlassian.com/projects/spring/browse/SPR-1650]].
Rubygems' support for proxy using -p wasn't working as the proxy information would get lost when download starts.\nhttp://rubyforge.org/tracker/index.php?func=detail&aid=5390&group_id=126&atid=577
Check it out http://www.redkawa.com/mediacenters/wiimediacenterx/\nIt's written in Java, JSP & runs under Jetty.\n
If you uncheck the checkbox of a completed item and check (complete) it again then the item is not removed from the incomplete section.\n\nSolution: you must have "!~ToDo" as the heading before the incomplete list\n\nHowever the bug then becomes that the Completed heading is not above the completed items and new items are created under the Completed heading.
Use ''setx''.\ne.g.\n{{{\nsetx JAVA_HOME c:\sJava5\n}}}\nIt will modify existing variable or create it if it doesn't exist.\nBy default setx (or -m option) will create variable in user settings.\n\nTo create system settings use -m system. e.g.\n{{{\nsetx JAVA_HOME C:\sJava5 -m system\n}}}
Add {{{pause}}} at the end of the batch script.\nIt will prompt user to hit any key to continue. So it's not suitable if the batch script needs to be executed without user interaction (unless it the last script to run)
You would've seen the following error when you {{{rake rails:freeze:gems}}}.\n{{{\nERROR: While executing gem ... (ArgumentError)\n install directory "activesupport-1.4.0" not absolute\n}}}\n\nThe problem is in installer.rb extract_files() not receiving full path to the target directory to unpack gems from its caller unpack(). So the problem will happen when you {{{gem unpack any_gem}}} as well.\n\nYou just need to replace rubygems installer.rb's unpack() method with the following.\n{{{\n def unpack(directory)\n format = Gem::Format.from_file_by_path(@gem, @options[:security_policy])\n extract_files(File.expand_path(directory), format)\n end\n}}}
See http://svnbook.red-bean.com/nightly/en/svn-book.html#svn.branchmerge.commonuses.resurrect
Special variable\n{{{\n$:\n}}}
!! For classes\nAs below sample shows, ''extends'' adds module methods as ''class methods'' while ''include'' adds module methods as ''instance methods''.\n\n{{{\nirb(main):001:0> class X\nirb(main):002:1> end\n=> nil\nirb(main):004:0> module Y\nirb(main):005:1> def foo\nirb(main):006:2> p 'hi from foo'\nirb(main):007:2> end\nirb(main):008:1> end\n=> nil\nirb(main):009:0> X.foo \nNoMethodError: undefined method `foo' for X:Class\n from (irb):9\n from :0\nirb(main):011:0> X.extend Y\n=> X\nirb(main):012:0> X.foo\n"hi from foo"\n=> nil\nirb(main):013:0> class Z\nirb(main):014:1> end\n=> nil\nirb(main):015:0> Z.foo\nNoMethodError: undefined method `foo' for Z:Class\n from (irb):15\n from :0\nirb(main):017:0> Z.send :include, Y\n=> Z\nirb(main):018:0> Z.foo\nNoMethodError: undefined method `foo' for Z:Class\n from (irb):18\n from :0\nirb(main):019:0> z = Z.new\n=> #<Z:0x55488>\nirb(main):020:0> z.foo\n"hi from foo"\n}}}\n\n!! For instances\nInstances cannot include modules but can extend modules. The result is the module methods are added to instance method of the calling instance, while new instances of the class does not receive the module methods.\n\n{{{\nirb(main):021:0> class A\nirb(main):022:1> end\n=> nil\nirb(main):023:0> a = A.new\n=> #<A:0x4cb94>\nirb(main):025:0> a.send :include, Y\nNoMethodError: undefined method `include' for #<A:0x4cb94>\n from (irb):25:in `send'\n from (irb):25\n from :0\nirb(main):026:0> a.extend Y\n=> #<A:0x4cb94>\nirb(main):027:0> a.foo\n"hi from foo"\n=> nil\nirb(main):028:0> a2 = A.new\n=> #<A:0x3f494>\nirb(main):029:0> a2.foo\nNoMethodError: undefined method `foo' for #<A:0x3f494>\n from (irb):29\n from :0\n}}}
{{{\n~/work/shell\n$ cat file\na\nb\nc\nd\ne\n\n~/work/shell\n$ cat file | sed -n '/b/{n;p;}'\nc\n\n~/work/shell\n$\n}}}\n\nand [[many other useful sed command|http://sed.sourceforge.net/sed1line.txt]]
Read chapter 24 of Pickaxe.\n\n{{{\nirb(main):040:0> class T1\nirb(main):041:1> def self.hi\nirb(main):042:2> 'hi from class'\nirb(main):043:2> end\nirb(main):044:1> end\n=> nil\nirb(main):045:0> T1.hi\n=> "hi from class"\nirb(main):046:0> t = T1.new\n=> #<T1:0x25c31a8>\nirb(main):047:0> t.hi\nNoMethodError: undefined method `hi' for #<T1:0x25c31a8>\n from (irb):47\n from :0\nirb(main):049:0> t.class.hi\n=> "hi from class"\nirb(main):050:0> meta = class << T1; self; end\n=> #<Class:T1>\nirb(main):051:0> meta.hi\nNoMethodError: undefined method `hi' for #<Class:T1>\n from (irb):51\n from :0\nirb(main):061:0> module Patch\nirb(main):062:1> def hi_with_customisation\nirb(main):063:2> 'a new hi'\nirb(main):064:2> end\nirb(main):065:1> end\n=> nil\nirb(main):066:0> T1.send :include, Patch\n=> T1\nirb(main):067:0> T1.hi_with_customisation\nNoMethodError: undefined method `hi_with_customisation' for T1:Class\n from (irb):67\n from :0\nirb(main):070:0> T1.extend Patch\n=> T1\nirb(main):071:0> T1.hi_with_customisation\n=> "a new hi"\nirb(main):072:0> meta.alias_method_chain :hi, :customisation\n=> #<Class:T1>\nirb(main):074:0> T1.methods.select {|m| m =~ /hi/}\n=> ["hi_without_customisation", "hi_with_customisation", "hi"]\nirb(main):075:0> T1.hi\n=> "a new hi"\nirb(main):076:0> T1.hi_without_customisation\n=> "hi from class"\nirb(main):077:0>\n}}}
If it is a test then [[AbstractTransactionalSpringContextTests|http://www.springframework.org/docs/api/org/springframework/test/AbstractTransactionalSpringContextTests.html]] is a convenient base class to extend.\n\nOr use ~TransactionTemplate and setReadOnly on the given ~TransactionStatus is another option.\n
! Tools\n* What kind of workstation is provided ?\n* What's the version control process and tools ?\n* What software are supplied ?\n\n! Development\n* What's the deployment process (incl. all phases of development phases / env) ? \n* Describe how is automated testing used\n* What's the project methodology ?\n\n! Company\n* What products ?\n* Sales process ?\n* Support requirements ?\n* Company size and location ?\n
[[sp_procxmode say_hello, "anymode"|http://manuals.sybase.com/onlinebooks/group-as/asg1250e/sqlug/@Generic__BookTextView/55096;pt=55096;uf=0]] fixes the following error.\n{{{\norg.springframework.jdbc.UncategorizedSQLException: StatementCallback; uncategorized SQLException for SQL [exec say_hello]; SQL state [ZZZZZ]; error code [7713]; Stored procedure 'say_hello' may be run only in unchained transaction mode. The 'SET CHAINED OFF' command will cause the current session to use unchained transaction mode.\n; nested exception is com.sybase.jdbc3.jdbc.SybSQLException: Stored procedure 'say_hello' may be run only in unchained transaction mode. The 'SET CHAINED OFF' command will cause the current session to use unchained transaction mode.\n\nCaused by: com.sybase.jdbc3.jdbc.SybSQLException: Stored procedure 'say_hello' may be run only in unchained transaction mode. The 'SET CHAINED OFF' command will cause the current session to use unchained transaction mode.\n\n at com.sybase.jdbc3.tds.Tds.processEed(Tds.java:2988)\n at com.sybase.jdbc3.tds.Tds.nextResult(Tds.java:2292)\n at com.sybase.jdbc3.jdbc.ResultGetter.nextResult(ResultGetter.java:69)\n at com.sybase.jdbc3.jdbc.SybStatement.nextResult(SybStatement.java:220)\n at com.sybase.jdbc3.jdbc.SybStatement.nextResult(SybStatement.java:203)\n at com.sybase.jdbc3.jdbc.SybStatement.queryLoop(SybStatement.java:1698)\n at com.sybase.jdbc3.jdbc.SybStatement.executeQuery(SybStatement.java:1683)\n at com.sybase.jdbc3.jdbc.SybStatement.executeQuery(SybStatement.java:422)\n at org.springframework.jdbc.core.JdbcTemplate$1QueryStatementCallback.doInStatement(JdbcTemplate.java:357)\n at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:310)\n at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:372)\n at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:380)\n at org.springframework.jdbc.core.JdbcTemplate.queryForList(JdbcTemplate.java:411)\n at info.shenie.RollbackTransactionalTest.testStoredProcedure(RollbackTransactionalTest.java:18)\n at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)\n at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)\n at org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:69)\n at com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:32)\n}}}
I've used OS X ~StartupItems, which you can [[download|http://shenie.googlecode.com/svn/trunk/nginx_startup_items.tar.gz]] at my [[google code|http://code.google.com/p/shenie/]]. You should be able to use it assuming:\n* nginx was installed to /usr/local/nginx\n* /usr/local/sbin/nginx exists and starts nginx\n\nI created the startup item using [[Creating a Startup Item|http://developer.apple.com/documentation/MacOSX/Conceptual/BPSystemStartup/Articles/StartupItems.html#//apple_ref/doc/uid/20002132]] reference from Apple.\n\nAccording to the reference, I should be using [[launchd|http://developer.apple.com/documentation/Darwin/Reference/ManPages/man8/launchd.8.html#//apple_ref/doc/man/8/launchd]] instead of startup items. Maybe I'll try that when I get Leopard.\n<<<\nNote: The launchd(8) facility is he preferred mechanism for launching daemons in Mac OS X v10.4 and higher. Unless your software requires compatibility with Mac OS X v10.3 or earlier, you should use the launchd facility instead of writing a startup item. For more information, see “Guidelines for Creating and Launching Daemonsâ€.\n<<<\n\nBut reviewing my old personal notes, I noticed I wrote down that there is a bug with launchd with OS X 10.4.7. Maybe I'll try again when I upgrade to Leopard.
Currently, activerecord 1.15.3, [[ActiveRecord Calculation methods|http://railsmanual.com/module/ActiveRecord::Calculations::ClassMethods]] does not support multiple group by conditions.\ni.e. the following will not return txn_type in the results.\n{{{\n>> Txn.sum(:amount, :group => 'txn_type, reconciled')\n}}}\nThe resultset from the sql still has txn_type.\n{{{\n[{"txn_type"=>"deposit", "sum_amount"=>"30", "txn_type_reconciled"=>"0"},\n {"txn_type"=>"deposit", "sum_amount"=>"100100", "txn_type_reconciled"=>"1"},\n {"txn_type"=>"expense", "sum_amount"=>"2610", "txn_type_reconciled"=>"0"},\n {"txn_type"=>"expense", "sum_amount"=>"11990", "txn_type_reconciled"=>"1"},\n {"txn_type"=>"income", "sum_amount"=>"129", "txn_type_reconciled"=>"0"},\n {"txn_type"=>"payback", "sum_amount"=>"25", "txn_type_reconciled"=>"1"},\n {"txn_type"=>"transfer", "sum_amount"=>"1796", "txn_type_reconciled"=>"0"},\n {"txn_type"=>"transfer", "sum_amount"=>"1776", "txn_type_reconciled"=>"1"},\n {"txn_type"=>"withdraw", "sum_amount"=>"30", "txn_type_reconciled"=>"1"}]\n}}}\nBut the final result doesn't contain txn_type.\n{{{\n=> [["0", 30.0], ["1", 100100.0], ["0", 2610.0], ["1", 11990.0], ["0", 129.0], \n["1", 25.0], ["0", 1796.0], ["1", 1776.0], ["1", 30.0]]\n}}}
So the log file doesn't push me over my windows profile size limit.\nTry pass the following parameter when you start squirrel (with your choice of directory)\n{{{\n--user-settings-dir=c:\sworkspace\n}}}
Without access to DB Artisan, [[sybmon|http://www.midsomer.org/sybmon/sybmon.html]] is the next best thing.
I discovered by accident that most of the tiddler versions of this wiki were missing. Not that it is a big deal as I backup the database regularly but the problem is that there is now a opportunity to get exception when revisions button is clicked.\n\nI considered patched the code so that it doesn't throw method not found error (basically Java's ~NullPointerException) when tiddler revisions doesn't exist. But I decided it was easy to just recreate the data.\n\np.s. it technically just recreate the latest version record but that's good enough to stop the errors.\n\nSo here's what I did\n{{{\ndelete from tiddler_versions\n\ninsert into tiddler_versions\n (tiddler_id, version, title, modifier, body, tags, updated_on, created_on, private) \nselect id, version, title, 'YourName', body, tags, now(), now(), private from tiddlers\n}}}
The predefined variable ''$:'' contains an array of paths that Ruby goes through to search for files to require or load.
The bash alias command doesn't handle aliases with arguments :( (see man bash)\nhttp://forums.macosxhints.com/archive/index.php/t-2269.html\nhttp://www.unix.com/archive/index.php/t-14217.html\nhttp://www.mail-archive.com/lftp@uniyar.ac.ru/msg02718.html\nhttp://www.unix.com/showthread.php?s=&threadid=2830\nhttp://www.unix.com/showthread.php?s=&threadid=4310
Easiest way is to enclose the regex commands in double quotes. e.g.\n{{{\nname="bar"\necho "hi foo" | sed -e"s/foo/${name}/"\n}}}\n\nMore options from http://www.unix.com/showthread.php?s=&threadid=14085
This gives you all directories that are checked out from svn.\n{{{\nfind . -mindepth 2 -maxdepth 2 -name .svn -type d | sed -e's/\s.svn//'\n}}}\n\nPipe it to the following to check status (or change to anything else you see fit)\n{{{\nxargs svn st --ignore-externals\n}}}
Use the command strings. e.g.\n{{{\nstrings /usr/bin/less\n}}}
So in regex the following is a grouping-only parentheses, a.k.a //non-capturing// parentheses\n{{{\n(?:abc|xyz)\n}}}\nbut what does the '':?'' in the following mean?\n{{{\n(:?mswin|mingw)\n}}}\n\nahhh I spoke to the author of the patch, and he confirmed that it is a typo. It was meant to be {{{(?:...)}}}
Enter the following in address bar and find the file you want to save.\n{{{\nabout:cache?device=disk\n}}}\nActually this technique works for other media files as well.
Instead of\n{{{\n%w[mocha heckle].each { |g| gem g }\n}}}\nyou can write\n{{{\n%w[mocha heckle].each(&method(:gem))\n}}}\nfrom [[_why|http://redhanded.hobix.com/bits/gem_mirror_only.html]] and [[Dan|http://www.dcmanges.com/blog/29]] extended it to creating new objects.
To access profile manager you need to start firefox with --ProfileManager option. i.e.\n{{{\nfirefox --ProfileManager\n}}}\nNote on OSX, the firefox executable will be in the following directory assuming it was installed to /Applications.\n{{{\n/Applications/Firefox.app/Contents/MacOS\n}}}\n\nThere is an option in profile manager to always ask for profile when starting firefox.\nThat comes in handy for 2 people to have their own preferences under the same OSX login.\n\nHowever in OSX you'll normally only be able to start one instance of Firefox. So you wouldn't normally be able to start 2 firefox instances with different profile.\n\nTo get around that, you'll have to start the second firefox via command line. The following command will start another firefox with the specified profile.\n{{{\nfirefox -P another_profile\n}}}\nYou can add an & to the end of the command to get the prompt back.
For Win32, GTK, Mac OS and Photon:\n{{{\n :set guifont=*\n}}}\nwill pop-up font selection dialog.\n\nIf you want to save the change to vimrc but don't know the font name then do a {{{:set guifont}}}, the complete setting will be displayed in the command section so all you need to do is put the command in your vimrc file. e.g.\n{{{\nset guifont=Bitstream_Vera_Sans_Mono:h12:cANSI\n}}}\n\nDownload Bitstream Vera fonts [[here|http://www.gnome.org/fonts/]]\n\nYou can change DOS prompt as well but you will need to add a new font via registry in \n{{{\nHKLM/Software/Microsoft/Windows NT/CurrentVersion/Console/TrueTypeFont\n}}}\nThe new entry should be a string value called 00 with a value of Bitstream Vera Sans Mono (the name of the font).\n\nThen the new font will appear in DOS properties for you to select. But you will need to restart before the setting will become effective and stick around.
For gem version equal or later than 0.8.5 use\n{{{\ngem update --system\n}}}
You'll need to add new fonts to your registry. See the following link for more details.\nhttp://www.orablogs.com/duffblog/archives/001209.html
qnap\n\nhow to restart cron \n/etc/init.d/crond.sh restart\n\nhow to setup autorun.sh\n\nOn the TS-109/209/409 series NAS use the following:\n\n 1. mount /dev/mtdblock5 -t ext2 /tmp/config\n 2. cd /tmp/config\n 3. rm autorun.sh\n 4. ln -s /path to your file/autorun.sh autorun.sh\n 5. cd /\n 6. umount /dev/mtdblock5\n\n\nhow to change crontab\n\n/etc/config/crontab\n/tmp/cron/crontabs/admin\n\nhttp://forum.qnap.com/viewtopic.php?f=11&t=9682&p=44321&hilit=cron#p44321\n
You need to set the following\n{{{\nLDFLAGS="-arch x86_64" ./configure\n}}}\n\nBut it's probably not a good idea to use 64bits mysql if you are doing rails.\n
{{{\nsudo scutil --set HostName servername.example.com\n}}}
! Tips\n[[How to delete a branch inside the source git repo without logging to the box that host the git repo?|http://github.com/guides/remove-a-remote-branch]]\n{{{\ngit push {repository} :heads/{your_branch_here}\n}}}\n\nHow to push local branch to remote branch for the first time?\n{{{\ngit push origin devel-something:refs/heads/devel-something\n}}}\n\n! Bookmarks\n* [[A tour of Git: the basics|http://cworth.org/hgbook-git/tour/]]\n* [[Manage source code using Git|http://www.ibm.com/developerworks/linux/library/l-git/]]\n* [[A tutorial introduction to git|http://www.kernel.org/pub/software/scm/git/docs/tutorial.html]]\n* [[GitFaq — GitWiki|http://git.or.cz/gitwiki/GitFaq]]\n* [[A git core tutorial for developers|http://www.kernel.org/pub/software/scm/git/docs/core-tutorial.html]]\n* [[git for the confused|http://www.gelato.unsw.edu.au/archives/git/0512/13748.html]]\n* [[The Thing About Git|http://tomayko.com/writings/the-thing-about-git]]
http://svnbook.red-bean.com/
! My observation on how ~ClearCase affects the team\n* not updating your own codebase often because\n** update is pretty slow\n** risk of codebase not compiling after update as checked out/hijacked code are not updated\n* more ~CruiseControl failures because\n** accidental check-in files before they are complete when refactoring or creating new files\n** newly created files not checked in\n* ~CruiseControl failures de-sensitises team, i.e. people stop caring/responding to build failures making ~CruiseControl less useful\n** as a result, reduced team moral\n\nThe above issues are avoidable but the main points are:\n* it's not suppose to be this hard\n* workflow using ~ClearCase is not efficient and optimised for developers\n* what are the benefits with keep using ~ClearCase?\n** why can't we move away from it?\n** what can ~ClearCase give you other less sucky vcs can't?\n\nAlso some general issues with ~ClearCase\n* there are not that many people know how to use it well & efficient\n* it is not a tool to attract/retain staff\n* developers are just not happy using it\n
!! script/console\n* y (converts input to yaml)\n* app.flash\n* app.get '/projects'\n* app.cookies\n* app.assigns\n* helper\n* output of last command is in _ (underscore)\n\n!! block in view\n* yield outputs directly to the view\n* use concat to print to the view\n* concat requires binding as second arg, think of binding and the context of block's view. ** i.e. concat("foo", block.binding)\n* if you want to save the block result then use capture(&block)\n* use concat & capture to be able to use content_tag method
! XSLT include\nIf you source to stylesheet is specified in absolute path then the transformer will not be able to derive relative xsl:include URL unless you set the system ID on ~StreamSource.\ne.g.\n{{{\nStreamSource source = new StreamSource(inputStream, stylesheetDirectory);\nTransformer transformer = TransformerFactory.newInstance().newTransformer(source);\n}}}\n\n! XSL FO external-graphic\nIf you want to use relative path in external-graphic then you will need to set the baseDir property in FO Configuration.\ni.e.\n{{{\norg.apache.fop.configuration.Configuration.put("baseDir", baseDir);\n}}}
# [[Shooting|http://magazine.stack.com/TheIssue/Article/3730/Shooting_Form_with_Ray_Allens_Coach.aspx]]\n# [[Dribbling|http://magazine.stack.com/TheIssue/Article/4128/Basketball_expert_on_ball_handling_tips.aspx]]\n# [[Defense|http://magazine.stack.com/TheIssue/Article/6084/Lockdown_Any_Baller.aspx]]\n# [[Lateral jumps|http://magazine.stack.com/Exercises/3513/Lateral_Box_Jumps.aspx]]\n\nhttp://magazine.stack.com/TheIssue/Article/2376/Basketball_Quickness_with_the_Boston_Celtics.aspx\nhttp://magazine.stack.com/TheIssue/Article/2213/agility_drills_from_basketball_training_experts.aspx\nhttp://magazine.stack.com/TheIssue/Article/3511/speed_drills_with_mike_bibby.aspx\nhttp://magazine.stack.com/TheIssue/Article/4760/dribbling_drill_for_basketball.aspx\nhttp://magazine.stack.com/TheIssue/Article/3202/offensive_skills_with_the_washington_wizards.aspx\n\n<<<\nOne on One Low and Go Move\nStep\n1\nBE IN TRIPLE THREAT POSITION WITH THE BALL PROTECTED FROM THE DEFENDER. Triple threat is when you are in position to be able to shoot, dribble or pass. Your knees are bent and your body is square to the basket.\nStep\n2\nCHOOSE A PIVOT FOOT. This is the foot that will remain in place until you take your first dribble. For beginners, your pivot foot should be the foot that is opposite your strong hand. For instance, if you are a right-handed player your left foot will be your pivot foot. For more advanced players, keep your defender off-guard by switching your pivot foot during the course of the game.\nStep\n3\nNOTICE THE DEFENDER'S POSITION. You want to identify the defender's foot that is closest to you--in other words, his/her lead foot.\nStep\n4\nTAKE A LONG STRIDE TO POSITION YOUR FOOT NEXT TO THE DEFENDER'S LEAD FOOT. Be sure that you have not moved your pivot foot.\nStep\n5\nSTAY VERY LOW AND KEEP YOUR HEAD BEHIND YOUR EXTENDED KNEE. To see if you are low enough, your shoulder should be rubbing up against your defender's waist. This makes it difficult for the defender to put a body on you or to steal the ball.\nStep\n6\nQUICKLY MOVE PAST YOUR DEFENDER. As soon as your foot is next to their foot, take a low, hard dribble while your body is low to the ground to propel you past the defender.\n<<<
Install jruby, ~ActiveRecord-JDBC gem and activerecord then you should be able to establish connection like the following in jirb.\n{{{\nrequire 'rubygems'\ngem 'ActiveRecord-JDBC'\nrequire 'jdbc_adapter'\ngem 'activerecord'\nrequire 'active_record'\nActiveRecord::Base.establish_connection(\n :adapter => 'jdbc', \n :username => 'admin', \n :password => 'admin',\n :driver => 'com.sybase.jdbc3.jdbc.SybDriver',\n :url => 'jdbc:sybase:Tds:server:port/database'\n)\n}}}\n\n!! Problems with Sybase with ~ActiveRecord-JDBC\n* It is not handling primary key properly\n{{{\nActiveRecord::Schema.define do\n create_table :cars do |t|\n t.column :id, :integer, :null => false\n t.column :name, :string\n end\nend\n}}}\nThe above code will generate invalid SQL\n{{{\nCREATE TABLE cars \n(id primary_key, name varchar(2048) DEFAULT NULL)\n}}}\n\n* It is not handling row limit properly\n{{{\nclass Car < ActiveRecord::Base\nend\n\nCar.find(:first)\n}}}\nAgain generates invalid SQL\n{{{\nSELECT * FROM cars LIMIT 1\n}}}\n\nBoth of the above works fine with sybase_adapter.rb that comes with rails' activerecord, the problem is in the jdbc_adapter.rb from ~ActiveRecord-JDBC.
! ~ToDo\n[ ] ability to reconcile against a csv file\n[ ] Ability to create split items\n[ ] Fix roodi & metrics:all so they can run in romey\n[ ] Review & fix quality failures in romey\n[ ] Show page for transactions\n\n! Consider these\n* [[Change Romey to ActiveRecord session store|http://errtheblog.com/post/24]]\n\n! Deleted ideas\n* Create a release includes all the gem & plugins required and use ~SQLite\n\n! How to create download, run & no step 3 Romey install process\n* Add [[DLL|http://www.sqlite.org/sqlitedll-3_3_10.zip]] to project. e.g. lib/natives/win32\n* Unpack sqlite gem and add it to load path in environment.rb\n{{{\n config.load_paths << "#{RAILS_ROOT}/vendor/sqlite3-ruby-1.2.0-mswin32/lib"\n}}}\n* Freeze rails gems\n* Include sqlite database.yml\n\n<<addnewtodo>>\n\n! Completed\n[x] Make title more contextual\n[x] Make cashflow visible\n[x] Able to set aside $$ for specific purposes. e.g. share, holiday etc\n[x] Do this http://blog.martyandrews.net/2009/05/enforcing-ruby-code-quality.html\n[x] Display weekly budget amount\n[x] Make budget details more visible\n[x] use calendar to select date (copy from cal-feed)\n[x] Remove vendor specific SQL from finders\n[x] Add today's transaction summary\n[x] Upgrade to Rails 1.2\n[x] Different color for transfer transactions\n[x] Different color for future transactions\n[x] Remove income account from to account drop down list\n[x] Color looks bad on windows\n[x] Improve frequency maintainence screen\n[x] Add th to txn list\n[x] Extract color styles from style.css\n[x] Change fonts