HN user

olsgaarddk

112 karma
Posts1
Comments30
View on HN
XML is the future 3 years ago

At the tax authority we could query that directly from a database.

But yes, the public sector suffers from countless different systems that have accumulated over the years. It happens because everything has to go out to a public bid and throughout the times it has been considered anti competitive to built things in-house.

Obviously there are many things going on here, and I am not saying this is the end all explanation to the whole thing, but an interesting part of the puzzle I came across during a project I did on the brewery industry during my bachelor, is that there exists a whole market segment of consumers who just wants to "try something new".

When you ask yourself in the super market "Who in their right mind wants a snickers and mint flavored orea?" this is that segment.

So, in my case, the beer industry was (is? This was a decade ago) losing sales to ready-mades (Barcadi Breezer, cans of rum and coke, etc.) and a way to hold on to consumers was simply to add new, limited run recipes.

All classes of drinks are trying to hold on to consumers who are being stolen by other classes of drinks, by offering up new colors and strange flavor combinations.

But at the same time I think you are right about companies training consumers to drink larger and larger portions sugared drinks. Like, 1.5 liter coca-cola isn't even the largest size drink in the cinema sometimes!

A few years ago I decided I wanted to buy one of his limited prints with some extra money I was to earn. Then I pushed it off for a bit due to a few poor excuses, and eventually forgot about it.

And now his prints are of course ... out of print.

I'm not saying I need a numbered and signed limited print like The Tigers New Clothes [1] but it would be nice with maybe just a regularly, unsigned, unnumbered poster on my wall.

Are there any for sale?

[1] https://www.liberdistri.com/en/accueil/100--the-tiger-s-new-...

I thought I was pretty good at regex, but I could never have written this one and had to consult both `man grep` and regex101.com.

Explanations for the beginner and intermediate regex and grep user:

`-o`: Only return the match, instead of the entire line

`-P`: use Perl compatible regex

`-m` max-count, Stop reading a file after NUM matching lines.

And now for the regex:

`name:`: find the exact match

`\s*"`: Zero or more spaces leading up to and including an double quote

`\K`: This was the kicker for me. "resets the starting point of the reported match. Any previously consumed characters are no longer included in the final match" - basically tells the regex engine that the characters _before_ `\K` needs to be there in order to form a match, but it should only return the characters _after_ `\K` as the match. This is super handy! Is there a "reverse \K"?

`[^"]+`: One or more characters that are not a double quote. This basically means "Find the line that has a key called "name" and return all the characters after the first double quote and until the last double quote"

Does anyone on HN have any of these "surprising" email addresses that most people and developers do not expect?

How does it work with common e-mail clients? How do people react when you show/tell them your email?

I have a domain that uses non-ascii characters, and while I can receive emails on that domain, hosted by Fastmail, Fastmail clients refuses to _send_ emails to that domain (I can, if I type the domain as Punycode).

Since we are sharing our getting out of doom scrolling stories, I’ll share how I got off Reddit.

I realized that most of what I was reading on Reddit was fabricated outrage (since then they’ve added subs like “makes your blood boil” and “idiots in cars” - check them out if you feel like you are not outraged regularly enough)

I was the type of person who would sit on Reddit, be bored and type Reddit in the url bar.

So I decided to quit Reddit and used habitica for the task. It’s a gamification for to-do lists and forming habits. I added “visiting Reddit” as a minus 1, and every time I realized I was on Reddit I opened habitica and gave myself a minus 1.

Fictive internet points are quite powerful. I also started flossing this way (flossing at night, +1)

I really got a lot of use out of taking the GCP data engineer course on coursera (the one by google aimed at the cloud cert) and then later taking the actual certification.

With that being said it was very focused on BigQuery, and my impression is that it is that all their certs are now basically different variations of a kubernetes certification.

This reminded me of a recent experience on WeChat. I hadn't used it for a few years and recently tried to log in.

I was told, that my account had been deactivate due to inactivity and that it was against my agreement with Tencent not to use WeChat regularly. After that I had to check a checkbox promising to log in regularly.

Luckily I haven't paid for WeChat, and I don't need it anymore to keep in contact with friends, so I was far enough removed from the situation to laugh at it.

SQL Murder Mystery 5 years ago

I took a hint from Gorkish, having never heard of SQL triggers before, and I gotta say, the 2-query answer is really thinking out of the box and very clever. I learned a lot from it!

SQL Murder Mystery 5 years ago

You really need 3 for the first puzzle and 1 for the second puzzle.

Spoilers ahead:

- 1st query to get the crime report. This contain plaintext clues.

- 2nd query to get witness interviews. Again, these contain plaintext clues that can't be used in a `join` statement or a `where` statement in SQL.

- 3rd query to get interview with suspect. This contain plaintext information needed for solving the second puzzle

- 4th query for finding the master mind.

Short of writing regexes that basically extracts the clues by looking for patterns that are verbatim the clues themselves, I don't see how it can be done any shorter than this.

You can see my solution here on my github: https://github.com/olsgaard/sql_murder_mystery_solution/blob...

Matplotlib Gallery 5 years ago

When doing my master thesis, I wanted my plots to be printable on a black and white printer in case my professor would print or photocopy it (you never know)

I wrote up a blogpost about my findings on how to generate monochrome plots. I haven’t really used matplotlibs since my thesis days, but it’s kinda funny to see what my thoughts back then were on the interface.

I found the OO interface a necessary evil and that you have to mix interfaces to get full control of your plots.

Maybe things have been ironed out in the past 5 years? Reading the comments here it seems like the sentiment is that the OO interface is considered the sane, true interface.

http://olsgaard.dk/monochrome-black-white-plots-in-matplotli...

Mine is “first name at last name dot dk, only last name is spelled with an ‘O’ instead of an ‘Ø’” ...

It’s quite common when giving my email over the phone that my full name has already been established so I really wished the “Ø”-version would work (I also own that domain) but most (many? Some? Too many) email clients refuse to send emails to servers that contains special characters.

I can receive emails at the ø-domain, but not send to it using Fastmail. They recommend I use puny codes but that’s way too difficult to communicate.

This reminds me of a joke I used to tell people, when I was writing my master thesis:

"I wish I was doing my PhD thesis now. That way, I can finish writing my master thesis by procrastinating my PhD."

That's a really neat way of trimming the file extension, something that can end up being quite tedious to do with SED.

Do you know of a cheatsheet that describes what all the percentage sign means and other things you can do with parameter expansions?

A lot of the tips from TFA can be done in BASH as well and I'm sure the following of my own zsh tips also have a bash equivelant, but I'd like to share anyway:

Pure theme - My absolute favorite shell theme. Has almost all the bells and whistles of the powerlevel9k shown in the article, but looks, much cleaner and less in-your-face.

After downloading the theme, I've added this to my `.zshrc` file:

    # PURE theme - see https://github.com/sindresorhus/pure
    fpath+=$HOME/.zsh/pure
    
    autoload -U promptinit; promptinit
    prompt pure
Fuzzy find makes searching history much more powerful than what is listed in the article. I only use it together with ctr-r, but you can set it up for even more goodness.
    # Fuzzy find - see https://github.com/junegunn/fzf
    [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
Lastly I've added a syntax highlighter, which is really neat.
      # ZSH Syntax Highlighter - see https://github.com/zsh-users/zsh-syntax-highlighting
      source $HOME/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
I don't use oh-my-zsh, but I think my terminal is as fully fledged as even the best oh-my-zsh can offer.

Inspired by similar plaintext to-do discussions on HN I also built my own system.

I use Sublime and I love scrolling. The second makes the system in TFTA not good for me, and given the first, I didn't mind my implementation being editor specific - but the principal is dead simple, as to not really matter.

I have a small custom function stored in Sublimes user package folder which, when called using the [cmd]+[shift]+p command palette will insert a small template in the top of the current file (my `daily.txt`).

This is just a headline with the date, and name of day of week and Two lines called start and end (with datetime filled in in start) let's me keep loose track of my hours.

I also have a sub-heading that says to-do, with two `[ ] ...` txt checkboxes already added, another headline called did and a line that separates it from the previous day.

"To-do" is for things I plan on doing, "did" is for ad-hoc things I ended up doing. This helps me keep track of how much work I actually did, which is nice for days where everything is meetings and firefighting and I don't close issues in the tracker or PRs in git.

I can use go-to symbol to jump to a date, or just search the document for key words. Like I said, I like scrolling, and enjoy being able to just scroll down to see the previous day.

The system is like I said dead simple, easy to operate, easy for anyone to implement and customize to their liking. I've used mine for a few months and it has been great!

This is a really good summary.

For anyone who want to geek this out further, I highly recommend the the introduction in "Decoding Kanji: A Practical Approach to Learning Look-alike Characters" By Yaeko Sato Habein [1]. Despite being a workbook for intermediate students, the introduction really goes all-in on this stuff and treats the topic both very academically, but it also a treasure trove of kanji related "Fun facts", and the appendix has interesting compilations such as "Pairs of homonymous kanji compounds with one kanji in common".

[1] https://www.amazon.co.uk/Decoding-Kanji-Practical-Look-alike...

I am interested and would like to learn more. So do you just

    sudo apt install pypy3
and then
    pypy3 -m pytest /my/python/app
and if things go well you either got a 5-10x speed up or an insufficient test suite?
Do not log 6 years ago

Mostly because I didn't know of it. But also if you want to log caught exceptions as debug, because you were expecting the exception. E.g., a StopIteration exception you for some reason might want information about, or you have an object you need to check if it has a certain key, but for some reason doesn't have a get-method.

I'm sure there are also good reasons :)

Do not log 6 years ago

Kinda off-topic, since the article is about not making errors, instead of logging them, but sometimes you are not in control of input, and you expect some exceptions that you want to log.

In Python, instead of the example in the blog:

    try:
        do_something_complex(*args, **kwargs)
    except MyException as ex:
        logger.log(ex)
Use the almost undocumented `exc_info=True`, like this
    try:
        do_something_complex(*args, **kwargs)
    except MyException as ex:
        logger.error(ex, exc_info=True)
This will log the entire exception.

Even cooler, every un-caught exception calls `sys.excepthook()`. The function is supposed to be monkey patched by anyone who wants to do something with uncaught exceptions, so you can do the following if you want to log all uncaught exceptions:

    def exception_logger_hook(exc_type, exc_value, exc_traceback):
        logger.error("Uncaught exception", exc_info=(exc_type, exc_value, exc_traceback))
        sys.__excepthook__(exc_type, exc_value, exc_traceback)
    
    sys.excephook = exception_logger_hook
This will send all uncaught exceptions to the logger and then continue with raising the exception normally.

During my graduate degree, I was looking into phonetic search, and a lot of the papers I stumbled across were using an expanded version of soundex called Phonix[1] as their basis of new algorithms. However, I had a lot of trouble finding an implementation I could use, so I implemented it in Python.

After that I build a search engine programme that would look up swear words that were phonetically similar to input terms, as I thought that my fellow students might get a laugh looking up their own names. In the end, neither Phonix, double metaphone nor Soundex really produced any funny results.

plugs:

- Blogpost: http://olsgaard.dk/phonixpy-phonetic-name-search-in-python.h...

- Github repo: https://github.com/olsgaard/phonetic_search

[1] Gadd, T. N. “‘Fisching Fore Werds’: Phonetic Retrieval of Written Text in Information Systems.” Program 22, no. 3 (1988): 222–37.

That was my initial goal, but I had a lot of trouble with vanilla MeCab not understanding a lot of the text. But this was before neologd, so i think it would work better now.

I don’t have the source code on me, but I scraped it from a website that publishes subtitles. The scraping was easy, the cleaning not, and I believe this spreadsheet is generated from my first attempt at cleaning.

A lot of sources in Japanese nlp and linguistics have a bad habit of changing url often, so it bitrots easily. Sorry.

A few years ago I downloaded several hundreds of megabytes of Japanese subtitles, split into 3 categories: live action/drama, anime and foreign film/tv

I’ve listed them in a google sheets together with a few other corpora

https://docs.google.com/spreadsheets/d/1yb5dq4ahdwc_g0aQTL3Y...

Choose the jimaku tab for subtitles to see how big the variation between corpus can be.

According to other comments here, it appears that OP list is based on a newspaper corpus from 1993.