198 karma · joined March 30, 2009
Moreover, the author glosses over many of subtleties of reference-counting. For example, accessors in Java are dead-simple, practically boilerplate. But in Cocoa, what looks like a perfectly reasonable implementation to a newcomer is in fact buggy:
- setFoo: (id)aFoo {
[foo release];
foo = [aFoo retain];
}
Look closely, and you'll realize that if foo and aFoo are in fact the same object, it will be freed, and foo will have an invalid pointer assigned to it. Pretty much every Cocoa programmer knows about this, but we shouldn't ahve to.One of the better Cocoa blogs is written by Mike Ash, and he has quite a few posts that illustrate some of these issues. For example, the first half of http://www.mikeash.com/pyblog/friday-qa-2010-12-03-accessors... talks about whether or not accessors should autorelease their return values, with pros and cons for each option. Later on, the money quote: "If you're using garbage collection, this whole question becomes vastly simpler."
Our author here says that "Cyclic object graphs in Objective-C are not a problem. At all." But another post by Mike Ash illustrates that it can be harder to deal with: http://www.mikeash.com/pyblog/friday-qa-2010-04-30-dealing-w... . A great example:
_myInstanceVar = [[SomeClass alloc] initWithBlock: ^{
[self doSomething];
}];
Using 'self' within the block captures it in the closure as a reference, and then the closure itself is referred to by the instance variable of 'self'. This cycle is hard for the coder to notice, and will leak.What are elections like? First of all, proportional representation is difficult-to-impossible without parties, which eliminates one potentially fruitful type of political reform. Second, without party organizations to provide guidance as to a candidate's political stance, the "personal vote" predominates. This means a candidate needs extremely strong name recognition and personal financial resources: elected members are much more likely to be former entertainment celebrities, business magnates, leaders of ethnic or religious groups, local crime-lords or warlords, or of course incumbents. Another way to get personal recognition is to take credit for local spending, so candidates' campaigns tend to focus on the pork they'll bring if elected.
What about after the elections? Without a strong parliamentary whip, elected members can vote however they want, which sounds great—but it means that every single vote becomes an exercise in pulling teeth. Each member has an interest in acting recalcitrant in order to receive compensation in exchange for their vote. Governing coalitions end up ideologically incoherent, based mostly on which members are most in need of money for local projects. Since there's no ideological basis for government, changes of prime minister/president can happen either extremely often or extremely rarely, depending mostly on whether or not there are enough goodies to be passed around.
All this talk of weakening parties may show a lack of knowledge about the rest of the world. If you look around, you'll see that other nations, and most scholars, consider American political parties to be quite weak. Most countries with healthier political systems have parties that are perhaps smaller than the Democrats and Republicans, but are much stronger in the sense of having control over their elected members and candidates.
I'd argue that in the USA, we should be strengthening parties. Allow party whips to demand discipline from members, expelling those who will not vote with the rest of the party. Once a party wins Congress, they'll have to actually implement their agenda—no more making promises that are impractical or that they know they can't keep, and then blaming recalcitrant party members for preventing the passage of laws. Now, each party contains multiple opposing factions that proclaim incompatible visions. Instead, parties could decide internally what policies to support, and then the dissidents could just deal with it. Or dissidents could go start their own party, and you'd finally have some real diversity of views. Corporate influence could even fall. After all, it's a lot harder to bribe (I mean, uh, "contribute to the campaign of") an entire party to change their votes than to bribe one or two members.
One of the great recent successes of electoral design was in fact a party-strengthening exercise. In the unrecognized pseudo-country of Somaliland, political organization was nearly absent, and the nascent leaders worried that the new democratic system would become corrupt, based on local warlords and ethnic leaders. So first they held municipal elections across the country, and only the three parties with the highest nationwide total vote in these elections would be allowed to run in the subsequent national elections. Voilà! A new, fragile country developed three ideological, non-ethnic political parties; and while there are still serious problems there, the political system is pretty good for that region of the world.
The one issue I haven't really addressed is "what about the Interwebs!?" True, most of my information is from third world countries, where the Internet is not a serious factor. Non-partisan municipal governments in the West also have the problems I listed though, and have not typically been revolutionized by the Internet. But who knows, perhaps Naheed Nenshi's election in Calgary is the vanguard of a wave of social-network-inspired non-partisan renewal, I guess we'll see!
I don't see much Apple is likely to do to help. They could bless a package manager as official, include it in OS X, and pay for build-boxen and for people to work on it; but you'd still need a lot of community involvement, and that's not Apple's cup o' tea.
Apple could also just make a few things easier about building nix packages: Currently the OS X linker will automagically look for libraries in /usr/lib and /usr/local/lib by default, this should become easier to turn off so that packages don't end up with hidden dependencies on stuff the user threw in /usr/local. * A lot of libraries that are extremely common on other nix aren't included in OS X, eg: readline, iconv, gettext. But many of these are GPL3, so don't count on Apple being helpful. Universal, backwards-compatible binaries are currently a PITA to build from the command-line. You need to specify the SDK, DEPLOYMENT_TARGET, and compiler separately; and then if you ended up using different SDKs for different architectures, you need to use lipo to combine the results. Some way to specify all this stuff at once, and use sensible defaults would be great: 'gcc --sdk=ppc/gcc-4.0/10.4 --sdk=x86_64/clang/10.6 ...'
I'm curious how he would explain the success of schools in places such as Eastern Europe and China. More testing, regimented learning, little focus on individual needs...these seems like the opposite of what he's recommending, but it still works somehow.
PS: I think everyone on HN is a bit of a dreamer, no? :)
So what does this mean? Clearly there's more to it than just "more testing is necessary!" or the reverse. Is the Anglosphere in some "unhappy middle", where moving towards either more OR less testing would help? Is the amount of testing in fact orthogonal to school performance? I know both Finland and China are said to have high levels of societal respect for education, perhaps that's the crucial factor—but I'm not aware of any good measurements of this, maybe it's anecdotal.
Another hypothesis is that there's a fairly hard limit to how well children can be educated at this point in time, and that the best schools in Finland, China and the U.S. all near this limit. In China we only look at the best schools and students, and with so many people in China the best will look pretty good. Finland has very high equality and homogeneity, so the worst schools aren't so far off from the best, and the whole country comes out looking good. The U.S., however, has many badly funded schools and marginalized populations, so that could make the difference. Then the question becomes whether we can approach Finland's success, or if the Anglo countries are too inherently different. Again, this entire paragraph is truly rampant speculation, and my mind and gut are both skeptical.
Thoughts, anyone?
$(document).ready(function(){
$.getJSON(my_url, function(data) {
$('<p>').text(data.some_text).appendTo('#some_container);
});
});
But if we call getJSON before document-ready, the node $('#some_container') may not yet exist! Now we need some way to wait until both the AJAX request is complete and the document is ready…recommendations?EDIT: Thanks for the responses, glad to know it's safer than I thought!
The interface is still very rough, but it works. The xz utility comes with a very nice library and API, which made this a lot easier--thanks, Lasse!
• Offlineimap uses maildir format, used by some IMAP servers like Dovecot. So if Google ever goes evil and locks you out, you can just use your own server instead.
• Theoretically you can use Offlineimap to reproduce exactly all your mail and folders/labels onto another IMAP server. This would be pretty useful for migration, but I've never actually tried it.
Er...Preferences -> General -> Layout -> All-in-one?
std::string s("foo\u203D"); std::cout << s << std::endl;
Also, he's completely wrong about the program terminating on output of a wide string, it's just that wcout is broken. If he had tried causing output afterwards with, say, printf(), he'd notice the program is still alive. Or running it in GDB would show this just as well. It's generally speaking a bad idea to test whether your program is alive, using the same mechanism that you suspect of killing it!