NM_CUSTOMDRAW and Win 10

Hmm, I discovered that my solution using NM_CUSTOMDRAW does not quite do what I wanted in a MS Win 10 environment. The issue is the Win 10 themes.

The windows and controls that I use are created using CreateWindow or CreateWindowEx. In a MS Win 10 environment I found that I found that the  colour schemes that I tried to impose was not always followed.

If you call the API SetWindowThemeWindow , with the parameters: HWND of the target window / control, followed by 2 empty strings e.g.

SetWindowThemeWindow ( lWnd , _TEXT(“”),_TEXT(“”) ) ;

then the window/control will not follow the Windows Themes. I found it necessary to use this API for:

  • the main Window
  • Listviews so that I can set the colour of everyother row
  • the header of ListViews so that I can change the colour of the font and the background colour.

NM_CUSTOMDRAW and Listviews in Plain C

I recently spent 4 days trying to set the colour of the headers of a Listview in my Windows program SQLite-OLE. It was a painful experience partially because I program in plain C using the bare Win API and not using MFC (Microsoft Foundation Classes).

Hmm, well it was all my own fault. If you do not read the documentation carefully, what can one expect.

The solution was ultimately simple.

Here are a few tips if you want to set the background colour of a listview’s  cells or its column headers.

  1. When a Listview is displayed on the screen a number of  WM_NOTIFY messages are sent. We need to intercept a  subset of these WM_NOTIFY,  specifically those indicating a NM_CUSTOMDRAW operation.
  2. WM_NOTIFY / NM_CUSTOMDRAW messages concerning the data cells of the Listview are sent to the WndProc of the Listview’s PARENT, in my case the Window containing the Listview. These messages are also sent for some other controls, so be sure to check that the   (LPNMHDR)lParam)->hwndFrom  identifies the wanted Listview’s HWND.
  3. If you intercept these (cell) messages you can set the colour of the cell, the colour of the cells’ text, and the background color of the text, simply by providing a new RGB value to the data structure pointed at by the message’s lParam.
  4. WM_NOTIFY / NM_CUSTOMDRAW messages concerning the header of the Listview are sent to the WndProc of the Listview: In my case I had to subclass the Listview in order to create a WndProc for the Listview that I could intercept.
  5. If you intercept these (header) messages you can set the colour of the header cell, the colour of the text, and the background color of the text. BUT  you must use functions such as: FillRect, SetTextColor and SetBkColor.

Once I got this sorted out, the code was easy, and I can now modify the display of a Listview as shown below.

Before:

After:

Creating your own GUI with SQLite-OLE

SQLite-OLE has now been updated, still less that 2.5 Mb, to include the ability for a user to create their own GUI and to interact with it via callbacks.

The capabilities are part of the underlying Forth-like interpreter, I only had to find a ways to expose these capabilities via a “Basic” like command line interpreter.

Well, I found a way to expose some of these (> 1000 Forth-like definition) to the SQLite-OLE command line interpreter.

Microsoft Office and LibreOffice

I have done (for me) a  phenomenal amount of number crunching at work. One average I am processing about 1.2 million lines of data a week, nearly all of it provided as Excel or as CSV files. Fortunately the SQLite-OLE application lets me write script files, so that it is easy to rerun the processing steps.

I am a great fan of  the automation of repeated activities.

However when it comes to presenting the data / results to other people it is usually necessary for me to use Excel.

Now, I have been programming in VBA for Excel, Word and PowerPoint for more than 10 years (especially in PowerPoint). And I have been fortunate that I have a work laptop so that I can play program at home. But I have often wondered if I should install LibreOffice (https://www.libreoffice.org/).

I was (until today) wondering how easy it would be to use the OLE interface of SQLite-OLE to control LibreOffice. Well now I know.

I started looking at the possibility last Sunday, and today (Thursday) I managed to get the LibreOffice WriterDemo going.

For anyone who is interested, you can find it on the  SQLITE-OLE Scripts   page.

Happy New Year and SQLite-OLE

I have spent the last two weeks trying to get a 30 minute video ready for YouTube about the SQLite-OLE application that is available from this web-site.

Each time I tried to record the video demonstrating SQLite-OLE I did something a bit different, and the demo crashed. Now with less than 7 hours to the New Year, I have got the video done. I feel as though I did something in 2017!

Here is the video:

Oops, sorry. Happy New Year.

By jingo, now I’m German and British

Well, today has been a day that I expect most people do not experience.

Today I was given a piece of paper that says I am a Germany citizen. Along with about 60 people, I was at a small ceremony where we were given our citizenship certificates.

I know that I was not the only British citizen there. Whilst going through the relatively simple process I was told by the civil servant that there was a significant increase in the number of British people applying for German nationality. The civil servant said it was nearly all due to Brexit. I know that that was my reason for applying.

No, I will not be handing in my British passport, although I do believe that Brexit is fundamentally a stupid jingoistic thing to do.

I was born in a little village, St. Florence, in the south west corner of Wales, in the county of Pembrokeshire. Now, Pembrokeshire is a county that is split in to two. The north/east part is Welsh, whilst the south/west corner is called Little England beyond Wales.

There is a dividing line called the Landsker that runs though Pembrokeshire, apparently Landsker is a old Anglo-Saxon word that has a meaning related to land divisions.

Way back in history, when England’s kings and Queen Elizabeth I  were trying to impose their rule on Ireland, this south west corner of Pembrokeshire was used as a military base from which the English could nip over to Ireland. This part of Pembrokeshire had to be a safe base for the English, so ultimately the welshness of the area was, over many centuries, subdued. This got the south west corner of Pembrokeshire the name  Little England beyond Wales .

When I started primary school in 1959, there was no Welsh language teaching in the school. The school was built in the late 1800’s so it had things such as honour rolls of the village people who had died in the Great War of 1914-1918. These rolls, and all of the other paraphernalia and regalia, were in English, although the names were clearly Welsh: Jones, Lewis, Thomas, Williams,… But one should note that these are common throughout the UK, but Welsh names such as Blethyn, Prytherch, Iwan, Rhys did not appear on the rolls.

Indeed, the only time I heard Welsh in St. Florence was if my mum was talking to Mrs. Lewis the back.  One trace of welshness that we did have was a tendency to identify people by their job (hence the milkman Mr. Rowe was Rowe the milk) or by location (hence Mrs. Lewis the back who lived at the back of the village). Apart from Mrs. Lewis and my mum I do not recall ever hearing Welsh in the village.

The other time that I regularly encountered Welsh was when we visited my maternal grandmother who lived on the Welsh side of the Landsker. Granny Meaker could speak English but avoided it when possible especially when we came to visit. My mum and her mum would talk away in Welsh whilst my father and my brother/sisters and I would drink tea, eat Welsh cakes, and wait to go home. (My father was English, born in Birmingham.)

I believe that Granny Meaker hated my father on principle, and that she avoided English so she could avoid speaking to him. By all accounts my father did not want to speak to her either. Aren’t families fun!

When I was 11 and moved-up to the big school in Tenby there were one or two kids in the class who spoke Welsh, but they were bussed in from the
north, and were invariable farm children.

It was not until I went to university in Bristol that I was really confronted with an identity issue. To my English mates I was Welsh, but to the Welsh ones I was English.

Since then I have been critically aware that my nationality falls between two stools. I love the heritage of England (and the National Trust) and yet I feel the pain felt by many (the non-English British people and the Irish people) created by the English in the past.

Just for fun, check out Jane Austen and the speech made by the Baronet Sir Walter Elliot in the story “Persuasion”.

A widow Mrs Smith lodging in Westgate Buildings! A poor widow barely able to live, between thirty and forty; a mere Mrs Smith, an every-day Mrs Smith, of all people and all names in the world, to be the chosen friend of Miss Anne Elliot, and to be preferred by her to her own family connections among the nobility of England and Ireland! Mrs Smith! Such a name!

I find it strange and sad, and yet so very believable, that Scotland and Wales are not mentioned. However, this little speech strikes a chord with me. In a way it reminds me how my self identity is of little consequence.

I can stand-up and fight for Wales, or I can stand-up and fight for England. It is my choice.

But I find that I abhor divides. I consider reglious belief to be, 99%, depending on the self-identity that once assumes. Born in the UK, then probably protestant. Born in the Middle East, then possibly Islamic.

This insight suggests most strongly to me that religion and nationality are just other names for jingoism, or tribalism.

It is probably no surprise that I do not follow any football team, or rugby team, or indeed any other team. I disagree with the idea of us and them.
I do not mind a game, I do not mind people being in teams, but I do object to the tribalistic attitude that so often comes from teams.

As a general rule I believe that together is better than apart.
Now, to bring this blog to a close:

  • I saw the EU as a step toward together and away from apart.
  • I see Brexit as just another team playing at jingoism and the old mine is bigger than yours.

One of the drivers for me taking on Germany nationality was to support together, and one of the reasons why I will not give up my British nationality is I will not promote apart.

PSTN and Switching-Routing

I have noticed over the last 20 years a tendency by some people to consider PSTN to mean the Public Telephone Switched Network. It should come as no surprise to people who know me, that I take a different position.

Let us take a step back  to the first 100 hundred years of the telephone. Independent of who has the right to be called the inventor of the telephone, Alexander Graham Bell certainly brought the telephone to the public.

Each call across those telephone networks would consist of a set-up phase, a connected phase and a clear-down phase. Typically, at least in the days of the manual operator, the calling party would identify the called party by one of two means:

  1. A description of the end subscriber, such as Mr. Sherlock Holmes, 221B Baker Street, London
    or
  2. The identity of the end point on the telephone network, such as London, Whitehall, 1212 i.e. the telephone exchange and the “local number” on that exchange. (Whitehall 1212 was, from about 1934 till the 1960s, the  London Metropolitan Police station known as Scotland Yard.)

In the first case the operator would do a check in the telephone directory to convert the subscriber identity to an end point identity. Once the end point identity was known the operator would select a transport path that would extend the call in the appropriate direction. This decision, based on the context of the call (target destination ), took in to account the resources available to the operator, and the decision was and still is called routing.

Every telephone call over the PSTN is routed.  Sorry, but I see no room for discussion on this.

Once the call set-up has reached the called party, and the called party answers the call, then the call set-up phase ends and the call connection phase starts. In the call connection phase there is an identifiable semi-permanent route (often called a path) between the caller and called party. That route/path took the form of a galvanic connection between the parties (in the analogue telephone system).

In the implementation of the telephone service that started in the mid 1980s the galvanic connection was replaced by a sequence of logical transformations on digital signals in time and space

It was common, even in the analogue telephone days, to refer to the infrastructure that handled the routing decision and that interconnected the transport paths as a telephone switch.

Now we must step back to the 1970’s and 1980’s. In the early 1970’s the basics of the Internetworking Protocol were established by Bob Kahn and Vincent Cerf. The resulting telecommunications networks, based on the Internetworking Protocol, led to the establishment of the Internet as we know it today:

a set of interconnected infrastructure that has a shared end-point addressing scheme and a shared understanding of the structure and interpretation of data packets that the infrastructure transports.

Now we enter the period in which the fledgling Internet caught the attention of financially orientated concerns.
One of the topics that was turned in to an issue, was whether companies who provided public access to the Internet were subject to the regulations normally applicable to providers of telecommunications services.

One argument against the applicability of the telecommunications regulations to the Internet hinged on questionable logic:

  • The PSTN is subject to regulations.
  • PSTN “stands” for the Public Switched Telephone Network.
  • The Internet is routed, and has nothing to do with “switched”.
  • The Internet should therefore not be subject to telecommunications regulations.

I think that an appropriate phrase to some up this logic, and its conclusion, is horse feathers.

Hmmm, this was  a wonderful application of the now common  alternative facts, and yes, it was spearheaded by companies based in the USA.

It was of course, totally ignored by such non-regulation preferring companies, that the Internet in the last 20 or so years makes extensive (i.e. massive) use of  switching in the MPLS cores and in the Ethernet access networks.

I have said it before, and I will say it again.

Wishy washy words lead to wishy washy thinking”.

If you want to muddy the waters of your opposition, start using wishy washy words, obfuscate the issue.

To quote that author whom I have already referred to:

Terry Pratchett – ‘A lie can run round the world before the truth has got its boots on.’

If you really want to understand something, then consider this: the tools of comprehension are words and sentences. If you use the wrong tools do not be surprised if the results are sub-optimal.

Curse the darkness, or speak out.

Once more I ask myself why I have created this blog.

I have spent some time discussing this with my son (studying physics at university and just starting his M.Sc. thesis), and about the only conclusion I have reached is summed up by the following quotation which I understand is too old to be definitivly attributed to anyone:

Yet it is far better to light the candle than to curse the darkness

I suppose that my use of this blog is similar to the classical 1950’s letter that took the form:

To the Editor of the Local Newpaper.

Dear Sir

It has come to my notice that …

                Yours faithfuly, a concerned citizen of our good village.

 

Well, the truth is out, I am I suppose a concerned citizen of our good village, except maybe I should consider myself to be a concerned citizen of our global village.

Is a blog an opportunity to speak out. If so, are there better ways?

Wishy washy words and wishy washy thinking.

I try to take words seriously. That means that I believe communications between people is easier if we use the right words.

I have many phrases which I spout forth, one of which is wishy washy words lead to wishy washy thinking. I often think of this phrase when I read about the USA and the ongoing saga of network neutrality in the context of telecommunications.

If you have seen my earlier blogs you might have noticed that I have a very clear interpretation of what a telecommunication service is.

A telecommunications service is when a service provider agrees to transport valid user-defined input, from an incoming service access point to one or more, user nominated, outgoing service points, and that transport is carried out to a understood service level agreement.

I get the feeling that some of the USA discussions about network neutrality hinge on the Internet being an information service and not a telecommunications service. Hmm, looks like we are getting the now famous American alternative facts from such people.

I will try to highlight some relevant facts about telecommunications.

  1. The legacy public telephone service, whether realised by analogue switching, digital (fixed network ISDN or its wireless version)) technology , is a telecommunications service providing network.  The PSTN (Public Service Telephone Network and not Public Switched Telephone Network as many people would like to name it!) has been carrying data (machine-to-machine) since at least the 1920’s. In the early 2000’s the PSTN in many countries was carring more data (machine-to-machine), measured in transport volume, than speech conversations.
  2. Even if we restrict our analysis to speech communications across the PSTN (please remember the PSTN includes both fixed and wireless access technologies), we can easily argue that the PSTN supported the exchange of information between users. Even if I only phone my family back in Wales and ask “how are you”, it is a classical case of information exchange! Fortunately no-one succeeded in reclassifing the PSTN as an information service since the PSTN is clearly the transporter and not itself the information provider.
  3. If we now consider the current situation as presented in various online news sites about the USA / FCC and network neutrality. It appears that the USA has classified the Internet as an Information service. Not strictly wrong, unless you try to twist that into meaning that the transport provider(s) are providing information services. They are clearly not providing information, they are transporting.
  4. We do not say that the postal service is an information service, even though they deliver large volumes of information, sometimes written, sometimes on DVDs or CDs.
  5. Why do some people try to twist the Internet transporters as providing an inforamtion service. A rhetorical question, to which the answer is for an advantage!

I take the position that is it not in any way technically justifiable to classify the transportation of data (irrespective of how that data is encoded or packeted or routed or switched) as an informational service.

Now, please note that I have not commented here on whether network neutrality is good/bad/right/wrong! I have only considered whether it is justifiable to label the transport providers of the Internet as providing an information or telecommunications service.

My prime concern is that when we start applying incorrect labels to things we start thinking about them incorrectly.

Before we can really understand the whole network neutrality issue we must must must understand correctly what we are talking about.

One of the facts  in the network neutrality debate is that telecommunications services are regulated  differently to information services.

One of the alternative facts that is popular in the network neutrality debate is that the Internet is an information service for all involved parties, including the transport providers.

When key players start trying to change the classification of a transport service to an information service so that they can avoid telecommunications regulations, well that’s when I get to intensely dislike the morals of some of my fellow human beings.

Or possibly not quite so sad, but probably more common, I get heartily disillusioned at the lack of understanding shown by people who should know better.

Digital Archives and the Right To Be Forgotten

Oh dear, I find that the opportunity to “blog” might turn me in to a loud-mouthed small-brained speaker standing on a soap-box, screaming at the passers-by.

I am a fan of a few web-sites. One of which is the www.theregister.co.uk a web-site that carries “news” articles and some editorial comments.

Well today it reported on 3 things that immediately got me thinking.

1) One was about an organisation that maintains an archive of the Internet and that by doing so might prevent the creation of “Memory Holes”.

Basically, I think, they take snapshots of many Internet web-sites and commit the snapshot to a “read-only” storage.

2) Another article that the www.theregister.co.uk  had was about Google and the European Court of Justice and the “right to be forgotten”. I do not have a broad enough understanding of the legal, or even moral issues, to form an informed opinion.  I sort of feel a bit “iffy” because a printed document (e.g. magazine, book, newspaper…) makes a statement and that statement is archived for ever. So I ask myself why the Internet should be different. The obvious difference is the ease of access to online information, so an incorrect statement once in the Internet is (sort of) forever, but then so is a printed report. The “right to be forgotten” seems to focus on a number of issues:

  • Removing factual incorrect statements that cause damage to the involved people.
  • Removing factual correct statements that the involved people do not want others to know. This in turn breaks down in to:
    • Facts that were legitimately put in the public domain, but never-the-less the involved people want to “hush-up”.
    • Facts that have been placed in the public domain by some-one who has no right to do so.

I have no problem with the idea of “the right to be forgotten” with the first and the last bullets, but the “hush-up” bullet is a real problem.

Anyway, what I find interesting is how the “the right to be forgotten” relates to the archived Internet which (if I understood it correctly) specifically wants to ensure that the “hush-up” bullet does not get hushed-up!

And then, just beause of the way I tick, I reflected back on my blog “Hyde Park Speakers Corner and Digital Dinosaurs Footprint” and wondered about the moral implications of the science fiction story I mentioned.

Without any further thought or analysis, if there is a “right to be forgotten” is there a right to “publish for perpetuity”

3) as I have said in an earlier blog, I am in the telecommunciations industry (since 1979) and have quite a few “hobby horses”. One of my “hobby horses” is about laws and regulations.

I have no, absolutely no, training in law! But my belief is that a law should be an unambigous statement of behaviour/activity that is not permitted.

(I wonder how true that is, there are laws such as “you shall not kill”, but no law “you shall be nice to people”. Laws seem to be, and I am not complaining, proscriptive in nature.)

So a law that says that you are not allowed to drive a automobile on a public highway, without having a valid licence, is okay with me.

Also okay with me is a law that says that providers of telecommunications services can be required to provide metadata and media streams to legally entitled authorities (lawful interception).  Haa, a law that says you shall rather than you shall not, I have just been hoisted by my own petard!

But, it all depends on “what is a telecommuncations service?”.  If I invest in creating a piece of software that enables users to send media streams between themselves, and I create a central databank that lets users see which other users are “online” and where they are (IP address), then I might be supporting telecommunications but I am not providing a telecommunications service. Please no NOT go on about providing addressing information to users is a telecommunications service. It is not, a public library might make copies of the telephone directories available. That tells us under what “address /(telephone number)” a user can be reached. But that is not not not a telecommunications service. Just because some companies provide such informational services “online” does not make their service a telecommunications service.

According to the report on the web-site  www.theregister.co.uk , if I have understood it correctly, it seems that a Belgian court and Microsoft / Skype are in discussion over whether the Skype service is a telecommunications service.

Hmm, as I said, I am not an authority on legal issues, but I must ask the question: On what basis is Skype a telecommunications service?

I am 100% convinced that it is a telecommunications service IF it physically receives users’ media streams and passes them on, which I think Skype does when at least one of the users is identified by a E.164 public telephone number.

But between Skype to Skype users, identified by a Skype identity, I thought (please correct me if I am wrong) that the media leaves the user’s premises and is carried, without intervention by any Skype infrastructure, to the destination user’s premises. In my (non) humble opinion whatever service Skype provides in that specific situation, it is not a telecommunications service.