One week ago I started a blog called JRuby Scout . I blogging there about JRuby in general and interesting JRuby resources I found.
If you’re into JRuby you might want to subscribe to the RSS feed or follow @JRubyScout .
Software as a Business
25 days ago
One week ago I started a blog called JRuby Scout . I blogging there about JRuby in general and interesting JRuby resources I found.
If you’re into JRuby you might want to subscribe to the RSS feed or follow @JRubyScout .
25 days ago
html5doctor has a good flowchart leading you to the right content elements in HTML5:
200 days ago
“People who can code in the world of technology companies are a dime a dozen and get no respect. People who can code in biology, medicine, government, sociology, physics, history, and mathematics are respected and can do amazing things to advance those disciplines.”
— Zed Shaw
329 days ago
“Nur wenige leben in der Gegenwart; die meisten bereiten sich darauf vor, demnächst zu leben.” Jonathan Swift
336 days ago
An excellent Talk by Robert Martin called “What Killed Smalltalk Could Kill Ruby, Too” that shows why test driven development (TDD) as a concept is so important, not only for Ruby projects but for every software project.
The TDD relevant part starts at 23m 56s .
336 days ago
Chris Heald shows in his article ‘JRuby Performance: Exceptions are not flow control’ how the anti-pattern of using ‘exceptions as flow control’ has an serious effect on the performance.
Thanks to headius logging the exceptions is as easy as:
jruby -Xlog.exceptions=true -Xlog.backtraces=true -Xlog.callers=true -S trinidad 2>&1 | grep "Backtrace generated" -A4
BTW: trinidad is used to run rails and rackup applications in an embedded Apache Tomcat
466 days ago
Eine der besten und prägnantesten Übersichten für die UML (Unified Modelling Language) habe ich bei Wikipedia gefunden.
Leider wurde es dort nur im PNG bzw. SVG Format veröffentlicht. Daher habe ich es vom Vektorformat direkt nach PDF konvertiert, das sich am besten von allen Formaten ausdrucken läßt.
Herunterzuladen hier:
560 days ago
Hintergrund: Applikationen speichern meist ihre Anpassungen an andere Sprachen in eigenen Verzeichnissen. Ein Verzeichnis mit dem Namen de.lproj deutet auf eine deutsche Anpassung hin. Wenn die Applikation diese Sprachdateien nicht mehr findet, nimmt sie die Standardsprachversion, hier also Englisch.
562 days ago
You can think of BTrace as a scriptable debugger or logger: you set breakpoints and when your breakpoints are hit some script gets executed:
This means you can inject tracing into an already running java program. No changes to the source code of your program are needed. No additional jars need to be loaded by your program.
The scripting is done in Java and no compilation step is needed. See the example below.
The btrace download is available here .
The user guide is here .
Let’s assume we want to get a notification every time a thread is started.
Now let’s create the tracing script i.e. java class. Create a java class named BTraceThread.java:
import com.sun.btrace.annotations.*;
import static com.sun.btrace.BTraceUtils.*;
@BTrace
public class BTraceThread {
// @OnMethod annotation tells where to probe.
// In this example, we are interested in entry
// into the Thread.start() method.
@OnMethod(
clazz=“java.lang.Thread”,
method=“start”
)
public static void func() {
// println is defined in BTraceUtils
// you can only call the static methods of BTraceUtils
println(“about to start a thread!”);
}
}
If it ain’t running already, start the program that shall be traced. I’ll use JRuby IRB to start some threads interactively.
We need now the pid of the IRB. Find the already running Java programms with
jps -l
Which returned on my machine:
17404 org.jruby.Main
Which means we got 17404 as the pid of our programm.
Now run your btrace script with:
btrace 17404 BTraceThread.java
Everything is in place now. Let’s start some threads using JRuby IRB:
t = Thread.new do puts "New thread started at #{Time.now}" end
Everytime a new thread starts you should see ‘about to start a thread!’ .
D:\>C:\Programme\Java\btrace\bin\btrace 17404 BTraceThread.java about to start a thread! about to start a thread! about to start a thread! about to start a thread! about to start a thread! about to start a thread! about to start a thread! about to start a thread!
582 days ago
Logfiles tend to grow and grow and grow. The other day I had a log file about 1.3 GB large.
The relevant logging was only in one part of the file. Handling such a big file is a nightmare using most editors. I could open it but the editor would crash as soon as I tried to delete some parts of the file.
What I needed was the part of the file which contains the log entries for the load test, i.e. split the file into smaller parts – or – even better, cut the parts off that I would not need for my analysis.
As expected Unix-based operating systems have some built-in tools for this task:
split : Splits a file into equal-sized parts.
or
csplit : Splits a file into context-based parts.
Examples:
Create a new file named ‘output.log.00’ . It should contain only the part of the file input.log beginning with the line that matches the regular expression ‘^17:15:’ . I.e. give me everything from 17:15 until the end of the file:
csplit -f output.log. input.log '%^17:15:%'
Now create two files out of ‘output.log.00’: One containing everything before 18:00 (6pm) and one for the remaining part. I.e. I want a file named ‘log.17.00’ which contains all log entries from 17:15 until 18:00 .
csplit -f log.17. output.log.00 '/^18:/'
Using Windows? I’d recommend to install cygwin which provides split/csplit and many other useful Unix tools. In my opinion a must-have for every serious software developer working on this platform.