HNHacker News
TopNewBestAskShowJobs

sprior

307 karma · joined September 15, 2013

submissionscomments
sprior··on The stick shift might survive the electric revolution
That's what I meant. One thing I appreciate about a manual transmission car with its clutch pedal is the ability to coast, not accelerating but not slowing down like regenerative braking would.
sprior··on The stick shift might survive the electric revolution
Correct me I'm wrong, but I was under the impression that EV's like Tesla don't really have a transmission as in gears to change, so as much as I'm a diehard manual transmission fan I figured that was where it ends. Now a clutch pedal that simply allows the vehicle to coast with regenerative breaking disabled sounds like the best compromise to me.
sprior··on Ask HN: What services/apps are you self-hosting?
Quite common. However the Docker Blog recently changed their site to not have it so buh bye to them I guess.
sprior··on The Lie That Facebook Sold You
I would think that one thing FB could do to encourage them to post more is show how many people have seen something you post. Right now 50 people could see your post and all you know is that three people liked it and one commented. I think people would be encouraged to post more when they know they have an audience (assuming they actually do have an audience).
sprior··on IBM swallows Red Hat storage products
I remember when Notes came out and they said "It's Groupware!" and I said "what does it do?", and they just said it does Groupware stuff and I said what does it do? Then more marketing that it was groupware and I said WTF does it do???
sprior··on Far-ultraviolet LED designed to kill bacteria and viruses without harming humans
Not that hard to get them, your big box store has them in the pool filter section. In 2020 these instructions came out how to build a UV sterilizer for cheap: https://makezine.com/projects/build-a-diy-uv-c-sterilization...

And no, not safe without precautions.

sprior··on Long-term cardiac pathology in individuals with mild initial Covid-19 illness
Same situation as you and totally agreed.
sprior··on The end of the manual transmission is near?
I've been saying for years I'll give up my manual transmission when the car doesn't have a transmission - EV.
sprior··on Show HN: Pornpen.ai – AI-Generated Porn
Someone had to satisfy the "transporter accident" fetish
sprior··on How to Hire Good Engineers
I wouldn't be comfortable sharing code I wrote for a previous employer because I treat that as confidential. I'd be happy to show my personal code with the understanding that it tends to be improvisational and done a bit more casually than production code. But along the way I'm sure I'd show enthusiasm discussing the architecture of my personal projects as well as my home infrastructure: everything running on VMs, control panels, private git server, Jenkins, and everything deployed to containers.
sprior··on The Last Question
I saw it at the Fels Planetarium of the Franklin Institute in Philadelphia apparently in 1973 when I was 8 years old and always remembered it and even kept thinking about it every once in a while.
sprior··on The Power of Prolog
I dusted off an implementation of MQTT for SWI-Prolog so the way I did all the integration was via MQTT messages between Java. Python, c/c++ (on Arduino devices), and Prolog.

These days SWI-Prolog even has a library for Redis.

sprior··on What are the odds that some idiot will name his mutex ether-rot-mutex (2017)
I heard about that recently, I can't imagine how that works.
sprior··on What are the odds that some idiot will name his mutex ether-rot-mutex (2017)
I think programmers get used to the idea that some names for things are never meant to be spoken and don't ever say them in their head to see what they'd sound like.
sprior··on What are the odds that some idiot will name his mutex ether-rot-mutex (2017)
In my head it was just part of solid and rotation which was exactly that the code did and all I ever thought of, but once the other person pointed it out it was like "oh, right".
sprior··on What are the odds that some idiot will name his mutex ether-rot-mutex (2017)
Back when I was in high school and programming on the original IBM PCs I wrote a program that would graph "solids of rotation" (a function rotated around the X axis). Well I chose the obvious name based on the 8.3 filename limitations. One day someone looked over my shoulder and said "you named your program solid rot???" Oops.
sprior··on What’s in Which Python
Sometimes you're in an organization that doesn't upgrade things right away and it can be difficult to tell which features you can use and which you don't have yet.
sprior··on Take my app ideas
Someone proposed the second idea to me once. My immediate thought was of all the careers that would be ended as a result of it being too easy to share that random thought that went through your mind.
sprior··on Ask HN: How many computers you got?
That's not a question with a clear answer these days. Besides a Laptop and a Surface all my real development is done on currently 15 VMs ("if you can't tell, does it matter?") I host on several server computers in a rack. I've lost count of how many ESP8266/ESP32 devices that I built are around the house. There are 3 3D printers being run by Raspberry Pi 4's. All in all I'm running low on addresses for a class C network.
sprior··on Ask HN: What are some interesting examples of Prolog?
Here's part of a sample sequence: 1) Smarthome gets a notification of a vehicle detected in the driveway 2) sends a request to get an image from the driveway camera 3) gets the image, sends it off for storage and analysis 4) sends it to an image recognition service which returns a description(make/model/color + other info) as JSON 5) receives analysis, matches it to known vehicles and announces the results

The send_display_vehicle_id(Id) in the end actually does a lot, it queries redis for previously announced display type devices, then looks up the capabilities (bit depth, resolution) of each device and formats accordingly then sends the display request for each. Also send_android_notification sends the request to some Java code that initiates a push message to my phone and watch.

None of this is rocket science in terms of Prolog message(MQTTPathAsList, MessageBody) is my general predicate for handling an incoming MQTT message once I've subscribed to it and it's convenient to deal with a MQTT topic path as a list.

message(['Smarthome','Notify', 'vehicle','motion'],_):- log('brain saw vehicle motion'), get_short_timestamp(S), atomic_list_concat([S, ' Vehicle Motion'], NotificationMessage), send_android_notification('Smarthome', NotificationMessage), request_image('alibi4').

request_image(Camera) :- publish(['Smarthome', 'Video', Camera, 'brain', 'request']).

message(['Smarthome','Video', _ ,'brain','response'],Image):- store_image(Image, 'brain'), analyze_image(Image, 'brain').

analyze_image(Image, Id) :- publish(['Smarthome', 'Sighthound', 'analyze', Id], Image).

message(['Smarthome','Vehicle', 'Sighthound'],VehicleJson):- vehicle_id(VehicleJson, Id), get_short_timestamp(S), atomic_list_concat([S, ' brain saw vehicle: ', Id], NotificationMessage), send_android_notification('vehicle', NotificationMessage), send_display_vehicle_id(Id), atom_concat(Id, VehicleJson, Description), atom_concat('brain saw vehicle: ', Description, Message), log(Message).

sprior··on Ask HN: What are some interesting examples of Prolog?
Not a lot of code but a somewhat different use of Prolog than you're likely to see elsewhere. I used my fork of a MQTT library for Prolog (https://github.com/sprior/swi-mqtt-pack) to implement the central controller for my home automation system. The system responds to MQTT events and then coordinates the appropriate action by sending MQTT messages to other home services. Recent versions of SWI-Prolog also support redis and I've started using that to store device configuration and state between services. The MQTT version is actually a reimplementation of my previous version which used CORBA for inter-service communication.

I don't distribute the home automation code however it's pretty specific to my house. The MQTT library provides some building block examples.

You can also see some other comments I've made on HN which describe some other details.

sprior··on My typical working day as software engineer
It's been quite a while since I used this trick, but at the end of the day I used to put a deliberate compile error in the code where I was last working. So the next morning I'd compile the code and fixing that error was kind of a warm up to get to the right spot and keep going.

It's funny what works.

sprior··on GhostSCAD: Marrying OpenSCAD and Golang
Another possibility might be using Prolog's list/object composing ability. As a fun example let's imagine that you have a Flintstone's AirBNB. You write Prolog code to capture some pieces like a weather forecast icon and a headline or two, then compose that into a design that looks like this info on a stone tablet and send it to the printer loaded with marble colored filament, then have it on the table with breakfast.
sprior··on GhostSCAD: Marrying OpenSCAD and Golang
Yeah the Prolog part would probably have to just do a yes/no analysis of whether the proposed solution is even a candidate, but then maybe something else would score the quality of the remaining candidates.
sprior··on GhostSCAD: Marrying OpenSCAD and Golang
I always thought it would be interesting to use the solution seeking of Prolog to design a physical object, but haven't figured out a usecase. Funny that in my house it would be possible to trigger the design of an object by a MQTT message of an event, slice that object, then turn on my 3D printer and print it with no manual intervention.
sprior··on What's the strangest code you've seen a senior developer write? (2019)
Besides the comment about the developer who only used left joins there was also this one:

I worked with a ‘senior developer’ who, on a really big project with lots of different coders around the country, prototyped the implementation in prolog including the JUnit tests (in prolog too).

I think I actually know the answer to this one. I don't remember whether it was while I was still in school or later, but once heard someone say that they always picked a language to implement a prototype in that would never under any circumstances be used for the final system so that it was impossible to try to hack the prototype into the final system.

And for the record I actually like Prolog for certain projects.

sprior··on Ask HN: Why are you programming your hobby projects in a niche language?
Instead of trying to directly integrate for example Prolog and Python I set up services in whatever language/hardware and communicate between then using JSON messages transported via MQTT. With this method I've got Docker containers running Java, Python, and Prolog code interoperating with ESP8266 and ESP32 devices I programmed in C++ and anyone can talk to anyone. I also wrote a Java server that interfaces with an Insteon gateway so my little MQTT cluster can respond to devices turning on/off or send a MQTT message to control a device. The pieces don't know or care what language the other pieces are written in.

On the Prolog side of things with not that much framework code here is a trivial example:

message(['Smarthome','Notify','brain','ping'],_):- publish(['Smarthome', 'Notify', 'brain', 'ping_response']).

This code receives a MQTT message with a topic of Smarthome/Notify/brain/ping ignoring the message body and then publishes a return message on topic Smarthome/Notify/brain/ping_response

I even have a container that runs nothing but cron with a mqtt client installed that sends mqtt messages at various times of the day and all Prolog has to do is subscribe to those topics and handle those messages.

sprior··on Ask HN: Why are you programming your hobby projects in a niche language?
See my reply to ojford with a bigger description below.
sprior··on Ask HN: Why are you programming your hobby projects in a niche language?
I forked an abandoned implementation of MQTT for SWI-Prolog by olsky, my fork is at https://github.com/sprior/swi-mqtt-pack

Look in the examples directory for some basic pub/sub code.

The Prolog code that runs in my house is pretty specific to my house so I figured the best way to open source things would be as a framework more than an implementation. You can contact me via issues on the github repo and prod me into adding some more advanced examples - I've learned a lot since my last commit on the repo.

I've started using the Redis functionality recently added to SWI-Prolog, so my code now responds to MQTT messages and uses state queried from Redis to help determine what actions (implemented by sent MQTT messages) to send out. The beauty is that since I don't do anything that blocks significantly in the Prolog code it is now single threaded - even the MQTT listening. It still responds quickly enough and is MUCH easier to deal with than multi-threaded.

An example of what I'm doing is I built a bunch of ESP8266/EESP32 display devices that control neopixels/OLED/LCD displays. When one of those devices boots it sends a MQTT message announcing its location and capabilities (display type, bit depth, dimensions). Prolog receives that message and then stores that info in Redis. So that device info is all dynamic.

So then later Prolog might get a notification that something is in the driveway. All by MQTT it requests an image from the appropriate camera, then sends the image off to Sighthound and deepstack image recognition servers. The Sighthound front end sends a message back to Prolog with a description of any vehicle spotted which Prolog then matches against known vehicles. If it determines for example that a Fedex truck is in the driveway then Prolog sends notifications around the house - it queries all the display devices from Redis and then based on the capabilities of each devices creates a JSON formatted MQTT message to send to each announcing the Fedex truck. It then also sends a MQTT message to some Java code that connects with Google and sends a push message to an Android app I wrote that displays the alert on my phone and watch.

Before I switched to MQTT I was using Prolog with CORBA as the message transport and back then I also had Visual Basic and MS Agent as part of the system. One night I got bored and a little while later had 3 Peedy the Parrot characters singing Row Your Boat in a round across three different computers coordinated by Prolog. It was actually only a page worth of custom Prolog code for that.

sprior··on Linux from Scratch
I built my first LFS system in early 2001, it was the most educational thing I've done in my career up to that point.
← PreviousPage 3 of 4Next →