Kah – The Developer

Using Sed to Process a Set of Files

Posted by: kahgoh on: 6 February, 2010

In Creating a File Set Processing Script with Vim, Vim was used to quickly create a script for processing a set of files. Using Vim to generate the script works well if the operation only needs to done once. However, if you have to perform the whole operation later on another set of file, you would have to repeat the whole process. If you have Sed installed, the process may be simplified so that you can do it all on the command line.

Read the rest of this entry »

Tags: , ,

Finding Vertices on a Graph in Jung

Posted by: kahgoh on: 5 February, 2010

Finding the vertex or edge at a specific point, or the set of vertices in a certain area, requires the graph’s pick support. The support is obtainable from VisualizationViewer’s getPickSupport method. The support is actually an implementation of GraphElementAccessor and contains the following methods:

    V getVertex(Layout<V,E> layout, double x, double y);

    Collection<V> getVertices(Layout<V,E> layout, Shape rectangle);

    E getEdge(Layout<V,E> layout, double x, double y);

Read the rest of this entry »

Tags: ,

Creating a File Set Processing Script with Vim

Posted by: kahgoh on: 3 February, 2010

In Vim, the r! ex command will insert the contents of standard output of a command. Combining this with Vim’s powerful subsitute command, it is possible to write a batch script over a set of files. In this example, Vim is used to quickly change the extension of a number of files in a directory.

Read the rest of this entry »

Tags:

Controlling the Appearance of Vertices and Edges in Jung

Posted by: kahgoh on: 30 January, 2010

In Jung, if you want to control of the vertices or edges, you need to provide the appropriate Transformer to the RenderContext in the BasicVisualizationServer. From the Transformer’s documentation it is simply an interface that is “implemented by classes that transform one object into another“. In Jung the Transformer “transforms” a vertex or edge to a colour, shape, text or something else that controls their appearance.

Read the rest of this entry »

Tags: ,

Making Fields Focusable in a JPopupMenu

Posted by: kahgoh on: 17 January, 2010

Custom Swing popups are often created using a JPopupMenu. Some custom popups may contain input fields, such as a JTextField or a JSpinner. For these fields to be able to gain focus when the popup (or popup menu) is displayed, the invoker should be set prior to making it visible with setVisible. The invoker is usually the component that the user has to interact with in order to cause the popup to show. The invoker is set by calling the popup menu’s setInvoker.

Read the rest of this entry »

Tags: ,

Manipulating HTML elements with Javascript

Posted by: kahgoh on: 2 January, 2010

In this tutorial, Javascript is used to update the contents of elements on a page according to user inputs. A HTML page contains buttons for three random Korean characters, a copyright symbol and a square root sybmol and a text area for textual input. When a button is pressed, the character’s unicode is passed to the script, which converts it and appends it to the text area. The script also updates displays the contents of the text area on the same page.

Read the rest of this entry »

Appending Extra Options to a List Field in OpenOffice Base

Posted by: kahgoh on: 12 December, 2009

Many forms have at least one drop down field that provides a list of choices, with one option being an “other, please specify” type field. In OpenOffice Base, the source providing the list of options could be another table. In this case, you do not want to add an entry into the source table just to represent other. In such a case, you can use a macro to make the option appear.

Read the rest of this entry »

Petition Against Internet Filter in Australia

Only for those of you in Australia, EFA is organising a petition against Internet censorship. Click the image below if you feel up for signing or want to know more: EFAPetition

Topics

Pages

Blog Stats

  • 41,911 hits