frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Neomacs: Rewriting the Emacs display engine in Rust with GPU rendering via wgpu

https://github.com/eval-exec/neomacs
1•evalexec•28s ago•0 comments

Show HN: Moli P2P – An ephemeral, serverless image gallery (Rust and WebRTC)

https://moli-green.is/
1•ShinyaKoyano•4m ago•0 comments

How I grow my X presence?

https://www.reddit.com/r/GrowthHacking/s/UEc8pAl61b
1•m00dy•6m ago•0 comments

What's the cost of the most expensive Super Bowl ad slot?

https://ballparkguess.com/?id=5b98b1d3-5887-47b9-8a92-43be2ced674b
1•bkls•6m ago•0 comments

What if you just did a startup instead?

https://alexaraki.substack.com/p/what-if-you-just-did-a-startup
1•okaywriting•13m ago•0 comments

Hacking up your own shell completion (2020)

https://www.feltrac.co/environment/2020/01/18/build-your-own-shell-completion.html
1•todsacerdoti•16m ago•0 comments

Show HN: Gorse 0.5 – Open-source recommender system with visual workflow editor

https://github.com/gorse-io/gorse
1•zhenghaoz•16m ago•0 comments

GLM-OCR: Accurate × Fast × Comprehensive

https://github.com/zai-org/GLM-OCR
1•ms7892•17m ago•0 comments

Local Agent Bench: Test 11 small LLMs on tool-calling judgment, on CPU, no GPU

https://github.com/MikeVeerman/tool-calling-benchmark
1•MikeVeerman•18m ago•0 comments

Show HN: AboutMyProject – A public log for developer proof-of-work

https://aboutmyproject.com/
1•Raiplus•18m ago•0 comments

Expertise, AI and Work of Future [video]

https://www.youtube.com/watch?v=wsxWl9iT1XU
1•indiantinker•19m ago•0 comments

So Long to Cheap Books You Could Fit in Your Pocket

https://www.nytimes.com/2026/02/06/books/mass-market-paperback-books.html
3•pseudolus•19m ago•1 comments

PID Controller

https://en.wikipedia.org/wiki/Proportional%E2%80%93integral%E2%80%93derivative_controller
1•tosh•24m ago•0 comments

SpaceX Rocket Generates 100GW of Power, or 20% of US Electricity

https://twitter.com/AlecStapp/status/2019932764515234159
2•bkls•24m ago•0 comments

Kubernetes MCP Server

https://github.com/yindia/rootcause
1•yindia•25m ago•0 comments

I Built a Movie Recommendation Agent to Solve Movie Nights with My Wife

https://rokn.io/posts/building-movie-recommendation-agent
4•roknovosel•25m ago•0 comments

What were the first animals? The fierce sponge–jelly battle that just won't end

https://www.nature.com/articles/d41586-026-00238-z
2•beardyw•33m ago•0 comments

Sidestepping Evaluation Awareness and Anticipating Misalignment

https://alignment.openai.com/prod-evals/
1•taubek•33m ago•0 comments

OldMapsOnline

https://www.oldmapsonline.org/en
1•surprisetalk•36m ago•0 comments

What It's Like to Be a Worm

https://www.asimov.press/p/sentience
2•surprisetalk•36m ago•0 comments

Don't go to physics grad school and other cautionary tales

https://scottlocklin.wordpress.com/2025/12/19/dont-go-to-physics-grad-school-and-other-cautionary...
2•surprisetalk•36m ago•0 comments

Lawyer sets new standard for abuse of AI; judge tosses case

https://arstechnica.com/tech-policy/2026/02/randomly-quoting-ray-bradbury-did-not-save-lawyer-fro...
5•pseudolus•36m ago•0 comments

AI anxiety batters software execs, costing them combined $62B: report

https://nypost.com/2026/02/04/business/ai-anxiety-batters-software-execs-costing-them-62b-report/
1•1vuio0pswjnm7•37m ago•0 comments

Bogus Pipeline

https://en.wikipedia.org/wiki/Bogus_pipeline
1•doener•38m ago•0 comments

Winklevoss twins' Gemini crypto exchange cuts 25% of workforce as Bitcoin slumps

https://nypost.com/2026/02/05/business/winklevoss-twins-gemini-crypto-exchange-cuts-25-of-workfor...
2•1vuio0pswjnm7•38m ago•0 comments

How AI Is Reshaping Human Reasoning and the Rise of Cognitive Surrender

https://papers.ssrn.com/sol3/papers.cfm?abstract_id=6097646
3•obscurette•38m ago•0 comments

Cycling in France

https://www.sheldonbrown.com/org/france-sheldon.html
2•jackhalford•40m ago•0 comments

Ask HN: What breaks in cross-border healthcare coordination?

1•abhay1633•40m ago•0 comments

Show HN: Simple – a bytecode VM and language stack I built with AI

https://github.com/JJLDonley/Simple
2•tangjiehao•43m ago•0 comments

Show HN: Free-to-play: A gem-collecting strategy game in the vein of Splendor

https://caratria.com/
1•jonrosner•44m ago•1 comments
Open in hackernews

Implementing State Machines in PostgreSQL (2017)

https://felixge.de/2017/07/27/implementing-state-machines-in-postgresql/
30•todsacerdoti•9mo ago

Comments

michelpp•9mo ago
While this is a good approach to implements state machines, the transition function is hardwired to one transition graph. Another approach is to generalize the state and transition graph into a table, and group those transitions by a machine id, as shown here:

https://github.com/michelp/pgfsm

Now many machines (sub-graphs of state transitions) can be defined in general, and the transition checking function checks the validity of the next state based on the table, instead of static rules in a function.

smitty1e•9mo ago
TFA says he's using this to

> implement a realtime analytics dashboard for an application with over a billion event rows.

I'm interested in seeing how well this could be attained in SQLite with window functions[1] since SQLite doesn't seem to support a CREATE AGGREGATE.

There would also need to be some python[2] to provide the PL/SQL logic shown.

[1] https://sqlite.org/windowfunctions.html

[2] https://docs.python.org/3/library/sqlite3.html#sqlite3.Conne...

cryptonector•9mo ago
> I'm interested in seeing how well this could be attained in SQLite with window functions[1] since SQLite doesn't seem to support a CREATE AGGREGATE.

SQLite3 very much does support user-defined aggregate functions, just not with a CREATE AGGREGATE statement. You have to use one of the `sqlite3_create_function*()` C functions[0][1][2] to create a user-defined aggregate function:

  The sixth, seventh and eighth parameters
  passed to the three "sqlite3_create_function*"
  functions, xFunc, xStep and xFinal, are pointers
  to C-language functions that implement the SQL
  function or aggregate. A scalar SQL function
  requires an implementation of the xFunc callback
  only; NULL pointers must be passed as the xStep
  and xFinal parameters. An aggregate SQL function
  requires an implementation of xStep and xFinal
  and NULL pointer must be passed for xFunc. To
  delete an existing SQL function or aggregate,
  pass NULL pointers for all three function
  callbacks.
  
  The sixth, seventh, eighth and ninth parameters
  (xStep, xFinal, xValue and xInverse) passed to
  sqlite3_create_window_function are pointers
  to C-language callbacks that implement the
  new function. xStep and xFinal must both be
  non-NULL. xValue and xInverse may either both be
  NULL, in which case a regular aggregate function
  is created, or must both be non-NULL, in which
  case the new function may be used as either an
  aggregate or aggregate window function. More
  details regarding the implementation of aggregate
  window functions are available here.
> There would also need to be some python[2] to provide the PL/SQL logic shown.

Ah, so you do know about the `sqlite3_create_function*()` functions. You don't have to use Python, though you can of course.

  [0] https://sqlite.org/c3ref/create_function.html
  [1] https://sqlite.org/appfunc.html#the_aggregate_function_callbacks
  [2] https://sqlite.org/windowfunctions.html#udfwinfunc*
smitty1e•9mo ago
Hmmm...so a python generator might be just the thing for that aggregate...
cryptonector•9mo ago
I don't like TFA's TRIGGER using their aggregate function for the FSM because they are not ordering the events by time, but also because you just don't need the complexity of reviewing every event for an order every time there is a new event for the same order if you can just assume that all events arrive in chronological order and therefore the FOR EACH ROW trigger fires in chronological order. And if the events don't arrive (or are inserted) in chronological order then you need a FOR EACH STATEMENT trigger instead of a FOR EACH ROW trigger. Besides even as coded in TFA there is very much an in-built assumption that order_events inserts happen in chronological order anyways, so you just don't need to use the aggregate function in that trigger. The aggregate function is pretty neat and useful though, but every time you use you have to order input events by time, so the query of how many orders are in each possible state on any given day is incorrect.

Also, if you have a column to store the current/newest state of each order then I believe you can use plain SQL for the trigger function instead of PlPgSQL since you can then rely on a CHECK() to raise an exception when the new state would be 'error'.

(I bet TFA is looking for comments like these since as you can see at the bottom of TFA they are hiring.)

p0w3n3d•9mo ago
Can anyone give an example where state machine isn't an anti pattern?

I mean I never met a system that had a graph of states that wouldn't require working across this graph in certain situations. Hardwiring it to database would even worsen handling such edge cases.