Building OpenCV 3.0.0 for iOS Applications

Getting an Xcode framework version of OpenCV built used to be a pretty hair-raising exercise in yak-shaving. It’s gotten a whole lot easier lately.

First, check out the OpenCV sources:

cd ~
git clone https://github.com/Itseez/opencv.git
cd opencd/
git checkout 3.0.0

You’ll need to make a symbolic link to Xcode’s developer tools so everyone can find things:

cd /
sudo ln -s /Applications/Xcode.app/Contents/Developer/ Developer
cd ~/opencv

All you need to do is have python run the build. Works flawlessly.

python platforms/ios/build_framework.py ios

Walk away from the keyboard for half an hour, when you get back, you’ll have a nice opencv2.framework in ~/opencv/ios/…

Fixing an IPTables Startup Error on CentOS 6

If you’re running CentOS 6 on a virtual server, you may run into the following problem when you try to restart iptables:

# service iptables restart
iptables: Setting chains to policy ACCEPT: security raw nat[FAILED]filter 
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Unloading modules:                               [  OK  ]
iptables: Applying firewall rules:                         [  OK  ]

It’s a fairly simple fix. First, open up /etc/init.d/iptables in your favorite text editor, and look for this section of code:

   echo -n $"${IPTABLES}: Setting chains to policy $policy: "
    ret=0
    for i in $tables; do
        echo -n "$i "
        case "$i" in
            raw)
                $IPTABLES -t raw -P PREROUTING $policy \
                    && $IPTABLES -t raw -P OUTPUT $policy \
                    || let ret+=1
                ;;

After the “case” line, and before the “raw)” line — i.e. between lines 5 and 6, above — add the following:

           security)
               $IPTABLES -t filter -P INPUT $policy \
                   && $IPTABLES -t filter -P OUTPUT $policy \
                   && $IPTABLES -t filter -P FORWARD $policy \
                   || let ret+=1
               ;;

When you’re done, the whole section should look like this:

   echo -n $"${IPTABLES}: Setting chains to policy $policy: "
    ret=0
    for i in $tables; do
        echo -n "$i "
        case "$i" in
            security)
                $IPTABLES -t filter -P INPUT $policy \
                    && $IPTABLES -t filter -P OUTPUT $policy \
                    && $IPTABLES -t filter -P FORWARD $policy \
                    || let ret+=1
                ;;
            raw)
                $IPTABLES -t raw -P PREROUTING $policy \
                    && $IPTABLES -t raw -P OUTPUT $policy \
                    || let ret+=1
                ;;

Then, restart iptables, and things should be fine.

# service iptables restart
iptables: Setting chains to policy ACCEPT: security raw nat[  OK  ]filter 
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Unloading modules:                               [  OK  ]
iptables: Applying firewall rules:                         [  OK  ]

How to Run Multiple Instances of VLC on OS X

VLC is one of the very best media players out there, but on OS X it’s got one minor frustration: unlike other players (Quicktime Player, for example), VLC on the Mac only allows a single player instance at a time. Unless you get tricky. Here’s how.

We’re going to create an Applescript “droplet” which will create a new instance of VLC any time you drop a playable media file onto it. Start by opening up the Script Editor app — it’s in the Applications/Utilities folder by default — and create a new script with the following contents:

on run
    do shell script "open -n /Applications/VLC.app"
    tell application "VLC" to activate
end run

on open theFiles
    repeat with theFile in theFiles
        do shell script "open -na /Applications/VLC.app " & quote & (POSIX path of theFile) & quote
    end repeat
    tell application "VLC" to activate
end open

Next, select the save command, but before you save it out, change the file format to “Application” using the pop-up selector in the Save… dialog:

Script EditorScreenSnapz002

If you save this to your Desktop, you can simply drag and drop any media file that VLC can play back onto it, and it’ll open up the movie in a brand-new instance of VLC.

Installing Splunk on El Capitan

If you try to install Splunk Enterprise on an El Capitan system, you’re going to run into some errors when you try starting it up:

$ /Applications/Splunk/bin/splunk start
dyld: Library not loaded: /Users/eserv/wrangler-2.0/build-home/ember/lib/libmongoc-1.0.0.dylib
  Referenced from: /Applications/Splunk/bin/splunkd
  Reason: image not found
dyld: Library not loaded: /Users/eserv/wrangler-2.0/build-home/ember/lib/libmongoc-1.0.0.dylib
  Referenced from: /Applications/Splunk/bin/splunkd
  Reason: image not found
dyld: Library not loaded: /Users/eserv/wrangler-2.0/build-home/ember/lib/libmongoc-1.0.0.dylib
  Referenced from: /Applications/Splunk/bin/splunkd
  Reason: image not found
Did not find "disabled" setting of "kvstore" stanza in server bundle.

In order to get around this, execute the following commands:

$ sudo mkdir -p /Users/eserv/wrangler/build-home/6.2.6
$ sudo ln -s /Applications/Splunk/lib /Users/eserv/wrangler/build-home/6.2.6/lib

$ sudo mkdir -p /Users/eserv/wrangler-2.0/build-home/ember/
$ sudo ln -s /Applications/Splunk/lib /Users/eserv/wrangler-2.0/build-home/ember/lib

Then execute

$ /Applications/Splunk/bin/splunk restart

and everything should work fine.

The Easy Way to Update Drupal Core

Drupal gets regular updates, and it’s important to keep on top of them. Unlike WordPress, Drupal isn’t set up to update its own core automatically, and if you’ve been updating your site manually with mysqldump, ftp, etc., you’re working too hard. There’s a great tool for doing it from the command line: drush.

Presumably, you have pear installed on your Drupal site, so installing drush is very easy:

pear channel-discover pear.drush.org
pear install drush/drush

Once you have drush installed, navigate to the root of your Drupal site. Make a copy of the sites/ folder:

cp -r sites/ sites-bak/

Next, use drush to make a backup of the MySQL database:

drush sql-dump --result-file=../myDrupalSite.sql

Specify your result-file path to suit your needs. Now, put your site into maintenance mode:

drush vset --exact maintenance_mode 1
drush cache-clear all

Update Drupal core:

drush up drupal

When asked whether you “really want to continue, enter “y” and press return. drush will update your site core, perform any necessary database upgrades, and (by default) keep a backup copy of the existing site. Now, put your site back online:

drush vset --exact maintenance_mode 0
drush cache-clear all

Using drush is a lot quicker, safer, and more efficient than doing your core updates manually — check it out!

Thursday LinkFest (7/23)

Technology and Science!

  • You’ve heard that light is both a particle and a wave. Scientists have figured out a way to photograph the dual nature of light.
  • Take a free course in “Poker Analytics and Theory” from MIT. The math is pretty heavy, be forewarned: poker is not a game for the innumerate.
  • Check out this wonderful talk on “Web Design — The First 100 Years”.
  • Crows are scary smart. Crows might be smarter than you are.
  • Self-described “experts” may not be as smart as crows: they’re more likely to believe things that simply aren’t true. Researchers from Cornell and Tulane found that a little competence turns into a big case of Dunning-Kruger syndrome.
  • We’re hearing a lot about how self-driving cars are going to “make things better”, but I’m unclear on how cars whose cost will exceed the US median income are going to help anyone but the plutocrats who make them, and their minions who can afford them. And we’re seeing proofs-of-concept that while they may cut down on accidental traffic fatalities, there’s a distinct possibility that they might facilitate some deliberate ones.
  • A new species of firefly has been identified in Southern California. Yeah, we have fireflies out here, but a vastly smaller population of a very limited number of species, they’re not nearly as flamboyant as the ones back East. Bright, flashing fireflies pretty much stop west of Kansas, no one really knows why.
  • Does cold-brewed coffee have more caffeine than hot coffee does?
  • A study just published in JAMA Pediatrics suggests that extreme poverty may affect physical brain development, particularly in the areas responsible for things like learning. Another argument in favor of a guaranteed minimum income.
  • Boas, anacondas and other “constrictors” don’t kill their prey by asphyxiating them: they actually stop the blood flow in their prey’s body, according to new research.

Society and Culture

    FirefoxScreenSnapz175

  • What happens when a paleontologist takes issue with pop-tart Kesha for manhandling a triceratops fossil he worked to restore? Nothing good.
    Also, bonus ageism:
    FirefoxScreenSnapz176
  • Age discrimination at Google? Gee, ya think? A woman has joined a class-action suit against the Goog alleging that she was recruited no fewer than four times, had excellent interviews, and failed to get hired.
  • What do a shyster lawyer, nine million missing dollars, and several boxes of extremely rare comics books have to do with one another? Here’s a great story that will tell you.
  • When Twitter, a company where nine out of ten tech employees are dudes, throws a themed party, what’s the theme? Frat house, obviously.
  • The Timmins Public Library in Ontario started a robotics club, yay! But it’s only for boys, boo! But nine-year-old Cash Cayen’s mom didn’t take that sitting down, she got a petition going on Change.org, collected 27,000 signatures, and got the mayor to open the program to anyone who wanted to participate. Even girls.
  • The cop who stopped Sandra Bland did not have the right to tell her to put out her cigarette, nor to order her out of her car for no reason, nor did she have to do anything other than identify herself to him, nor could he “yank” her out of her vehicle, nor could he object to her recording this encounter with her cell phone, nor could he threaten to “light her up with a Taser”. It looks like your rights don’t matter much in the face of some Barney Fife’s aggrieved privilege.
  • Meanwhile, it seems increasingly likely that there are some shenanigans going on with the “now you see it, now you don’t” video of Sandra Bland’s traffic stop. Chicanery is being alleged.
  • A journey into the purring heart of Japanese Internet cat culture.
  • A robot is hitchhiking from the Peabody Essex Museum in Salem, Massachusetts to the Exploratorium in San Francisco. What adventures will our plucky little droid encounter?
  • Sound engineering is “the grumpiest profession in the world”. As an occasional audio engineer, I can confirm this.
  • Am I wrong to find it horrifying that the Smithsonian Institution is reduced to panhandling on Kickstarter — and giving Kickstarter a healthy percentage of the proceeds — to restore and preserve a unique and important artifact of American history?
  • The brilliant thinkers over on r/adultery have some great ideas for how to explain your having a “Ashley Madison” account to your (dumb) wife.
  • Louisa Lim, author of The People’s Republic of Amnesia, wants to know how China managed to completely forget that the Tienanmen Square uprising ever happened.
  • “I gave up Ayn Rand for Bernie Sanders” — a journey back to sanity.
  • Speaking of Ayn Rand, here’s a nice piece on how she became the “Libertarian Sociopath Pixie Dream Girl”. Also, some hair-raising quotes from her newly-published-for-no-reason-whatsoever bad novelization of her very bad stage play, Ideal. Believe it or not, this is a quote: “He felt as if there was something—deep in his brain, behind everything he thought and everything he was—which he did not know, but she knew, and he wished he did, and wondered whether he could ever know it, and should he, if he could, and why he wished it.”
  • Why is Congress handing over Apache sacred lands to a British-Australian mining company?

Security

Everything Else

  • No words are necessary. Just watch.
  • Ambient sound in movies — particularly the sounds you never notice but would absolutely miss if they weren’t there — is what “foley artists” and “soundscape designers” do.

Quick Note: Solving an OS X Terminal Weirdness

I had something that started up a few days ago where my attempts to connect to any server via SSH in Terminal simply stalled, after the key exchange had successfully taken place. Not really sure what was wedged, but the solution turned out to be to first remove openssh with brew, then reinstall it, with keychain support:

brew remove --force openssh
brew install openssh --with-keychain-support

Next, we want to modify the LaunchAgents plist for openssh:

sudo sed -i '' 's/\/usr\/bin\/ssh-agent/\/usr\/local\/bin\/ssh-agent/' /System/Library/LaunchAgents/org.openbsd.ssh-agent.plist  

We can add a little helper script to ~/.bash_profile:

eval $(ssh-agent)
    function cleanup {
        echo \"Killing SSH-Agent\"
        kill -9 $SSH_AGENT_PID
    }
    trap cleanup EXIT

And finally, set up the system to use the updated ssh, rather than the OS X stock one, universally (some apps will look for ssh in /usr/bin, rather than respecting $PATH settings.

sudo mv /usr/bin/ssh /usr/bin/ssh_old
sudo ln -s /usr/local/bin/ssh /usr/bin/ssh

Seems to be working fine again now.

Wednesday Linkfest

ETHICS!

    FirefoxScreenSnapz166

  • Columnist Dan Savage asks the entirely reasonable question, “Why are people horrified at Gawker for outing one cheating dude, yet gleeful over hackers outing 37 million of them?”

Security

  • After Hieu Minh Ngo was convicted of a massive series of identity thefts, a class-action suit has been instituted against credit bureau Experian, which is accused of violating the Fair Credit Reporting Act, among a variety of other things. The plaintiffs want to force Experian to contact anyone who may have been affected by Ngo’s activities, to offer them a full year of free credit monitoring, to disgorge any profits Experian may have realized from Ngo’s scheme and to establish a fund to reimburse people affected by Ngo’s activities.
  • AshleyMadison CEO Noel Biderman made an effort to pitch Robert Scoble on how incredibly serious they were about security. You’d think they might’ve considered encrypting their databases.
  • A possible breach at PNI Digital Media, providers of a widely-used online photo management platform, has had the effect of causing CVS, Rite-Aid, CostCo and a number of others to shut down their photo-processing services.
  • The Federal Trade Commission is taking action against putative identity-protection firm Lifelock, for lying about its services, a charge it has faced in the past. Additionally, the FTC has charged that LifeLock failed to implement a meaningful security program (STOP ME IF YOU’VE HEARD THIS ONE BEFORE!), falsely claimed that it offered consumers protection comparable with that of major financial institutions with regard to their own data, and had failed to meet the record-keeping requirements of the company’s $12 million, 2010 settlement with the Commission and 35 states’ attorneys general.

Technology

DEVONthink Pro OfficeScreenSnapz003

Drones, Drones, Drones

Society & Culture

FirefoxScreenSnapz165

  • If you talk with your co-workers about your salaries at Google — discovering all sorts of untoward things in the process, evidently — your manager will give you a hard time about it, in spite of the fact that doing so is completely illegal in California.
  • Breitbart chucklehead and Donald Trump impersonator Milo Yiannopoulos doesn’t believe women should be involved in tech. No one’s got time for that kind of stupid, especially not Margaret Hamilton, who led software development for the moon landing and coined the term “software engineering”.
  • Speaking of “Breitbart chuckleheads”, editor Ben Shapiro has filed assault charges against transgender reporter Zoey Tur after she put her hand on his neck and called him a “little man”. Why so serious, Ben? Feeling…inadequate…?
  • A young iOS developer hurls herself to her death from a 20th-floor rooftop bar in Manhattan’s Flatiron district. Other patrons, attending a “corporate event”, are unperturbed and just keep on drinking.
  • A study by researchers at the University of New South Wales and the University of Florida has found that the worse a guy is at games the more likely he is to make negative comments toward women gamers. U JELLY BRO?
  • Remember how people used to “run away to the Big City” to make their fortune? Got a median income? Here are all the big cities you can’t afford to live in, and when they became unaffordable. San Francisco crossed that line in 1982.
  • A 6-foot 4-inch 260 pound South Carolina construction worker has been arrested for slapping a waitress (on whom he had 120 pounds and 13 inches) when she took issue with his racially harassing a black family while they were trying to have dinner. Reportedly, he was under the impression that the family “didn’t mind” being abused.
  • Been bitten by a rattlesnake? Expect an enormous hospital bill. ObamaCare has improved things, but the American health care system is very broken.

Other Stuff (and #CannibalismInTheNews!)

DEVONthink Pro OfficeScreenSnapz002

  • A burglar manages to take a selfie by accident while stealing an iPhone from the apartment he’s broken into. Venice, California police are requesting help in identifying this dolt. Guys like this are the reason “crime doesn’t pay” — they bring down the average.
  • “Pot polish” — the rounding of broken bone edges when they’ve been cooking in a pot — as well as cut marks on the bones show pretty conclusively that the doomed Franklin Expedition of 1845 did, indeed, resort to cannibalism.
    Relatedly, Dan Simmons’ book The Terror is a terrific fantasy novelization of the privations and demise of John Franklin and his two ships full of hapless, doomed explorers.
  • Missed yesterday’s Festival of Links? Check it out here.

    The Internet is Broken: The Trolls

    Back in the day on USENET, we had trolls, although they were relatively mild (for the most part—there are distinct exceptions, and you’ll get to meet one in the next installment). We also had a reasonably effective way of dealing with them: we sent them to alt.flame, USENET’s own little “basement”. It worked reasonably well, mostly through force of tradition and peer pressure; there were certainly no technical measures to enforce it, nor could you “throw someone off USENET”. It wasn’t a “site”, it was a distributed system of servers which synchronized with one another, and there was no notion of “membership”, you simply posted things to a group.

    Mostly, trolling amounted to name-calling. Some of it was clever, some of it was dopey, but it was a rare case that ever went beyond that.

    (And just to demonstrate how far South things have gone, a Google search on “alt.flame” turns up numerous references to something called “alt.flame.niggers”.)

    Today, we hear—from folks like the denizens of ChanLand and its territories, like #GamerGate—that people who complain about online harassment are just “getting their jimmies rustled” over people “saying mean things on the Internet”.

    Anyone who believes that needs a swat upside the head with a clue-by-four, and then to read this story, once they’ve regained consciousness. A cabal of anonymous trolls literally drove a man almost to suicide and terrorized his family in Virginia. If that’s not enough, read how Nazi harasser Andrew “weev” Auernheimer (in our “featured image”) drove Kathy Sierra off the web.

    If you need more evidence of how out-of-control this can get, I strongly recommend Danielle Keats Citron’s Hate Crimes in Cyberspace, which is a pretty chilling read—at least if you couldn’t have written a bunch of it yourself. Here’s a very partial extract of some of the harassment experienced by a grad student Citron refers to by the pseudonym “Anna Mayer”.

    Over the next year, the attacks grew more gruesome and numerous. Sites appeared with names like “Anna Mayer’s Fat Ass Chronicles” and “Anna Mayer Keeps Ho’ing It Up”. Posts warned that “guys who might be thinking of nailing” her should know about her “untreated herpes”. A post said, “Just be DAMN SURE you put on TWO rubbers before ass raping Anna Mayer’s ST diseased pooper!” Posters claimed she had bipolar disorder and a criminal record for exposing herself in public. Racist comments she never made were attributed to her. Posts listed her professors email addresses, instructing readers to tell them about Mayer’s “sickening racist rants”. Someone set up a Twitter acount in Mayer’s name that claimed she fantasized about rape and rough sex. Hundreds of posts were devoted to attacking her.

    I want you to keep this in mind, especially when we get to the next installment, which will go over my experiences having an online stalker for (so far) over a decade. You’re going to see some similarities.

    However, I want to relate the specifics of why I’ve “gotten off” Twitter—actually my account is now protected, and I’m limiting the people who have access to it. As I’ve mentioned, I’ve got some strong opinions about GamerGate, and I haven’t been terribly shy about expressing them, forcefully. This has been going on for several months, but in the last few weeks, the response from GamerGate went from name-calling to actual harassment.

    One form this harassment took was the posting of photographs of members of my family by a GamerGate-r, @rustBeltExpat. I reported them to Twitter, and learned a couple of things about how “seriously” Twitter takes harassment. First, it seems to have taken them about three days to get to dealing with my report; at least that’s how long it took to get a response on it. Second, I was informed that if the harassing user takes down obviously privacy-invading material before Twitter looks at it, it “doesn’t count” as harassment.

    MailScreenSnapz035

    Another form was the creation, and subsequent deletion—over a period of maybe ten or fifteen minutes apiece—of numerous new Twitter IDs impersonating various members of my family, again with photos. These were used to bring my attention to their existence by favoriting or retweeting various defamatory posts I was mentioned in. The bottom line here is that Twitter is a great deal less than serious about its commitment to dealing with harassment on its platform.

    When I say “defamatory”, I’ve been accused of being a arsonist, a Satanist, a blackmailer, a “revenge pornographer”, an attempted murderer, and a pedophile. That’s fine, I don’t worry too much about stuff like that, particularly when the “evidence” is nothing but anonymous comments somewhere that link to other anonymous comments somewhere to provide a façade of “support” for the claims.

    In spite of this apparently-lengthy criminal record, I’ve never heard from an actual representative of law enforcement on any of these very serious charges. Go figure.

    When uninvolved third-parties who have absolutely no horse in the race get dragged into things to be used as a blunt object, that’s a strong sign that someone out there is valuing their viewpoint a little too highly. And since Twitter only offers lip service to its “concern” about its users being attacked (and attacked and attacked), this represents my “strategic retreat” to “higher ground”. We’ll see how things proceed.

    In the interests of fairness and balance, I need to point out that trolling — at least of the milder, name-calling sort — is not limited to #GamerGate partisans. At around the same time this was all going on, I had gotten involved in the usual sort of heated #GamerGate discussion in which one of the other participants was #GamerGate critic Sarah Nyberg. It should be noted that Nyberg has herself been subjected to harassment by #GamerGate as well over the past six months, much of it in the form of accusations that she’s a “pedophile” and a “dog-fucker”. (In a similar vein, ggblocklist ccreator and OAPI executive director Randi Harper has been accused of selling her child for methamphetamine.)

    Nyberg effectively issued me an order that I untag not her, but an unspecified “us”, from the conversation at one point. I pointed out to her that she wasn’t the boss of me, and that if she wanted something from me, she could ask nicely and say “please”. Her response to this was to block me and start tweeting about how I was “the archetype of a problematical male ally”, along with the help of about a half-dozen of her minions.

    FirefoxScreenSnapz164

    Of course, #GamerGate happily picked this up, and has been broadcasting the news that the (actually non-existent) “aGG” — the monolithic block of “Social Justice Warriors” they’re crusading against — had “excommunicated” me.

    No worries, I’ve been declared a heretic before by much more impressive groups.

    In the next installment, I’ll talk about my own personal stalker, a fellow with more names than most people have housekeys and a very sad excuse for a human being who’s managed to be a pothole on the Information Highway for two decades now.

    His given name is Jason Christopher Hughes.

    This is the second of a series of articles; the previous installment is here.

    UPDATE, 7/22/15: Apparently Twitter went back and took a closer look at @rustBeltExpat; the account has now been suspended for “abusive behavior”.

    MailScreenSnapz038