{"id":371,"date":"2003-04-14T17:39:55","date_gmt":"2003-04-14T21:39:55","guid":{"rendered":"\/?p=371"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-30T04:00:00","slug":"karelia_cocoa","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2003\/04\/14\/karelia_cocoa\/","title":{"rendered":"Karelia Cocoa"},"content":{"rendered":"<p>\n\nDan Wood has started a <a href=\"http:\/\/cocoa.karelia.com\">blog<\/a> containing random bits of Cocoa code. What&rsquo;s nice is that they seem to be self-contained, so you don&rsquo;t have to bring in a whole framework to take advantage of them. Also, each file has a URL, so the code will be indexed by Google and hopefully also spur some discussion. In that spirit:\n\n<\/p>\n\n\n\n<p>\n\n<a href=\"http:\/\/cocoa.karelia.com\/Foundation_Categories\/NSAttributedString\/Truncate_a_string_t.m\">Truncate_a_string_t.m<\/a>: It appears that this method isn&rsquo;t Unicode-savvy. It should probably use <code>rangeOfComposedCharacterSequenceAtIndex:<\/code>.\n\n<\/p>\n\n\n\n<p>\n\n<a href=\"http:\/\/cocoa.karelia.com\/AppKit_Categories\/NSWorkspace__Return.m\">NSWorkspace__Return.m<\/a>: The answer to the question in the comment is <code>-[NSFileManager stringWithFileSystemRepresentation:length:]<\/code>.\n\n<\/p>\n\n\n\n<p>\n\n<a href=\"http:\/\/cocoa.karelia.com\/Foundation_Categories\/NSSet__Show_the_con.m\">NSSet__Show_the_con.m<\/a>: I commented on <a href=\"http:\/\/rescomp.stanford.edu\/~akosut\/log\/2003\/04\/08\/000116.html\">another blog<\/a> that I sometimes miss Java&rsquo;s <code>Iterator.hasNext()<\/code> when programming in Cocoa. This is a good example of where it would be useful.\n\n<\/p>","protected":false},"excerpt":{"rendered":"<p>Dan Wood has started a blog containing random bits of Cocoa code. What&rsquo;s nice is that they seem to be self-contained, so you don&rsquo;t have to bring in a whole framework to take advantage of them. Also, each file has a URL, so the code will be indexed by Google and hopefully also spur some [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"","apple_news_api_id":"","apple_news_api_modified_at":"","apple_news_api_revision":"","apple_news_api_share_url":"","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-371","post","type-post","status-publish","format-standard","hentry","category-programming-category"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/371","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=371"}],"version-history":[{"count":0,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/371\/revisions"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=371"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=371"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=371"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}