HNHacker News
TopNewBestAskShowJobs

Avernar

397 karma · joined November 5, 2014

submissionscomments
Avernar··on C++ 11 Auto: How to use and avoid abuse
I agree. When the return type changes now you'd have to change every spot it's called regardless if the return value is used or not. This would be very annoying if you don't have a refactor function in your IDE or if the ammount of changes crosses a company policy trigering a full program test taking days of your time, etc.

The original function name was named poorly however.

Avernar··on Timezone updates need to be fixed
The postgres documentations says exactly that. Other databases might do something else so it's best to read the documentation.
Avernar··on Timezone updates need to be fixed
Nice article. For your rule of thumb section there is a third case. For a future event that must happen x number of seconds/minutes/hours/days into the future you want to store it as UTC and not wall time.

For example, the bypass valve on the boiler must be opened in 30 hours. You want that as UTC instead of wall time as you don't want a DST change to add an extra hour to that as you'd get a pile of scrap instead of an intact boiler.

Avernar··on Timezone updates need to be fixed
> The event was literally moved to a different time UTC. I'm glad we agreed that it was rescheduled.

I think I see the confusion here. If you went to a group of people and said the movie you were all going to was rescheduled from 11pm UTC to 10pm UTC because of DST you'd get a bunch of "Huh?" and "What local time was it rescheduled to?" You'd answer it was rescheduled from 6pm to 6pm local time. You'd get a bunch of laughs at your "geek humour" while they secretly thought you were nuts. :)

Social events like meetings, movies, etc. are not considered rescheduled when DST starts/stops or the TZ rules get changed.

If you stored the event as UTC you'd have to alter your database when DST starts/stops or the TZ rules changed (is your system going to compare the old and new rules automatically now?).

Avernar··on Timezone updates need to be fixed
We don't agree. It was not rescheduled in reality. Your system would have said it was rescheduled to 7pm Toronto time while in reality the event would still be 6pm Tronto time. The people using your site/app/whatever would be an hour late.

UTC is the correct was to store timestamps (things that happened) and intervals (things that need to happen x seconds/minutes/hours from now).

For future events at a specific geographical location you need to store it as local time + timezone. Many databases have a time+timezone type.

Avernar··on Timezone updates need to be fixed
Wrong. Let's say an event is scheduled for 6pm daily in Toronto (EST -0500). You store it as 11pm UTC. Now eventually we switch to EDT -0400 due to DST. Now your system will say the event is at 7pm local time.

YOU just rescheduled the event.

Works the same with dates and not just times. If you store each of those events individually and the politicians move the DST switch date (or an error was corrected in the TZ database) then some of your event times will now be an hour off.

Avernar··on Timezone updates need to be fixed
Not for events like shows, movies, work hours, etc. An event starts and stops at a specific local time. If the DST rules change then the UTC version will be wrong but the one stored in local time + TZ will be correct.

Intervals should be stored in UTC. If you're supposed to drop the control rods in a reactor in 24 hours you store the time it's supposed to happen in UTC. DST transitions and rule changes would mess this up if stored in local time.

Timestamps for logs and files should also always be UTC.

Avernar··on Russia says Saudis proposing global oil production cut
Funny thing is I read this about the Saudis and OPEC last night: https://np.reddit.com/r/worldnews/comments/4203ko/oil_price_...

Basically he says that the Saudis don't trust OPEC, are pro production cuts but won't cut their own production because they got burned in the past.

Avernar··on Clojure is for Type B personalities
I am also type B and prefer statically typed languages and the compiler telling me as much as possible what's wrong with my code. I really hate finiding errors at runtime that should have easily been detected by my compiler.
Avernar··on How 3D printing threatens our patent system
Except that with the current reality people are commiting patent infringement for replicating objects based on obvious and trivial patents. And unlike large corporations with their war arsenals of patents, the little guy has little hope of overturning these patents.
Avernar··on How 3D printing threatens our patent system
"They’re awarded for inventions that are nontrivial advances in the state of the art."

I stopped reading right there.

Avernar··on Taking Let's Encrypt for a Spin
> Let's Encrypt follows all redirects and ignores expired certificates

Didn't know that. It will simplify my http to https redirect configuration.

Do you know where the redirect and ignoring expiry dates is documented?

Avernar··on Why Python 3 Exists
Going to PyPy4 would be nice. But mod_wsgi doesn't support it. It has something to do with PyPy not implementing Python's embedding API I belive.

So I'll be sticking with 2.7 for now.

Avernar··on HFS+ is crazy
Except that in the windows example you gave the .rsrc section is part of the main data stream. It is counted in the file's size when doing a dir command. When the file is copied by all command line and shell tools or sent over the internet the data in the .rsrc section is copied/sent just like all the other data in the exe/dll.

None of this is true for the resource fork in the Mac case.

Avernar··on Python 3 makes it easier to develop high-quality software
> Using utf-8 as the internal unicode representation is flawed too - index and length operations are slow.

And this perfectly illustrates what I posted in another comment elsewhere. Thinking that doing operations on code points (indexing and length) is the proper thing to do. You need to use a unicode library to work on graphemes and take into account grapheme clusters.

> For regexes, \w matches any unicode word character

From what I've read, \w just matches code points. I did find that the https://pypi.python.org/pypi/regex module supports \X which matches graphemes as per the unicode spec http://www.unicode.org/reports/tr29/.

Avernar··on Python 3 makes it easier to develop high-quality software
> But seriously, all what python (and as a matter of the fact majority of languages) is placing a clear distinction between a byte and a character.

No, they make a clear distinction between bytes and code points. This is the wrong approach as code points are not characters. People are going to think that everything is fine now that they're using code points and the unicode type when they should be using a unicode library for text manipulation.

Avernar··on Python 3 makes it easier to develop high-quality software
Nice, down voted for someone not agreeing with me. I'd rather know what you though was wrong with what I wrote.

I've always wanted to know how things are done internally. Makes me a better programmer. What I said about all this extra conversion does to performance is correct, especially when scaling up.

And my choice to use UTF-8 internally is a valid way to do things. I make sure that what comes in from the outside world is UTF-8 (either by rejecting or converting) and then don't have to worry about it from that point on. The bulk of my code deals with outbound data so no need for me to do any encoding as it's already UTF-8.

Avernar··on Python 3 makes it easier to develop high-quality software
The world seems to be headed to UTF-8 for everything. That's why having Python3 force us away from it doesn't make sense to me.

As for regular expressions, they work perfectly if your delimiters are in the ASCII range. If you're trying to match a single character then they don't work for Unicode even when using Python3's unicode type. The reason is that code points are not characters.

Avernar··on Python 3 makes it easier to develop high-quality software
Not an issue because I don't use the Unicode type. All my data comes in as UTF-8 on which I do a quick validation check. Then it's just handled as bytes all the way to and from my database.
Avernar··on Python 3 makes it easier to develop high-quality software
Yes it is. Every conversion to and from the unicode type and every expansion of the unicode type from 1 to 2 to 4 bytes eats up processor time, cache/memory bandwidth and puts more pressure on the garbage collector.

And I don't want to be forced to distinguish between strings and bytes. To me they are one and the same as I use UTF-8 for everything. Not once in my code do I need to encode/decode anything.

Avernar··on Python 3 makes it easier to develop high-quality software
I've had no issues whatsoever dealing with unicode in Python2. Just wondering what you found to be a nightmare?
Avernar··on Python 3 makes it easier to develop high-quality software
> Recent versions only convert to UTF-32 when a wide character is present

It's non-BMP characters that trigger the conversion to 4 bytes per codepoint. Unfortunately Emoji are non-BMP and are super common.

Avernar··on Python 3 makes it easier to develop high-quality software
I agree. Everything is so much simpler when you use UTF-8 everywhere. Being effectively forced to use the ASCII/UCS2/UCS4 unicode type in Python3 is the only thing that has kept me from switching to it.
Avernar··on Friends don't let Friends install Used RAM
I hade a similar problem with one of my servers. The SSDs would stop responding at odd times. Strange lockups and other hardware wierdness. When I tried putting FreeBSD on it it would kernel panic at odd times during the instalation.

Turns out the CPU aux power connector was not hooked up. I must have knocked it loose while working on the innards a while back. The machine has been rock solid ever since I reconnected it.

Avernar··on Getting rid of free office snacks doesn't come cheap
"A programmer is an organism that converts caffeine into code."
Avernar··on Trying out Let's Encrypt (beta)
> Keep in mind you have to repeat this process every 6 months

Renewal and revalidation are not the same process. Unfortunately they're thinking about making the revalidation period 90 days as well. That would suck as I have several sites where the content is generated by a script which would have to be disabled to serve a file.

Avernar··on Trying out Let's Encrypt (beta)
Would you happen to know if these business people run their own web server or use a hosting service?
Avernar··on Unicode: Good, Bad, and Ugly (2011)
Most code works perfectly fine indexing bytes in a UTF-8 string. Anything that looks for stuff in the ASCII range such as parsers would not need to be changed.

Python 3 already required all code to be looked over because of the string literal change so it wouldn't be much different.

Avernar··on Unicode: Good, Bad, and Ugly (2011)
For what reason other than perhaps font rendering code do you need to index code points in a string? Everything you think you need code points for (character counting, truncation, etc) you actually need grapheme clusters.

I wish Python went with UTF-8 instead of their multi width internal representation.

Avernar··on McDonalds to Rebrand Itself as a “Progressive Burger Company”
Wendy's already tried this. I no longer eat at Wendy's.
← PreviousPage 8 of 9Next →