HNHacker News
TopNewBestAskShowJobs

juki

285 karma · joined January 14, 2017

submissionscomments
juki··on Nim 2.2.6
There are shorter options in Nim too, depending on your stylistic preferences

    let sorted = entries.sorted(proc (a, b: Entry): int = cmp(a.timestamp, b.timestamp))
    let sorted = entries.sorted((a, b) => cmp(a.timestamp, b.timestamp))
    let sorted = entries.sortedByIt(it.timestamp)
I suppose you could change the whole proc to something like

    proc groupIntoThreads(entries: seq[Entry], threshold: int): seq[seq[Entry]] =
      let sorted = entries.sortedByIt(it.timestamp)

      for i, entry in sorted:
        if i == 0 or entry.timestamp - sorted[i - 1].timestamp > threshold:
          result.add(@[sorted[i]])
        else:
          result[^1].add(sorted[i])
juki··on Why America's economy is soaring ahead of its rivals
You're misreading that. The survey ranks USA as #3 overall, but #22 on quality of life. The overall ranking is mainly thanks to the agility (#1), power (#1), entrepreneurship (#2) and cultural influence (#3). The other categories aren't that good: https://www.usnews.com/news/best-countries/united-states
juki··on C# almost has implicit interfaces
I think a lot of people here are being confused by all the talk about "implicit interfaces" in the article. It's not actually talking about interfaces in C# at all, just about the old-fashioned way of passing callbacks.

If you consider that a problem, you would also have the same problem in any other language with first class functions. Someone might define a `readSomething(string -> int) -> ...` function. Does that mean everyone who now defines a `string -> int` function must make it suitable for `readSomething`? Obviously not. It's up to the caller to pass correct arguments to the functions they are calling.

juki··on MOOC – free courses from University of Helsinki
It seems to just be the landing page that's down. The course pages themselves still work.
juki··on MOOC – free courses from University of Helsinki
The Java course (https://java-programming.mooc.fi/) was being updated every year until a couple years ago when they switched to Python. I did it in 2020 and it was certainly a good introduction to programming. I don't know about the new Python edition.

Their web development course is also very good: https://fullstackopen.com/en/

juki··on Discord monetization: microtransaction stores and paid 'exclusive memes'
Images can also be turned off under "Text & Images" in the settings.
juki··on QuestPDF: Modern .NET library for PDF document generation
You could just build the example in C#, grab all the required dlls from it and then load them in PowerShell with `Add-Type -Path '.\QuestPDF.dll'`.

Unfortunately it looks like this uses extension methods for everything, and those are a pain to use in PowerShell. You'll probably want to write the PDF creation bits as a C# cmdlet instead.

juki··on Microsoft is preparing to add ChatGPT to Bing
What did you find fishy about them? They seem roughly the same, aside from the countries involved with the projects having a bit more local information.
juki··on Why your REPL experience sucks
They don't. What aidenn0 said applies to all CL implementations, although with a small correction that it's not "any already compiled forms", but rather any variables/objects that already hold the value of `#'foo` that will keep pointing to the old definition. Compiled code calling `(funcall #'foo ...)` will get the new definition normally (unless `foo` is inlined).
juki··on India follows EU's example in requiring USB-C charging for smart devices
> If a significant advance in charging connectors is made, they can simply amend the law.

Also, I'm not sure what the Indian law says, but at least the EU version actually requires review of current technologies every 5 years.

juki··on The Kalevala (Crawford Translation, 1888)
Also, for those who speak Finnish, the materials that Lönnrot and others gathered are nowadays freely available online at the Suomen Kansan Vanhat Runot database: https://skvr.fi/
juki··on The Kalevala (Crawford Translation, 1888)
> And I still don’t know what the Sampo is!

No one does. Sampo is basically just a magical MacGuffin that brings wealth to whoever has it. In Kalevala it is usually understood as a mill that creates infinite grain, salt and money, but different folk stories have different interpretations.

juki··on Nushell: Introduction to a new kind of shell
Less work than trying to add named stacks to bash. If it's so central to your workflow that you're willing to put up with the rest of bash just for it, adding a couple lines to your profile can't be that big of a deal.
juki··on Nushell: Introduction to a new kind of shell
Just get the 7th path from `Get-Location` and `Set-Location` there, e.g.

  function Set-StackLocation ($Position) {
    (gl -Stack).Path | select -Index $Position | cd
  }
juki··on Nushell: Introduction to a new kind of shell
Assuming you have curl installed, it'll say

  curl: try 'curl --help' for more information
I assume you're thinking of the old Windows PowerShell that used to have curl/wget aliased to it's own commands, but that's not the case with the new cross-platform PowerShell.
juki··on Nushell: Introduction to a new kind of shell
Also make sure you're on latest version of PSReadLine (I had some problems with it not updating properly and had to do a manual `Install-Module PSReadLine -Force`) and try

  Set-PSReadLineOption -PredictionSource HistoryAndPlugin -PredictionViewStyle ListView
You can also toggle between the default inline and listview with F2. Also if you install

  Install-Module CompletionPredictor
and add this to your profile:

  Import-Module -Name CompletionPredictor
  Set-PSReadLineOption -PredictionSource HistoryAndPlugin -PredictionViewStyle ListView
you also get the normal intellisense autocompletions in the listview. And remember that if you have all the help files installed locally you can use F1 to view help for the current parameter/command.
juki··on Nushell: Introduction to a new kind of shell
`dirs -v` would be `Get-Location -Stack`. Also in newish versions PowerShell `Set-Location` (aliased to `cd`) supports -/+ to move backwards/forwards in it's own history, so usually you don't even need to bother with `pushd`/`popd` unless you need a named stack.
juki··on Retrowin32, a Win32 emulator
> blessed upgrade path for C++ applications.

There is C++/WinRT + WinUI 3, but looking at the screenshot that will pretty much require re-designing the whole UI so it's not going to be a simple upgrade.

juki··on Obsidian 1.0 – Personal knowledge base app
> I guess it is because Edge is using the one that comes with Chrome

Is it? As far as I can tell, Chrome just has a plain PDF viewer with none of the annotation/highlighting/commenting/read-aloud features that Edge has.

juki··on Closing a 30 pixel gap between native and web
The latest Windows 11 update just switched the task manager to the new UI style with support for dark theme.
juki··on National Rail Network Map
It might make sense if Francisca had just said "from Córdoba" and Jayalalithaa "from Erode, Tamil Nadu". Since everyone was talking about countries rather than states, one would reasonably expect Peter to do the same, and thus assume he is from Georgia rather than the USA.
juki··on The GPU shortage is over
Notice that if you look at the all-time stats, the decline in the summer happens every year, so it probably doesn't have anything to do with covid.
juki··on Why don't more people use throat mics?
> Sony's WH-1000XM4 is a good wireless option on the go, but because it uses bluetooth it murders the quality of incoming audio if you use the mic.

In my experience they work well if you only connect it to a single device, but if you use the two device mode then the mic is useless.

juki··on The Grug Brained Developer
> You have to step through the breakpoints, right?

This seems to be a common misunderstanding, but debuggers generally also support logpoints (print statements that you can add/remove on the fly without having to close, compile and restart the application).

juki··on Fyne, a cross-platform GUI toolkit written in Go
Too fresh. While it looks nice, it's not yet usable for anything but very simple mobile apps. I'm not actually quite sure whether it will ever be suitable for complex desktop applications; at least for now everything is clearly designed only for mobile.
juki··on Robert Jordan, the Man Who Connecticut Police Said Was ‘Too Smart to Be a Cop’
Same in Finland. All police officers go to the Police University College, which counts as a University of Applied Sciences, just like engineering schools.
juki··on Is there a maximum size for Windows clipboard data?
The ImportExcel (https://github.com/dfinke/ImportExcel) PowerShell module is quite useful.
juki··on Reasons to ditch Chrome and use Firefox
I haven't really tried using Edge for general use, but I do use it whenever I want text-to-speech. That's a lot better in Edge than other options I've tried.
juki··on List of Tech company layoffs in Europe
What do you mean? It hasn't been called Constantinople in a long time.
juki··on List of Tech company layoffs in Europe
The company in question does seem to be headquartered in Istanbul, on the European side of the strait: https://goo.gl/maps/23aKqwx2xRtdHU4A6
Page 1 of 6Next →