HNHacker News
TopNewBestAskShowJobs

waf

59 karma · joined October 4, 2009

submissionscomments
waf··on Exercise: Minesweeper in 100 lines of Ruby
Fun exercise! I found that the Ruby in this post resembles modern C# (probably because Ruby is a gold standard in readability, and in the last 5 years or so C# has been making big strides in readability). I've recreated the Ruby code mostly line-for-line in C# and posted it here: https://gist.github.com/waf/5c6a04899e8250cb9a89406b978c9bcc

It mapped from Ruby to C# really well. The only concept I had to add was a `BoardCell` base type for the `Mine` and `Empty` types so we could return either `Mine` or `Empty` in a typesafe way. Everything else matched conceptually 1-1.

It's 118 lines total, with 18 lines of whitespace, so 100 lines exactly. I figure the original Ruby code was also not counting whitespace so it's a fair comparison. I tried to not use any "code golf tricks" that would minimize line count. It's a full program; it could be copy/pasted into a modern .NET 8 project and run without any additional setup.

Note, I posted this same comment on the original blog post, but I've posted it here too as it might be interesting for HN folks.

waf··on HTTPie Desktop: cross-platform API testing client for humans
For VSCode, there's https://github.com/AnWeber/vscode-httpyac
waf··on Error Handling Patterns
An older yet still excellent take on this topic is https://joeduffyblog.com/2016/02/07/the-error-model/
waf··on GPT-4 performs significantly worse on coding problems not in its training data
I've been adding C# code completion functionality to my REPL tool, and ended up reverting to the text-davinci model.

The codex (discontinued?) and text-davinci models gave much better results than GPT3.5-turbo, specifically for code completion scenarios. The latest models seem to produce invalid code, mostly having trouble at the boundaries where they start the completion.

My suspicion is that these latter models focus more on conversation semantics than code completion, and completing code "conversationally" vs completing code in a syntactically valid way has differences.

For example, if the last line of code to be completed is a comment, the model will happily continue to write code on the same line as the comment. Not an issue in a conversation model as there is a natural break in a conversation, but when integrating with tooling it's challenging.

Most likely the issue is that I'm not yet effective at prompt engineering, but I had no issues iterating on prompts for the earlier models. I'm loving the DaVinci model and it's working really well -- I just hope it's not discontinued too soon in favor of later models.

waf··on Nushell.sh ls | where size > 10mb | sort-by modified
Just for reference, the PowerShell version of this would be:

    ls | where Length -gt 1mb | sort LastWriteTime
waf··on Ask HN: Who is hiring? (November 2022)
Jetabroad (Thailand) | Senior Software Engineer | Bangkok, Thailand | Hybrid | Full-Time | Visa / Work-Permit | Salary USD 80K | https://www.jetabroad.com.au/

Airfares are hard, we tackle the hardest part, multi-city up to 10 legs long. Think exponential search space, fuzzy constraints, and constantly changing variables. We're looking for Senior .NET / C# developers to work on our flight search and booking platform.

We're located in central Bangkok, though we work from home most days and come into the office one day a week.

We use the latest C# and .NET technologies, GitHub, Continuous Integration, and Amazon Web Services. The majority of our code is .NET 6 and .NET Standard, as well as some older systems in .NET Framework that are being updated over time.

If you're interested, shoot me an email: will at bkk.jetabroad dot com

waf··on On Repl-Driven Programming (2020)
For what it's worth, modern C# can evaluate top-level statements with no other ceremony. The following is a valid standalone C# program:

  Console.WriteLine("Hello");
For REPLs, there are options like (my own) https://github.com/waf/CSharpRepl which stand on top of the Roslyn compiler infrastructure, which is quite extensive and can easily evaluate standalone functions and statements.

It's still nowhere close to the REPLs of lisp and smalltalk, but it's a step in a more flexible direction.

waf··on Rust on Nails: A full stack architecture for Rust web applications
I'd love to see an additional section on unit testing -- if we wanted to write some assertions on our async http handler that queries the database, what would that look like? Would we need to structure the code differently in order to test it?
waf··on PSReadline – bash inspired readline implementation for PowerShell
Agreed, the predictive intellisense is really nice and a makes a huge difference in my productivity at the command line. It's similar to Fish Shell's features.

There are a ton of interesting and non-obvious options in PSReadLine, like setting hotkeys for running arbitrary PowerShell functions.

I've put together a nice combination of features in my personal profile available here: https://github.com/waf/config/blob/dfc50fbe7fac9536250c5550c...

waf··on Make Your Python CLI Tools Pop with Rich
For C#, there's https://github.com/spectreconsole/spectre.console

I use this in a lot of my "quick apps" for status monitoring

waf··on AWS doesn’t know who I am
Right, AWS accounts created before September 2017 are coupled to amazon.com retail accounts. Accounts created after this are separate.
waf··on Best practices can slow your application down
It sounds like the team is interested in adding more automated tests, but are blocked by static singletons, which have high performance but also high coupling, resulting in poor testability.

I'm sure they've heard of test libraries like MS Fakes and Pose; I wonder if these libraries would let them maintain high performance, and only introduce the required layer of indirection during testing?

waf··on Choosing Java instead of C++ for low-latency systems
Because of the domain name, I expected this to be a quality blog post from the stackoverflow engineering team--they always have good content.

But this website appears to be a place for free-lance writers to post articles of somewhat lesser quality. I wonder what happened? Appears the Engineering Blog is now here: https://stackoverflow.blog/engineering/

waf··on Slate, create beautiful, responsive API documentation
I've used this before (as an API consumer, not an author), and while it's better than many other documentation sites, for some reason the "scrolling will change the URL and active navigation item" was really disorienting. I kept finding myself lost in the one long stream of documentation -- there was no anchor!

The goal is to have everything browser-searchable (i.e. ctrl-f), and I think it's a good goal. I wonder if there's a better way than having everything on a single page with very little compartmentalization, though.

waf··on Syntax highlighting is a waste of an information channel
Visual Studio does semantic highlighting for at least C# (they call it enhanced highlighting). Static classes, parameters, internal structure of regex strings, etc. Basically anything returned by the Roslyn Classification API.

I personally like it, but I think other people feel that syntax highlighting plus semantic highlighting leads to rainbow soup.

waf··on Self Host a Wiki or Knowledge Base for Your Team
ah, interesting. I guess the implication in your comment is that there are other, more capable alternatives (but not as "pretty"). What are some of the criteria where wikijs is lacking? For me, wikijs was leading in all the criteria I mentioned in my original post.
waf··on Self Host a Wiki or Knowledge Base for Your Team
Did you look at wiki.js ( https://wiki.js.org/ )?

I've been evaluating wikis too, and that's at the top of my list because it checks the boxes of having a git backend, markdown, and third-party auth providers.

Only downside is that it's NodeJS, which I'd rather not deal with given our existing tech stack, but as an internal app it should be fine.

waf··on Stranger Things, JavaScript Edition
Another fun one to figure out is:

  072 === 058 // returns true
Thankfully, doesn't work in strict mode.
waf··on Mono and WebAssembly – Updates on Static Compilation
You can also contribute and track the progress here: https://github.com/dotnet/corert/issues/4659
waf··on How Booking.com manipulates users
> The fact they display the "total cost of all nights" in the results, instead of the per-night cost. That's not a misleading UX, it's just a bad UX decision.

I prefer the total cost in the results, since that's what I'll ultimately pay. Why do you prefer per night? Doesn't that make you do the multiplication in your head?

waf··on NeverSSL – helping you get online
My go to site is http://example.com
waf··on Write a Shell in C (2015)
After clicking that github link, it appears to be in `src/powershell/Program.cs`, along with a readme explaining how the entrypoint works.

I'm not making any statement on the complexity of the general Powershell codebase, but finding the entrypoint at least seems straightforward.

waf··on We continue checking Microsoft open source projects: analysis of PowerShell
SonarQube is incredible (and free). We've been using it at work, and it's uncovered bugs in a codebase that's been around for years.
waf··on Why Erlang Matters
I'm really interested in BEAM languages, but the fault-tolerance / supervisor aspect of it doesn't speak to me. Aren't all modern application fault-tolerant, as long as you don't design something really poorly?

For example, I've never had a single HTTP request bring down an entire website -- that's already isolated. Same with message-queue listening processes. For general batch applications, I've always had them short-lived and running periodically, e.g. every minute, so even a complete crash there is isolated between runs.

One powerful aspect is how it strongly encourages you to design loosely-coupled message-passing systems that should be easier to scale out. But I'm not convinced that's enough to warrant a switch.

waf··on Category Theory abstractions for Clojure
A big clojure conference happened last week (http://clojurewest.org/). That's probably spurring a lot of conversation.
waf··on Functional Go Programming Language
If I remember correctly, the "C", "L" and "J" in "clojure" stand for "C#", "Lisp", and "Java", respectively; since Clojure is a Lisp that runs on either the C# (.NET) or Java runtimes.

So maybe a good name would be replacing the "c" with "g": Glojure. Doesn't seem to be taken by any other project, and it has the potential for some nice "glow" logos.

waf··on F# Web Services on any platform in and out of a web server
This article is kind of old (September 2011), and I notice that the last stable release of F# was April 12, 2010. Is F# still a maintained project at Microsoft, or are people moving to something else? I know a lot of the more functional JVM languages (clojure, scala) also run on the .NET CLR.
waf··on Show HN: My 24-hour project, instacss.com
My test case was typing in 'background', since I can never remember the order of all the values. It showed a lot of the border-* properties (but not all of them, background-position, for example), and didn't show plain old 'background'