All posts by josefB

Spring Framework’s ModelAndView word

I was a doing a little Spring MVC a few weeks ago, reading the docs, yet again. One thing that irked me a bit with Spring is the “ModelAndView” term. Couldn’t they have found a better word to capture that?

Well, at lunch one day I came up with a word: Pose. Hmmm, was that the word? I should have written it down. Anyway, in the fashion modeling world (not that I know anything about it) the view captured of a model is a ‘pose’.

“Pose”: “A particular way of standing or sitting, usually adopted for effect or in order to be photographed, painted, or drawn.”

Or, maybe not.

April 27, 2013: Just stumbled on this blog post by Kent Tong on this subject: Better name for ModelAndView in Spring MVC?

Spring API on ModelAndView
Better name for ModelAndView in Spring MVC?

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.

Why are command shells one dimensional?

Despite all this touch this or that and 3D gee wiz shown in movies we are still in the punch card age to some extent.

Decades ago you had to create code that was chopped up into a fixed line length; some positions where even used for specific things. An example is the programming of Fortran using punch cards.

You’ll find this punch card single line interface still alive today. The browser address bar is such an interface. And, afaik, most command shells operate in a per line manner, the enter key executes the command line (which could itself be composed of multiple commands, pipes, redirections, and mutliple ‘command streams’). If you want to enter text to create commands in a more natural 2D manner, you have to create scripts or programs or open up special shells that allow you to highlight text and execute it.

One current way of minimizing this one-dimensional limitation is allowing the single line to be rich. For example, in Bash you can do some powerful stuff on the single command line, like history, substitutions, and so forth. But, this is just a geeky way to control a system. What is needed is a domain specific language per task. Or is natural language processing the only solution?

I could be wrong, of course, and so what. Just making an observation.

Interesting comparison: Bash vs. PowerShell

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.

I Am, Therefore I Think

Consciousness is one of those nebulous concepts, at least in the ‘normal’ non-academic world. Some say there is no such thing, a delusion. It’s just how the body refers to itself and organizes its sensory processing. There are so many theories. On the other side there are the religious, spiritual views that posit that there is something more then the meat body, more then just electro-chemical discharges. In between there are some investigators finding that the traditional views are lacking. Some even claim that consciousness derives from deep quantum mechanical processes; quantum effects are relevant at room temperature and macro scales.

Heck if I have an answer. I just Am.

I’ll make one observation though. Seems that people argue about consciousness from the mental processing angle. That is, if something is conscious it exhibits certain properties. Yet, stop the flow of thoughts and what remains is awareness. How can awareness be awareness of being aware? Or is it just the body all along that encases the waking state dream?

  1. Cytoskeletal Signaling: Is Memory Encoded in Microtubule Lattices by CaMKII Phosphorylation?
  2. Consciousness
  3. OnLine Papers on consciousness
  4. Consciousness; Internet Encyclopedia of Philosophy
Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.



The abandoned wreck lay in the street.

We climbed and jumped; so much to do that week.

A mattress appeared and now our feats grew.

Then one day no more; someone took it away.

Another week, a sewer formed a lake

from which sprung exotic adventures and competitions.

I played a pirate with my wooden sword, my buddy slayed the savage sea beast.

Then one day no more; someone took it away.

Nostalgic, I look back on those days. I was not poor; I enjoyed the endless array

Of things abandoned, trees to climb, hidden corners, and the paradise of neglected yards.

When summer lasted years, and the fun was measured by my socks and

how far they peeked from the holes in the bottoms of my shoes.

On rainy days from the past to today,

I can almost feel my soggy socks

and like an echo in my heart,

hear my mother calling me to come from play.

— Josef

Other works

  1. Scattered A short story about the future extremes of …
  2. Hero waits A nano-story.
Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.

Can the predictive web also enable control?

In a previous post, “Synergistic Social Agent Network Cloud“, I discussed how a web of ‘agents’ could optimize ‘apps’ to be more responsive, proactive, and multipliers of our intents. I was just reading “Should we fear mind-reading future tech?” by Andrew Keen, and was thinking of the possible negative aspects. Still reading the article, so it may cover this. (finished reading it, was not mentioned).

Privacy is the usual concern about this high-tech stuff. This is very important. But, can “faster than realtime” computing, prediction, massive complex-event-processing and correlation also enable the powers that be to also control? We already know that advertising in all it’s forms can control, else why, for example, is the American presidential election a feeding fest of political money contributions?

Could that same advertising and fake news reporting via social media and apps that employ predictive quasi-AI morph into controlling media, an Orwellian manifestation of new-speak? In a scenario that would make a great sci-fi novel, Big Interests like political parties, business groups, and political organizations use social media, not only to advertise, but to gently guide one toward having programmed epiphanies.

Can it even be more “physical” and intrusive? For example, by prediction, these groups can arrange that one will meet a certain someone at the right time. Your a bleeding heart influential liberal? No problem, the future Fox News will arrange that you meet this gorgeous strong willed conservative that will change your mind.

Silly example, but you get the point, when you know, you can make nano-adjustments: unnoticeable, personalized, massive lobbying. Ads are old school, here come the psych-bots.

Some links

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.

Dedicating multiprocessors per OS structure

A few weeks ago something I’ve been thinking about for a while came back into my thoughts. What if instead of multithreading at the application level, we instead dedicate a chip of a multicore processor to a specific OS resource.

What kind of OS resource? I don’t know. Maybe four processors at ring zero, or at the IO subsystems. We could have application specific cores that are optimized for specific software tasks, just as the new graphic processors are used for APU.

I’m certainly not a system designer and the above is probably pure drivel. Like, how would context switching work and not slow everything down? However, there are possible reasons why perhaps its not.

  • Number of cores will keep growing.
  • GPUs will become more important and powerful.
  • Future applications will be distributed and require advanced resource handling, example, hierarchical robust device systems, like memory handling.
  • Thermal limitations will demand new forms of optimization.
  • AI and robotics applications will reach a tipping point and become ubiquitous, and even more performance will be demanded from computing systems

After thinking about this, I later started seeing articles on internet-on-a-chip, a new way of connecting multicores. Interesting.

Further reading

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.

How to use multiple views in Notepad++

Good editors always have some support for showing multiple editor windows. This is supported in many ways. See this for a comparison of the available document interfaces.

Multiple Views
I was happily surprised to find that Notepad++ also supports this. The trick is to right click on an edit window’s tab and choose “Move to other view” or “Clone to other view”.

Eclipse IDE
By the way, Eclipse IDE also supports multiple docking of edit views. You can even open two views into the same file. However, Notepad++ allows you to synchronize this. Which, afaik, Eclipse does not.

Multiple instances
While the above is great, sometimes you want two Notepad++ instances to, for example, open them each in their own display monitor. For that you just have to add to the notepad exe startup: -multiInst. For example on my Windows 7 instance my Notepad++ shortcut has:
“C:Program Files (x86)Notepad++notepad++.exe” -multiInst

Comparison of document interfaces
Managing two views in a single Notepad++ instance

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.

What is Cloud Computing?

Someone from the non-technical business side asked me what is this Cloud computing all about. If you search for the term you find a bunch of definitions and descriptions. For example, on Wikipedia:

“Cloud computing refers to the delivery of computing and storage capacity as a service to a heterogeneous community of end-recipients.”

That doesn’t sound like anything new. We had similar things even in the sixties. You have to read more of the above article to see the differences. But, to see what it really means a blog post, “Startups are Creating a New System of the World for IT“, puts it in context.

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.

Ant transforms using Groovy template scriptdef

Ant provides powerful transformation capability. For example, the copy task can include filters that replace tokens in the text. There is also the XSLT task to perform more complex XML based transforms.

Sometimes you may need more dynamic or procedural transforms for non-xml based templates. While this can be done in Ant, they should not be; Ant should really only be used in a declarative manner. One can do this outside of Ant using custom solutions or use the various templating frameworks, such as Velocity and Freemarker, which provide Ant plugins.

Another alternative is the Groovy language which has always provided text processing in the form of GStrings and templates. These are used in various solutions such as Groovlets and Groovy Server Pages. Below I show how Groovy templates can be easily used in Ant.

listing 1 shows a meeting agenda text template with a list of topics. Note that it has a GString interpolated string using “$” character. It also, analogous to Java Server Pages, uses a scriptlet with <% and %> to execute code. Yes I know, scriptlets are evil.

List 1, template1.txt, a template:

Hello ${name}!
Agenda is:
%>- $it 
<% }	

In listing 2 below, an Ant script invokes the “template” task to transform the template in listing 1.

Listing 2, build.xml, use template task:

<project default="init">
<import file="tasks.xml"/>
<target name="init" 
	<property name="name"    
	<property name="subject" 

Listing 3 shows an example run.

Listing 3, example use:

Saving result to temp.txt
     [echo] Hello world!
     [echo]     Agenda is:
     [echo]     - beans
     [echo]     - GStrings
     [echo]     - templates


Listing 4 is the implementation. It is a simple scriptdef using Groovy as the script language. The Groovy code is inline but could have been in external file using the “src” attribute of the scriptdef declaration.

Listing 4, tasks.xml, the scriptdef implementation:

<!-- config stuff not shown -->

Render a Groovy template using properties to create the binding 
<scriptdef name="template" 
  <attribute name="src"/>   <!--  required -->
  <attribute name="dest"/>  <!--  optional -->
  <attribute name="property"/> <!--  optional -->
  <attribute name="failOnError"/> <!--  optional, true -->
  <element name="property" type="property"/> <!--  required -->
def SRC= 'src';
def PROPERTY = 'property'
def DEST = 'dest'
def FAILONERROR = 'failonerror'
	// convert element properties to map
	def map = [:]
	// render the template
	String result = new groovy.text.GStringTemplateEngine()
	  .createTemplate(new File(attributes.get(SRC))
	def prop = attributes.get(PROPERTY)
	if(prop){ // save to property?
		project.setNewProperty(prop, result)
	def dest = attributes.get(DEST)
	if(dest){ // write to file?
		project.log("Saving to $dest",project.MSG_INFO)
		new File(dest).write(result)
}catch(Exception ex){
	def f = attributes.get(FAILONERROR)
	def failOnError = f ? f : true;

	if(failOnError == 'true'){
		throw ex;
</scriptdef>  <!-- end name="template" -->


Shown was an example of using Groovy templates in an Ant task. A simple scriptdef was created to allow reuse in Ant scripts.

Kind of begs the question, since scriptlets have a bad rep, should there instead be a way of using taglibs in the templates. I think Grails implemented Groovy taglibs.


Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.

Git status not showing changes or new files?

In a git repository created using the –separate-git-dir option executing “git status” is not showing any changes. This was working correctly for weeks.

I created a new file in the top level folder, it doesn’t show as untracked. Tried “git status -u -v”. Nothing. Removed the .gitignore file. Nothing. Strange.

The separate directory is on a shared drive in Windows with a connected drive “k:”.
“git fsck” shows no issue, etc.

Work around
Anyway, what I did. I deleted the .git file. Then I reinited:

git init –separate-git-dir K:/where/it/is/at.git

Now it works.

OS: Windows 7, 64bit.
Git: 1.7.9.msysgit.0

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.