1. 17

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. 8

    As an update to last week’s comment, I successfully dug up some 10-year-old Java code from my PhD, put it up on GitHub, and am in the process of slightly modernizing it.

    A few observations in doing so:

    • Wow, I’d forgotten how verbose Java is. This code doesn’t really do that much, but still, it needs 6000 LoC to do it. And lots of those lines look like this:

      • BufferedReader file = new BufferedReader(new InputStreamReader(new GZIPInputStream(new FileInputStream(filename))));
    • But it’s stable. We’re using Swift at work lately, which doesn’t care at all about backwards compatibility, so even 1-year-old code doesn’t compile anymore. It’s nice that 10-y/o Java compiles and works fine. Yeah, the ancient Swing UI looks ancient, but it works.

    • Overall it’s reasonably nice to pick up and figure out what I was doing, because it’s fairly well architected (even if in a Java “high OO” style I now find annoying, with Factory methods and whatever) and copiously commented. Clearly was written when I was an idealistic young grad student. Especially happy that it was only loosely coupled to the project it was originally written for, auto-skinning J2ME games for featurephones (the J2ME stuff has bitrotted much more, so I ripped it out).

    • Except that, the bulk of the application logic for the GUI constraint-graph editor, >1000 LoC, was all written directly inside one Swing mousePressed() event handler. Wtf? I thought there might be some hidden terrible-hack reason for this, since the rest is pretty clean, but no, I was just lazy I guess, because factoring it out worked fine.

    • Refactoring doesn’t work well with git. I moved a bunch of static functions from an inner class to an outer class (they didn’t need to be in the GUI class), without otherwise changing them, but because this caused them to move up one level of indent, it shows up as a giant changelog, git-blame doesn’t show the right thing anymore, etc. Maybe darcs or pijul would handle this kind of code-move diff better? Not sure.

    • Cross-platform GUI has weird gotchas. I developed this on Linux and am now mainly using macOS, and whoops, there’s no middle mouse button here. And even the right mouse button didn’t work right: MacOS’s ctrl-click convention to simulate right-click doesn’t cause SwingUtilities.isRightMouseButton() to answer true, but the two-finger-trackpad-tap convention to simulate rightclick does count as a right-mouse-button click.

    1. 3

      Git just stores the previous and current versions; the diff is generated by your difftool. I’d be quite interested to see a more intelligent diff tool that was aware of nesting.

      1. 1

        Refactoring your own ancient code can be fun. Even when your past self was meticulous about comments and cleanliness… there are still plenty of WTFs.

      2. 6

        Today I’m starting a new job at a startup (this would be my third one overall). This is the first time it is (exclusively) for an argentinian audience (where I live).

        The product itself is fintech, and unfortunately I cannot go into details. Every person I talked (even non-tech people like members of my family) is quiet excited about what we are building, and that really gets me excited as well.

        We are currently mostly working on planning, specification, user flows, business model, meetings with partners/providers, etc.

        I’ve started learning golang as that’s the language we decided to use for our backend for its good safety/performance/easy-to-use/maintainability/hiring balance. If anybody is familiar with golang, I’d appreciate some feedback. (I know I’m lacking a readme and documentation, I am sorry): https://github.com/seppo0010/wikipedia-go https://github.com/seppo0010/wikipedia-graphql-go

        1. 6

          Going to write a simple NTP client in Common Lisp.

          1. 5

            Between contracts, waiting on a really good research job opportunity that takes a long time to make happen (I applied this time last year), reaching out to literary agents.

            Last week, wife was in NYC and I had little else to do, so I wrote like I was running out of time. So I worked a 139-hour week and finished Farisa’s Courage, my first novel and the first of the Antipodes series. By “finished” I mean that it’s revision complete. I still have serious metric pwnnage of editing to do, but I’m not going to be adding scenes except possibly in the one chapter that’s still a mess. Hope to have that finished by today. I’ll probably start sending copies to people I trust and like in the next ~3 days, and then if it is really, really good, send gloat copies to people I don’t trust and like in ~6 months when it’s super-polished. (Hey PG, it’s the guy whose tech career you tried to ruin. You’re a decent writer but I did something that you never could. I hit the Farisa level and Wrote The Other 51 on your ass, while you’re making up words like “refragmentation” and, while still wealthier than I’ll ever be, nonetheless declining into self-created irrelevance. Happy October!)

            Got outside for ~5 mi yesterday. It was beautiful. Spring is fully here. (I live in Chicago.) Weird how weather changes quickly if you’re a hermit for 2 weeks… and neither April nor October make good hermit months, but that’s how it worked out. Then again, this past winter was absurdly mild so spring started in February, which isn’t the norm in Chicago.

            1. 5

              I’m trying to find better sales channels for my startup, Turnkey Telemetry. It’s not as fun as writing code or building hardware. I could use some advice if anyone has experience with the sales end of a similar product line.

              1. 7

                It looks like https://barnacl.es/ is the place for you.

                1. 1

                  Hadn’t seen that. Thanks!

              2. 5

                My 7 year old desktop machine was on its last legs, so I ordered a new machine from CybertronPC via Newegg. I had organized a list of parts and had debated on building a machine myself, but didn’t really want to spend the time and hassle.

                The machine came on Thursday and I futzed around with installing Ubuntu and all the drivers and getting it just right. Still having issues with my USB wifi adapter and my hi-resolution display (surprise!). I have a wifi lan bridge on order since I already burned 6 hours debugging through driver related nonsense and decided the $40 was worth avoiding further hassle. Side note - I can’t find a single usb wifi adapter that claims to ‘just work’ with Linux. WTF.

                So with that out of the way I was finally able to pick up where I left off with the krgspl.com migration. I made a new logo in inkscape, and did some front end design work which I mostly struggle with. Then I jumped right back into the fun stuff with PostgreSQL and backend migration. The games and member display now works with the new API I exposed using my trusty RESTful library “Heimdall”, which I wrote 4 years ago, and use for all my node web projects.

                Next on the list is to get logins and gameplay working with the new DB, which should be easy since I did a reasonable job of abstracting the data layer for those aspects of the architecture.

                1. 5

                  gRPC documentation doesn’t have much info regarding handling errors, so I wrote this - gRPC Errors

                  1. 4
                    • Writing a lisp bytecode interpreter in C (I’d be interested in any suggestions for resources/books on stack based vms)
                    • Giving a presentation on the undergrad research I’ve been doing on solving the multidemand multidimensional knapsack problem with a population based metaheuristic.
                    • Fiddling with Common Lisp and SDL to (maybe?) write a text editor
                    • Signing up for classes for next semester (I’m most excited about an doing independent study on Coding Theory, which is definitely going to be interesting)
                    1. 4

                      This isn’t about stack machines specifically, but I posted a good survey paper on abstract machines here:


                      I think it’s relevant because it asks the question of how you design an abstract machine, stack machine or otherwise. I think most people base their design on another system that they’re familiar with.

                      I’m about to reimplement the Python stack VM [1] so any future designs will probably be heavily based on it :)

                      [1] http://www.oilshell.org/blog/2017/04/09.html

                      BTW if you haven’t heard of it, the SECD machine for Lisp is influential and well-studied.

                      1. 2

                        Oooh, thanks for the info - I’ll read into those two links. SECD machines look awesome too! I can’t believe I haven’t seen them before now - I’ll probably go and rewrite it now using that model, since it maps so well to lisp. Thanks! :D

                        EDIT: btw, just noticed you’re the oil shell dev - just wanted to mention that I really dig your blog posts - very interesting for me since I fiddle with a lot of language design :)

                    2. 4

                      This week I’m going to HackInTheBox Amsterdam, where I’m going to be doing a two hour workshop on a project I’ve spent the last 18 months working on. It’s a bit like an Arduino, but with some interesting features that make it stand out and a whole bunch of tutorials aimed at people who’ve never hacked hardware before.

                      Tonight I was testing the 0.9a prototype’s breakout area by building a battery powered temperature sensor with an OLED screen. Here’s a pic.

                      If you’re in Amsterdam this week, drop by the Commsec village and say hello. We’re launching a Kickstarter on Thursday, but have a few prototype kits for sale for people who are interested.

                      1. 3

                        Short working week for me, before driving most of the way up Scotland to visit friends for a long weekend with the family. Hoping for practically no screen time, lots of game time (Exploding Kittens!) and seeing who drops first each day, friend’s dog or our kids.

                        1. 3

                          In the past few weeks I’ve made Peergos read access about 200X faster by improving caching, and http request patterns, live on our demo server.

                          This week I’ll be focusing on the new website, and trying to figure out the bottleneck in pinning in IPFS when a Peergos user commits a write. Maybe I’ll try and fix the mobile version of the web-ui too. With any luck, I’ll find time to start on the CRDT based version of Peergos too. And on that topic, I think I’ve invented a new CRDT design for a Set, but would love a second opinion from a CRDT expert.

                          1. 3

                            My side-project has been using C# for the GUI (with WPF), and Python underneath for the real work. Both languages are great at what they do, but language interop has always felt a bit constrained.. they are forced to communicate through the common denominator, C structs and function signatures.

                            I’m working on learning PyQt5 so the entire project can be in Python, and wow this toolkit is really blowing me away. You can:

                            While researching GUI toolkits, it was surprisingly hard to find a treeview widget that also supports columns. If it was possible, you often needed to implement it yourself. Qt’s widget supports it out of the box, and it seems plenty performant.

                            1. 2

                              That’s unusual combination of C# on GUI and Python for logic. What motivated that?

                              1. 4

                                A complete lack of deadlines and a desire to experiment :)

                                There are a few different Halo modding tools, the most notable being HMT and Eschaton. These tools understand the layout of Halo’s structs and let you edit values in the .map file.

                                One day, I wanted to edit a value for every shader in the mapfile. With a programming language I could have used a simple loop, but with the GUI I was forced to iterate by hand, editing each shader manually.

                                I would have been satisfied to make a small edit to Eschaton and recompile, but it was unfortunately implemented in the proprietary language RealBasic (now Xojo), and I couldn’t find a development environment capable of compiling the project.

                                Since then, my side-project has been writing my own Halo-modding tool. I don’t really need to develop the tool, but it’s a fun domain with lots of little challenges. Since I was starting from scratch anyways, I decided on additional stretch goals: editing the map while it’s running, and scriptable editing. I also wanted the codebase to be clear and simple… most Halo modders are not proficient programmers, so the code ought to be as accessible as possible.

                                With Python I was able to achieve those goals rather easily. The only thing eluding me is a polished GUI. Tk, WxWidgets, and GTK were all ruled out. I could have hacked up something simple, but at the time it seemed WPF was the only option for a truly polished Windows GUI, and I was already familiar with the technology.

                                Embedding Python in a C# project was a fun challenge in its own right, but in retrospect I would not recommend it. I did manage to achieve a working demo showing off live memory-editing with Python scripts and a WPF GUI, but the interop layer was too complex and needed to be redesigned. At one point I was using the bastard hybrid language “C++/CLI” which straddles the boundary between .Net and native code. Nasty stuff. I later switched to using P/Invoke to load python35.dll directly from C#, but it’s still not ideal.

                                I’m glad I experimented with language interop, because I would have just done everything in C# if I had forced myself to stick with a single language. Ultimately I think Python is the better choice for this project.

                                1. 2

                                  Great, detailed writeup on that. Your choices make sense. I especially agree on Python as language choice for increasing usability by non-programmers or less experienced. I also see why they used RealBASIC (or BASIC period): BASIC’s look like pseudocode. Easiest thing go learn and maintain. My LISP/4GL hybrid was BASIC variant for that reason. They definitely should’ve gone with an OSS BASIC, though, given there’s good ones out there. Another project whose uptake is limited by proprietary tools. (Shakes head.)

                                  1. 2

                                    They definitely should’ve gone with an OSS BASIC, though, given there’s good ones out there.

                                    I agree. I would have been happy to work with Gambas. Another good choice would be Lazarus FreePascal.

                                  2. 2

                                    HMT and Eschaton

                                    Hah, it almost looks like a Mac’s resource fork! You can definitely tell the Mac heritage of Bungie.

                                    1. 2

                                      Halo modding is interesting that way… there are both Mac and PC versions of Halo, and the map files are compatible. The challenge is in developing cross-platform tools.

                                      HMT was developed in .Net 2.0 circa 2003. I’m not sure why that image has a Mac UI border… perhaps they are running it in Wine? Eschaton does not require a compatibility layer because RealBasic is able to target both Mac and Windows.

                                      Another modding tool with a storied history is Sparkedit. It was originally developed as a Windows-only application using C++ with the MFC toolkit. Then it was forked as a Mac-only application called Swordedit. So it has supported both OSes, but not at the same time.

                                      1. 1

                                        That’s definitely some kind of custom theme. (either via WindowBlinds or uxtheme signing disablement) Mac themes were all the rage back then.

                                        (Also, nitpicker’s corner: .NET 2.0 is from 2005.)

                                        1. 1

                                          Ah you’re right. Halo PC came out in 2003 and the tool was written later. It was definitely a cutting-edge technology at the time.

                              2. 2

                                Started writing unit tests for the open source dev tool Wago.

                                I haven’t found any bugs (yet!) but I did improve IO handling (should be more performant) and it’s been fun mocking objects.

                                1. 2

                                  Work: tracking down a bizarre Magento 1.x bug (probably just PHP-FPM configuration…) with quickly expiring sessions (causing lost cart data, if any one has insight, please let me know!). Continuing research and test work on moving our bare-metal to AWS.

                                  Home: Nothing. Probably read more about Markov chains and anything else that grabs my attention.

                                  1. 2

                                    Writing up how I’m using a finite state machine to drive a GUI, writing up evaluations and writing up some guides on how to run a meeting effectively

                                    1. 2

                                      Just bought a copy of Type-Driven Development! Time to finally learn Idris.

                                      1. 1

                                        I look forward to another great write-up from you down the road on how usable or helpful it was on different, common usages. As you learn, keep your eye open for ways to demonstrate power of stronger typing without user being a math genius. Like your TLA+ examples.

                                      2. 2

                                        Trying to get some sleep – Celeste is a good sleeper for a 10 day old but that still means a lot of time awake. I’m working my way through The Expanse at night. It’s perfectly cromulent TV, ideal for late nights and low brain capacity.