PHP DOMNode -> setAttribute() max-width confusion

While adding some custom code into Mahara, I came across what seems like a very odd PHP bug today, so odd that I put it down to user error, but just can’t seem to find what the user error is! Imagine the code below with some embed code from youtube or picasa as the value of $embedCode.
$embedCode = "<embed .................></embed>";
$dom = new DOMDocument();
$dom->loadHTML($
embedCode);
$allElements = $dom->getElementsByTagName('*');
$firstElement = $allElements->item(2);
$
firstElement->setAttribute("style", "max-width:100%");
echo $dom->saveHTML();

The line that plays up is the one including setAttribute(“style”, “max-width:100%”).

It works on pretty much all other possible css values, but doesn’t seem to like max-width nor min-width. I can set the style to hold color or background values, or text-align, but not max-width! What gives? Why does PHP seem to have CSS max-width?

EDIT: I have since uncovered the cause of this. My text string was being passed through a Mahara function clean_html() which strips out various things, including max-width style definitions. The solution is to clean_html() before I apply my max-width and hey presto, everything works as expected.

Pirates and Protecting Personal Privacy (a response)

In response to: http://ericjoycemp.wordpress.com/2010/12/18/pirates-and-protecting-personal-privacy/

As one of the Pirate Party members present for the excellent DEAPPG meeting (thank you!), I’ll try and respond to some of your comments Eric. I will emphasise however that my comments do not necessarily represent anyone else in the Party nor the Party itself 😀

I’m glad you were intrigued by us. I am glad you recognise that we are willing to engage in the debate, and that we do so intelligently rather than dogmatically. Holding a polemical view doesn’t necessitate an aggressive delivery of that message. Despite the name we are a serious political party (a phrase that sometimes seems to become our catchphrase), and by that I mean both that our issues are very serious and we wish to engage with national politics in a serious way.

I am happy to leave aside issues of copyright, because despite what some say we are not a ‘single issue party’, and I’ll try to respond to the 3 things which struck you about our argument.

Impossibility of stopping leaks

Taking a position that it isn’t possible to stop leaks – in response, I believe, to a straight question of ‘is it possible?’ doesn’t necessarily equate to a position on whether leaks are inherently good or bad. It is just a simple recognition of reality. My personal view would probably depend on context to some extent in the same way as the question about lying to and/or misleading Parliament.

If a full complete and truthful answer in Parliament might cause immediate harm (such as confession of an upcoming currency devaluation) then I could accept a misleading answer as long as it was followed as soon as possible by an honest and fully explained apology. If however Parliament was mislead over something that would only cause discomfort or embarrassment (keeping secret an agreement to allow cluster bomb munition on British soil in US) then no apology would suffice for the contempt with which Parliament was treated.

Likewise I would treat leaks the same way. If a leak would cause more immediate harm than good (admittedly difficult to assess at times), with no efforts to mitigate the harm (anonymising names or waiting for a vulnerable period of time to pass) I would likely regard that specific leak as ‘bad’. If however a leak reveals information that ‘is in the public good’ (again, can be hard to assess) even if it might be diplomatically or politically embarrassing, I’d be inclined to consider the leak ‘good’. This fairly arbitrary notion of good or bad doesn’t change whether we can stop it, and it doesn’t necessarily mean it should be legal/illegal to leak.

Arguing strongly for personal privacy

There are very clear conflicts between notions of pure free speech, and the respect of privacy, and I imagine that it is a fine line to legislate. I am reminded of something I read elsewhere once upon a time (regret to not remember where) discussing the outrage in the USA at the idea of their national flag being burnt despite it being legal to do under free speech*. The article discussed the dichotomy of this being a protected free speech while at the same time being abhorred by so many in society. The authors perspective was that the social outrage towards the flag burner was sufficient social punishment for the ‘crime’ and that the law didn’t need to provide further punishment, and thus could preserve free speech.

To my mind this is a way in which personal privacy and how to handle it could be dealt with.

Likewise legislatively there is a very clear difference between trying to criminalise the local neighbourhood gossip poking their nose into everyone’s private business, and having the position as a Government that the state should not intrude into the private lives of citizens by covering every square inch with CCTV cameras, holding DNA databases of innocent people, trying to impose national ID cards as well as integrating government databases with all sorts of personal information about us and then opening it up to everyone and their dog, and the list of government intrusions into our privacy could go on. Yes, we want our private data to be private. Yes, information can be easily leaked. Solution, stop putting all our private data into more and more government databases and start to respect our privacy as individuals.

The important thing to recognise is that it doesn’t matter if I, or you, or anyone else, thinks a leak is good or bad in terms of stopping that leak occurring in the first place. If someone is motivated to leak, they will. What is important, and needs more looking at is how you deal with leaks after the fact.

I would personally advocate in favour of a system where leaks and breaches of personal privacy can be prosecuted, because the law should not just be about what we can or can not enforce, it should also be about what we as society are asking of each other. That is exactly what I see laws as being, our social contract with each other over what we deem acceptable. I accept that leaks can be the right thing to do, I also accept that leaks can be bad, as such we need laws that are capable of prosecuting leakers when in the public good but with wiggle-room to protect whistle-blowers.

The very existence of laws to penalise leakers may be sufficient to stop those who may be inclined to leak frivolously. I personally believe that anyone that sees something bad going on and leaks despite the often harsh penalties of doing so is a hero.

Laws that punish leakers need to be crafted to accept that sometimes the public good trumps secrecy, needs to analyse motives and the intent of the leaker rather than just the embarrassment the leak may cause. Such shades of grey are hard to legislate, but we ought to aspire to manage it. We already have a system that is supposed to look at the public good before prosecuting a legal case against someone, so there is some ability to deal with the shades of grey between wrong/right before something comes to trial. I also have faith in the British public to judge between a good and bad leak.

More than any of this, I would prefer to live in a country where there were no nasty secrets being held back from the public, where the people and Parliament weren’t mislead for political/diplomatic convenience, where there weren’t any secrets that were in the public good to be leaked.

If the state should decide what is kept private

I don’t know that we ‘argued that the state did not have the right to decide what should be kept from the public’. In a sense we the public grant the state the right to make that decision. It is the state that has proven that it doesn’t respect the public to use that power fairly and responsibly. The rights of the state are rights that the public can take back. I think you call this anarchy Eric. I call it democracy.

You also mention Eric that there is a contradiction in the Pirate Party having policies that respect personal privacy while at the same time accepting and admitting that it is easier for information to spread than it is to contain it. There is no contradiction here. Recognition that information can be communicated is not acceptance that all information should be communicated. I think we all probably know people that gossip a little too freely with the private information of others. Gossiping is something we all engage in from time to time, but most people recognise that while gossiping can be irresistible, we’re not actually discussing matters of great intellectual significance, we’re not curing cancer, and we aren’t (no matter how much hot air we give out) sending rockets to the moon.

It is possible to distinguish between private and personal information about a person, and between information about the state, about that activities of government, etc. As to who should make that distinction, I agree with you Eric, it is the state. That is, the people that live in the state, the wider society, and not just those that choose to make the decisions behind closed doors. Governments should by all means have definitions of what they think should be public and secret, but those definitions should be open to society so we can choose if we agree or not. Government should then stick to those definitions and not deceive and manipulate us.

You wrote, Eric, that you put that question to us a number of times and we didn’t answer. I guess there are a number of reasons. Primarily I suspect it was because the discussion we were there to have wasn’t about the distinction between personal private information and state ‘secrets’. We were there to discuss the issue of state ‘secrets’ being put into the public domain and the clear revelation of quite how dirty some of those state secrets are. Those leaks have us question the honesty of those that purport to lead us and the real question was what should states do to deal with the threat of leaks. The answer is that states should behave with honour and dignity and have nothing to fear from such leaks. The secret face of our state should be one we aren’t ashamed to discover.

Of course, another good reason why you might not have been given an answer to your question is that some of us (or maybe just me) are new to that sort of environment and need to take some time to observe and absorb rather than actively participate right off the bat. Some of us might not be natural politicians, and tongue-in-cheek slightly, maybe that’s a good thing.

Just because one Pirate argues that all information will come out, doesn’t make that person (or others in the movement) an anarchist. Rather perhaps just a realist? I’m not sure any of us want to kill the state. As a Party we are trying to enter mainstream politics. Not to kill it from within, but to fix those problems we see. Why did you and your colleagues enter politics? Hopefully for many of you it was because you perceived a problem and wanted to fix it! As a motivation I respect that, even where I may disagree with the perceived problem and solution (though having been a life-long Labour voter maybe not as much disagreement as others might have). Likewise I hope mainstream politics will respect us in the Pirate Party for holding that same willingness to try and right those wrongs we perceive.

You are very right Eric that those ‘with political, commercial … power now have a responsibility to question their own assumptions about information, creativity, communications, [etc]’. You are also right that Pirates need to understand people as well as technology. I worry that there is an implication that you think we don’t. I disagree. Some of us (it pains me to exclude myself) may be young and (happy to include myself) more technology aware than average, but neither of these characteristics should assume a lack of knowledge or experience with the real world. Of course some of us fit stereotypes, but many of us do not. From my reading of what you wrote you are asking us to decide if we like democratic values or regard them as irrelevant. I hope you didn’t mean it that way, but I point once more to us entering the democratic political process, as well as restating that recognition of the inevitability of something does not equate to support of it. We very much want our ideas to be part of the solution. I don’t think that will happen until a lot of the mainstream parties throw away a lot of their perceptions and truly engage with our policies.

*Burning in fact actually being the preferred way to dispose of worn US flags.

Featured image – Would Like To Use Your Current Location some rights reserved by Kai Hendry

One year anniversary

As of posting this, I have been a paid up member of the Pirate Party UK for a year.

It has been a rather busy year, and so much has happened both personally and for the party.

I’ve stood for and achieved uncontested victory as the RAO for the South East. I have also stood for election to the Board of Governors where, despite a strong field, I am proud to be amongst those chosen.

This of course is only the beginning, both of these positions require a lot of time and hard work on my part, and I am grateful for the opportunity to be involved with furthering the goals of a political party that I so strongly support.

Featured image – Some rights reserved by Omer Wazir

Policy discussion forums, open or closed?

When the PPUK’s policy discussion forums were closed I was aware of it, but as a paid-up member not really affected by it. At least that’s what I thought.

I should also confess that I didn’t pay any attention to the debate surround the issue before or after the decision was made, and have blissfully and ignorantly supported the decision retrospectively.

Having recently traded some communications with a non-member (i.e. signed up to the forum but didn’t pay to join the party) who was affected by the decision I decided to go back and look at the debate.

I find it quite telling that there are quite a few eager people who seem very supportive of the party’s aims that declared an intent to leave and not join over the issue. Their relatively low post totals does seem to indicate that they did indeed leave. Of those, it is also clear to me that some of them are clearly eloquent, well educated on our issues, and have essentially been driven away due to this decision.

Of course, to balance against that, I have all the ‘benefits’ of this decision being taken. But as those benefits are mostly invisible things like ‘prevent non-members coming into the forums and spamming and de-railing them’ they are really hard to measure. How many spammy derailing forum posts have been prevented? Who knows.

Over the past year I have seen the occasional clearly spam forum post (via the RSS feed) which have been pretty much nuked/quarantined/whatever well before I can see them in the actual forum. This tells me our forum admins are doing a great job in clearing away the junk. Could they have handled any spam in the policy forums? Probably. Of course that does raise the issue of do we want our admins nuking non-spam posts that derail policy discussions? I’m uncomfortable with that idea.

I don’t know whether or not there is much will amongst the rest of the party to revisit this issue, but if there is, ask yourself this: as paid up members, how are we affected by this decision?

My answer is this: I have missed out on the valuable contributions of those who want to engage with our party, want to engage with our issues, and who may be subsequently persuaded into joining and contributing further.

Featured Image NORAD blast doors, Cheyenne Mountain, Colorado. USAF photo. Public Domain.

Dogfooding STV and the Board of Governors

The Pirate Party UK recently held elections for their Board of Governors, and with 12 seats up for grabs the fairest and most logical voting method to use was a Single Transferable Vote using the Electoral Reform Society’s 1997 guidelines.

The ‘dog food’ of the blog title refers to using the same tools and technologies that you advocate others to use – so close to but not quite the original meaning.

This election finished today, with not only the results being made public, but the ballot and count files too so that those that requested receipts can confirm their votes were accurately recorded, and so that all members can check to see the results match up with the ballot file. This is true democracy in action, and shows the beauty of the STV system for elections over other such systems as, say, AV.

I’m happy to say that not only was I a candidate in these elections, but I was successfully voted through in the first count of votes.

With the vote over, and my thanks to all those who had confidence in me, the hard work begins.

Rest assured that any constitutional amendments that may go through the Board do require full ratification by member vote, so you don’t need to worry about back-room dealing and any decisions made without member oversight.

As a newly elected Governor I invite any and all members to email me (and I am sure any of the other Governors would be happy to receive your ideas too) with any ideas and suggestions they have for the Board to consider.

Featured image – Preferential ballot – Rspeer at the English language Wikipedia [GFDL or CC-BY-SA-3.0], from Wikimedia Commons

Date of the AV referendum

David Cameron has been urged to rethink plans for holding a referendum on voting reform at the same time as the Scottish Parliamentary election.

Scotland’s First Minister Alex Salmond said in a letter to the prime minister that holding the votes on the same day could “overshadow” devolved issues.

To be honest, if the voters allow the referendum to overshadow devolved issues, they probably don’t really care enough about those devolved issues. For those that do care, how on earth is an additional unrelated vote going to confuse them?

Tell the electorate what you stand for, outline your policies, if you can’t get your message across to them the failure is yours! A message for any political party.

Featured image Open Science – some rights reserved by gemmerich

Open source and Schools

After reading Peter’s post on this subject I thought I’d weigh in with some thoughts.

In a previous life I worked at a school as a webby-techie sort. This was back in the days before fast internet and the school had serious problems with the speed of the internet with all the children surfing for the same things at the same time. In addition the ISP filtering (and this article isn’t going to discuss whether filtering is good or bad) was fairly rudimentary.

Being a fairly adventurous sort I snagged an old machine and installed Squid (a GPL licenced caching web proxy with filtering support) on it. The school then changed the proxy settings of all PCs to go through the new proxy and we gained a slightly faster system for frequently visited sites, and had the means to block other sites totally.

Once the system had proved how valuable it was, the school decided it needed something better than a random old PC to handle the web cache. Rather than buy a more fit for purpose machine for me to repeat my installation, they promptly paid through the nose for a black-box solution from RM. After basic investigation it turned out that this black-box solution was running nothing other than Squid. The school however had more confidence in a commercially obtained solution than some free thing downloaded and installed in-house.

It is this sort of “nobody ever got fired for buying IBM equipment” mentality that seriously hampers the take-up of free and open source software (FOSS) within schools. To some extent this isn’t surprising. The people making the decisions aren’t usually technical experts, and want to make a decision that they think won’t backfire on them.

What we need are trustworthy organisations to advise and guide schools away from closed proprietary systems and towards open source, and to do so consistently rather than give mixed messages. Maybe a focused single perspective on this issue that saved money could have helped BECTA from being closed down. Maybe not.

If you’re FOSS savvy and know how to install and support this sort of thing but you aren’t prepared to get a job in a school doing this (or volunteer many hours of your time) then it is easy (but not necessarily helpful) to look on the problem from the outside and say something must be done.

The real problem is how do we get the relevant expertise into our schools in a sustainable way? For this I really think the government needs to lead, and in a time of financial cuts across the board, I believe real savings can be made by guiding a lot of the public sector over to FOSS.

Featured image Open Science – some rights reserved by gemmerich

FPTP, AV, and PR

Yesterday saw the announcement of details of the coalition government’s plan for a voting reform referendum.

As suspected true proportional representation (PR) isn’t on the table. Instead the choice is between the current first past the post (FPTP) system and the proposed alternative vote (AV) system.

What is FPTP?

This is relatively simple, and is the current system by which MPs are elected to Westminster. Each member of the electorate has a single vote with which they can express a single preference. The candidate with the most votes wins. This is nice and simple, conventional, and results in, as its detractors would say, in a situation where the winner generally receives less than 50% of the vote. With a 3+ party system, the ‘winner’ usually has more people voting against them than for them. A further disadvantage is that minority views from the electorate are not represented in parliament.

What is AV?

This is a slight variation on FPTP in which the electorate have the ability to express a ranking preference. After counting first preference votes if no candidate has an outright majority (50%+ of the votes) then the last placed candidate is eliminated and any votes they received are redistributed according to the second preference. This process repeats until a single candidate has 50%+ of the votes (or I guess until there is only one candidate left). This system prevents a result in which more people voted against the winner than for the winner, but does still leave minority views unrepresented.

What is PR?

Proportional representation systems vary, but the intended result is to elect a candidates from parties as appropriate to the proportional vote those parties receive during the voting process. There is generally a minimum threshold of votes required, after which if a party receives 10% of the vote, they can expect to win 10% of the seats up for grabs.

This system ensures that (after the certain threshold) the views of the electorate are reflected proportionally in (for example) the House of Commons.

How could PR work in the UK?

This is the big issue. A PR system isn’t really compatible with our current system by which we have one winner per constituency, and would need to go hand-in-hand with other changes. This does present a good opportunity for wholesale democratic changes, though obviously the more you wish to change, the harder it is to get agreement.

Without going into too much detail, one way to incorporate PR into our constituency system would be to still elect one MP per constituency (based on a FPTP/AV system) and tallying up all additional votes nationally to get a sense of the proportion of the country voting for certain parties, and then to use a list system to elect parties to the House of Lords based on the proportion of the vote.

This would maintain the link between MP and constituency, and democratise the House of Lords completely. For those who object to minority-view parties being elected (by very fact that they have the minority of the vote and shouldn’t get to have any power at all – glossing over whether this is a fair perspective or not), there is some consolation that the PR elected candidates only get to provide oversight from the Lords rather than more direct influence in the Commons.

This also mitigates the problems of how to deal with a perceived mandate to govern for a wholly elected Lords – as the election occurs simultaneously with that of the Commons, it is the commons that has the clearer ‘majority’ mandate to govern. Whereas the Lords would only have the ‘minority’ mandate to make sure the views of minorities are heard and considered by government.

Turn about?

With the Liberal Democrats consistently being a strong proponent of proportional representation* it is very disappointing to find them settling for this compromise, especially as it does not seem like a compromise. If the Conservative element of the coalition are reserving the right to campaign for a ‘no’ vote, then why are the Liberal Democrats compromising at all?

Artificial inflation of turn-out

Another disappointment is that there seems to be more uproar over the timing of the referendum as opposed to the exact question of the referendum itself. There seems some concern that presenting the referendum at the same time as other elections is both insulting to those other elections (how?), and also will artificially inflate the rate of response. It is disgusting for elected representatives to be heard suggesting that taking advantage of a voter’s presence in a voting booth to ask for additional voter opinions is artificial. I want to hear our representatives looking for ways to increase voter turn-out, not decrease it!

Yes or No to AV?

If it becomes clear that the only choice on offer in the referendum in FPTP or AV, then it is clear what is better. You can only choose from the options available, and AV is fractionally a better system that FPTP, and as such would have by support.

*To the point where Straw recalled that Clegg, during the general election campaign, told The Independent that the alternative vote system was a ‘miserable little compromise’, and ‘I am not going to settle’ for that.

Copyright and Patent reform

I’ve just read a great post by a fellow PPUKer on Copyrights and Patents, which is well worth a read before you continue reading my post here.

Despite wanting to make non-commercial file-sharing legal, that doesn’t mean the Pirate Party UK wants to allow things such as counterfeiting and people profiting from other people’s works without proper permission. These will remain illegal, though the maximum copyright term will fall from it lasting 70 years after the original author dies, to a maximum of 10 years after the work is created. This is done to encourage the creation of new works, and prevent reselling and repackaging of old work for profit.

When it comes to the Pirate Party‘s copyright position the common counter is about fairness. How fair is it for someone’s work to be taken by others and used without payment? How fair is it for people to take advantage of the creations of others? etc. etc.

This talk about fairness is perhaps what frustrates me the most. How on earth did we reach a point where thoughts, ideas, words, sounds, and other intangible things are treated like physical limited goods that ought to be owned?

How can it be fair that use of an idea be artificially restricted to the person that first conceived it to the point of depriving the rest of society of that idea? The only way it can be fair is if that restriction is finely tuned to provide the perfect balance between giving the creator incentive to be creative, while at the same time making sure the creation eventually becomes free for all of society to benefit from.

Copyright terms of 70 years after the death of the creator very clearly are designed to benefit corporate entities that have copyrights signed over to them rather than benefiting the creator or society.

How can if even be fair if copyright terms were just 70 years even if the creator was still alive? Why should anyone deserve to be paid for 70 years after coming up with an idea? When I spend a year working in my job, I get paid for the year. I have to then keep working to keep getting paid. I recognise creative works can often take many years of unpaid work before being finished, and that’s why a fair balance needs to be struck that allows a creative person to get sufficient financial return for their work.

Frankly if a creator of a piece of work can not recoup sufficient earnings for their time working on an idea within 10 years of announcing it – then the chances are it’s not that revolutionary and useful an idea. At which point why does a capitalist society owe them anything?

It’s that fairness, and the desire to rebalance fairness in favour of the rest of society, that is one of the primary reasons why I am an ardent supporter of Pirate Party policies.

Featured image Books HD – some rights reserved by Abee5

First footsteps into regional administration

Having recently been elected to the august post of Regional Administrative Officer for the South East, I have been taking a more active role in the Pirate Party.

Last Sunday (and any reason other than the England v Germany result to remember the day by is most welcome) I chaired a South East regional meeting for the first time and took great pleasure in meeting some members I’d only previously gotten to know via the party forums.

It was actually a slightly tricky meeting: firstly it’s always difficult to sit around talking about actually doing something other than sitting around, and secondly with the South East covering quite as much geography (was approx a 3 hour drive each way to the meeting from home, and other meetings may take me further) as it does the next meeting is likely to be located such so that that same members are unlikely to be able to make it.

If I hold a meeting every 4 weeks, and if only every 4th meeting repeats a location, it will be quite difficult to gather momentum as in practice the first 3 meetings may have to cover the same ground (with different people), with the 4th-6th essentially just being the second meeting with the attending members. If it takes the third meeting before real productive activity is taking place, that may well be 6 months down the line from now (daunting and not really sounding acceptable to me).

Of course, discussing things on the forums is an alternative, but I really want to reach members who aren’t active on the forums (forums aren’t everyone’s cup of tea), but there’s a hurdle of persuading people to turn up for their first face-to-face meeting (we’re all internet weirdos after all, aren’t we?).

All in all, despite there being many challenges ahead for me, I feel greatly encouraged after Sunday’s meeting. I know that after every subsequent meeting I will feel more encouraged, because there is nothing like meeting up with like-minded individuals and getting into conversation with them to reaffirm my belief in both this party and our objectives.