{"id":4839,"date":"2022-02-02T12:56:14","date_gmt":"2022-02-02T20:56:14","guid":{"rendered":"https:\/\/www.flamingspork.com\/blog\/?p=4839"},"modified":"2022-02-02T12:56:14","modified_gmt":"2022-02-02T20:56:14","slug":"every-time-i-program-a-mac","status":"publish","type":"post","link":"https:\/\/www.flamingspork.com\/blog\/2022\/02\/02\/every-time-i-program-a-mac\/","title":{"rendered":"Every time I program a Mac&#8230;"},"content":{"rendered":"\n<p><strong>&#8230; the preferred programming language changes.<\/strong><\/p>\n\n\n\n<p>I never programmed a 1980s Macintosh actually in the 1980s. It was sometime in the early 1990s that I first experienced Microsoft Basic for the Macintosh. I&#8217;d previously (unknowingly at the time as it was branded Commodore) experienced Microsoft BASIC on the Commodore 16, Commodore 64, and even the Apple ][, but the Macintosh version was something else. It let you do some pretty neat things such as construct a GUI with largely the same amount of effort as it took to construct a Text based UI on the micros I was familiar with.<\/p>\n\n\n\n<p>Okay, to be fair, I&#8217;d also dabbled in Microsoft QBasic that came bundled with MS-DOS of the era, which let you do a whole bunch of graphics &#8211; so you could theoretically construct a GUI with it. Something I did attempt to do. Programming on the Mac was <strong>so much easier<\/strong> to construct a GUI.<\/p>\n\n\n\n<p>Of course, Microsoft Basic wasn&#8217;t the preferred way to program on the Macintosh. At that time it was largely Pascal, with C being something that also existed &#8211; but you <strong>were<\/strong> going to see Pascal in Inside Macintosh. It was probably somewhat fortuitous that I&#8217;d poked at Pascal a bit as something alternate to look at in the high school computing classes. I can only remember using TurboPascal on DOS systems and never actually writing Pascal on the Macintosh.<\/p>\n\n\n\n<p>By the middle part of the 1990s though, I was firmly incompetently writing C on the Mac. No doubt the quality of my code increased <strong>after<\/strong> I&#8217;d done some university courses actually covering the language rather than the only practical way I had to attempt to write anything useful being looking at Inside Macintosh examples in Pascal and &#8220;C for Dummies&#8221; which was very not-Macintosh. Writing C on UNIX\/Linux was a lot easier &#8211; everything was made for it, including Actual Documentation!<\/p>\n\n\n\n<p>Anyway, in the early 2000s I ran MacOS X for a bit on my white iBook G3, and did a (very) small amount of any GUI \/ Project Builder (the precursor to Xcode) related development &#8211; instead largely focusing on command line \/ X11 things. The latest coolness being to use Objective-C to program applications (unless you were bringing over your Classic MacOS Carbon based application, then you could still write C). Enter some (incompetent) Objective-C coding!<\/p>\n\n\n\n<p>Then Apple went to x86, so the hardware ceased being interesting, and I had no reason to poke at it even as a side effect of having hardware that could run the software stack. Enter a long-ass time of Debian, Ubuntu, and Fedora on laptops.<\/p>\n\n\n\n<p>Come 2022 though, and (for reasons I should really write up), I&#8217;m poking at a Mac again and it&#8217;s now Swift as the preferred way to write apps. So, I&#8217;m (incompetently) hacking away at Swift code. I have to admit, it&#8217;s pretty nice. I&#8217;ve managed to be somewhat productive in a relative short amount of time, and all the affordances in the language gear towards the kind of safety that is a PITA when coding in C.<\/p>\n\n\n\n<p>So this is my WIP utility to be able to import photos from a Shotwell database into the macOS Photos app:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"584\" height=\"331\" data-attachment-id=\"4845\" data-permalink=\"https:\/\/www.flamingspork.com\/blog\/2022\/02\/02\/every-time-i-program-a-mac\/screen-shot-2022-02-02-at-12-52-15\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.flamingspork.com\/blog\/wp-content\/uploads\/2022\/02\/Screen-Shot-2022-02-02-at-12.52.15.png?fit=793%2C449&amp;ssl=1\" data-orig-size=\"793,449\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Screen-Shot-2022-02-02-at-12.52.15\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.flamingspork.com\/blog\/wp-content\/uploads\/2022\/02\/Screen-Shot-2022-02-02-at-12.52.15.png?fit=584%2C331&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.flamingspork.com\/blog\/wp-content\/uploads\/2022\/02\/Screen-Shot-2022-02-02-at-12.52.15.png?resize=584%2C331&#038;ssl=1\" alt=\"\" class=\"wp-image-4845\" srcset=\"https:\/\/i0.wp.com\/www.flamingspork.com\/blog\/wp-content\/uploads\/2022\/02\/Screen-Shot-2022-02-02-at-12.52.15.png?w=793&amp;ssl=1 793w, https:\/\/i0.wp.com\/www.flamingspork.com\/blog\/wp-content\/uploads\/2022\/02\/Screen-Shot-2022-02-02-at-12.52.15.png?resize=600%2C340&amp;ssl=1 600w, https:\/\/i0.wp.com\/www.flamingspork.com\/blog\/wp-content\/uploads\/2022\/02\/Screen-Shot-2022-02-02-at-12.52.15.png?resize=768%2C435&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.flamingspork.com\/blog\/wp-content\/uploads\/2022\/02\/Screen-Shot-2022-02-02-at-12.52.15.png?resize=500%2C283&amp;ssl=1 500w\" sizes=\"auto, (max-width: 584px) 100vw, 584px\" \/><\/figure>\n\n\n\n<p>There&#8217;s a lot of rough edges and unknowns left, including how to actually do the import (it looks like there&#8217;s going to be Swift code doing AppleScript things as the PhotoKit API is inadequate). But hey, some incompetent hacking in not too much time has a kind-of photo browser thing going on that feels pretty snappy.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8230; the preferred programming language changes. I never programmed a 1980s Macintosh actually in the 1980s. It was sometime in the early 1990s that I first experienced Microsoft Basic for the Macintosh. I&#8217;d previously (unknowingly at the time as it &hellip; <a href=\"https:\/\/www.flamingspork.com\/blog\/2022\/02\/02\/every-time-i-program-a-mac\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[76],"tags":[633,768,374,766,769,767,366],"class_list":["post-4839","post","type-post","status-publish","format-standard","hentry","category-code","tag-code","tag-commodore","tag-history","tag-objective-c","tag-pascal","tag-qbasic","tag-swift"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p5a6n8-1g3","jetpack-related-posts":[{"id":4793,"url":"https:\/\/www.flamingspork.com\/blog\/2022\/02\/02\/adventures-in-the-apple-partition-map-part-2-of-the-continuing-adventures-with-the-apple-power-macintosh-7200-120-pc-compatible\/","url_meta":{"origin":4839,"position":0},"title":"Adventures in the Apple Partition Map (Part 2 of the continuing adventures with the Apple Power Macintosh 7200\/120 PC Compatible)","author":"Stewart Smith","date":"2022-02-02","format":false,"excerpt":"I \"recently\" wrote about obtaining a new (to me, actually quite old) computer over in The Apple Power Macintosh 7200\/120 PC Compatible (Part 1). This post is a bit of a detour, but may help others understand why some images they download from the internet don't work. Disk partitioning is\u2026","rel":"","context":"In &quot;General&quot;","block_context":{"text":"General","link":"https:\/\/www.flamingspork.com\/blog\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":4780,"url":"https:\/\/www.flamingspork.com\/blog\/2021\/03\/20\/the-apple-power-macintosh-7200-120-pc-compatible-part-1\/","url_meta":{"origin":4839,"position":1},"title":"The Apple Power Macintosh 7200\/120 PC Compatible (Part 1)","author":"Stewart Smith","date":"2021-03-20","format":false,"excerpt":"So, I learned something recently: if you pick up your iPhone with eBay open on an auction bid screen in just the right way, you may accidentally click the bid button and end up buying an old computer. Totally not the worst thing ever, and certainly a creative way to\u2026","rel":"","context":"In &quot;powerpc&quot;","block_context":{"text":"powerpc","link":"https:\/\/www.flamingspork.com\/blog\/category\/powerpc\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.flamingspork.com\/blog\/wp-content\/uploads\/2021\/03\/IMG_2035-scaled.jpg?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.flamingspork.com\/blog\/wp-content\/uploads\/2021\/03\/IMG_2035-scaled.jpg?resize=350%2C200 1x, https:\/\/i0.wp.com\/www.flamingspork.com\/blog\/wp-content\/uploads\/2021\/03\/IMG_2035-scaled.jpg?resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.flamingspork.com\/blog\/wp-content\/uploads\/2021\/03\/IMG_2035-scaled.jpg?resize=700%2C400 2x, https:\/\/i0.wp.com\/www.flamingspork.com\/blog\/wp-content\/uploads\/2021\/03\/IMG_2035-scaled.jpg?resize=1050%2C600 3x, https:\/\/i0.wp.com\/www.flamingspork.com\/blog\/wp-content\/uploads\/2021\/03\/IMG_2035-scaled.jpg?resize=1400%2C800 4x"},"classes":[]},{"id":4592,"url":"https:\/\/www.flamingspork.com\/blog\/2020\/05\/22\/refurbishing-my-macintosh-plus\/","url_meta":{"origin":4839,"position":2},"title":"Refurbishing my Macintosh Plus","author":"Stewart Smith","date":"2020-05-22","format":false,"excerpt":"Somewhere in the mid to late 1990s I picked myself up a Macintosh Plus for the sum of $60AUD. At that time there were still computer Swap Meets where old and interesting equipment was around, so I headed over to one at some point (at the St Kilda Town Hall\u2026","rel":"","context":"In &quot;cool gadgets&quot;","block_context":{"text":"cool gadgets","link":"https:\/\/www.flamingspork.com\/blog\/category\/cool-gadgets\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.flamingspork.com\/blog\/wp-content\/uploads\/2020\/05\/IMG_5260-scaled.jpg?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.flamingspork.com\/blog\/wp-content\/uploads\/2020\/05\/IMG_5260-scaled.jpg?resize=350%2C200 1x, https:\/\/i0.wp.com\/www.flamingspork.com\/blog\/wp-content\/uploads\/2020\/05\/IMG_5260-scaled.jpg?resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.flamingspork.com\/blog\/wp-content\/uploads\/2020\/05\/IMG_5260-scaled.jpg?resize=700%2C400 2x, https:\/\/i0.wp.com\/www.flamingspork.com\/blog\/wp-content\/uploads\/2020\/05\/IMG_5260-scaled.jpg?resize=1050%2C600 3x, https:\/\/i0.wp.com\/www.flamingspork.com\/blog\/wp-content\/uploads\/2020\/05\/IMG_5260-scaled.jpg?resize=1400%2C800 4x"},"classes":[]},{"id":1183,"url":"https:\/\/www.flamingspork.com\/blog\/2008\/08\/27\/building-mysql-cluster-on-windows-for-windows\/","url_meta":{"origin":4839,"position":3},"title":"Building MySQL Cluster on Windows (for Windows)","author":"Stewart Smith","date":"2008-08-27","format":false,"excerpt":"You will need: CMake (at least 2.4.7) Bazaar (the newer the better - 1.6 was just released - at least use that) Gnu Bison Visual Studio (Express works, but I'm talking about 2005 here) ... and all this installed on a Microsoft Windows machine. ... and to hate yourself, you\u2026","rel":"","context":"In &quot;mysql&quot;","block_context":{"text":"mysql","link":"https:\/\/www.flamingspork.com\/blog\/category\/work-et-al\/mysql\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":4896,"url":"https:\/\/www.flamingspork.com\/blog\/2024\/01\/13\/using-llvm-mca-for-predicting-cpu-cycle-impact-of-code-changes\/","url_meta":{"origin":4839,"position":4},"title":"Using llvm-mca for predicting CPU cycle impact of code changes","author":"Stewart Smith","date":"2024-01-13","format":false,"excerpt":"Way back in the distant past, when the Apple ][ and the Commodore 64 were king, you could read the manual for a microprocessor and see how many CPU cycles each instruction took, and then do the math as to how long a sequence of instructions would take to execute.\u2026","rel":"","context":"In &quot;code&quot;","block_context":{"text":"code","link":"https:\/\/www.flamingspork.com\/blog\/category\/code\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":158,"url":"https:\/\/www.flamingspork.com\/blog\/2003\/09\/09\/potential-fix-for-keyboard-scancode-errors\/","url_meta":{"origin":4839,"position":5},"title":"potential fix for keyboard scancode errors","author":"Stewart Smith","date":"2003-09-09","format":false,"excerpt":"on my ibook2 (500mhz), while on console and changing brightness, i get a \"keyboard: unknown scancode e0 4c\" (or e0 54 if going up brightness) log message. Changing the brightness still works though.... This patch may help..... --- linux-2.4.21-ben2-xfs.recent\/drivers\/macintosh\/mac_hid.c 2002-08-03 10:39:44.000000000 +1000 +++ linux-2.4.21-ben2-xfs.recent-stew1\/drivers\/macintosh\/mac_hid.c 2003-09-09 00:20:13.000000000 +1000 @@ -207,8 +207,8\u2026","rel":"","context":"In &quot;linux-kernel&quot;","block_context":{"text":"linux-kernel","link":"https:\/\/www.flamingspork.com\/blog\/category\/linux-kernel\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/posts\/4839","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/comments?post=4839"}],"version-history":[{"count":1,"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/posts\/4839\/revisions"}],"predecessor-version":[{"id":4846,"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/posts\/4839\/revisions\/4846"}],"wp:attachment":[{"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/media?parent=4839"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/categories?post=4839"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/tags?post=4839"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}