HNHacker News
TopNewBestAskShowJobs

jansommer

556 karma · joined July 16, 2020

https://ja.nsommer.dk
submissionscomments
jansommer··on Ask HN: Pay per article
The wording should indeed be course and not article. Having to pay for articles seem to be a bit frowned upon.
jansommer··on Ask HN: Pay per article
Auch. I am attempting to earn money on topics that are of interest to me, which I think will be fun for others to read.
jansommer··on Superb Linux Documentation
I have to squeeze my eyes to see the difference between ( and [ in the code examples. Everything looks like a square bracket. See the example at the bottom: https://dashdash.io/3/setbuf
jansommer··on V86: x86 virtualization in the browser, recompiling x86 to WASM on the fly
Thanks, that did the trick. setvbuf was what I was looking for.
jansommer··on V86: x86 virtualization in the browser, recompiling x86 to WASM on the fly
This is a really cool project. I'm currently working on a tutorial on how to use it with Buildroot Linux and Tiny C Compiler, where I now have tcc in the browser. v86 is unable to debug with gdb (v8, 10.2, 11.2) (though it works if you use gdb to intercept gdbserver from another device), so I'm experimenting with strace, and have written a basic streaming parser for read/writev syscalls. What strace does is intercept printf/puts/gets/readline etc and by parsing its output, one can create a simple but highly stylable "console" in html that prints and reads text input. No support for TUI's, this is where xterm.js shines.

Compilation in tcc with a file of ~300 lines of code, linking to a library, takes roughly 50 ms. Compiling the entire libharu library takes 23 s. It's ~120.000 SLOC but where most is long arrays of encoding data.

I have used musl as toolchain, but will look into uclibc because of a weird problem: printf without \n in the end doesn't display the text before something creates a newline. And that could be readline, in which case you'd get:

  Pizza
  What's your favourite food?
At least I think this is because of musl where there's a problem with the syscall writev: https://www.openwall.com/lists/musl/2013/05/05/9.

Really looking forward to get the tutorial out and I hope it'll be with the strace based console!

jansommer··on When hiring developers, have the candidate read existing code
Would make sense to provide it as an option, and approach candidates without side projects in a different way. I would much rather show up with code I've already written and use that as a starting point for conversation.
jansommer··on Show HN: How to compile C/C++ for WASM, pure Clang, no libs, no framework
I'm investigating v86 [1] (x86-compatible CPU and hardware emulator in JS) to get a c compiler in the browser. There's an example with a 5.5 mb Build Root Linux example [2] where you can pass files and commands between the browser and vm. The vm boots within a few seconds in Firefox on my Pixel 2 XL. There's also an example where Lua code is passed from the host, but you have to download the GitHub repo to see it [3]

It likely isn't suited for compiling big c programs, but I think one can get far with preparing a few shared libraries and Tiny C Compiler or similar.

[1] https://github.com/copy/v86

[2] https://copy.sh/v86/?profile=buildroot

[3] https://github.com/copy/v86/blob/master/examples/lua.html

jansommer··on Modern PHP
jsoniq uses the same notation https://www.jsoniq.org/
jansommer··on Ask HN: Is there a pure SMS based UI?
Re: Twilio, just created an account a few days ago. Super simple API, and had receiving texts and robocalling myself with their content running within an hour or so. You don't have to store texts on your own, query Twilio's logs and they're all there.
jansommer··on Ask HN: How Is Your Neck?
I go to a chiropractor. They do wonders! Perhaps I had to go there a few times in the start, but now I go there probably every second or third month, and it immediately releases whatever pain there is in my neck.
jansommer··on Who wrote this shit?
I've been annoyed by my own legacy code long enough to try really hard to make sure the features being asked for are REALLY needed, simplifying things as much as possible before going into code. That's usually where most of the code is removed - sometimes all of it.
jansommer··on Do Not Log
I think the flamewar algo is preventing me from replying to your message xg15, but yes, it totally makes sense to have a global error handler on threads. I think that though the original article sounds like it is never okay, I don't imagine the author is against corner cases such as global error handlers in web frameworks, threads, browsers and so on. I just wish developers would refraign from writing try catch 80% of the time, because it pretty much always boils down to only a logging call and perhaps a generic error response that the framework would take care of anyway (at least in ASP.NET).
jansommer··on Do Not Log
That code is never acceptable. Don't catch all exceptions just to log and continue. That's like Visual Basic's On Error Resume Next sprinkled with logging! Now, you could instead catch a specific exception, a caught exception, log it, and write a very detailed comment on why you're only logging and not rethrowing, so the reviewer doesn't have to ask.
jansommer··on Do Not Log
I think the abstract stuff you're talking about is caught exceptions. I'm talking about catching exceptions where the only purpose is logging:

> Just log all uncaught exceptions in something like Sentry, or a file for that matter, via a global exception handler.

jansommer··on Do Not Log
What? Perhaps in some programming languages, but catching exceptions globally in C# works just fine.
jansommer··on Do Not Log
Excellent article! Something I've been wanting to write myself for years. Love the first example: try ... catch(ex), log(ex). I've seen numerous developers do this and it's always unnecessary unless you can't catch exceptions globally. Just log all uncaught exceptions in something like Sentry, or a file for that matter, via a global exception handler. It's not about eliminating all possible exceptions, it's to avoid writing a bunch of boilerplate, since every line of code could potentially fail at some point. In the rare cases where some additional context is needed besides what is always added such as the current user, then of course, log away, but write a long comment about why the exception is caught just to be logged.
jansommer··on macOS Setup after 15 Years of Linux
Completely agree. Ubuntu 20.04 with a 5k monitor (Dell UP2715K)? The result: Burn in that lasts for an hour and graphics completely messed up. After a few days the monitor broke. Are 100% scaling too small for your new 4k monitor? Well if you think 200% is too much, you'll have to switch to fractional scaling, where things get blurry. Don't know about macOS, but Windows have no trouble scaling things nicely to 150% for instance.

In Windows there are no monitor issues and it's super easy to set up my PlayStation 3 controller for games (that are also nicely supported). Overall there's just less configuration in Windows.

Instead I run Linux in VMware, which comes with its own perks: By creating a virtual machine per project, everything is neatly grouped in its own workspace, and by suspending instead of shutting down when done, I can get back to where I left off as easy as loading it's previous state from disk, with everything open - unsaved documents, applications, browser tabs, etc. I get the best of both worlds this way.

jansommer··on The state of external retina displays
My UP2715K broke recently, and I thought, well, 4k can't be that bad, there's almost no 5k monitors so perhaps the difference isn't that big of a deal. So I bought Dell's UP2720Q. Brilliant colors, can't complain at all on that point, but text is noticably blurry compared to what I'm used to. This is such a bummer
jansommer··on Better SQL JOINs
It'a slow even without indexes. In other cases, where the CTE is used multiple times in the same query, it can be faster
jansommer··on Better SQL JOINs
CTE's are indeed nice, but can also make your queries substantially slower, at least in Postgres
jansommer··on Web4 Should Run on LaTeX
It's not a bad suggestion, but it still doesn't satisfy the requirement. You can't put it all in a single executable if that is what you want
jansommer··on Web4 Should Run on LaTeX
Doesn't fit the part about licenses that restrict what you can do with your code:

"Qt for Application Development is dual-licensed under commercial and open source licenses. The commercial Qt license gives you the full rights to create and distribute software on your own terms without any open source license obligations." https://www.qt.io/licensing/

jansommer··on Web4 Should Run on LaTeX
Please suggest a cross platform framework that doesn't come with accessibility issues, that also allows you to create as rich ui's like what you can do in a browser, and without various licenses that restrict what you can do with your code? Something that supports Android, iOS, Linux, Windows and MacOS.
jansommer··on How We Turn Authorization Logic into SQL
The performance hit can be quite big. I had a query that went from 1s to 400ms by disabling RLS. The security policy was a simple where org = abc. When I encounter performance hits like these, I refactor the slow query into a function with SECURITY DEFINER and a huge warning that you're on your own regarding security. Besides that, it's nice not having to worry if your SQL is accessing stuff the current role isn't allowed to see.
jansommer··on PHP is worth learning and using
I also live in the EU, and 4,5k is not a massively good salary for a programmer in my country (Denmark). This is usually what a junior is paid.
jansommer··on The unemployment rate will match 50-year low by end of 2022, Goldman Sachs says
Off topic, but for the ultimate dark patterns experience, try clicking manage cookies. Hard to see if you're enabling or disabling something, and you "object" to things that you want to disable (I think!). Did not expect this level of deceptive design from CNN.
jansommer··on JSONiq: JSON Query Language
See also https://rumbledb.org by same author
jansommer··on What if there were no ad blockers?
Making procrastination unpleasant seems like a good idea. Ideally the result would be more time spent on being social with coworkers, or even get out of the office and participate in local events. Doesn't necessarily increase productivity, heck, it could even decrease, but one might just end up being happier either way.
jansommer··on Deploy a website on imgur.com
Back in the days (I'm 33 and thus quite old in web years) we would use forms
jansommer··on Employee shortages: Where have all the workers gone?
If the pay is good, demand is high and all you need is to go on a two month course, I'd bet a lot of unemployed people would be eager to do that. The "shortage" is indeed because of Brexit, but paying a thousand dollars an hour will most certainly magically summon workers en mass in a few months.
← PreviousPage 6 of 7Next →