1. 9

This is the weekly thread to discuss what you have done recently and are working on this week.

Be descriptive, and don’t hesitate to ask for help!

  1.  

  2. 5

    Personal:

    • Resuming my GTD weekly planning habit
    • Getting the house back under control (5 year old + 4 year old + 7 month old + wife’s injured ankle mean I need to put some extra work in there!)
    • Writing a new section of Prose for Programmers for the first time in a while

    Work:

    • Convince Product to drop IE11 support in the next couple of months
    • Do more work on our backend services (historically I’ve been more on the UI side)
    1. 4

      Getting the house back under control (5 year old + 4 year old + 7 month old + wife’s injured ankle mean I need to put some extra work in there!)

      Dude, just let it go, ‘cause it’s gone. You can look forward to having a clean house again in about 18 years. ;)

      1. 3

        Oh, I’m not trying to have a clean house, that’s just ridiculous! Hoping to have one that’s a bit less of a disaster, though. :-)

    2. 4

      Learning and setting up terraform. My thoughts so far:

      The good:

      • Enjoying the nice documentation and community
      • Simple to get the basic concepts
      • Seeing the plan is incredibly helpful

      The bad:

      • Managing shared resources is confusing
      • Dependency on those resources is confusing - who should own what?

      I think I’ll find a good solution for the parts I’m confused on eventually - feels like it takes a good amount of research to get there.

      1. 4

        Please write up what you learn! This could make for a very interesting blog post.

        Although I have to ask - aren’t you creating your resources with a shared account anyway? if not, you probably should be, or at the very least use some kind of abstraction (e.g. a per region, per fleet, whatever account) to keep people from using their personal accounts for this.

        If you’re in AWS space, IAM has some good abstractions that allow you to create special purposes accounts with a very narrow permissions set to only the resources they need.

        FWIW I think Terraform is current best of breed in terms of infrastructure as code, and I’d like to see it even more widely adopted.

        1. 3

          We’re using AWS with a few IAM user accounts.

          By ‘managing shared resources’ I mean shared among other terraform files. For example, writing a .tf module describing our web-app for production, staging, and development which uses a shared security group resource or vpc.

          Thanks for the kind words of encouragement - appreciate it :)

      2. 3

        Preparing for 0.1 release of janetsh. In the past few days I improved the interactive terminal, fixed a bunch of bugs, and made sure it works on openbsd and freebsd.

        1. 3

          Create a kaitai format description for Python’s Pickle format

          1. 3

            Killing react native. https://twitter.com/theshawwn/status/1130649352538677248

            More precisely, we’ve been exposing all iOS interfaces to NodeJS. You can npm install whatever you want (including native bindings).

            The idea is that you can build iOS apps using very simple Javascript. Many (most?) swift tutorials almost can be copy-pasted verbatim. It’s actually a bit shorter in JS since you don’t need to deal with type declarations and such.

            There’s a laundry list of things I need to get done: Docs (probably docusaurus), a release process for the iOS node libraries, and other odds and ends.

            Watching another dev use sweetiekit really opened my eyes to how much more effective it is to write apps this way. You end up doing around 10x less work, mostly thanks to npm’s massive ecosystem. If you want to blub some json or snarf a URL, someone somewhere has already done the work for you in JS.

            socketio, axios, express… Almost everything seems to work flawlessly. It was really surprising that the default case is “whoa, it worked” rather than “what do I need to do to get this to work?” And I say that as someone who is generally skeptical of new frameworks.

            1. 1

              The idea is that you can build iOS apps using very simple Javascript. Many (most?) swift tutorials almost can be copy-pasted verbatim. It’s actually a bit shorter in JS since you don’t need to deal with type declarations and such.

              Really? How does that jive with Swift’s heavy use of optionals?

              1. 2

                Here’s our UIButton example: https://gist.github.com/shawwn/bf50f3284fa6b079ca80d2661281c042

                https://i.imgur.com/S3pxAf4.png

                https://i.imgur.com/YY6ozPr.png

                Pretty basic, but it illustrates how JS can end up a lot simpler than Swift. Notice that the code looks like:

                const button = new UIButton('👋 Hello Button', {x: 12, y: 80, width: w - 24, height: 50}, () => {
                   /* ... this code is run whenever the user taps the button ... */
                }
                

                You can still do the Swift equivalent .addAction, but we’ve made a few simplifications that feel quite natural.

                Googling “Swift UIButton tutorial” gives you this basic Swift example:

                func createProgButton() {
                    let progButton = UIButton()
                    progButton.frame = CGRectMake(20, 200, 100, 30)
                    progButton.setImage(UIImage(named: "progButton"), forState: UIControlState.Normal)
                    progButton.addTarget(self, action: #selector(progButtonPressed), forControlEvents: .TouchUpInside)
                    self.view.addSubview(progButton)
                        
                }
                    
                func progButtonPressed(sender: UIButton!) {
                    print("progButtonPressed")
                }
                

                Pretty standard, but a lot more verbose just to add a basic button.

                We’re going with principle of least surprise: Although we do add shortcuts that make sense for JS, we try to adhere to iOS interfaces pretty strictly. Our philosophy was “expose everything that Objective-C can do, and then it will be easy to add a layer that makes it feel like writing Swift.” The end goal is for you to be able to copy almost any Swift code, e.g.

                UIImage(named: "progButton")
                

                … add brackets …

                UIImage({named: "progButton"})
                

                … and then you’re done. Hence, you can mostly copy-paste from Swift.

                We’re not quite there yet, but it’s getting close. Here’s a more complicated example that uses ARKit + SpriteKit:

                https://gist.github.com/shawwn/106e642ba5d1e4e3a0309a8fbdd9f9b1

                Notice that we’re using ThreeJS to do the matrix math and place stuff in the scene. Speaking informally as a graphics programmer: holy crap it’s so much nicer to use a known library like ThreeJS. Not only is their documentation stellar, but people have created a ton of ThreeJS utilities that can be used directly here. You can even use ThreeJS’s OBJExporter to build an obj mesh, then drop it right into a SceneKit node. Presto, you’re now using ThreeJS with augmented reality.

                The weird thing is, it really is that simple. These examples aren’t hiding any complexity or handwaving anything. We just give you the interfaces to do with as you want.

                (To answer your question directly: A swift optional corresponds to JS null or undefined. E.g. if an optional value is nil, we just return undefined to JS. And if you return null or undefined to us from some callback function, we pass in nullptr or nil to the corresponding ObjectiveC or Swift API.)

                1. 2

                  This makes sense. I’d forgotten that JS actually has ‘real’ immutable values.

                  One of these days I will dedicate myself to learning and using JS. Not today however :) I need to double down on my Python mastery and just get better at the problem solving aspect of coding.

            2. 3

              Going to build on my success from last week drawing spirals and probably do some sort of little xsaver-esque spiral splat kinetic thing, and then start working on actually getting sprites to move around the screen in interesting ways using curves and randomization.

              Again I know all of this is ludicrously basic for this crowd, but the goal is to get me programming in a context I find fund and relaxing because I can’t take much in the way of hard core after my day job gets done with me :)

              Also might try my hand at applying some of the things I’ve learned to love2d because its API is so similar or possibly Pygame Zero because Python is my language of choice (although I’m surprised at how much I’m enjoying Lua as well.)

              1. 1

                Update: I’ve started the Talk Python 100 Days of Code course and am really enjoying it. Working on a pomodoro timer that’s CLI based and keeps records in JSON. Having structured lectures & problems to solve will be a help, I think.

              2. 2

                Turns out I need to make a quick v2.5.1 release following on from the epic saga that culminated in https://lobste.rs/s/bbew5z/what_are_you_working_on_this_week#c_duyden, some unit tests were in fact missing in the 2.5.0 release, and those missing tests also missed some broken functions.

                I also need to look at some of the proposed data structures for a “client”/friend’s project, and make a final decision about whether we should drop the SQL db and use e.g. OpenLDAP (as a general-purpose store, not just for authentication), to get the benefits of hierarchy, simpler multi-valued attributes etc.

                I think I’ve found a desktop solution to replace the easy time-tracking part of Billings Pro (because the self-hosted version is now EOL, and the client app is being updated in ways that break compatibility), so it’s probably time I make a start on a backend to import times worked, manage clients, generate invoices, track payments etc. I’ve been looking for something OSS to either use or fork and extend but haven’t found much I like so far.

                1. 2

                  I’m working on finalizing my GoCon Canada talk. That has been interesting. Writing talks for these things is difficult.

                  I also have been working on my TempleOS series. I hope to tackle The Hardest Question in Programming as well as write some more basic usage examples (with keyboard shortcuts) and see if I can get jslinux’s webassembly qemu port to run TempleOS in a browser. I hope I can get a proper emulation of the PC speaker in Javascript. Nothing really matches the fury of the 1-voice speaker.

                  1. 2

                    Another busy week ahead: work:

                    • We’re looking at current cloud offerings and trying out various things. So far big question marks are support and how to handle (application)incidents.
                    • I’m doing changes to handle an internal change, so far it’s going ok-ish but I’m not quite happy yet. I want this to be as transparent as possible so there will be lots of testing, testing and more testing after this…
                    • Lots of meetings too, I’m going to give training to make sure the rest of the team knows the basics of things I’m writing. They aren’t developers but it’s a very bright bunch of people so I’m confident things will be ok.

                    personal:

                    • continue with the terraform stuff I started this weekend. I’m struggling with finding the best layout so I have more thinking to do
                    • the weather currently is not quite good here, but I hope it will get a bit better soon. I need to mow the lawn again and maybe also go to the recycling center with some more stuff
                    • I was doing some easy maintenance work on my motorcycle to prepare for summer. I’m thinking of removing some fairings and re-wiring a bit. I’m also looking for an ok-priced maintenance book for my model but no luck so far.