Post navigation

Homebrew – Building a working APC 3.1.9

I’ve recently started using Homebrew as a means to get a working PHP/APC on my local MACs. It was fairly straight forward, however, after installing APC, PHP stopped working. Turns out there was a tiny bug in apc_lock.h that needed to be fixed. Literally, one extra character in the header caused the whole thing to go kaput.

Turns out it’s a pretty simple fix. Just have to remove ONE ampersand (&) in the file and everything is kosher. But, since I couldn’t figure how to incorporate a patch in Homebrew, I wrote some hacky ruby in the apc.rb file to fix the situation.

Hacky code to follow:

   def install
        Dir.chdir "APC-#{version}" do
            text = File.read("apc_lock.h")
            text.gsub!(/apc_fcntl_unlock\(&a TSRMLS_CC\)/, "apc_fcntl_unlock(a TSRMLS_CC)")
            File.open("apc_lock.h", 'w') { |f| f.write(text) }
            system "phpize"
            system "./configure", "--prefix=#{prefix}"
            system "make"

            prefix.install %w(modules/apc.so apc.php)
        end
    end

Enjoy!

Posted in Code Chunks, General Nerdery, How-To | Leave a reply

AFP: Fourteen US states sue to block health reform

Quote

“State law is irrelevant,” Siegel said. “Where state and federal law conflict, federal law wins.”

Except tax laws.

http://www.examiner.com/x-16414-SF-Personal-Banking-Examiner~y2009m12d29-The-…

United states. Whatever.

via shakeit

Posted in Photos | Leave a reply

Random Comment Spam #1

eventhough I commit just about all of my daytime hours on the web using games like myspace poker or restaurant city, I nonetheless like to utilize some spare time to check out a small amount of sites sometimes and I’m grateful to report this most recent page is in fact quite good and greatly superior than 1 / 2 the various poor quality stuff I read today , anyways i’m off to take up a couple of rounds of zynga poker

via shakeit

Posted in Randomness | Leave a reply

Somehow, I don't think he's going to find what he's looking for

[image]

I’m just sayin’

via shakeit

Posted in Randomness | Leave a reply

Gary Coleman arrested in Utah on domestic assault warrant; In jail working on bail

Gary Coleman arrested in Utah on domestic assault warrant; In jail working on bail

Sunday, January 24th 2010, 9:02 PM

Gary Coleman has been arrested in Utah for domestic violence, authorities say. The actor had previously been charged with misdemeanor domestic violence after a fight in July with his wife.

Whatchu talkin’ ’bout Willis?

via shakeit

Posted in Randomness | 1 Reply

Porn video shown on Moscow highway billboard

MOSCOW (AP) — Drivers in downtown Moscow were squinting in disbelief
as an electronic highway billboard blazed a two-minute pornographic
video in place of the regular advertising clips. Late-night traffic on one of the Russian capital’s busiest roads
slowed Thursday as a couple’s explicit escapades appeared across the 9-
by-6-meter (yard) display. The screen’s owner — the 3 Stars advertising agency — has told The
Associated Press that a hacker attack is likely to blame. City police
say they have yet to receive any complaints and have not opened an
investigation. Russian news agency RIA Novosti quoted a city official as saying that
Moscow will bolster security of data transmission to ad screens. Mobile phone camera footage has been posted on popular video-sharing
Web sites. http://biz.yahoo.com/ap/100115/eu_odd_russia_porn_in_the_city.html?.v=1via shakeit
Posted in Randomness | Leave a reply

Kodak challenges Apple and RIM on patent: Digital Photography Review

The Kodak complaint, filed with the U.S. International Trade Commission (ITC), specifically claims that Apple’s iPhones and RIM’s camera-enabled BlackBerry devices infringe a Kodak patent that covers technology related to a method for previewing images. Separately, Kodak filed two suits today against Apple in U.S. District Court for the Western District of New York that claim the infringement of patents related to digital cameras and certain computer processes.

Good luck Kodak.

via shakeit

Posted in Randomness | Leave a reply

Lightty Cake: CakePHP + Lighttpd Rewrite Rules

This little snippet will also allow you to capture your query string variables should the need arise.

url.rewrite-once = (
    "^/(css|files|img|js)/(.*)" => "/$1/$2",
    "^/([^?]*)(?:\?(.+))?$" => "/index.php?url=$1&$2"
)

Posted via email from shakeit

Posted in General Nerdery, How-To | Tagged Code Chunks, howto, lighttpd, php | Leave a reply

New post

This post is only for people who complain that I haven’t posted since May.

Posted in Uncategorized | 2 Replies

Prototype: It’s Not Just a JavaScript Library

Used to be that writing front-end code (HTML, CSS, JavaScript) wasn’t terribly complex. The syntax of HTML and CSS isn’t all that difficult to get the hang of and JavaScript (back in the day) was just a tool to validate form fields and play funny tricks on poor unsuspecting visitors. These days, JavaScript has become the language for front-end development and it’s not just for printing the ‘lastModifiedDate’ of a document.

Anyone who has kept up with the advancements of JavaScript knows the Prototype library. For those who don’t know, it’s a JavaScript library that wraps a whole bunch of functionality into easy to use (and remember) “shortcuts” for doing things like getting elements on a page, manipulating said elements, and dealing with data. It’s all written in JSON notation and allows you do things like:

$('element-id').addClassName('active').show();

Instead of

var element = document.getElementById('element-id');
    element.className = 'active';
    element.style.display = 'block';

Anyway, things like Prototype, jQuery, Dojo, and YUI all provide some convenience to writing custom JavaScript applications. I haven’t dug super deep into any of the frameworks’ source (mostly because the code has been somewhat obfuscated and “compressed” to save space), but I imagine that they all have one thing in common; they make use of the prototype property to extend both existing and custom built objects/classes in JavaScript.

The prototype Property

Even if you don’t make heavy use of one of the afforementioned framework/toolkits, using the prototype property to extend existing JavaScript objects and/or classes can be quite useful. Say you want an easy way to print out a date. Rather than createing a separate function, just extend the Date object itself.

Date.prototype.months = new Array(
    {name: "January", abbrev: "Jan", number: "01"},
    {name: "February",    abbrev: "Feb", number: "02"},
    {name: "March",       abbrev: "Mar", number: "03"},
    {name: "April",       abbrev: "Apr", number: "04"},
    {name: "May",     abbrev: "May", number: "05"},
    {name: "June",        abbrev: "Jun", number: "06"},
    {name: "July",        abbrev: "Jul", number: "07"},
    {name: "August",  abbrev: "Aug", number: "08"},
    {name: "September", abbrev: "Sep", number: "09"},
    {name: "October", abbrev: "Oct", number: "10"},
    {name: "November",    abbrev: "Nov", number: "11"},
    {name: "December",    abbrev: "Dec", number: "12"}
);
Date.prototype.dow = new Array(
    {name: 'Sunday',  abbrev: 'Sun', number: "01"},
    {name: 'Monday',  abbrev: 'Mon', number: "02"},
    {name: 'Tuesday', abbrev: 'Tue', number: "03"},
    {name: 'Wednesday',   abbrev: 'Wed', number: "04"},
    {name: 'Thursday',    abbrev: 'Thu', number: "05"},
    {name: 'Friday',  abbrev: 'Fri', number: "06"},
    {name: 'Saturday',    abbrev: 'Sat', number: "07"}
);
Date.prototype.getShortDate = function() {
    return this.months[this.getMonth()].abbrev + ' ' + this.getDate() + ' ' + this.getFullYear();
};
Date.prototype.getLongDate = function() {
    return this.dow[this.getDay()].name + ', ' + this.months[this.getMonth()].name + ' ' + this.getDate() + ', ' + this.getFullYear();
};
Date.prototype.getValueDate = function() {
    var d = (this.getDate() < 10) ? '0'+this.getDate():this.getDate();
    return this.getFullYear() + '/' + this.months[this.getMonth()].number + '/' + d;
};

var now = new Date();
document.write(now.getLongDate());

And you get something like this . Handy.

Now, there’s a couple of issues with the above script. One, the names aren’t localized and two, there’s probalby a more efficient way to formatting a date (much like the example on this page). But, it works in all the browsers I tested (Chrome, Firefox, IE7, Safari [Mac]).

You can prototype most of the default objects in JavaScript. Say you have an application the has to validate a bunch of text fields. Prototype the String objects to add built in parsing methods for various fields.

String.prototype.isValidEmail = function() { ... }
String.prototype.isValidPhone = function() { ... }

You get the idea.

The prototype property is a handy little tool. There maybe some limitations between browsers, but overall, it should help simplify your code and prevent repetitive and reduntant methods.

Posted in Code Chunks, General Nerdery, Home | Tagged Code Chunks, howto, javascript, prototype | 1 Reply

Post navigation