Here it is:
ruby download/install sys-proctable gem
then require it
then
ProcTable.ps[0].cmdline
Monthly Archives: December 2008
java how to tell if an httpserver has closed yet
here it is:
while(true) {
try {
ServerSocket testClosed = new ServerSocket(httpPort);
testClosed.close();
System.out.println("CLOSE SUCCESS\n\n\n\n\n\n\n" + httpPort);
break;
}
catch(IOException e) {
// still in use...
System.out.println("CLOSE FAILURE\n\n\n\n\n\n\n");
Thread.sleep(100);
}
}
skype phone adapter doesn’t let you dial out
So…you buy a new skype rj11 adapter and it doesn’t let you dial out (it doesn’t pick up)? Never fear:
install skypemate
then right click on it -> advanced -> device options -> adaptor default channel set to USB and you can dial!
from:
http://www.amazon.com/Eforcity-Adapter-Interface-connects-network/dp/B000JCU88S
in terms of “open source skypemate” here is something:
Skypemate simply provides the button functionality to use it as a real phone.
But then how does it detect pick up?
to use: you dial 001+area code+number+#.
or dial “speed number as a two digit number” then #
from
http://www.von-phone.com/guide-skype-b2k-windows.php#speeddial
something cool I wish for ruby
I wish ruby had a lint parser to tests for:
unreachable statements
maven mixing junit and testng modules
Don’t do it. Turns out that you currently can’t, it seems [with junit 4 stuffs].
see
http://jira.codehaus.org/browse/SUREFIRE-377?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=159395#action_159395
maven woe
If you use maven and it says “BUILD FAILED” go and see the logs and you go there and the logs are blank…It may mean that
a runtime exception is thrown in an @BeforeClass method, maven terminates with “go and see the log generated” message, however the generated log files are blank.
maven woe
So…you try and run your junit 4 tests’s with maven and none of them run? Or it requires all of your methods to have the test prefix?
You may have this in your pom.xml
Note the old version! Beware!
java naming woe
——————————————————-
Exception in thread “Thread-0″ java.lang.RuntimeException: javax.naming.NoInitialContextException: Need to specify class name in environment or system
property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
at org.xxx.utilities.ConfigurationReader.prepareConfigurationURL(ConfigurationReader.java:112)
at org.xxx.utilities.ConfigurationReader.getURL(ConfigurationReader.java:132)
at
this meant “you need to specify the context within the newly created thread, as well as the main thread, of your test, otherwise it doesn’t transfer cleanly” — I think
ruby how to display stack trace with parameters
Isn’t quite there yet but here’s how to almost do it: outputs [something almost like] this:
c:\dev>ruby -rtracer2 crash.rb
|#0:crash.rb:4:Object:>: def go a
args were [["a", 3]]
|#0:crash.rb:5:Object:-: go2 a, 55
| |#0:crash.rb:1:Object:>: def go2 a, b
args were [["a", 3], ["b", 55]]
| |#0:crash.rb:2:Object:-: raise
|#0:crash.rb:3:Object:<: end
#0:crash.rb:6:Object:<: end
for file:
crash.rb:
def go2 a, b
raise
end
def go a
go2 a, 55
end
go 3
Go and get it: http://wilkboardonline.com/roger/tracer2.rb
Note also that ruby-debug has the "--trace" option which is similar but not quite as cool
how to get the current methods parameter values in ruby
Here it is
require 'ruby-debug'
Debugger.start
... # code
then
args = Debugger.current_context.frame_args 1 rescue nil # may need to tweak this number
and their value
eval (arg[0], Debugger.current_context.frame_binding(2)) # grab a value