Dear Objective C
It’s called “dot notation“, and it works really well. You should check it out.
Teaching our nation’s children basic dick-kickery
It’s called “dot notation“, and it works really well. You should check it out.
check out these actual menus from the “Games” section of the crappy Cingular/AT&T Media mall thing on my cellphone:
I’ll save you the witty commentary because you’re an adult and can make up your own witty commentary (although I will point out that while bowling is the one thing that men and women can get together on, apparently girls suck at it too much to deserve the sequel). Now, if you’ll excuse me, I’m off to talk to Demetri about the co-designing my new game, Lace Doily 3
Although you wouldn’t know it form reading her one line in this article, which I like to call, “Hey! Did You Know New Yorkers are Dickbags Where-ever They Go? Let’s Reinforce Some Regional Stereotypes!!”
I just want it stated:
Also, can I really be the only one who is sooooo tired of the “NEW YORK PIZZA FTW!!!111!!!” tirade? Or the whole “My regional pizza is better than your regional pizza” debate? Seriously, you wanna start talking about how Coke is called Soda in the north and Pop everywhere else? And then maybe we can all get past our college orientation weekend conversation starters and Move the F— On. Asshole.
…so let’s say you have a site, that has two versions, a.throat-punch.com and b.throat-punch.com. And Apache uses a cookie to determine which version you should be viewing, and sends a 302 redirect if you’re on the wrong domain.
Now let’s say you want to access a page on this site from an <iframe> from an external domain, say www.whowantsathroatpunch.com. Stupid IE6 will not send the right cookies in the request headers. In fact, I’m pretty sure it will send no cookies. Why? Because it’s a dick. Every Other Browser does this correctly. It’s not a security issue -it’s not like you’re asking IE6 to send cookies that belong to another domain, or to teach our nation’s children to read or anything. You’re asking the browser for the cookies that have been previously set, and IE6 in its infinite dick-kickery is failing in that basic respect.
What really gets my goat is that, whereas the iframe will not get its cookies, if you make the src of the iframe do an AJAX request to another page on the site, that request will get its cookies sent correctly.
The workaround I found is to give the <iframe> src a new page if the browser is IE6, and on that new page, make an AJAX request to another new page that outputs the value of the cookie you’re looking for. When you receive the AJAX request, you can then parse the response and redircet the user to the now-corrected original <iframe> src. It’s stupid and inefficient, I know:
<script type="text/javascript">
// note: this page only called from IE6, so no browser testing
// or compatibility checks are needed. I'm rocking the prototype.js for
// the ajax, you do what you like.
function editionTest() {
var test_url = '/cookie_tester.php';
var domain = new Ajax.Request(test_url, {
method:'get',
onSuccess: function(transport){
var response = transport.responseText;
if (response.search('site_a') > -1) {
redirector('a');
} else if (response.search('site_b') > -1) {
redirector('b');
} else {
redirector('');
}
},
onFailure: function() {
redirector('');
}
});
}
function redirector(domain) {
var url = parseUrl();
var id = url['id'];
var var = url['var'];
var domain_parsed = ‘http://’ + domain + ‘.throat-punch.com/page_you_really_wanted.php?id=’ + id + ‘&var1=’ + var1;
window.location = domain_parsed;
}
function parseUrl() {
var hash = {};
var url = String(document.location).split(’?');
if (url[1]) {
var vars= url[1].split(’&’);
var ct = vars.length;
for (var i=0; i<ct; i++) {
var item = vars[i].split(’=');
var name = item[0];
var value = item[1];
hash[name] = value;
}
}
return hash;
}
Event.observe(window, ‘load’, function() {
editionTest();
});
</script>
I’m writing this post solely for google to pick it up, just in case anyone ever is in this position again. So, dude who googled “ie6 cookies iframe 302 throat punch”, this one’s for you.
(thanks to celebdu for the photo)
Merry Clayton - Southern Man (mp4 link cause that’s what I like)
You’ll probably recognize her voice - Merry sang with Ray Charles as a Raelette, with Leonard Skinnard on “Sweet Home Alabama”, with Neil Young on his first album, and, probably most notably, with Mick Jagger on “Gimme Shelter.”
This is off her 1971 self-titled solo album, which includes a song (or two) by Carole King and Billy Preston. I’ll post more when I get around to recording the rest of the LP.
Clearly, she’s not afraid to let it all out. Although I find it interesting that, in this song, there’s so much pent up energy being released, so much depth to the voice, and yet every time she runs up against the most emotionally charged word in Neil’s lyric - “black” - she shies away from it, changes it to some other phrase. Maybe, because this recording is charged enough, she was scared that, by singing The Word, she might accidentally electrocute her listening audience.
I heard this on KEXP a couple years ago, and the subsequent search to find my own copy lead me to eBay, where a signed LP was the only option (this has *looooong* been out of print). I ponied up the $20, thinking to myself, a) awesome!, and b) you know how people collect things? Well, I don’t collect anything really. Maybe I should start collecting stuff. Maybe I’ll collect old soul records, that seems an appropriately cool and hipster-ish thing to collect. And, two years later, this one album, one, represents the sum total of my old soul record collection, wedged in there between my dad’s old Steve Martin records and the Thrift Store records I amassed back in college, when people still did things like go down to the Ithaca Salvation Army to stock up on old man pants, ironic tshirts, and records celebrating the victorious season of the 1973 Miami Dolphins, to be used in lieu of lyrics on a ROVER 78* song.
* Yes, I did just namedrop “ROVER 78″ - if only for it to have one, single solitary reference on google.
in one bowl:
in another bowl:
in a measuring cup
Pour the wet bowl into the dry bowl. mix like once or twice. add the blueberries and mix for approximately 10 seconds. If it’s too thick add some more (buttermilk). Cook on high heat on the griddle ’til they’re nice and pancake-y. mmmmmmm!
It’s not bad enough that I had to turn off all non-anonymous commenting because of the flood of spam I was getting, but now I get another google-banning for people injecting code into my posts? If I had a nickel for every time this has happened, I’d have like 10 cents by now! Security this sh*t up, people!
..so I’ve just surfaced from a couple Kafka-esque evenings spent in xbox tech support limbo. I won’t bore you with the details of why (suffice to say, Microsoft’s policy of rewarding its long-time customers by deleting their access still has some kinks to work out), but I’ve gone from xbox tech support, to xbox level 2 tech support, to email support with Windows Live ID, back to Xbox tech support, to billing, and back to xbox leve 2 tech support, where the last guy I talked to hung up on me (”accidentally” I’m sure). Irate, I called back, trying to bypass the Mike the X-Treme!!11! voice-activated computer phone menu by shouting “OPERATOR! OPERATOR! OPERATOR!” at it until stopped trying to sell me upgrades and connected me to a live person. So, after about 4 hours of holding, transferring, re-explaining the problem, re-explaining why their proposed solutions won’t work, re-explaining the problem, re-trying the proposed solutions so I could re-tell them the exact error messages, holding, listening to the Most X-Treme!!11!est Of All Hold Music, transferring, etc… this last person fixed the problem in 6 minutes. She said, “hmm. well, we could do this….” and it was done.
I’m sure you can tell by the subject of this post that the problem here is that the difference was the last person I talked to and the first 6 was that she was American. And it really makes me feel awful that, when I heard an accent I recognized as not-Indian, a tiny little part of me went, “oh, thank god.”
Intellectually, I know it’s not India’s fault. Intellectually, I know that the people who man these tech support lines are given a strict script to follow and are probably not allowed to vary from it too much. I know that, for every phone operator out there, there are probably 100 people who want their job, so the pressure to fulfill the time quotas and to never veer from the script must be intense. And that the scripts probably work for 95% of the callers, and that I only call tech support for those issues that the script can’t handle.
But still, it reinforces a subtle racism when, if the Indian front-lines can’t solve the problem, and they bump you up far enough up the chain, you eventually reach an American voice with actual authority to make changes. I think that’s what gets me most. Because before I talked to Honkey McPersonable, I talked to an Indian in the billing department who said what I was asking for wasn’t possible. It’s like they get the Indians to do all the dirty work, sending customers through endless loops of transferring and holding and red tape, and they ride in like a Great White Hope, bestowing clarity and authority to those who have risen above the fray.
So F— you, Microsoft, and F— you, BellSouth (another, much longer story). F— you for making me dread hearing what I used to think was the Most Awesomest Accent of English Ever. F— you for reducing your tech support to reports on time-per-call and calls-answered-per-day. F— you for not giving your farmed-out Support Centers any authority to act on customer’s behalf. F— you for your whole poopy Tech Support system.
…so I wrote (what I think is a) clever little function (well, two functions) to take a complex php variable and turn it into a json-ized string, ready to be passed back to javascript. It works on the principle that json really only has a couple rules if text formatting: strings go inside double quotes, with both slashes and double-quotes escaped, iterative arrays are comma delimited inside brackets [obj1,obj2], and associative arrays go inside curly-brackets {key:val,key:val}. Using these three points, and a little bit (ok, a lot of) recursion, and voila, an elegant little function.
Of course, this doesn’t handle unicode, or any really special cases, but if you’re looking for a basic object parser, and you dont’ have access to php 5.2, which has it built into the language, it’ll do the trick…
/**
* input an object, returns a json-ized string of said object
* @return
* @param $obj Object
*/
function php_json_encode($obj) {
if (is_array($obj)) {
if (array_is_associative($obj)) {
$arr_out = array();
foreach ($obj as $key=>$val) {
$arr_out[] = ‘”‘ . $key . ‘”:’ . php_json_encode($val);
}
return ‘{’ . implode(’,', $arr_out) . ‘}’;
} else {
$arr_out = array();
$ct = count($obj);
for ($j = 0; $j < $ct; $j++) {
$arr_out[] = php_json_encode($obj[$j]);
}
return ‘[' . implode(',', $arr_out) . ']‘;
}
} else {
if (is_int($obj)) {
return $obj;
} else {
$str_out = stripslashes(trim($obj));
$str_out = str_replace(array(’”‘, ”, ‘/’), array(’\”‘, ‘\’, ‘/’), $str_out);
return ‘”‘ . $str_out . ‘”‘;
}
}
}
function array_is_associative($array) {
$count = count($array);
for ($i = 0; $i < $count; $i++) {
if (!array_key_exists($i, $array)) {
return true;
}
}
return false;
}