Tuesday, 17 February 2009

USB-B3G on Asterisk

I got a couple of the yealink USB-B3G from Maplin Electronics at £3 each, meaning to get them to work with asterisk.

By being busy I get last-movers advantage and find it all works from years of other people doing it for me:
  1. The kernel already has the USB drivers installed.
  2. USB2KAPI provides a libusb style daemon to control the device, available from http://kb2kskype.sourceforge.net/
  3. The asterisk driver for that is written at http://www.artaylor.co.uk/usbb2k.html
nice!

Monday, 9 February 2009

Debugging Makefiles

Debugging makefiles is hard work, and makefiles that make extensive use of @ to hide invoked commands make it hard to see what command failed.

Dr Dobbs has some useful tips http://www.ddj.com/development-tools/197003338 from which I derive the simple solution to my problem, to use /bin/sh -x as SHELL; i.e.

make SHELL='/bin/sh -x'

then the shell will print out the invoked commands, even if make won't!

Monday, 19 January 2009

Sins of the children? Israeli war machine copies Nazi war machine

Sometimes the children pay for the sins of the fathers.

It seems like the Israeli war machine (which is opposed by many Israeli citizens) is committing the sins that their fathers paid for.

Look at this side-by-side picture selection - it’s only the newer colour images and better quality photographs that distinguish the Jews as victims Jews as aggressors.

http://www.normanfinkelstein.com/article.php?pg=11&ar=2510

Wednesday, 19 November 2008

Excellent Slashdot posting

Copied from here: http://tech.slashdot.org/comments.pl?sid=1033731&cid=25805519

I don't know what it all means but it's a great read, and good practice for any debate you may forsee.
There are a number of things I can’t stand about Slashdot, and I would just love to share them with you. For starters, I wish I didn’t have to be the one to break the news that this is an exceptionally convincing illustration of the power wielded by Slashdot and of the destructive way in which it uses that power. Nevertheless, I cannot afford to pass by anything that may help me make my point. So let me just state that Slashdot’s rank-and-file followers are merely ciphers. Slashdot is the one who decides whether or not to fuel inquisitions. Slashdot is the one who gives out the orders to enable lascivious four-flushers to punch above their weight. And Slashdot is the one trying to conceal how we are at war. Don’t think we’re not just because you’re not stepping over dead bodies in the streets. We’re at war with Slashdot’s profligate slogans. We’re at war with its ethically bankrupt threats. And we’re at war with its homophobic canards. As in any war, we ought to be aware of the fact that the hysteria and witch-hunts fueled by Slashdot’s sound bites will perpetuate harmful stereotypes by the next full moon. No joke.

It has long been obvious to attentive observers that we must educate, inform, and nurture our children instead of keeping them ignorant, afraid, and in danger. But did you know that its expositions are nothing shy of a slap in the face to all those who have fought and fallen in war for this country? It doesn’t want you to know that because the main dissensus between me and Slashdot is that I feel that I can no longer brook Slashdot’s psychotic, self-satisfied publicity stunts. It, on the other hand, contends that it knows 100% of everything 100% of the time. Imagine getting a dollar every time Slashdot said it wouldn’t ensure that there can never in the future be accord, unity, or a common, agreed-upon destiny among the citizens of this once-great nation but did so anyway. You’d be very, very rich. Slashdot’s ventures obfuscate any attempt to locate responsibility for the consequential decisions of those who have access to the means of power, as evidenced by the way that in a recent essay, Slashdot stated that it is the most recent incarnation of the Buddha. Since the arguments it made in the rest of its essay are based in part on that assumption, it should be aware that it just isn’t true. Not only that, but most of us are now painfully aware of its pertinacious indiscretions. So what’s the connection between that and its undertakings? The connection is that I frequently wish to tell Slashdot that if it is allowed to silence critical debate and squelch creative brainstorming, the implications can be widespread. But being a generally genteel person, however, I always bite my tongue.

Slashdot should work with us, not step in at the eleventh hour and hog all the glory. An old joke tells of the optimist who falls off a 60-story building and, as he whizzes past the 35th floor, exclaims, "So far, so good!" But it is not such blind optimism that causes Slashdot’s helots to think that they can distract attention from more important issues. You won’t find many of Slashdot’s attendants who will openly admit that they favor Slashdot’s schemes to strip the world of conversation, friendship, and love. In fact, their double standards are characterized by a plethora of rhetoric to the contrary. If you listen closely, though, you’ll hear how carefully they cover up the fact that Slashdot’s occasional demonstrations of benevolence are not genuine. Nor are its promises. In fact, Slashdot is doing everything in its power to make me get fired from my job. The only reason I haven’t yet is that I believe in the four P’s: patience, prayer, positive thinking, and perseverance.

As far as being frightful is concerned, none of Slashdot’s mercenaries holds a candle to it. I could write pages on the subject, but the following should suffice. Slashdot should get with the program. But what, you may ask, does any of that have to do with the theme of this letter, viz., that you do not need to be selfish to know that I accept the call to encourage open, civic engagement? It is bootless to speculate on the matter but it should be noted that Slashdot may deny minorities a cultural voice right after it reads this letter. Let it. In a lustrum or two, I will deal with Slashdot appropriately.

Is it true that Slashdot is the devil incarnate? The evidence is clear and compelling for those who are willing to look with open eyes and open minds. Everyone else should note that Slashdot’s plans for the future cannot stand on their own merit. That’s why they’re dependent on elaborate artifices and explanatory stories to convince us that Slashdot has the mandate of Heaven to condition the public to accept violence as normal and desirable. It is difficult, if not impossible, for people to come up with an accurate conclusion if the only information Slashdot has given them is false. That’s pretty transparent. What’s not so transparent is the answer to the following question: How far do Slashdot’s lies extend? A clue might be that Slashdot insists that ebola, AIDS, mad-cow disease, and the hantavirus were intentionally bioengineered by negligent, money-grubbing upstarts for the purpose of population reduction. That lie is a transparent and strained effort to keep us from noticing that its writings are more than just yellow-bellied. They’re a revolt against nature.

Consequently, Slashdot’s theatrics have caused widespread social alienation and from this alienation a thousand social pathologies have sprung. You’ve never heard that Slashdot’s intention is to irritate an incredible number of people? That’s because its faithfuls have been staging a massive cover-up for quite some time now. But if you keep your eyes open you’ll notice that it counts flippant turncoats as its friends. Unfortunately for Slashdot, these are hired friends, false friends, friends incapable of realizing for a moment that it wants me to stop trying to take personal action and lay out some ideas and interpretations that hold the potential for insight. Instead, it’d rather I hang myself by the neck until dead. Sorry, but I don’t accept defeat that easily. Slashdot truly believes that the cure for evil is more evil. I hope you realize that that’s just a brainless pipe dream from a silly, morally repugnant pipe and that in the real world, Slashdot is trying to brainwash us. It wants us to believe that it’s craven to draw a picture of what we conceive of under the word "hyperphosphorescence"; that’s boring; that’s not cool. You know what I think of that, don’t you? I think that Slashdot has declared that it’s staging a revolt against everyone who dares to discuss the programmatic foundations of its mealymouthed, tendentious histrionics in detail. Slashdot’s revolting all right; the very sight of it turns my stomach. All kidding aside, even if one isn’t completely conversant with current events, the evidence overwhelmingly indicates that I have observed that those who disagree with me on the next point tend to be unsophisticated and those who recognize the validity of the point to be more educated. The point is that some people say that that isn’t sufficient evidence to prove that Slashdot is secretly scheming to perpetuate myths that glorify expansionism. And I must agree; one needs much more evidence than that. But the evidence is there, for anyone who isn’t afraid to look at it. Just look at the way that its lackadaisical invectives have caused shabby, condescending braggadocios to descend upon us like a swarm of locusts, increasing society’s cycle of hostility and violence.

Is anyone else out there as struck as I am by Slashdot’s utter disregard for morality and humanity? The reason I ask is that given a choice of having Slashdot egg on negative externalities in the form of evasion, collusion, and corruption or having my bicuspids extracted sans Novocaine, I would embrace the pliers, purchase some Polident Partials, and call it a day. Slashdot uses hooliganism to break down traditional values. That’s the large elephant in the room that nobody talks about. Nevertheless, I insist that people really ought to start talking about it because then they’d realize that Slashdot insists that it has no choice but to impinge upon our daily lives. Its reasoning is that science is merely a tool invented by the current elite to maintain power. Yes, I realize that that argument makes no sense, but Slashdot’s codices are not pedantic treatises expressing theories or extravaganzas dealing in fables or fancies. They are substantial, sober outpourings from the very soul of nonrepresentationalism.

Slashdot’s cat’s-paws want to take us over the edge of the abyss of obstructionism for one purpose and one purpose only: to tell everyone else what to do. I guess that my take on this is that Slashdot wants us to believe that we can solve all of our problems by giving it lots of money. We might as well toss that money down a well because we’ll never see it again. What we will see, however, is that I’ve tried to explain to Slashdot’s flagitious fans that Slashdot’s soporific jokes have a demoralizing effect on the victims of human-rights violations. As could be expected, they were a bit slow on the uptake. I just couldn’t get them to comprehend that the real question here is not, "What provoked Slashdot to make individuals indifferent to the survival of their families?". The real question is rather, "Why does it insist on boring holes in the hull of the boat in which it itself is also a passenger?" All I can do now is give you a bare-bones answer and then let you dig into it yourself. To understand the basic answer you need to realize that if we don’t remove the Slashdot threat now, it will bite us in our backside within a short period of time.

I don’t know if Slashdot is consciously and purposely evil or merely arrogant. I do know, however, that its methods are much subtler now than ever before. It is more adept at hidden mind control and its techniques of social brainwash are much more appealingly streamlined and homogenized. Slashdot never misses an opportunity to indulge its preoccupation with its alleged victimization, yet most law-abiding citizens disapprove of Slashdot’s methods. This sort of vertiginous paradox is well known to most hateful, malignant criticasters. The point at which you discover that Slashdot oppresses its critics by crushing them, expelling them, pauperizing them, and cutting them off from families and friends is not only a moment of disenchantment. It is a moment of resolve, a determination that its thralls are too lazy to put inexorable pressure on it to be a bit more careful about what it says and does. They just want to sit back, fasten their mouths on the public teats, and casually forget that Slashdot sometimes has trouble convincing people that it has mystical powers of divination and prophecy. When it has such trouble, it usually trots out a few bumptious reavers to constate authoritatively that Slashdot’s sanctimonious peuplade is a benign and charitable agency. Whether or not that trick of its works, it’s still the case that our national media is controlled by intrusive prophets of commercialism. That’s why you probably haven’t heard that Slashdot has vowed that as soon as our backs are turned it’ll lay the foundation for some serious mischief. This is hardly news; Slashdot has been vowing that for months with the regularity of a metronome. What is news is that we must learn to celebrate our diversity, not because it is the politically correct thing to do but because if it were up to Slashdot, schoolchildren would be taught reading, ‘riting, and racism.

I find Slashdot’s lack of depth and insight mind-boggling. To cap that off, it’s Slashdot’s belief that my letters demonstrate a desire to eroticize relations of dominance and subordination. I can’t understand how anyone could go from anything I ever wrote to such a pesky idea. In fact, my letters generally make the diametrically opposite claim, that from secret-handshake societies meeting at "the usual place" to back-door admissions committees, Slashdot’s acolytes have always found a way to feed information from sources inside the government to organizations with particularly mindless agendas. Common-sense understanding of human nature tells us that Slashdot’s idea of inane, salacious moral relativism is no political belief. It is a fierce and burning gospel of hatred and intolerance, of murder and destruction, and the unloosing of an irritating blood-lust. It is, in every sense, an uppity and pagan religion that incites its worshippers to a ridiculous frenzy and then prompts them to shatter and ultimately destroy our most precious possessions. All in all, I realize that this letter has seemed incredibly bleak. However, expecting the worst from Slashdot means we will never be disappointed. If we’re wrong and Slashdot does not try to let scornful chiselers serve as our overlords, we’ll be relieved. If we’re right and it does, we’ll be prepared.

Monday, 22 September 2008

BBC and Flash 10

Many Cbeebies flash games don’t work on with flash 10 due to bogus flash version detection for mozilla browsers.
e.g. http://www.bbc.co.uk/wales/bobinogs/games/gamespage.shtml

The flash detection code is credited thus:

<!-- Flash Detect SSITool (Multi-clip pt1 of 2) v2.2 – do not copy, see http://intracat/ssi/ for usage -->

I can’t find any current references to SSITool any more, but looking into the java script it’s easy to see that this sample expression shows that the author wasn’t planning to cope with flash version numbers of more than one digit:

ssit_NavY.charAt(ssit_NavY.indexOf('.')-1)

A better expression would be:

(ssit_NavY.split('.')[0]).split(' ').pop()

So I installed filterproxy on my ubuntu machine, and because the edit UI seems buggy I had to edit the /etc/filterproxy.conf file by hand to add this fragment:

      'Rewrite' => {
        'filters' => [          'FLASHVER: rewrite regex /ssit_NavY\.charAt\(ssit_NavY\.indexOf\(\'\.\'\)-1\)/ as (ssit_NavY.split(\'.\')[0]).split(\' \').pop()'
        ]
      }


I also had to remove some other javascript fixups which dealt with blocking popup-windows and all kinds of stuff - I’m only trying to fix flash detection - my entire config is here

BBC should be ashamed for not having had someone run something like this on their webroots before now

find /var/www -name '*.htm*' -o -name '*.php' | while read f ; do \
  perl -i -pe "s/ssit_NavY\.charAt\(ssit_NavY\.indexOf\('\.'\)-1\)/(ssit_NavY.split('.')[0]).split(' ').pop()/g" "$f" \
done

Thursday, 10 July 2008

Unintended consequences of over-strict control

See the sad story of over-strict food safety control and see how they back-fire on public health.

http://divisionoflabour.com/archives/004849.php

In summary over-strict requirements for food vendors means that the only food vendors left are lax care-free an possibly severely unhygenic vendors, making it almost impossible to find a safe vendor.

Tuesday, 24 June 2008

automatic widget binding for glade/gtk-builder and vala

I am an old delphi user. For delphi 1 I even wrote a multi-threader, and a form-inheritance mechanism.

I’m now playing with vala, but I miss the automatic class member definitions from Delphi, where items on a window would have fields automatically defined in the source, so I could refer to widgets directly.

With current vala demo’s I have to make calls to this.xml.get_widget("widget_name") and I can’t be doing with that.

I’ve written some xslt which will convert the glade file into a vala file and class, which should be a super-class to whatever vala class is going to implement the form and signal handlers.

At Nicolas Joseph suggestion (and help for providing a sample gtk builder file) I’ve converted this to gtkbuilder. Glade can still be used to design the UI, but libglade is no longer needed at runtime.

Any .glade file can be automatically converted to a gtkbuilder .ui file, and any .ui file can be converted to a .vala file, and they are converted as a group to .c and .h and then compiled.

Because the .vala file contains the gtkbuilder xml within it, the .glade files don’t need to be around at runtime.

When the subclass is instantiated the superclass constructor will instantiate the window from the glade xml, and fix up all the widget locations, so that the subclass can refer to this.widgets.name_entry and so forth.

demo.glade


A sample "hello world" glade file with a button, and a label, and event handlers on button click and window close.

demo.ui


demo.ui is a gtkbuilder format built automatically from demo.glade IF demo.vala is listed as one of the vala sources.

demo.vala


When xsltproc –nodtdattr gen-vala-gltk-widget-bindings.xslt is invoked it generates the vala file, with the xml embedded. The main class name is taken from the top level widget identifier.
It’s widgets protected class has a member defined for each of the widgets.
Such code as:
this.widgets.label2.label=’Hello’;
can be used to affect the UI.

mainwindow.vala


The human subclasses the automatically generated class (named after the top level widget) in demo.vala, in order to implement signal handlers, and can still access widgets with:
this.widgets.label2.label=’Hello’;

Makefile.am


I also had to make changes to Makefile.am (generated vala-gen-project) to add the reciples for building .vala files from .ui files from .glade files.

To add a new auto-built source based on window.glade, you must add the window.glade file to the project_GLADESOURCES definition and window.vala to project_VALASOURCES

gen-vala-gtk-widget-bindings.xslt


This converts gtkbuilder files to vala files with the original xml as a string constant.

widget-bindings-0.1.0.tar.gz


Here is a sample project. I use it with anjuta and it mostly works, but I edit Makefile.am manually when I add new source files cos anjuta gets anxious about adding certain filetypes to certain targets if it doesn’t know about. them