Saturday, 5 January 2013

Thursday, 3 January 2013

Rum and Moody Blues

Today i discovered Rum.

Well, i guess i'd have to say "rediscovered".

So while i work, it's rum and Moody Blues (to our children's children's children)

god bless them

pop




Wednesday, 2 January 2013

Sugar: The Bitter Truth


This is pretty intense stuff - how we are being killed by, believe it or not, Richard Nixon

well kindof - take a look and see for yourself


pop

Wednesday, 28 November 2012

Memories


Over the last few weekends i have been doing a job that i had put off for years.

After my first marriage broke up most of my life was boxed up and then hauled around from one short term place to another. Most of what was left of my life was shed - first all my books and sports gear then most of my cameras and musical instruments. Eventually it was down to just a few boxes of papers and photographs.

These then sat on a shelf in the shed of the house we have been renting for the last four years. I've not looked at any of it for something like ten years and some of the papers in there i've not looked at for maybe twenty years.

I'd been planning to put all of the old family photographs together to take back to New Zealand and give to my ex. The opportunity has recently come and with it also the incentive - for it is likely that i will be moving to a distant country and i do not know if i will ever get the chance again.

So i bought a photo and slide scanner on eBay and for the last four weekends i have been scanning pictures and documents going back more than sixty years. The first day of it drove me to whisky. It was too much - yes there was joy at seeing all the wonderful old pictures of my children when they were young and my wife when she was lovely - but with every joy came sadness at the lost family. After a few hours each new photograph brought more joy and more sadness than i could stand and i sought solace and numbness in Jim. It does not take much to trigger my need for escape and each of these two or three thousand pictures was  itself enough.

The following weekend was little better. The third, well i was starting to get over it, and by the last weekend i got through it all sober and happily through with the task.

I can't say i did a perfect job. Most of the photographs were unordered and i had to guess what year each was. At times i was gauging the year by the closeness to a major event like the birth of a child - so seems to me when i look at them now that there's a lot of pictures around the years of the birth and fewer after. It's not that i took more pictures about then - it's simply that the years between seem empty and so my allocation to years has echoed that feeling.

The next job will be to pass all the prints and slides to my ex. Maybe somehow she can aid with getting the years right. After that when or if i ever get the chance i might go through the thousands of negatives looking for great old pics that might have been lost or given away.

Wish me luck :-)

p





Thursday, 22 November 2012

Friday, 19 October 2012

A letter of note


I suck an RSS feed from Letters of Note

the site publishes or re-publishes letters from famous people.

This one (copied in full) really speaks out to me:



Thursday, 18 October 2012


People simply empty out


In 1969, publisher John Martin offered to pay Charles Bukowski $100 each and every month for the rest of his life, on one condition: that he quit his job at the post office and become a writer. 49-year-old Bukowski did just that, and in 1971 his first novel, Post Office, was published by Martin's Black Sparrow Press

15 years later, Bukowski wrote the following letter to Martin and spoke of his joy at having escaped full time employment.

(Source: Reach for the Sun Vol. 3; Image: Charles Bukowski, via.)

8-12-86

Hello John:

Thanks for the good letter. I don't think it hurts, sometimes, to remember where you came from. You know the places where I came from. Even the people who try to write about that or make films about it, they don't get it right. They call it "9 to 5." It's never 9 to 5, there's no free lunch break at those places, in fact, at many of them in order to keep your job you don't take lunch. Then there's OVERTIME and the books never seem to get the overtime right and if you complain about that, there's another sucker to take your place.

You know my old saying, "Slavery was never abolished, it was only extended to include all the colors."

And what hurts is the steadily diminishing humanity of those fighting to hold jobs they don't want but fear the alternative worse. People simply empty out. They are bodies with fearful and obedient minds. The color leaves the eye. The voice becomes ugly. And the body. The hair. The fingernails. The shoes. Everything does.

As a young man I could not believe that people could give their lives over to those conditions. As an old man, I still can't believe it. What do they do it for? Sex? TV? An automobile on monthly payments? Or children? Children who are just going to do the same things that they did?

Early on, when I was quite young and going from job to job I was foolish enough to sometimes speak to my fellow workers: "Hey, the boss can come in here at any moment and lay all of us off, just like that, don't you realize that?"

They would just look at me. I was posing something that they didn't want to enter their minds.

Now in industry, there are vast layoffs (steel mills dead, technical changes in other factors of the work place). They are layed off by the hundreds of thousands and their faces are stunned:

"I put in 35 years..."

"It ain't right..."

"I don't know what to do..."

They never pay the slaves enough so they can get free, just enough so they can stay alive and come back to work. I could see all this. Why couldn't they? I figured the park bench was just as good or being a barfly was just as good. Why not get there first before they put me there? Why wait?

I just wrote in disgust against it all, it was a relief to get the shit out of my system. And now that I'm here, a so-called professional writer, after giving the first 50 years away, I've found out that there are other disgusts beyond the system.

I remember once, working as a packer in this lighting fixture company, one of the packers suddenly said: "I'll never be free!"

One of the bosses was walking by (his name was Morrie) and he let out this delicious cackle of a laugh, enjoying the fact that this fellow was trapped for life.

So, the luck I finally had in getting out of those places, no matter how long it took, has given me a kind of joy, the jolly joy of the miracle. I now write from an old mind and an old body, long beyond the time when most men would ever think of continuing such a thing, but since I started so late I owe it to myself to continue, and when the words begin to falter and I must be helped up stairways and I can no longer tell a bluebird from a paperclip, I still feel that something in me is going to remember (no matter how far I'm gone) how I've come through the murder and the mess and the moil, to at least a generous way to die.

To not to have entirely wasted one's life seems to be a worthy accomplishment, if only for myself.

yr boy,

Hank


Saturday, 13 October 2012

like stepping through a door


like stepping through a door
or falling down a stair
from this to the next
can happen anywhere

anytime it can happen
and one day it will
a slip or a stumble
a fall or a spill

be careful

p


Friday, 17 August 2012

MS SQL Server Spatial to Google Maps KML

I don't usually post code tips on my blog but this one might help some other poor soul.

You have some map data stored in SQL Server as geometry (or geography) and you want to extract it in a format that you can use in your google maps mashups.

I wanted a Q and D solution that would be confined entirely to SQL Server functions. I can certainly write C type code (maybe a million lines in my life) but i wanted this totally within SQL Server and easily used.

Note that my maps are relatively simple - there are no interior rings though there are all sorts of combinations of MULTIPOLYGONs, GEOMETRYCOLLECTIONs and simple POLYGONs. You should check your own maps for complexity and if necessary add support for interior rings (which i don't need).

Here's the 3 main pieces of code i wrote to satisfy my needs.


This first function returns the MultiGeometry part of my Placemark (sorry, everything above you will have to sort out yourself):


CREATE FUNCTION [dbo].[kmlGeometryElementsExtract]
(
@p_Spatial geometry
)
RETURNS xml
AS
BEGIN

DECLARE @v_spatialXML xml

SET @v_spatialXML = dbo.kmlGeometryElementsExtractAux(@p_Spatial.ToString())

DECLARE @v_collection xml
DECLARE @v_multi xml
DECLARE @v_poly xml

SELECT
@v_multi = nref.query('.')
from @v_spatialXML.nodes('/bracket') as R(nref)
where
nref.value('.[1]/@tag','varchar(100)') = 'MULTI'

IF @v_multi IS NOT NULL
BEGIN

RETURN (

SELECT
(
SELECT
dbo.kmlGeometryCoordsConvert(nref.value('.','VARCHAR(MAX)')) as 'outerBoundaryIs/LinearRing/coordinates'
from @v_multi.nodes('//bracket') as R(nref)
where
nref.value('./bracket[1]','VARCHAR(MAX)') IS NULL -- no backet below
FOR XML PATH('Polygon'), TYPE
)
FOR XML PATH('MultiGeometry'), TYPE
)

END

SELECT
@v_collection = nref.query('.')
from @v_spatialXML.nodes('/bracket') as R(nref)
where
nref.value('.[1]/@tag','varchar(100)') = 'COLLECTION'

IF @v_collection IS NOT NULL
BEGIN
RETURN (

SELECT
(
SELECT
dbo.kmlGeometryCoordsConvert(nref.value('.','VARCHAR(MAX)')) as 'outerBoundaryIs/LinearRing/coordinates'
from @v_collection.nodes('*/bracket') as R(nref)
where
nref.value('.[1]/@tag','varchar(100)') = 'POLYGON'
FOR XML PATH('Polygon'), TYPE
)
FOR XML PATH('MultiGeometry'), TYPE

)
END

SELECT
@v_poly = nref.query('.')
from @v_spatialXML.nodes('/bracket') as R(nref)
where
nref.value('.[1]/@tag','varchar(100)') = 'POLYGON'

IF @v_poly IS NOT NULL
BEGIN
RETURN (
SELECT
(
SELECT
dbo.kmlGeometryCoordsConvert(nref.value('.','VARCHAR(MAX)')) as 'outerBoundaryIs/LinearRing/coordinates'
from @v_poly.nodes('*/bracket') as R(nref)
where
nref.value('.','VARCHAR(MAX)') IS NOT NULL
FOR XML PATH('Polygon'), TYPE
)
FOR XML PATH('MultiGeometry'), TYPE
)
END

RETURN NULL
        
END



The kmlGeometryElementsExtract function above calls this one - which looks like a hack but it turns out to be the fastest way to skin this cat - i had written a FSM to do the job but SQL Server string handling is way too slow if you are concatenating one char at a time to a large string.

 CREATE FUNCTION [dbo].[kmlGeometryElementsExtractAux]
(
@p_SpatialString VARCHAR(MAX)
)
RETURNS varchar(max) -- in xml format
AS
BEGIN

DECLARE @v_result VARCHAR(MAX)

SET @v_result = REPLACE(@p_SpatialString,'GEOMETRYCOLLECTION (','<bracket tag="COLLECTION">')
SET @v_result = REPLACE(@v_result,'MULTIPOLYGON (','<bracket tag="MULTI">')

SET @v_result = REPLACE(@v_result,', POLYGON','POLYGON')
SET @v_result = REPLACE(@v_result,'POLYGON (','<bracket tag="POLYGON">')
SET @v_result = REPLACE(@v_result,', LINESTRING','LINESTRING')
SET @v_result = REPLACE(@v_result,'LINESTRING (','<bracket tag="LINESTRING">')

SET @v_result = REPLACE(@v_result,'), (',')(')

SET @v_result = REPLACE(@v_result,'(','<bracket>')
SET @v_result = REPLACE(@v_result,')','</bracket>')

RETURN @v_result

        
END


The kmlGeometryElementsExtract function above also calls this one - which simply formats the coordinates element contents to suit my needs - YMMV:


CREATE FUNCTION [dbo].[kmlGeometryCoordsConvert]
(
@p_CoordsString VARCHAR(MAX)
)
RETURNS varchar(max)
AS
BEGIN

/* this line replaced with line from post comment below   
RETURN CHAR(10) + REPLACE(REPLACE(@p_CoordsString,', ',',0' + CHAR(10)),' ',',') + ',0' + CHAR(10)

here's the new line:
*/

 RETURN CHAR(10) + REPLACE(REPLACE(REPLACE(@p_CoordsString,', ',',0' + CHAR(10)),' ',',') + ',0' + CHAR(10), CHAR(10), CHAR(10) + ' ')

END




Hope you find that useful

pop


ps see DB rankings here: DB-ENGINES

Friday, 13 July 2012

Dear Apple, Dear Samsung

I am still using an old Nokia 1110i Phone:
Nokia 1110i

Work gave me a nice new HTC smart phone some time back but after i used it for a week i threw it in my drawer and went back to the Nokia.

My family asks why i don't have a smart phone - they all have one.

I don't have a smart phone for the following reasons:

  • The battery lasts for little more than a day and if i forget to charge it it becomes a useless brick
  • Email is not meant to be answered instantly - why should i want it everywhere i go?
  • There's not a single smart phone that provides what i want from a hand-held computer
  • At work and at home i have great huge screened desktops running Linux and Windows - in between i'm driving or riding my bike
  • I live in a city where i grew up and don't need GPS
  • I don't play games
  • I don't like to spend money unnecessarily

I would buy myself (or get work to buy me) a nice new smart phone if it could provide what i want:

  • at least 2 days of battery life even under moderate use
  • connectivity so that i can use a normal large desktop screen, keyboard and pointer - ie i want to plonk it down on the desk, have it recognise available interface devices and automatically start to use them
  • ideally the whole phone is a solar energy collector that augments the battery life

If you mighty technical geniuses can give me a nice unix based pocket sized computer with built in coms for everything i need - i'll spend up to $2000 for it

In the mean time i'm sticking to my Nokia - it has a battery life of up to 15 days, does not pester me with emails, costs me nothing if i lose it, does not break if i drop it, and most of all

does not communicate to the world that i'm a brainless consumer

pop

ps, if such phones were available how long do you think Microsoft would last - everyone on earth could get rid of their desktops forever and most of their laptops and their stupid tablets (a touch sensitive screen interface need only be that - an interface)

of course, maybe what Microsoft is planning is to beat the competition by being the first with such a device

but i doubt it - they are still stuck on blood-sucking the dying life out of their poor trapped MS Office users

brainless leeches

p

Friday, 6 July 2012

Patricia Kuhl: The linguistic genius of babies (TED)


This talk is just fascinating

it suggests that if you really want your kids to be awesome then you should expose them to as many native foreign language speakers as possible for as much as possible and starting as soon as they are born.




and this too

p