Yeah, 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:
A text field allows you to set the attributes of its text, the text background color, whether it draws the background, and whether it draws a bezel or border around its text. Note that the text and background colors of selected text are configurable. The selected text color overrides any actual text color applied to the text while it’s selected (this is generally the case with controls).
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:
NSTextView *textEditor = (NSTextView *)[InputWindow fieldEditor:YES forObject:InputTextField];
[textEditor setSelectedTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[NSColor blackColor], NSBackgroundColorAttributeName, nil]];
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 • “
Caught You! masquerades as a standard iPhone app called Bank Details. […] The Bank Details app invites Mr. Thief to enter a pin number. The thing is, there is no pin number, and so while Mr. Thief is excitedly trying various combinations, the app is covertly mailing its location back to you.” I’m not gonna pay for that, but it’s clever enough. Don’t tell your thieving friends about it, though.
Resist, resist, resist the temptation to make my own RSS reader for the Mac.
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 • “
Our datastore stores schema-less bags of properties (e.g., JSON objects or Python dictionaries). The only required property of stored entities is id, a 16-byte UUID. […] We index data in these entities by storing indexes in separate MySQL tables.” Interesting. It fascinates and frightens me that all those social, intrinsically relational web 2.0 services can never use JOINs because of scalability issues.
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 • “
Tonight Ning will introduce new chat functionality, giving Ning network administrators the oft-requested ability to integrate a rich chat environment similar to the one launched on Facebook last April.” Wow, they’re still really alive?
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.
MacBook Air hinge defect not covered by Apple’s warranty? • “
Our own MacBook Air Rev. A had the exact same problem – the hinge becomes loose over time, then suddenly catches and cracks from normal use, it’s not from undue stress.” Yay for screwing early adopters.
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.
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.)
Some users have experienced an issue wherein Mail stop receiving new mail. The program will load and quit normally, but will hang in the activity window and prevent mail from being downloaded. The apparent fix for this issue is to delete Mail’s preference files and relaunch the application.
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:
defaults write com.apple.mail EnableBundles -bool NO
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 • “
Instead of continuing to charge for these four applications, which aren’t getting updated as frequently as our other titles, we felt it would better serve the community to make them available at no cost.” Selling OmniWeb was untenable; I’m a little surprised about OmniDazzle; apparently there’s more money to be made with GTD and project management tools, is there.
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.
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:
In the new beta, you can actually move the window by clicking and holding the tabs (which takes some serious getting used to) and move tabs, as well as tear them, by touching the little ‘textured’ zone at the right side of each tab.
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.
Come on, Interface Builder has to be the most inscrutable piece of software Apple ever released. How are all OS X devs so happy?
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.)
"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.
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.
HTC has announced its second Android smartphone; it’s a little prettier (but not much) than the G1, doesn’t sport a keyboard (even though that was arguably the G1’s main advantage), and will be exclusively sold in Europe by Vodafone (and SFR in France).
That would be much more exciting news if we didn’t know about the Palm Pre; as it stands, it’s all gonna be about price… but I doubt it’s going to be much cheaper (if at all) than the iPhone.
A rule of thumb Valley insiders use is that adding a million users to a site like Facebook requires $1 million in capital. That means Facebook should be spending roughly $5 million a week on servers and other computing infrastructure. From what’s understood about its finances, Facebook is not covering the cost of its operations, let alone generating enough profit to pay for capital investments.
I want to get out of that industry.
“Steve Jobs has started writing a book,” a plugged-in tipster tells me. It’s the barest of rumors, but the book industry is already eagerly anticipating the Apple CEO’s autobiography.
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.
People want full ownership and control of their information so they can turn off access to it at any time. At the same time, people also want to be able to bring the information others have shared with them—like email addresses, phone numbers, photos and so on—to other services and grant those services access to those people’s information. These two positions are at odds with each other. There is no system today that enables me to share my email address with you and then simultaneously lets me control who you share it with and also lets you control what services you share it with.
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.
We’re only halfway through the first day at Mobile World Congress and already things are looking bleak for Android. Many of the major manufacturers have already announced their new products at the show, and not one Android handset has been seen.
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?
Lycos n’ira plus chercher. “
Dimanche, Lycos Europe a fermé ses portes. En France, la société était surtout connue pour l’hébergement gratuit Multimania et le tchat-mail Caramail. Si les comptes utilisateurs ont été récupérés par d’obscurs prestataires, il s’agit sans doute du dernier chapitre d’une saga qui a accompagné l’histoire du Web français.” Ah, le chat Caramail…
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?
TinyURL shut down the redirect quickly and Twitter has responded, but the same attack could arise unless measures are taken. Of which, more later.
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.
The hack is an example of clickjacking. (I’ve heard the term a lot, but only understood its meaning after the investigation of this tweetbomb described here.) […]
Firstly, it’s using an iframe to embed Twitter.com on the page. The iframe is essentially invisible, due to the CSS structure […]
We can see from the CSS z-indexes, the iframe is on top of the button. And we can see from the iframe’s opacity that it is completely invisible. Hmmm… so it’s on top, but completely invisible. If there was a button there, you wouldn’t be able to see it, but you would still be able to click on it.
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.
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 ?
With WhatTheFont for iPhone, you can take a picture using the iPhone’s camera, and use the WhatTheFont to identify the font in the image. No more guessing — or even waiting until you get back to the computer.
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.)
LEDs do not burn out like an incandescent bulb, rather, their brightness slowly fades. So, if the lifespan of your LED is listed at 25,000 hours, that is the point when your bulb will most likely be shining at around 70% capacity (the industry assumes people notice a decrease in brightness at that point) […]
So, the moral of the story is that manufacturers need to come up with a different system to accurately convey the lifespan of their products to incandescent and CFL converts. Personally, I don’t think this is much of an issue. I would much rather replace a bulb after 50,000 hours because it got too dim then replace a traditional incandescent after 1000 hours with a bandaged hand because it blew out while I was chopping up something in the kitchen.
If you’re wasting time fighting with CSS – and we know you are – we’ve got just the tool you need. Download the Give Up and Use Tables timer. We’ve scientifically determined the maximum amount of time that you should need to make a layout work in CSS: it’s 47 minutes. When your time is up, we’ll even give you the table code you need. Take three minutes to build a table. And ten minutes to get a donut. Bill the client for an hour. Done.
This jibes with a story I heard several months ago from a source who works at Apple, which is that Google showed Apple legal a pre-release prototype of the HTC G1, specifically to avoid patent-related disputes.
This makes a lot of sense.
According to my source, in addition to multi-touch, the other feature that Apple objected to was using a standard headphone jack. Apple apparently owns a patent on controlling software using buttons connected by a standard 3.5mm headphone jack (at least for music and video playback controls), and would not grant Google a license to the patent.
This makes very little sense.
Yet I can’t quite say it’s incredible, considering the state of patents nowadays.
Apple, which of course makes the signature multi-touch mobile device, the iPhone, apparently asked Google not to implement it, and Google agreed, an Android team member tells us.
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.
The service uses Microsoft Exchange’s ActiveSync protocol to get the job done, and because of this can actively push changes as soon as they’re made.
Oh, come on — I know Apple went all Exchange on us with the iPhone, but Google? Really?
It’s worth noting that if you have an iPhone or Windows mobile handset the process will wipe out any existing contacts and calendars from your device. This data loss does not occur on Nokia, BlackBerry, Sony Ericsson, or Motorola devices.
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.
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.
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.
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.
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.
Facebook : "*** a commenté le fait que vous se joindre à un groupe."
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.
Testing Newsgator sync again in NetNewsWire, and of course it still doesn't work right.
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.