28 février 2009 |
Changing the selected text’s color for an NSTextFieldYeah, I’m getting intimate with Cocoa development, so you can expect occasional posts like this one. My readers are not supposed to care about this; I’m just posting it because I’ve been googling that question for an hour and didn’t find a proper answer anywhere.
There’s a point in the Cocoa documentation (I would link to it, but it looks like URLs tend to change every so often) that says:
But nowhere does it say how. NSTextView has a setSelectedTextAttributes, but NSTextField doesn’t; so how do you change the selected text’s attributes? Maybe you’re supposed to know that from the start (I’m learning Cocoa in random order, by googling for bits of information as I need them, and I know that’s not how you’re supposed to do it but, hey, my app works, and it doesn’t even seem to leak), but NSTextView isn’t just a control you can drop in Interface Builder to let users enter long, formatted text; there’s also an NSTextView associated with each window, and it processes the text behind the scenes or something. So all you have to do is get access to that NSTextView, and setSelectedTextAttributes on it. Here’s how you get text fields of the window InputWindow to show selected text on a black background:
The (NSTextView*) bit is because fieldEditor:forObject: thinks it returns an NSText*, even though it seems like it does return an NSTextView* — otherwise the code just wouldn’t work, would it? Looks like a known bug in the Cocoa headers. |
|
|
Caught You! — Make Your iPhone Rat Out Thieves • “ |
|
|
Amazon sorta capitulates, will let publishers decide text-to-speech availability • Oh, come on. You’d think Amazon is big enough now not to let the bullies win. |
|
|
Resist, resist, resist the temptation to make my own RSS reader for the Mac. |
|
27 février 2009 |
|
Au fait, c'est la téléphonie par Freebox qui est à chier, ou la liaison transméditerranéenne ? |
|
|
How FriendFeed uses MySQL to store schema-less data • “ |
|
|
Yeah, I wrote this email to brag that I had rewritten Quicksilver from scratch in my first week of Obj-C. What of it? |
|
|
Ning Launches Rich, Persistent Chat Feature • “ |
|
|
Memory Management Programming Guide for Cocoa: Object Ownership and Disposal • I’m re-reading this now that I’ve managed to make an app that doesn’t crash (and doesn’t leak memory very noticeably), and… yeah, it’s fucked up. So fucked up it still gives me nervous giggles. |
|
|
O’Reilly Webcast: Developing Applications for Palm webOS • Call me back when it’s not a fucking 56-minute filmed PowerPoint presentation (recorded with a can and some string). Godmotherfuckindamn youtubization of the internet. |
|
|
doubleTwist • I didn’t really look into it when it was announced, because I don’t care so much about the sharing aspect, but now that I’ve tried it I have to admit it might be a rather interesting competitor to iTunes for managing your media; I just might use it to browse my movies and TV shows — I definitely didn’t expect an application that would run so smoothly. |
|
26 février 2009 |
|
MacBook Air hinge defect not covered by Apple’s warranty? • “ |
|
|
Changes Coming to Windows 7 Release Candidate that Weren’t in the Beta • Aero Peek in Alt-Tab was a long time coming, but Win+number to launch or switch to your ten most used applications is useful. (I’m still annoyed that the Mac doesn’t have a Windows key equivalent — i.e., reserved for systemwide shortcuts.) |
|
|
Apple's product naming conventions are fun, but how do I find how to fix a problem with how SPACES handles my application windows? |
|
|
Now that I have it in Safari, I'm not sure I like full-page zoom after all. |
|
25 février 2009 |
|
Gmail Puts Unread Message Counts First in Tabs, Title Bars • There’s absolutely no excuse for this being buried in the Labs settings just because the guy who coded it doesn’t have check-in privileges. |
|
|
‘Zen Bound’ Finally Arrives in App Store • $5 is a bit more than I like to pay for iPhone games I’ll only be playing for a day, but this is so gorgeous I don’t think I can pass. (Must drain your battery in two seconds, though.) |
|
|
Safari 4 public beta: problems and fixes
And have to reconfigure all my accounts? Like hell! The day I have to reconfigure my Mail preferences from scratch is the day I switch to Thunderbird. If Mail hangs in the activity window, removing plug-ins may not be enough (unless you remove all of them, which I didn’t try); simply disable plug-ins with this Terminal line:
Mail bundles are supposed to be disabled by default anyway, and I’m beginning to think I’ll just leave that alone and not enable them again — unless some other utility’s installer does it for me without asking (there are two ProxiMail bundles on my system, so I figure Proxi will automatically enable bundles on install). Also, note to self: boycott GrowlMail. The fucking thing is supposed to have an uninstaller but doesn’t, and somehow it places itself in /System/Library/Mail/Bundles instead of the still annoying, but acceptable, /Library/Mail/Bundles, or the right place which would be in the user’s home directory. |
|
|
Mac4Ever : SFR répond à nos questions sur son offre iPhone • J’avais lu les tarifs d’un oeil, pas remarqué le wifi illimité et, surtout, les SMS illimités. Hrmf. (Mais pas au point d’avoir des regrets.) |
|
|
OmniWeb, OmniDazzle, OmniDiskSweeper, and OmniObjectMeter now freeware • “ |
|
|
iPhone sur SFR le 8 avril • je n’ai pas de regret, moi ça fait un an que j’ai un iPhone. Et évidemment que les tarifs sont alignés sur ceux d’Orange, vous espériez quoi ? |
|
|
Kindle 2 dissected, found to contain space for a SIM card — i.e., it is coming to Europe… someday. |
|
|
On thirty-fourth thought, when I'm able to buy a new Intel Mac I'll be rich enough not to be sorry I bought a 75€ RAM upgrade for my G5. |
|
|
I really don't enjoy that Google recently started processing dashes like spaces. |
|
24 février 2009 |
|
I haven’t installed it, because I can’t live without 1Password, but it looks very pretty. It finally has Cover Flow on your history and bookmarks; the 3D take on the classical start page mosaic is cute; Apple didn’t waste time copying Chrome’s tabs-on-top system, going as far as removing the title bar altogether (which looks great but makes me wonder how you actually grab and move the window); and they’re getting surprisingly aggressive on the Windows side with a native UI. I just can’t wait for 1Password to be updated.
P.S. Cocoia Blog:
Which I take to mean that dragging a tab moves the whole window unless you clicked on the tiny hotspot at the right of the tab. I guess that works. |
|
|
Snow Leopard screenshots show interface tweaks. I need to remember Snow Leopard is coming out, drop the idea of finally upgrading my G5’s RAM and save to finally buy a decent Intel Mac. |
|
22 février 2009 |
|
Come on, Interface Builder has to be the most inscrutable piece of software Apple ever released. How are all OS X devs so happy? |
|
20 février 2009 |
|
Facebook Connect Comments Box. Where do you find a website that needs to rely on an external comments widget nowadays? |
|
|
Possible image of the new Mac mini leaked. DisplayPort, FW800, a buttload of USB ports and no external redesign, I guess that’s too boring to be fake. (Although just because it might physically exist doesn’t necessarily mean it would be be released.) |
|
19 février 2009 |
|
"You can now email photos directly from CameraBag!" Cool. |
|
|
Palm Pre’s Touchstone charger requires matte, soft-touch battery cover. I was afraid the required “accessory” to work with the induction charger would be an ugly protuberance; in fact, it’s a nice replacement back cover. That’s a relief, even though I still think it should be standard. |
|
|
Virb reboot. The TechCrunch writeup says they’re going more FriendFeed to find themselves a niche, but the site doesn’t look that different from the previous version. A bit prettier, more streamlined, and still not bringing anything that would make it exist against Facebook et al. |
|
18 février 2009 |
|
PowerShot SX200 IS. Twelve megapixels, 28-336mm zoom with optical stabilization, 720p video and HDMI for $350 list. Damn. |
|
|
Vodafone SIM card in a Palm Pre. That’s unexpected so soon. (The Pre is supposed to be Sprint-exclusive for a while, and Sprint isn’t GSM and doesn’t use SIM cards.) |
|
17 février 2009 |
|
This is a very well-done hierarchical notes organizer: you can switch between outline view and tree view, but the latter is not the messy free-form organizational charts I expected — just a column view where each item can be detailed or collapsed (think of the Finder’s column view). 35 € is rather steep for an application that can only handle plain text, but I really like the way it’s done. The funny thing is, I already had plans for a tandem of iPhone and Mac applications that would work a bit like that. |
|
|
Chromium Build For OS X [via]: presumably, the guy who bothered to compile and distribute it didn’t add a trojan. I didn’t bother, but if you’re bored… |
|
|
TinyChat [via]: instant disposable chatroom (or you can create your own room just like any IRC channel). Very simple — no credentials, no operators — and well done. Except for the inherent evil of offering to “log you in through Twitter” (and then automatically tweeting your room ID). |
|
|
HTC a annoncé son deuxième smartphone Android ; il est un peu plus joli (mais pas de beaucoup) que le G1, n’a pas de clavier (alors que c’était probablement le principal avantage du G1), et sera exclusivement vendu en Europe par Vodafone, et SFR en France. Cette news serait beaucoup plus spectaculaire si on n’avait pas entendu parler du Palm Pre avant ; maintenant, ça va juste être une question de prix… mais je doute qu’il puisse être beaucoup moins cher que l’iPhone (voire, je ne serais pas surpris qu’il se retrouve plus cher). |
|
|
For Facebook, More Users Are More Problems
I want to get out of that industry. |
|
|
When is the Steve Jobs Autobiography Coming Out?
Even though the author’s note that Jobs being on leave from Apple, and probably bored out of his skull, is in the best opportunity ever for him to write an autobiography, I still can’t really imagine him doing that. I’d think he wants to be remembered for what he created rather than how he lived; and I’d think he’s too narcissistic to write a really honest public account of his life, but too smart not to realize that anything else would be useless. But then, I’m only trying to put myself into his shoes, and I just can’t really imagine what it feels like to be a 55-year-old Steve Jobs possibly dying of cancer. |
|
|
Zuckerberg On Who Owns User Data On Facebook: It’s Complicated
I can’t say I disagree with Zuckerberg’s point, and it’s an interesting analogy. But then, I’ve never been on the paranoid side of that argument anyway. |
|
|
MWC 2009: Android Forgets To Join The Party
Are there untold development hurdles? It was expected that everyone would be able to whip out Android versions of their phones very soon — and I can’t really imagine any non-technical reasons why that wouldn’t happen. Microsoft doesn’t have that kind of leverage anymore, does it?
|
|
16 février 2009 |
|
|
|
|
Lycos n’ira plus chercher. “ |
|
|
Am I wrong to wonder if the times are gone of _caring_ about what a blogger writes? In and out in 30 seconds now, isn't it? |
|
12 février 2009 |
|
Explaining the “Don’t Click” Clickjacking Tweetbomb
Well, yeah, they reacted quickly once an English version made the rounds amongst popular US bloggers, but the French version had been running the Twittersphere, unnoticed, for a week.
This is very clever — basically relying on transparent iframes (and I agree with Gruber’s point: why should iframes be allowed to be transparent?) and Twitter’s unvarying home page layout to trick you into clicking the “Update” button without knowing it. And the fix only works if your browser has Javascript enabled; if it doesn’t, you’re still vulnerable, and it would be pretty complicated for Twitter to fix that. (Unless they stop accepting update text to be sent as a URL parameter, but I guess they implemented this so that some scripts or external sites could use the functionality.) |
|
|
Oooh. For once I'm the one who misunderstood how the Twitter exploit worked. Much, much more clever than I thought. |
|
|
Vérifié sous Firefox, slate.fr s'affiche de la même façon que dans Safari... ça veut dire que ce n'est pas un bug ? |
|
If this worked, it would be positively awesome. Sadly, it doesn’t. At all. And if it doesn’t work on my iPhone with a Clarifi macro lens, you really needn’t bother downloading it, even for free. Not to mention that it’s infuriatingly slow right now, as everyone’s testing it and overloading the server. (I assume. Unless it’s inherently sluggish.) |
|
|
LED Bulb Life Spans Are Not What They Seem
|
|
11 février 2009 |
Damn right! |
|
This makes a lot of sense.
This makes very little sense. Yet I can’t quite say it’s incredible, considering the state of patents nowadays. |
|
10 février 2009 |
|
Apple asked Google not to use multi-touch in Android?
This strikes me as odd because, no matter how much Google’s engineers love that device, I’d figured Apple would need Google more than Google would need the iPhone. However, it could have been a friendly warning from Apple Legal that they were going to be awarded a broad patent over multi-touch, and Google ought to be cautious about going there. While Palm has its own patents that Apple might infringe on, and that particular conflict is likely to be resolved by a cross-licensing agreement, I don’t expect the same would have to happen if Google started stepping on Apple’s toes. More than they already are, that is. |
|
|
Doesn't anyone at Twitter know about the umoor.eu (harmless, annoying) security flaw? Preventing that is web form security 101. |
|
|
So... I know how to make a web browser for the iPhone. That's not gonna earn me money. |
|
|
Google Sync pushes contacts, calendars to phones
Oh, come on — I know Apple went all Exchange on us with the iPhone, but Google? Really?
Well, yeah, it is worth noting. I already wasn’t very interested — I don’t want to have Google manage my contacts for me and add whomever I write; I’m one of those weird people who like to manage their data themselves, so Address Book is quite fine, thank you — but that’s all the more reason not to use this. |
|
9 février 2009 |
|
No thanks to Apple's docs, but it's pretty awesome that I have a working custom web browser for my iPhone in a few hours' work. |
|
|
There's just no way you can learn iPhone programming from Apple's own docs, is there? |
|
|
If someone had thought of making a Twitterific-like client for del.icio.us three years ago, we wouldn't have to suffer 140-char link dumps. |
|
8 février 2009 |
|
I don't really care that I only get every other Clone Wars ep (at best), but it's a bit ridiculous that TV Shows still hasn't been fixed. |
|
|
In love with the concept of GMail Labs' Multiple Inboxes; too bad the layout assumes 2000px-wide windows and the settings UI is awful. |
|
|
Why do I have to geek around my Scripts menu in order to be able to manually color my inbox messages in Mail? |
|
|
I can’t believe I didn’t know it already was in iPhone 2.0 [via] — or did I just forget about it because the syntax is a bit overcomplicated? (Although, once you get to know it, it actually works just the way I wish you could do more things in CSS: essentially, by defining macros.) Now I have a reason to install WebKit. |
|
6 février 2009 |
|
The iPhone can do VPN, right? Why doesn't OS X include an easy VPN server on all desktop Macs? With OTA iTunes sync... yum. |
|
5 février 2009 |
|
I guess buying an iPhone development book might be a good idea. |
|
|
AppleScript is such a pretty concept and such a messy implementation. |
|
|
Je rêve ou Google Reader rame moins que la dernière fois que je l'ai testé ? (Sous Safari.) |
|
|
Ah, of course NetNewsWire/iPhone would choke on my list of feeds. God how I hate that NewsGator bought NNW. |
|
3 février 2009 |
|
Gmail Adds Tasks to the iPhone I don’t really like the desktop version, but the iPhone interface (which you can only access for now by manually going to mail.google.com/tasks/ — after you’ve enabled Tasks in Gmail Labs) is perfectly seamless. I’m thinking it might actually be worth creating a Fluid.app instance (that pretends to be Mobile Safari) if I ever needed task lists to be synchronized between my iPhone and my desktop. Like, you know, if I went places and did stuff and all. |
|
2 février 2009 |
|
Testing Newsgator sync again in NetNewsWire, and of course it still doesn't work right. |
|
1 février 2009 |
|
The number — and tone — of blog posts about Google's malware screwup is depressing me. |
|
|
"As a result of this growth, [Facebook will] start to issue uids greater than 2^32 in a few months." Geez. |
|
2000 • 01 02 03 04 05 06 07 08 09 10 11 12 2001 • 01 02 03 04 05 06 07 08 09 10 11 12 2002 • 01 02 03 04 05 06 07 08 09 10 11 12 2003 • 01 02 03 04 05 06 07 08 09 10 11 12 2004 • 01 02 03 04 05 06 07 08 09 10 11 12 2005 • 01 02 03 04 05 06 07 08 09 10 11 12 2006 • 01 02 03 04 05 06 07 08 09 10 11 12 2007 • 01 02 03 04 05 06 07 08 09 10 11 12 2008 • 01 02 03 04 05 06 07 08 09 10 11 12 |