News for hackers. Stuff that matters.

mristin

I have heard a couple of times -- Uber, but for prostitution.
Re:XML Is a Cheap DSL on Saturday March 14, 2026 @03:37PM (#47380308)
Have a look at Asset Administration Shells (AAS) -- it is a data exchange format built on top of JSON and XML (and RDF, and OPC UA and Protobuf, etc.).

https://industrialdigitaltwin.org/

(Disclaimer: I work on AAS SDKs https://github.com/aas-core-works.)

Show HN: Learn English with pictograms, speech and body pose

https://github.com/mristin/dance-to-english

Hi HN, We are moving abroad, so my kids (7 and 4 yo) will have to attend classes in English, but they don't know any English (yet). I made two fairly simple language games to motivate them. I wanted to share the games with you assuming some of the other parents might be in the same situation.Since both children are still only learning to read and write, I dispensed of all the text, and use only...

( Read More... | no comments | on HN )
Just let the kids play games in foreign languages. That's educational enough for me.
Re:Show HN: Let your body be the gamepad on Monday April 17, 2023 @02:29AM (#35597409)
XBox doesn't work outside & in the class room. Now, I wouldn't advocate for playing computer games outside -- but this might be a nice gimmick for children's birthdays when celebrated in the garden.

A friend of mine uses these games in the classroom as a primary school teacher. Kids here all have a laptop, so when they get nervous, it's a neat way for them to make a break & move a bit. Apparently, this works well for kids with hyperactive tendencies. Kinect would be too complicated in that setting as you need to purchase & maintain 20+ Kinects.

Re:Semaphore: A Full-Body Keyboard on Thursday April 13, 2023 @01:07AM (#35551197)
I'll try to package it for Linux this morning. So far nobody asked for it.
Re:Pynguin – Generate Python unit tests automatically on Tuesday June 01, 2021 @10:09AM (#27354737)
Sorry, I did not express myself clearly. For certain functions you can express all the properties in contracts and have them automatically tested.

For other functions, you write some obvious contracts (so that those are also tested in integration tests or end-to-end tests), but since writing all the contracts would be too tedious or unmaintainable, you test these functions additionally using, say, table-driven tests where you specifically test with data points for which you could not write the preconditions or you check the post-conditions manually given the input data. For example, sometimes is easier to generate the input, manually inspect the results and write the expected results in the test table.

> [...] turn contracts into tests [...]

icontract-hypothesis allows you to ghostwrite Hypothesis strategies which you can further refine yourself.

Re:Pynguin – Generate Python unit tests automatically on Tuesday June 01, 2021 @09:07AM (#27353802)
P.S. I think the important bit is not to be religious about contracts and tests. Sometimes it's easy to write the contracts and have the function automatically tested, sometimes unit tests are clearer.

I tend to limit myself to simple contracts and do table tests for the complex cases to reap the benefits of the both approaches.

Re:Pynguin – Generate Python unit tests automatically on Tuesday June 01, 2021 @08:48AM (#27353603)
In my anecdotal experience, it takes very little time for juniors to pick up adding contracts to their code. You need to grasp implication, equivalence, exclusive or, and get used to declarative code, but then it's easy. (I often compare it to SQL.)

I find contracts personally super useful as I can express a lot of relationships in the code trivially and have them automatically verified. For example, when this input is None, then that output needs to be positive. Or if you dele the item it should not exist in this and that registry, and some related other items should also not exist any more.

My email is in the commits of the repository, feel free to contact me and we can have a chat if you are interested in a larger picture and more details.

Re:Pynguin – Generate Python unit tests automatically on Tuesday June 01, 2021 @01:27AM (#27350986)
Just in case you are looking for an alternative approach: if you write contracts in your code, you might also consider crosshair [1] or icontract-hypothesis [2]. If your function/method does not need any pre-conditions then the the type annotations can be directly used.

(I'm one of the authors of icontract-hypothesis.)

[1] https://github.com/pschanely/CrossHair

[2] https://github.com/mristin/icontract-hypothesis

Re:Effective Property-Based Testing on Thursday February 04, 2021 @01:58AM (#26023287)
You can already do that with a family of predicates if you write preconditions in your Python code (see my previous comment [1]). There is an ongoing discussion how to bring this in into Hypothesis (see the issue [2]).

[1]: https://news.ycombinator.com/item?id=26018386

[2]: https://github.com/HypothesisWorks/hypothesis/issues/2701

edit: newlines

Re:Effective Property-Based Testing on Wednesday February 03, 2021 @03:00PM (#26018386)
If you use Python and want to infer test strategies from contracts, you might want to check out this library of mine: [1].

There are also plugins for IDEs (Pycharm, VS Code and vim), which can be quite helpful during the development.

[1]: http://github.com/mristin/icontract-hypothesis

Use contracts and propery-based testing. See Hypothesis library in Python (and other laguages). I wrote a library for contracts in Python (http://github.com/Parquery/icontract, see its readme for further references to other libraries).
Re:Evil Unit Testing (2019) on Thursday September 24, 2020 @02:09PM (#24581597)
I find the combination between unit tests, component tests and contracts the best. Contracts allow you to test with tons of data you wouldn't have ever generated manually when enabled in component and e2e tests.

The contracts obliviate often the need to write extensive unit tests. As they are part of the interface, we can avoid thus to re-write many unit tests when the interfaces change during a refactoring.

Switzerland faced similar warfare, terror, murder and bloodshed -- it's only in 1848 that Switzerland came to peace.
Re:Things I Believe About Software Engineering on Monday February 03, 2020 @05:44AM (#22223028)
I always wondered where this multiplicative factor of "several times" comes from. In my experience, writing correct software was marginally slower than writing sloppy software as long as most thinking is done with a pen & paper. Would you mind to elaborate a bit more?
Re:Docker is a dangerous gamble which we will regret (2018) on Monday January 27, 2020 @10:30AM (#22160153)
You can use PEX for Python.

At my previous job, we used a python script to rsync files -- very, very simple. I think it would have been much more difficult and error-prone with Dockers.

Re:JSON for Modern C++ on Sunday September 29, 2019 @04:28PM (#21109425)
See also Mapry [0], a code generator we particularly made for JSON.

[0] https://github.com/Parquery/mapry