Grep for php deprecated calltime pass by reference


grep -rin '\&\$' /path/to/your/codebase | grep -v function | grep -v '\=\ \&\$' | grep -v '\=>\ \&\$'| grep -v foreach | grep -v \@param | less

You'll still get a bunch of junk to pick through, but only a screenfull instead of 30.

PDO hates punctuation in placeholder values

If when upgrading a drupal module from Drupal 6 to Drupal 7 one hits an error like the following:
PDOException: SQLSTATE[HY093]: Invalid parameter number: parameter

One may have problems with the formatting of the placeholder values for PDO. For instance several drupal.org threads talk about when dynamically naming these values, make sure not to put a colon (:) ine them. In my own case, of upgrading the e_activist module to drupal 7, it was the dots in table aliases that made PDO stumble.

This is OK:
$result = db_query("SELECT * FROM {e_activist_page_map} WHERE nid = :nid AND page = :page AND submit = :submit", array(':nid' => $node->nid, ':page' => $page, ':submit' => 1));

This was not (Note the e.xxxx in placeholder names)
$result = db_query("SELECT * FROM {e_activist_page_map} WHERE nid = :e.nid AND page = :e.page AND submit = :e.submit", array(':e.nid' => $node->nid, ':e.page' => $page, ':e.submit' => 1));

So if you need to differentiate between tables in placeholders, think up your own difference... maybe "e_" instead of "e.". Only alphanumeric and underscore are valid. (http://stackoverflow.com/questions/5809951/pdo-valid-characters-for-placeholders)

Bitcoin as a viable model for Anonymous, valuable identities on the internet?

I hate spam. Anonymous people wasting your time and resources for their commercial gain with no way to track them down and blacklist them is a significant problem. Any identity of theirs that you blacklist is so cheap that it is instantly replaced with 10 new ones.

I also hate all current services that establish identities but do so in very dangerous ways. Users are asked to invest time creating these identities by websites, ostensibly either for the purpose of building community context about each other (for instance Facebook profiles), or as a way of preventing spam (Disqus logins). Many sites are simply looking to build human or human looking identities in order to sell them to advertizers. These sold and resold private identities, or the more limited yet more sinister dossiers compiled on us by various law enforcement agencies, are becoming dangerously complete weapons aimed at any concept of a private life for people on this planet. When Eric Schmidt said that privacy is dead, he underscored just how far business models that sell our identities as goods will go to turn every atom of who we are into pennies bouncing through a global Rube Goldberg machine.

So, what we need is a concept of identity that will subvert both of these problems. Have we already seen the solution, and just not recognized it?

Lets use the mathematical ideas of bitcoin to solve the internet identity problem. We want identity to be anonymous where needed, decentralized, with no central authority allowed to be the final arbiter, and no advertiser able to turn our internet name into a product to be sold. At the same time, the problem of SPAM, and the need for some trusted identity for community building teaches us that identities should not be so cheap and disposible that one can use them for antisocial or fraudulent purposes without reckoning some cost.

In this system, (call it Bitvoice?), identities would be created based on solving some number problem similar to the hash collisions used by Bitcoin. This would have to be a significant effort, perhaps somewhat easier that discovering a bitcoin, but significantly more costly than just generating an RSA public private key pair. An algorythm should be selected that would generously outpace, but not totally become unhinged from expected population growth of humans (and any other intelligent beings with identities we expect to need to communicate with). The resultant solution would represent an identity that could be used to communicate online. The identity should be cryptographically identifiable as the same identity, should be not inherantly traceable to a human except through the content of communication it chooses to produce, yet should be expensive enough that the blacklisting of this identity as a spammer or a troll would be a small, but significant financial setback.

Dissidents or people who need anonymity could use newly computed or donated identities to do their work, while spammers, who require millions of fraudulent identites to eek out a fraction of a cent in returns would be quickly bankrupted or have to rely on botnets to slowly regenerate blacklisted identities. So, itentities could be tuned to the right scarcity for nurturing a well balanced online society.

The initial distribution of identities would be the big problem with this system. How can the average John Q Public, or the average child in Mumbai get a small number of identities to work with initially, with some being able to be registered for government services and benefits an others able to be kept anonymous?

Anyway, I think there might be something to think about here. What if we could actually find a technical framework that would balance anonymity and identity towards a happy medium? That would be a good day indeed.

Mysql client can't resolve host

ERROR 2005 (HY000): Unknown MySQL server host 'db.example.com' (-1)

If your mysql client software --everything including gui and cli tools-- dies with the previous error after asking for a password, then you either have a DNS problem (most likely) or you may have a freak issue where a line in your /etc/hosts file has gotten too long.

Thank god for mdavidn over on the ubuntu forums who figured this one out.
http://ubuntuforums.org/showthread.php?t=1278665

I got into the issue because networkmanager kept splicing my workstation hostname into my hosts file until that line got like 3000 characters long.

It was totally a crazy problem to troubleshoot, because wireshark confirmed that my local mysql-client was not even sending out any requests over the network, and reinstalling and wiping out local mysql client configuration didn't help at all.

Setting a non detected resolution on modern xrandr system

This script distills the knowledge needed to get my old samsung syncmaster 213T to work at native res from my macbook air running gnome 3.


#!/bin/bash

# if you are adapting this script get the modeline information by running cvt
# then to the below to add this named mode with its config details to the xrandr system
xrandr --newmode "Syncmaster1600" 161.00 1600 1712 1880 2160 1200 1203 1207 1245 -hsync +vsync

# make the new mode setable on this monitor
xrandr --addmode VGA1 Syncmaster1600

# now the new mode should be in the display control panel, but we will go ahead and set it here.
# sets the vga out to use the modes from above
xrandr --output VGA1 --mode Syncmaster1600

How to use deb-src repos

first add them to your source.list file, run apt-get update and.....

"apt-get source foo" to fetch source. "apt-get -b source foo" to fetch and build source "apt-get buld-dep foo" to install the packages necessary to build foo.

(thanks to stew in #debian)

Thoughts on life choices around software freedom

ThistleWeb has a really nice soul searching blog post on the abundance of self limiting purity in the free software community.

http://thistleweb.co.uk/blog/25/05/2011/why-do-we-hold-ourselves-back

I've made a bit of a different choice than he has with regard to facebook (setting up a dummy account and responding to friend requests by letting them know where else to find me). However, I have recently started pushing my notices from identi.ca through to twitter so that I can communicate with the large group of friends already well established there. Open source is not the only issue I am promoting in my life, and while I use only free software on the desktop, and on servers I own and I use open network services preferentially, I'm not going to stop reaching out to people who I love just because they are entrapped in a proprietary platform.

I don't think lecturing or judging friends helps anyone. Cutting yourself off cold turkey is also not effective. However, I do think letting them know why you've made different choices upfront is important.

On some strategic choices, one should take a stand, in others, one is allowed to calculate the risks and benefits:

* At the tipping point, one should err on the side of what is right. (Webm vs h264 is hot right now, I'm gonna only produce content in Webm, cause open formats have a chance of winning and opening up a new era of freedom in content production).

* With well entrenched proprietary communications methods with which you can reach a lot of people, but where your participation or non participation has a negligible impact on the marketplace, I would say that one should take it on a case by case basis, and merely put safeguards in place against a slippery slope. Twitter falls into this category for me. It's more important for me to reach people and be reached by them than to hope against hope for identi.ca to become the norm. I post to twitter only through identi.ca and hope that I can keep enriching both ecosystems. The quality of relationships are deeper and more friendly on identi.ca, but the breadth of information and the potential to reach people is greater on twitter.

* When it goes to participation in an ecosystem controlled by an openly evil empire, I would just say no, regardless of the effectiveness of your individual resistance on the marketplace as a whole. Facebook and Microsoft Skype fall into this category to me. In the former, I have an easier decision, since I have no personal network created there. I will create alternate methods of reaching those folks in that ecosystem, and expend energy to get the message to them. What I will not do is enrich that ecosystem. In the case of Skype, it's gonna be hard to replace. I'm gonna have to ween myself and hopefully some of my network off towards freer alternatives such as Jitsi. It's gonna take a while, but with the news that MS is cancelling skype integration with Asterisk as its first act since the merger, a downward trend is clear.

Canonical I think is a bit of a different issue, it's one of people falling out of love with what was percieved as a savior or leader rather than any sort of software purity test. Pretty much 5 years ago Canonical totally embraced the linux community and was embraced back. Since then, they have progressively made clear that they see themselves as the decisionmakers and us as the consumers of the Ubuntu product. OK then, if it's us and them on opposite sides of a line, then let all the consequences of that decision work themselves out. I think that's what we are seeing there, rather than any software purity debates.