atlas news
    
Juri Pakaste
12  août     05h30
Splitting a Xcode project with SPM
   I was talking on Mastodon about splitting an Xcode project into smaller pieces. Here’s an elaboration. Background: With SwiftUI previews you want small focused Xcode schemes. The larger your scheme, the less likely the preview is to succeed. You also get faster compilation if you don’t always build...
10  juillet     06h40
A fast timestamp parser in Swift
   I wrote a timestamp parser in Swift. It x ;s called Parse . It x ;s well known that DateFormatter, the main timestamp formatter and parser Apple ships in Foundation, is not particularly fast. It x ;s flexible and it x ;s correct, but it takes its time. The newer ISO DateFormatter has...
01  novembre     17h00
Git worktrees helper
   I recently became an avid user of Git worktrees. However, the command line interface to them is about as great as Git command line interfaces always are. Just git worktree add is a confusing maze of options. I wrote a shell script to help myself and then I wanted to check parameters and then I...
18  octobre     19h00
Better diff hunk headers with Swift
   When you run git diff or look at diffs in at least Fork on a modified Swift project you see things like this: , , extension AppUITests let container app.scrollViews quot;scroll quot; XCTAssertTrue container.waitForExistence timeout: ...
15  mai     15h00
Creating icons in Xcode playgrounds
   I’m no good at drawing. I have Affinity Designer and I like it well enough, but it requires more expertise than I have, really. Usually when I want to draw things, I prefer to retreat back to code. Xcode playgrounds are pretty OK for writing your graphics code. Select your drawing technology of...
16  janvier     17h12
Date component ranges in Swift
   Ever needed to iterate over a list of days or months in Swift Ever needed to have a random access collection of those The first thing they teach you in the How to not Operate on Dates Horribly Wrong class aka Calendrical Fallacies is to forget about using seconds for calendar correct...
09  janvier     10h00
Async Swift and ArgumentParser
   Swift . brought us async functions. ArgumentParser is the most popular way to write command line interfaces with Swift. Swift . supports an asynchronous main function, but ArgumentParser does not, as of version . . . To bridge this gap, you can call ArgumentParser manually from your...
14  juillet     12h00
Converting between NSBezierPath and CGPath
   The macOS SDK ships with at least two graphics path types: NSBezierPath and CGPath. They are mostly used in different contexts but sometimes it would be useful to convert between them. On iOS UIBezierPath has tools for the conversion, but on macOS we have to do it manually. Here are the two...
30  mars     18h12
Swift networking with AsyncHTTPClient
   When you need to access resources over HTTP in Swift, in most cases the answer is URLSession from Foundation. On server side that’s most probably not the right choice; there you are most likely running on SwiftNIO and you’ll want something that integrates with it. On command line it’s a toss up; on...
07  février     12h00
Database connections in Vapor 4
   Version of the Swift web framework Vapor was released a while ago. Vapor emphasizes their ORM, Fluent, and it seems that version has changed how a database connection can be acquired if you prefer to write the SQL yourself. They’ve also skipped documenting it, so getting things working requires...
30  janvier     12h00
Alfred Script Filter with find and jq
   Looks like this is a jq blog now, so here’s another one. I work on an iOS repository that’s used to create a large number of apps and a few frameworks. Each app has a directory with configuration and a script that regenerates the associated Xcode project with XcodeGen. You can run the script from...
24  août     09h00
Diff two modified JSON files in fish
   Another interesting command line JSON exercise: you have two JSON files, you want to diff a modified version of one to the other, and your shell is fish. For making JSON diffable, gron is a great choice: it transforms a JSON file into a list of assignment lines. Like this: echo ;...
23  août     12h00
Copy value with jq
   I use jq heavily in my day to day work. It’s a powerful tool but not always easy, so I have piles of notes about how to do things with it. I had to do a few iterations of copying a value from one JSON file to another the other day, and the files are large, and copying and pasting and launching...
06  avril     15h20
Parsing and evaluating mathematical expressions in Swift / Part 3: Interpreter
   Ever needed to interpret mathematical expressions with variables, like a.field a.field b.field , in Swift I did. This series of blog posts will walk you through my solution. This is part of the series: Tokenization Building a syntax tree Evaluating the syntax tree Evaluating the...
    15h19
Parsing and evaluating mathematical expressions in Swift / Part 2: Building a syntax tree
   Ever needed to interpret mathematical expressions with variables, like a.field a.field b.field , in Swift I did. This series of blog posts will walk you through my solution. This is part of the series: Tokenization Building a syntax tree Evaluating the syntax tree Parsing a list...
    15h18
Parsing and evaluating mathematical expressions in Swift / Part 1: Tokenization
   Ever needed to interpret mathematical expressions with variables, like a.field a.field b.field , in Swift I did. This series of blog posts will walk you through my solution. This is part of the series: Tokenization Building a syntax tree Evaluating the syntax tree Background I...
24  juillet     09h51
Looser dependencies with Swift
   What kind of types do you use to manage dependencies between objects in Swift How do you keep your objects that depend on others testable How do you prevent an addition of a method from causing changes to test code Couplings should be loose, but how to achieve that Assumptions I’m making a few...
02  juin     18h44
GraphQL with Swift
   Know that thing where you start writing a tool for something, discover it needs for some values of need something slightly complicated, you decide to write a library for said complicated thing, then discover you don’t need the tool you were working on in the first place but decide to write the...
16  novembre     18h29
annotate-git-commit
   I got into the feature branch workflow back when I was using Mercurial. I’ve since discovered that Mercurial’s branches aren’t really suitable for short lived branches and switched to Git for a variety of reasons, but I still wish my commits carried with them metadata about what they were related...
01  septembre     10h35
TODO.swift
   I saw this Swift trick a few years ago on Twitter. I can’t recall who it was, sorry. It sounded way too clever at first, but after a while I tried and decided I love it. Now it’s one of those things I add to every project. Sometimes you just want to get on with declaring your functions without...
15  février     19h03
Converting UNIX dates to a readable format on Mac
   I tend to run into UNIX dates large numbers representing points in time as seconds since the first second of , something like for : : all the time in my work, dealing with servers, web APIs, etc. Here’s how to make them readable on a Mac. All text below assumes...
25  mai     08h30
Netstrings for Swift
   I published another small Swift library: swift netstring implements reader and writer for D. J. Bernstein x ;s Netstrings format in Swift. Netstrings is a specification for length prefixed and delimited byte strings, useful mostly as a low level building block for network protocols. With swift...
02  octobre     17h35
Flue: Fluent API for value extraction and conversion for Swift
   Flue is a Swift . , as of this writing library for extracting, validating and converting values from user input. It tries to do this with a fluent interface: vp.extract quot; quot; .maxLength .regexp quot; . quot; .asInt .required It can output readable help and error messages from...
06  juin     18h37
Talking to servers: WebSockets
   This is a sort of follow up post to ZeroMQ, iOS and Python from a year ago. I again wrote a test app and server. Of the earlier components, iOS stayed, but ZeroMQ I replaced with WebSockets and the server is this time written in Clojure. Idea of the exercise is the same as last time: two way...
27  avril     19h03
NSStringinfying enums from AppCode
   I added a text option to nsstringfromenumgen so it can be used with JetBrains’ excellent Objective C IDE, AppCode. AppCode doesn’t integrate with OS X services, but you can configure nsstringfromenumgen as an quot;External Tool quot; and provide the selected text as a parameter. There’s still an...
29  décembre     10h18
NSStringinfying enums
   Making sense of enum values in C is too difficult. Usually sooner rather than later while debugging you need to see what x ;s inside an enum value, but C provides no introspection tools. You just get an integer value, no mapping to the original symbolic name. That x ;s why every enum should be...
01  mai     14h35
ZeroMQ, iOS and Python
   I wrote some example code for you. Background: last week a coworker asked me what x ;s the flavor du jour in two way communication between a network server and an iOS app, should he just go with BSD sockets or is there something better I suggested he should take a look at ZeroMQ. Not that I...
30  novembre     20h45
Unit testing Cocoa code with MacRuby
   Announcing RCRunner, a GUI test runner for MacRuby and Cocoa. Cocoa unit testing can be a pain. In addition to the usual difficulties of writing tests for user interface heavy code, the Apple sanctioned solution, SenTestingKit, can isn x ;t the greatest testing framework around and the default...
10  novembre     18h11
Using Firefox as Flash playing Safari fallback
   If you want to go Flashless on Mac and Safari, it’s possible to use Firefox as a fallback, too, not just Chrome. While Firefox does load Plugins from Library Internet Plug Ins and Library Internet Plug Ins, it looks in other places too. I just tested and it seems to work fine from Library...
19  juin     19h17
xibgraph: Interface Builder overviews
   When putting together user interfaces with Interface Builder, you connect things together with bindings, actions and outlets and it x ;s good. Understanding the result later on is a completely different matter. It can be time consuming and difficult to browse the objects inside one by one, trying...
04  juin     20h14
hg-status-sections
   I usually use Murky, dvc or some other shell for Mercurial. Not always though, for various reasons, and when running hg status I x ;m always frustrated when copy and pasting file names. bzr provides neat, non cluttered lines that can be copied whole to get a file name without a hassle, but hg...
22  mai     14h03
A better synthesize
   The biggest problem with Objective C x ;s synthesize directive for properties is how difficult it x ;s to augment the synthesized code. You often need to add logic to a property setter, but while you x ;re adding it, you x ;re losing the probably correct implementation Apple x ;s code...
08  mars     19h28
Block indentation in Emacs
   There are several small things Emacs could be doing to make it nicer to write code. One I was missing was making it possible to go with one press of the return key between braces in a C derived language from this: if test to this: if test lt; insertion point here That is,...
29  juillet     22h04
Exporting geolocation data from iPhoto with AppleScript
   I recently transferred all my photos to iPhoto. I share them on Flickr, but I’ve been unhappy with iPhoto’s built in Flickr support it has an arbitrary photo limit on web album size, it’s crashy, it does weird synchronizations that take ages when combined with lots of large photos and a slow...
27  février     18h31
Announcing Chipmunk Backup
   I put up on Launchpad a backup utility I wrote called Chipmunk Backup. It x ;s not extremely configurable nor does it have a huge set of features. It x ;s a simple tool for maintaining a number of GnuPG encrypted full backups of a directory in a remote, rsync accessible location. There x ;s...
06  janvier     16h26
Emacs tips: Navigate CamelCase words
   Emacs tip : Always search EmacsWiki when you think you might need something. Emacs tip : To navigate studlyCapped words, M x c subword mode, as found on the CamelCase page. I had to add the following lines to my .emacs to get it work with C left C right, M b M f worked right out of the box...
23  décembre     16h52
Inline admin forms with admin site links in Django
   I have a somewhat difficult relationship with Django’s admin site. It’s a very useful feature, but I haven’t really done enough with it to know when I’m going to hit a wall, if that wall’s in the code or in my understanding, and how hard it’s going to be to climb over the wall. This time I wanted...
21  novembre     20h31
iPhone shuffle
   These days I use an iPhone as my mobile music device. I have a bit over songs on it. I usually use shuffle and had it stuck in a weird state a couple of weeks ago it was constantly playing me just a few tracks. I usually listen for just half an hour to an hour at a time, so I don’t know if...
04  octobre     17h30
Crashes with NSURLConnection
   Speaking of Cocoa and iPhone programming, for a change. Having trouble with spurious EXC BAD ACCESS crashes when using NSURLConnection NSZombie giving you not very clear messages about Not A Type retain , pointing to an address that malloc history says has been allocated somewhere with only...
18  septembre     18h14
Various Python related things
   Python Magazine published my article quot;Using Dependency Injection in Python quot; in their August issue. Doug Hellman saw my blog entry about DI when I was switching web hosting and managed to repost old stuff to Planet Python, contacted me to ask if I wanted to expand on it a bit, I said yes,...
18  août     23h04
Flow 08: Saturday and Sunday
   On Saturday, it was raining cats and dogs. We were appropriately equipped and sniggered at the people in trainers etc trying to dodge the puddles. However, didn’t see too many acts saw a bit of Sébastien Tellier, but decided the crowds were too much and went to find some food which was excellent...
16  août     11h45
Flow08, Day 1
   Flow started off a whole lot better than last year. Everything worked smoothly despite the fact that there were twice as many people and twice as large an area as last year. In fact, the enlarged space felt better than the more constrained area of last year, maybe because we got to see more of...
27  juillet     17h22
Using custom widgets with Django's newforms-admin
   The following isn’t magic but it was unclear to me and required reading both documentation and source code and some additional Googling to get right. Maybe that’s because I’m a Django newbie, but hey, I’m probably not the only one. By the way, the following applies to Django SVN revision . That...
25  juillet     17h17
A moment of C hate
   Apologies, I x ;m going to indulge myself for a moment. If you aren x ;t interested in C ranting, skip this. I x ;m in the process of converting some C code to heap allocate objects instead of putting them in the stack, because I need to use them in Objective C and stack allocated...
18  juillet     18h34
JUGC 0.2 with Python support
   I just released version . and . . , now with a NEWS file of JUGC, the unit conversion library generator. It allows you to specify a set of measuring units and translations in XML files and generate a conversion library from them, thus avoiding parsing a definition file at startup. The...
04  mai     14h40
pgrok
   I put up pgrok quot;Project Grokking for Emacs quot; , a simple Elisp package for project settings and tools, on Launchpad. It’s a tidied up version of a couple of things I’ve been using for ages, basically for loading project a source tree settings, functions or whatever you need from files...
17  avril     09h33
Software Engineering Radio
   They keep on asking their listeners to plug them, so here goes. I’ve been listening to podcasts quite a bit lately, as I got a phone that can do them and my commute is too short to really concentrate on reading articles, and the best of the ones I regularly follow is Software Engineering Radio....
13  janvier     14h36
AudioFormat 0.6
   Waking the project up, at least momentarily, from a nine month slumber, I released version . of AudioFormat, the friendly audio file format converter for the GNOME desktop. I x ;ve again found more use for the software and discovered that it was in several ways still embarassingly broken, from...
11  décembre     19h38
Dependency injection: I'm not going back
   InfoQ carried an article about dependency injection, with the title quot;Does Dependency Injection pay off quot;. Answer: it does. You learn something useful from most languages, frameworks and libraries you get to know. One of the more surprising revelations the Java world had for me, after...
08  décembre     09h55
Using SSH from the Gnome menus
   Some time ago I wrote in a SSHMenu related blog posting’s comment thread that I found the Gnome panel’s menu combined with gnome terminal’s profiles feature sufficient for my SSH needs. As a followup, I got a email a couple of days ago by someone asking if I knew how to do the same thing except...