Better HN
topnewbestaskshowjobs
Log inSign up

arnehormann

83 karma · joined Mar 7, 2013 (13y ago) · 54 submissions

Submissions

comment 2y ago · link · parent

Try "Best served cold" by Joe Abercrombie. Followed by The Heroes. And to avoid minor spoilers, read the First Law trilogy first. All good books are great, The heroes is probably the best!

comment 10y ago · link · parent

you are replying to the original poster.

comment 10y ago · link · parent

A struct tag is just a string literal - according to the spec. The tags can only be accessed by reflect. The reflect api docs mention the convention. https://golang.org/pkg/reflect/#StructTag

comment 10y ago · link · parent

It is specified - a struct tag is just a string literal after a struct field. See https://golang.org/ref/spec#String_literals

If you use backticks, the tag must not contain another backtick. On anything but a struct tag, you could get by by concatenating literals, but that's not allowed for struct tags: https://golang.org/ref/spec#Tag You could use double quotes instead of backticks, but that leads to a dark corner of escaping hell and an utterly unreadable mess.

Thankfully, the language strongly nudges you to very, very simplistic and light uses of struct tags.

comment 10y ago · link · parent

Superfish is a root certificate installed by crapware in the preinstalled windows version. It can be uninstalled or removed by a fresh OS install. I guess someone replacing hardware components in a notebook doesn't keep the preinstalled OS for long.

comment 11y ago · link · parent

It's a non-classical example of arbitrage.

comment 11y ago · link · parent

I use "var undef;" at the top of a function and never set it to a value. Comparison with === is the same as with undefined. And it's nice for minification.

comment 11y ago · link · parent

And what about signal jamming or drones being shot down? Not only for package theft, also to strip or steal the drones themselves? I'm really curious how robust this delivery method is against external manipulation and general human misbehavior. Or say there's a defect - some structural damage - and a drone crashes or loses its 10 kg package into a front screen of a car driving on the interstate. Honestly, I don't see a way this could work. Not because delivery by drone in densely populated areas is economically and technically unsound. Because of... other stuff.

comment 11y ago · link · parent

you have missed

mkdir -p ~/.config/git

comment 11y ago · link · parent

You should use switch v := i.(type) so you can access v as the type in a case.

comment 12y ago · link · parent

MariaDB enabled Cassandra as a storage engine: https://mariadb.com/kb/en/mariadb/documentation/storage-engi...

comment 12y ago · link · parent

My Java is getting rusty... I read about this sometime somewhere but forgot it, thanks! I should have picked something like "String getText()", then.

comment 12y ago · link · parent

Because of the implicit thing! The api designer doesn't have to write the interface, you can do it yourself. As long as naming conventions are kept to and the signature matches, you can apply this anywhere.

Imagine a close() interface in Java. There isn't one - but having a try {...} finally { x.close(); } can be very useful sometimes. But having interface graphs made of granular interfaces makes everything slow and causes a lot of complexity when you try to think about your type hierarchy. That's why interfaces always just grow and you can't use them any longer because other classes only implement part of the api. Something usable for all of awt, swing, file handling, random foreign libraries? Unthinkable. Also, adding something in a later release (like CharSequence in 1.4) can have a wide ranging impact and requires you to change a lot of code.

In Go, you just add an interface from the union set of multiple structs api - and you can use it. No matter who wrote those structs. The value is enormous. Think of it as something like dependency injection at compile time.

comment 12y ago · link · parent

There's a great video treating imperial measurement units. I instantly fell in love with it: http://www.youtube.com/watch?v=r7x-RGfd0Yk

I landed there after watching one on paper sizes on the same channel. Also pretty much worth it!

comment 12y ago · link · parent

I really doubt that, where does it say so? AFAIK, he supported the TweetNaCl in C. That does not mean anything concerning this port.

comment 12y ago · link · parent

The costs: allocating the memory, having it set to zero values and keeping the garbage collector a little busier. All of that more than once if you don't keep the conversions down. Profile and disassemble your program, Go comes with pretty great tools!

comment 12y ago · link · parent

I believe that's a good thing - I prefer a small api surface to a large one and I don't want to spend time digging through never ending functions to locate what I have to use.

For me, next to everything from Microsoft is an example for a horrible api, the one from Javas standard library is rather meh and Go is pretty much the greatest thing since bread came sliced.

comment 12y ago · link · parent

It doesn't need to. You could also write type Runes []rune but the struct variant has the advantage that you can get the array back without any conversions - it's pretty cheap. And you can embed it. That's an advantage if you e.g. don't define Less on Runes but define it on RunesAsc and RunesDesc. See http://golang.org/pkg/sort/ -> Examples (SortWrapper)

comment 12y ago · link · parent

The setup needs a little boilerplate, but it's definitely possible. And it can support different sort orders after writing the boilerplate once. For those wanting to test drive it: http://play.golang.org/p/I_Vu34hUoV

comment 12y ago · link · parent

I wrote a ruby script to help with OpenVPN.

https://gist.github.com/arnehormann/9744964 There's a usage howto in the comments and this should be short enough to fully grasp what it does. No third party requirements, just ruby core + openssl.

It creates client and server configuration and creates and manages CA and CRL.

The VPN uses tun mode over UDP. Required changes on the server are written down in comments at the beginning of the server configuration.

If there is sufficient interest, I can make it a real repo so it can get issues and pull requests.

comment 12y ago · link · parent

Length could be encoded differently, as a varint. As long as the highest bit is set, the next byte is also part of the length - just left-shift the result so far by seven and add the 7 lower bits, as soon as the highest bit is 0 we have the final length. The processing overhead is low, 127 bytes only cost 1... Not such a big issue.

comment 12y ago · link · parent

TCP and UDP use the same underlying wire and the same hardware. If UDP would lose a packet or it would arrive late, the same could happen to TCP. TCP will retransmit and you lose a little bandwidth. But in both cases, you can't use the late data anymore - audio has about the hardest timing restrictions you can have when dealing with humans. Lateness means forced loss. TCPs ACK packets don't help there either, you want to keep down latency because your data can not be used any longer if it's dropped or late. Reliability becomes increasingly irrelevant, latency is everything.

comment 12y ago · link · parent

And how about Codemirror? It's mainly used for monospace code editing and it's missing a UI and editing widgets, but the configurability and maturity should blow everything else out of the water. A demo showing it's not only usable for monospace fonts in a single font-size: http://codemirror.net/demo/variableheight.html

comment 12y ago · link · parent

Right now they say replace all occurrences of "upstart" with "Mir" and all occurrences of "systemd" with "Wayland". I can't see how that would work.

comment 12y ago · link · parent

They will continue to provide it. Part of what he wrote: > We’ll certainly complete work to make the new logind work without systemd as pid 1.

comment 12y ago · link · parent

Your regexps are wrong, these replacements don't make any sense at all.

comment 12y ago · link · parent

ChaCha is a little faster and apparently a little more secure. Dig through http://www.ietf.org/mail-archive/web/tls/current/msg10843.ht... for reference.

EDIT found a better one: http://www.ietf.org/mail-archive/web/tls/current/msg10630.ht...

comment 12y ago · link · parent

Also look at a list of proposed ways to add generics (and why they didn't make it): https://github.com/remyoudompheng/go-misc/blob/master/generi...

comment 12y ago · link · parent

This is too late to help you, but still...

BitSets: look at math/big - not that intuitive, but what you need is probably there.

Sets: I wrote https://gist.github.com/arnehormann/6234573 while thinking about an api. It's not a regular repository because I never needed a set type myself, but it should work.

Like another commenter said, the cpu usage statistics in the Java program are most likely due to Java threads you didn't start yourself, e.g. the garbage collector. If your code involved creation and disposal of a lot of Objects, Go is at a serious disadvantage compared to the JVM. But that can be mitigated with a little effort and will probably disappear in due time.

12