Aug 162012
 

It happens quite regularly that I need to extract a JAR or WAR file for a brief inspection. Of course I can do it on command line however, when operating in Finder I wanted to get something that just unarchives a selected file by mouse click. 

To achieve this I used for the very first time Automator, a tool I didn’t really think would be providing a solution to any of my needs. What I did do:

  • Open Automator
  • New > Service
  • In the drop down menus choose in Service receives selected files or folders in Finder.app
  • In Actions search for Run Shell Script and double click on it
    • enter this as command line unzip -n “$1″ -d “$1″.zip
    • select for Pass input as arguments
  • Click on Save and give a name, e.g. Extract Archive

To verify:

  • Open Finder
  • Right click any archive
  • In the context menu select Services > Extract Archive

Note: As a filetype cannot be selected the menu is available for all files and folders. If you select something that is not a extractable with unzip you’ll see an error message.

Popularity: 3% [?]

Tags: , , , ,
Jul 122012
 

I recently changed my job and so I have now new duties and responsibilities. Mainly understanding devops processes as they are currently and then scoping out improvements, introducing new tools, processes etc. I’m a master on drafting everything on whiteboards, however there are 2 drawbacks:

  • nobody except me seems to be able to read my handwriting, so sending out photos of whiteboards only causes WTF’s
  • it’s kinda hard to annotate, rearrange or optimize what has been written down and photographed

So I had a look how to easily translate my drawings into something readable. I don’t own a visio license, I checked a few commercial tools but didn’t find the one that was made for me in terms of simplicity, usability and flexibility. 

My first find was yEd, a nice editor to easily draw diagrams. I did do a couple of server/network layouts with it, documented processes and it worked out quite well. But then there was a graph i couldn’t draw – basically a version control branching strategy for a set of enterprise products. I picked up one of my co-workers presentations and followed up with drawing in powerpoint which was better than expected but not quite satisfying. 

Today I had to draw just another graph and neither yEd nor Powerpoint fitted the requirements:

  • I wanted to easily extend/modify the objects
  • I did not want to arrange object manually
  • I didn’t want to get distracted by moving pixels but i wanted to focus on content. 

I decided to use dot language as it is plain text, generates graphs and takes care about the alignment of objects itself. I used dot indirectly a few days ago when I used vizant to generate a documentation over a set of ant files and jaranalyzer to outline dependencies between jar files. The dot documentation looked a bit to brief for me so I did use the sample gallery and just picked a graph that contained something I needed and 2h later I ended up with my complete whiteboard in a nice and presentable way. All change request I implemented within minutes and the output always was a nice looking, technical graph. I used graphviz for visualization and export to image files. Graphviz is quite sweet, it loads file changes straight away, so I had my text editor and graphviz side by side to get an instant preview.It seems there is a reasonable community using it as all my questions were asked before and got answered at stackoverflow.com.

Here a little example for a graph:

digraph “G” {

  // general config

node [style=filled, color=grey97, fontname=Helvetica, fontsize = 12];

edge [color=grey50]

// ranking

{rank = same; start1, “start2″}

{rank = same; aDone, bDone}

// boxes

    subgraph cluster_a {

    [ label="a box", color=lightsteelblue1, style=filled;fontcolor=dodgerblue3];

subgraph cluster_aa {

    [ label="a box in a box", color=lightsteelblue2, style=filled;fontcolor=dodgerblue3];

    organge ; normal;

   

longLabel; 

}

 

   subgraph cluster_b {

   [ label="another box", color=gray90, style=filled; fontcolor=dodgerblue3];

taskB

      -> bDone;

    } 

 

    subgraph cluster_c {

   [ label="invisible box", color=white, fontcolor=dodgerblue3];

anotherLabel; 

}

 

    start1 -> taskA;

 

    “start2″ -> {normal organge } -> join -> taskA -> aDone  -> taskC -> done;

    “start2″ ->  longLabel -> anotherLabel -> join ;

 

    join -> taskB [label="edge label", fontcolor=grey];

    // node aliases and configuration

    node aDone [label="a",color=green2]

    node bDone [label="b",color=green4]

    node longLabel [label="a long label\nwith line break"]

    node join [label="join and fork"]

    node anotherLabel [label="another label"]

    node organge [label="organge",color=bisque2]

node done [color=grey80]

}

Below is the generated image:
  • it contains layout configurations for nodes and edges (colors, fonts)
  • boxes of type cluster
  • color highlightings
  • edge lables
  • ranks to aling elements

this is a subset of what I have done today. Considering that I looked into it today for the first time and that i got everything the way I wanted I’m quite happy. I admit a graph like this can be easily done in any other visualization tool. However, the power of dot is in how simple it is to do modifications. Anohter sub graph or another order of elements won’t require major reconstruction work. simply change the order and that’s it. 

graph output

Popularity: 19% [?]

Tags: , , , , , ,
Jun 282012
 

A small, handy way to find stuff easily via commandline in a set fo files:

grep -inHR “search term” –include=’*.xml’ *

  • i ignore-case
  • n line number
  • H Print the filename for each match
  • R  –include=<Pattern> Recurse in directories only searching file matching <Pattern>
  • * The preceding item will be matched zero or more times.

in all sub folders in a given folder all files that end with xml and contain search term are listed in the output with name and the matching line including the line number.

I used to use file search in ultraedit, however my license expired and ultraedit on mac is not quite as powerful as its Windows equivalent so I didn’t bother to renew. Grep is my new best friend. 

Update: sweet example:

grep -inRH “4.7.0″ –include=’*pom.xml’ * -B2

is looking in pom files that contain the given string and prints out 2 lines before.

Popularity: 2% [?]

Tags: , , ,
Mar 222012
 

I just found out how to do youtube on a PS3. Just simply go to internet search and search for youtube.com/xl. This opens youtube in a specific, maximized view which is perfect for display and navigation on PS3. Sweet. I guess husband and I will watch W. W. Young’s silent movie Alice in Wonderland from 1915 later on the big screen :)

Popularity: 4% [?]

Tags: , ,
Mar 042012
 

I haven’t used org-mode in the past few months and when I was using it this week the PDF export was broken. Instead of getting a PDF output I got this error

LaTeX Error: File `wrapfig.sty’ not found.x

As I haven’t changed anything regarding emacs nor org-mode installation it took me a while to figure how to solve it. I have org-mode installed via mac ports, I might have done a port upgrade outdated at some point and this might have caused the issue. Now, how did I get it working again?

  • sudo port selfupdate :: I haven’t touched macports in a while.
  • sudo port upgrade org-mode :: I upgraded org-mode hoping that this would solve it. I got a minor upgrade (7.0.2 -> 7.0.3), the error still occured.
  • sudo port upgrade texlive-latex-extra :: this is the file that supposedly contains all the missing file. 
  • sudo texhash :: to rebuild TeX-inputfiles-database
  • changing my emacs configuration :: I added the line (require ‘org-latex) in the ~/.emacs file and restarted emacs.

That did do the job, now the PDF export runs again. Jippieh!

Popularity: 5% [?]

Tags: , , , , , , ,