Valgrind: Apology Edition

The things Your JoeDog will do for you….

A couple weeks ago he complained about Valgrind (and probably a whole bunch of other stuff but we’re talking about Valgrind now). His snippet was leaking memory and valgrind was unable to identify the leak. The leak was manually identified in this function:

ARRAY
array_destroy(ARRAY this) 
{
  int i;

  for (i = 0; i < this->length; i++) {
    xfree(this->data[i]);  
  } 
  xfree(this->data);
  this = NULL;
  return this; 
}

While we freed the elements of the array, we never freed the array itself. The leak is fixed like this:

ARRAY
array_destroy(ARRAY this) 
{
  int i;

  for (i = 0; i < this->length; i++) {
    xfree(this->data[i]);  
  } 
  xfree(this->data);
  xfree(this);
  this = NULL;
  return this; 
}

Today Your JoeDog was coding on the train again.  Before he boarded, he downloaded the above code onto his snazzy Linux laptop.  He was turning caffeine into code when wouldn’t you know it? Another stinkin’ memory leak. “What the hell,” he thought. “Let’s give valgrind another try.” Unfortunately it wasn’t installed on snazzy Linux laptop. For some reason, Amtrak’s proxy won’t allow downloads larger than 10MB. Stupid Amtrak.

That’s easy to bypass. Your JoeDog established an ssh tunnel from his laptop to this webserver and proxied to the Ubuntu repository.

 

--2014-10-25 10:15:13--http://us.archive.ubuntu.com/ubuntu/pool/main/v/valgrind/valgrind_3.10~20140411-0ubuntu1_amd64.deb
Resolving localhost (localhost)... 127.0.0.1
Connecting to localhost (localhost)|127.0.0.1|:11111... connected.
Proxy request sent, awaiting response... 200 OK
Length: 15078790 (14M) [application/x-debian-package]
Saving to: ‘valgrind_3.10~20140411-0ubuntu1_amd64.deb’
100%[=============================================>] 15,078,790 290KB/s in 73s
2014-10-25 10:16:26 (202 KB/s) - ‘valgrind_3.10~20140411-0ubuntu1_amd64.deb’ saved [15078790/15078790]
 Funny thing. That copy of valgrind found the leak. Guess where it was? Give up?
ARRAY
array_destroy(ARRAY this) 
{
  int i;

  for (i = 0; i < this->length; i++) {
    xfree(this->data[i]);  
  } 
  xfree(this->data);
  //xfree(this);
  this = NULL;
  return this; 
}

In order to illustrate his first post on valgrind, Your JoeDog commented out the fix he told you about. Well, this second copy of valgrind found it. So what gives?

1. Valgrind works and I’m sorry I busted on it.

2. RedHat’s version doesn’t seem to work but Ubuntu’s does.

 

Posted in Uncategorized | Leave a comment



New Features For Fido

There’s rumors on the Internets. “Oh, really? What do they say?” They claim your posting frequency affects Google’s crawling frequency. The more you update, the more often it crawls.

Your JoeDog wanted to scrutinize this hypothesis. He wanted to monitor his logs and compare Google’s crawl rate against his web site updates.

So he added this rule to fido.conf

/var/log/httpd/joedog-access_log {
 rules = Googlebot
 action = /home/jeff/bin/googler
}

With that config he produced this document: google.txt

“J!!!!!!!!” Funk shouted in IRC. “You need to verify Googlebot”

“You mean a lot people forge that User-agent?”

“I’ll bet forty percent is forged.”

“D’oh!”

Fido can’t validate an IP address, nor do I want it to. Still, it needs a new feature, namely the ability to interact with its action script. Your JoeDog will add support for regex capture to his rules. This will allow you to capture part of the match and send that text to your action script.

“I have no idea what you just said.”

Okay, let’s modify the rule above with its intended implementation:

/var/log/httpd/joedog-access_log {
 rules = ([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+).*Googlebot
 action = /home/jeff/bin/googler
}

The parentheses are highlighted in red because they represent the proposed feature.

On a match, fido will capture everything inside the parentheses and send it as argument 1 to the googler script. In this case it will be an IP address which googler can then verify as one that belongs to Google. If you have multiple captures, fido will send them as space separated arguments, i.e.,  /home/jeff/bin/googler  173.240.11.11 GET /index.php

For a sh script, $1 = 173.240.11.11, $2 = GET and $3 = /index.php

If all I wanted to do was solve this problem, I’d just write a script that parses the logs. However, I think this will be a valuable feature that will allow fido more flexibility to solve all the world’s problems.

Posted in Uncategorized | Leave a comment



Bitcoin Bust

Your JoeDog hasn’t spent much time blogging about Bitcoin but it does interest him for two reasons: 1.) He studied economics in college and 2.) The rogue currency has a technology/Internets angle. From an economics perspective, a successful currency must provide a medium of exchange and serve as a reasonably stable store of value. Bitcoin certainly provided the former but the latter was always in doubt.

And doubt won. Since its peak, Bitcoin has lost two-thirds of its value. Its bust was obviously not without victims. From Izabella Kaminska, we hear the story of one of those victims. Redditor Whattodobtc appears to have impoverished himself with bad bets on Bitcoins.  Izabella claims, “Some extremely wealthy libertarians have a lot to answer for if these sorts of ppl lose all due to believing in them.” Your JoeDog is certainly no libertarian but he feels the burden of risks should be placed on those who take them.

Certainly there have been influential libertarians who’ve been pushing Bitcoin as a hedge against fiat money. And if people like Whattodobtc better understood currency, they’d be less inclined to go long on a Libertarian pipe dream. But is this any different than the hucksters who shilled gold as a hedge against non-existent hyper-inflation? If you believed Glenn Beck back in 2012 and sunk your savings in gold, you lost 36% of your investment. That’s not as depressing as Whattodobtc’s story but it’s equally devoid of a happy ending.

Whattodobtc posted to Reddit because he wanted advice. Should he sell or weather the storm? He should have posted a similar inquiry before he sunk his savings in Bitcoin. Personally, I’d sell now before all I had left were some worthless binary numbers.

Posted in Uncategorized | 1 Comment



Siege 3.x.x On Ubuntu

Your JoeDog uses Ubuntu Linux on his laptop. A few years ago he was deep in siege development and he was caught without a working copy. “I wonder if … ” Your JoeDog thought, “I wonder if Ubuntu has it.” He ran ‘sudo apt-get install siege’ and there it was, ready for installation. The Big Boys were distributing his software and Your JoeDog was convinced that he was a Somebody.

If this happens to you, if a major vendor starts to distribute your software and you feel the need to tell people about it, take an opportunity to learn this lesson: nobody gives a shit. It’s a great feeling so you’ll probably ignore it. You’ll puff your chest and tell people, “Debian is distributing my software!” Instead of a pat on the back, you’ll hear “What’s Debian?” You’ll tell them and they’ll quickly change the subject. Trust the JoeDog on this one: nobody gives a shit. Your wife might give you a poorly acted, “That’s great, honey.” but at the end of the day, your software project excites people as much as your fantasy football team.

Now turn the clock up a few years. Yesterday Your JoeDog had an encounter with a with a compromised Mormon dating site. He wanted to see what software they were running so he ran ‘siege -g http://singlesaints.com/’ on his snazzy new System76 laptop. Turns out he didn’t have a copy. But wait a second: Ubuntu distributes siege, remember?

“What’s Ubuntu?” – See, I told you nobody cares.

When he went to run that command with Ubuntu’s siege he got this message: ‘siege: error while loading shared libraries: libssl.so.1.0.0: No such file or directory’

In recent days, our log aggregator has been telling us that many of you are googling ‘ubuntu siege libssl’ and it suddenly became clear why you were doing that. This nerdblogger decided to investigate the cause and document it here. As a diligent nerdblogger, he uninstalled siege in order to document the the problem from scratch. Funny thing. When he ran siege after the second install in order to capture the error message, there was no error message. Siege worked.

At this point all that is known is this:

  1. There appears to be a problem with siege on Ubuntu
  2. Here’s the error message: libssl.so.1.0.0: No such file of directory’
  3. libssl.so.1.0.0 was installed on the laptop in which this error was encountered
  4. After removing siege with ‘sudo apt-get remove siege’ and
  5. Reinstalling it with ‘sudo apt-get install siege’
  6. It worked.
  7. Your mileage will vary. If the problem persists you should post to the Ubuntu forums 

 

 

 

Posted in Uncategorized | Leave a comment



Different Tasks

tasks Vis xkcd

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Posted in Uncategorized | Leave a comment



Hope And Change: Nerdblog Edition

Your JoeDog read that women marry a man hoping he’ll change. Men, on the other hand, hope she’ll remain the same. He’s also noticed that most of the denizens on this nerdblog are men. They don’t like change! Well change is coming.

No, we’re not taking art classes with young guys named Pierre.

Your JoeDog is ditching cvs for git. This is a good thing. He’s using github.com which means the repository will be available to you.

Unfortunately, the history is not. Your JoeDog tried and tried to port the history to git. He used all the tools, followed all the instructions and posted all the errors into the Google machine. Apparently his cvs repository is — how does he say this? — fscked up. It doesn’t seem fscked up but the Internets have spoken.

The commit history is important. A few years ago Your JoeDog was contacted by a heroic Patent Fighter. Some douche wanted to patent a rudimentary coding technique and Our Patent Fighter was searching for original art, stuff that was published before Patent Douche came up with his “orginal idea.” I believe that idea was, “I can’t believe nobody’s thought to patent this yet!”

Well sir, Your JoeDog was able to provide detailed publishing dates which were used as original art. Patent Douche was defeated and it was happy nice time for everyone but Patent Douche.

The point is, kids, don’t smoke cigarettes. Also, we’re moving the source to github.com

UPDATE: Siege was added to github.com; same deal, no history. You can check it out of version control with the following command:

git clone https://github.com/JoeDog/siege.git

 

[Trending: JoeDog's source repository]

 

Posted in Uncategorized | Leave a comment



All Aboard….

Your JoeDog is coding on the train right now. What’s he coding? He’s adding recursive directory searches to fido.

 

 

Posted in Uncategorized | Leave a comment



When Customers Don’t Want Their App Purchases Tracked

  1. “I beg of you” please delete my name from the app purchase list.
  2. Wifi Wars or how to express your views with SSIDs
  3. Is your wifi SSID a security risk?
  4. Apple keeps Steve Jobs’ empty office untouched
  5. And now we wait: Net Neutrality Considered
  6. Before computers, people programmed looms

 

 

Posted in Uncategorized | Leave a comment



High Tech Depression

The Atlantic has an interesting article about depression and anxiety in the tech industry.

Yet certain elements of startup life and culture may make people particularly susceptible to depression. Stress, uncertainty, youth and isolation—the virtual cornerstones of today’s startup—have all been shown to increase likelihood of developing the disorder.Irregular work hours and constant high stress levels can lead to both social isolation and sleep disturbances, which can aggravate depression and make people even more volatile.It’s almost a perfect storm, says Maurice Ohayon, a professor of psychiatry at Stanford University School of Medicine. “Any psychiatrist can tell you that this population is particularly exposed,” he told me.

Most founders operate under a huge amount of pressure. They are responsible for employees, shareholders, and maintaining company morale, mostly before reaching the age of 30. And especially in the early stages of running a startup, they shoulder that burden mostly alone.

[Atlantic: Tech Has a Depression Problem]

 

 

Posted in Uncategorized | Leave a comment



A Lock Picking Tool For Sidewinder Locks

 

When Your JoeDog lived in Manhattan his car had traditional locks. Thieves frequently jimmied those locks and took whatever they could find inside the vehicle. One morning before work, he was seen carrying a new battery down Second Avenue after his was stolen the night before.

He finally solved this problem in 1993 by installing a red light below the dash. The light didn’t do anything other than illuminate but thieves figured Your JoeDog had a fancy pants alarm and moved on to the next car.

In 1998, Volkswagen introduced sidewinder keys to thwart lock jimmiers. These keys had a flat metal blade with a wavy groove down the center. They had an identical cut on the reverse so the key could be inserted either way. They were also known as internal cut or laser cut keys.

Starting in October 2000, Volkswagen added a transponder chip for additional security. This type of key is now found on a wide array of vehicles.

The video at the top of this post is generating a stir. It features a lock picking tool for sidewinder locks. After a little fiddling inside the enclosure, the tumblers seem to adjust to the tool and the door opens for the intruder. He’s able to turn the ignition with even less effort. Fortunately, the car doesn’t start. It’s probably looking for a signal from the transponder chip.

So while your car may remain in its parking spot, as Your JoeDog can attest, once thieves gain entry they can wreck your entire morning. A battery gets pretty heavy after just one block. Imagine lugging one for seven more….

[Digg: If You Live In Bangkok Here's How Your Car Will Get Stolen]

Posted in Uncategorized | Leave a comment



Recent Comments

  • Mirko: Wow! This trick saved my day :) thanks a lot
  • The Spaniard: greatest team ever
  • Mike Smith: I find that Dunning-Kruger explains a lot. The difficult part is getting help to those that suffer from...
  • Sohan: I am using node-js http server. I created http request to hit the server and log the message. In that case...
  • Jeff Fulmer: I don’t know what “simple http server” means. If you’re using apache out of the...