Tuesday, 18 December 2012

Time

There's an argument that our intuitive understanding of time is essentially evolutionary driven.
For most people anything less than a tenth of a second is instantaneous (the conscious mind is still making some plausible story round what's noted), anything much more than a lifetime is a very long time - look at the problems otherwise perfectly intelligent people have between something  around 7500 thousand years ago roughly when we are known to have cheese to heading out of Africa 60000 to 125000 years ago, or even 65 million years ago - they're all just a long time.
I was reminded of this again in an email interchange with a well known market data supplier in an attempt to discover what the accuracy of a timestamp as I was told "difference is generally very small and in most cases, it is less than a second", presumably completely unaware that worldwide the peak pricing message rates have been above 6 million a second, Europe will peak over 80-100 thousand a day with a historic high over 300 thousand. A second may be a small time for us, but it's an age working in computer time - light can get nearly  7.5 times around the equator.

I think there is a similar issue when people ask "where are you from?" Essentially we're all from Africa but that's going back the 60 to 125 thousand years. Where I was born is identifiable and succinct, where I stay is also, but where am I from is a question that has no simple answer.The centroid of the places I've lived? The heartland of the cultural identify I feel closest to? Where I feel I have roots? Where I work? Where I had lunch? I don't know, but should I launch into an exploration of the question on being asked, I see eyes glaze over and the person drawn magnetically to the nearest exit, so I find it hard to discover what they were really asking.

Thursday, 29 November 2012

Apollo Stomp and Delphi

I was curious how easy it was to connect a Delphi app to Apollo, running on Windows7

There's a nice Ruby library called stomp, not terribly surprisingly, that makes the testing of functionality easy
I'm always pleasantly surprised how easy  it is to get something up and running with Ruby. Having a nice repl in IRB, an excellent IDE in RubyMine if I muddle syntax and Sublime Text 2 if I have to change much text it's actually enjoyable to work.

For Delphi there's a commercial library at Habari which looks as though it works - I tried a performance test and got around 7100 messages a second - the ruby client was just over 2000 messages a second
I tried the Delphi library at http://svn.codehaus.org/stomp/trunk/ which compiled and worked with XE2
I get over 100,000 msg a second with a loss of around 3% - I'm not sure where exactly they're being lost, so that's the next puzzle. Increasing the buffer sizes in Apollo seems to make things worse.
Stopping via the services, I managed to corrupt the data files under brokerdir\data somehow, so Apollo never started up fully. Deleting the contents and Apollo restarted properly.
But there seems to be work for me to get something more robust.

Monday, 26 November 2012

Sketchup

I've been doing a couple of things with Sketchup recently.
1/ Mapping out some gears with a free gear plugin. I've yet to cut them out of plywood.
I've started playing with the ruby scripting interface as a result

2/ working through the plans for a loft extension to see how to lay it out and create the plans for planning approval.
I used the free 8 hours of Layout access to produce the actual diagrams.
My workflow was:
Create the model in in Sketchup.
Remove all the dimension labels etc. I had in Sketchup.
Create animation slides for each section cut (remembering to hide the actual section guide on a separate layer)
Create a new Layout file (note a lot of the template detail text are on separate layers and those layers are locked for some reason)
Import the Sketchup model
Create layout pages for each view I was looking for
Paste the model on each page
For each page adjust the view, set the scale to provide a scaled drawing e.g. 1:100 at A4 print out, add description text and add dimensions and labelling
Export as a PDF
It's considerable easier than writing it down here

Sketchup really is a fantastic product, and with Layout to be able to produce a set of drawings that actually are consistent, to scale as quickly as that is astonishing. Laser rangefinders and sketchup must make an astonishing improvement in surveyors productivity..



Thursday, 8 November 2012

count of unique values in pivot table ine Excel

Looking to summarise a table in Excel 2007
Category, count of accesses, count of unique people accessing

There doesn't appear to be a function for count of unique entries
Googling produced add a new column in the data  =IF(COUNTIF($A$1:A1,A1)=1,1,0)
and then sum that
But over many thousands of rows it grinds to a halt

An alternative grouping here by two columns is createing a column
isFirstAccess with formula  =IF(AND(A7=A6,D7=D6),0,1)
after sorting by A and D
Then summing that in the pivot table, which works fine.

STAC summit

I went to the STAC summit in London yesterday.
Always interesting, this was no exception.
I noted:
The interest in map reduce frameworks - IBM's use of their grid (called Platform Symphony to distinguish it from where the Lotus desktop software now called Lotus Symphony) getting improvements in one STAC test of 1.4 to 10 times against the vanilla Apache Hadoop, mainly they thought through better scheduling of the tasks and not stopping and starting processes as much.
The use of microwave routes for some data giving for example sub 5 ms (4.45 to 4.8) routes London Frankfurt as long as you don't have the wrong type of rain
Continued improvement in  switches and an initial look on programming for the Intel Phi coprocessor board.
The key point seemed to be that if you don't use the vector units and parallelisation together with the Phi it's quite possible you're better off not bothering, as one slide showed. So there's some work needed to use it properly, but that should be a fraction of the work needed to make your code work on a GPU
From a developer's perspective it does seem that compilers are not keeping up with the advances in hardware, from handling RAM caches properly to pragmas for how to parallelise
Still if they manage to price somewhere near their advance pricing of 400 USD the Texas Advanced Computer Centre paid it should sell. All to be disclosed next week apparently at the supercomputing conference

Friday, 13 July 2012

Excel VBA function on value in a range from called cell

In a cell you can refer to an range and the corresponding entry in the array is used as an input.
E.g. with with a1 to a6 filled with 1 to 6 and is named test_range and b2 has the formula = test_range + 1
b2 => 2
However if you put the range into a vba worksheet function, the whole range is passed.
and you need to select the specific value
e.g.
public function add_one (src_range) as variant
add_one = src_range.Cells(1 + Application.ThisCell.Row - src_range.Row, 1).Value
end function