Better HN
topnewbestaskshowjobs
Log inSign up

oftenwrong

15,025 karma · joined Apr 22, 2012 (14y ago) · 2,479 submissions

sfir6i2z@mailer.me
Submissions

comment 9y ago · link · parent

(pedantic note: When you run shell commands in vim, they are running in an actual shell.)

vim can be thought of as a visual and interactive helper for your text-processing utilities. The "intended scope" of vim is text editing, and while you're editing you may want to run commands on the text in your buffer, or just parts of it, and have the results apply immediately without writing and reloading the file, or exiting.

For example, in vim, you may be writing a list somewhere in your document, and you realize you want it sorted alphabetically. You can visually select the range of lines ('<,'>) that comprise the list and then sort them by calling the sort utility [1]:

    :'<,'>!sort
And then you can continue adding to the list.

What would your workflow be for the above? Some like this...?

1. write the file you are working on in your EDITOR

2. make a mental note of the absolute line numbers for the list in the document

3. open new terminal

4. call an awk command that uses `sort`, or some other script, passing in your line numbers, and the file name

5. switch back to EDITOR and reload file

----

[1] Of course vim has its own `sort` command, so you can leave out the '!' in that example to do the same.

vi did not have its own `sort`, so people used the external `sort`. vi also didn't have the visual selection, so people could pick lines using ranges:

    :.,+10!sort
i.e. sort from the current line to the line 10 lines down, inclusive

1952.

Demolition of Tianjin’s old city(bricoleurbanism.org ↗)

2 points · by oftenwrong · 9y ago · discuss

1953.

Bikeshare company Bluegogo may launch in San Francisco without permits(sfexaminer.com ↗)

1 points · by oftenwrong · 9y ago · discuss

comment 9y ago · link · parent

sea to summit ultra-sil day pack

68g, 20L, silnylon

http://www.seatosummit.com/product/?item=Ultra-Sil%26reg%3B+...

Possibly my favourite of my many backpacks. It scrunches up to the size of a clementine, making it an ideal secondary bag to keep in one's main bag when travelling. It can be worn under a jacket to inconspicuously carry a laptop in areas with pickpockets.

comment 9y ago · link · parent

"I have my own army in the NYPD, which is the seventh largest army in the world..."

- Former NYC Mayor Michael Bloomberg

comment 9y ago · link · parent

The comment section has some interesting discussion and counterpoints.

1957.

Why Washington DC's Metro should not have bought the 7000 series railcars(ggwash.org ↗)

3 points · by oftenwrong · 9y ago · 1 comment

comment 9y ago · link · parent

Developers at the small companies that I have worked at have had at least some input into business needs.

Developers are often aware of solutions that do not occur to the business people. A business person might think we are being as efficient as we can be in process P, but then a developer may come along and say we can automate parts of process P by implementing solution S, for example.

A lot of the time this sort of thing does not happen in the scheduled, structured meetings, or in email chains, or in video conferences. It happens when people in the office approach each other "out of the blue" and decide to grab a conference room and work something through face-to-face.

comment 9y ago · link · parent

This is more of a split between Latin America and Spain (and the various other places that borrow language from them)

Latin America -> computadora

Spain -> ordenador

comment 9y ago · link · parent

I use vi macros for that

comment 9y ago · link · parent

uuoc!

comment 9y ago · link · parent

innocent bystanders

comment 9y ago · link · parent

It should be considered that LEDs are now being used for lighting in situations where there used to be no lighting at all [1]. The potential energy savings we could realise with LEDs may be negated by an increase in lighting itself. This would be an example of Jevons' paradox [2].

[1] http://www.lowtechmagazine.com/2008/10/led-light-cfl-b.html

[2] https://en.wikipedia.org/wiki/Jevons's_paradox

comment 10y ago · link · parent

You may create a A/GPL fork of the project if you wish.

comment 10y ago · link · parent

Better headline:

"Arduboy, the game system the size of a credit card"

comment 10y ago · link · parent

Good Eats and Fast Food My Way were my introduction to cooking. I think the latter was more influential for me because it helped me to stop measuring and cook by feel.

comment 10y ago · link · parent

For the hard hardcore, the Precision 17 7000 is available with 64GB ECC. I can't risk a cosmic ray corrupting my extreme web browsing sessions.

comment 10y ago · link · parent

In San Francisco there is a lot of progress that can be made without building up. For example, building more Accessory Dwelling Units [1] and subdividing oversized streets [2].

[1] http://sf-planning.org/ACCESSORY-DWELLING-UNITS

[2] http://narrowstreetssf.com/mcallister/

comment 10y ago · link · parent

I submitted the same url earlier, but it seems the duplicate dectection didn't prevent this story from being created. Maybe because the headline was different? Not complaining; just contrary to my expectations. What is the logic behind HN's dupe-detection?

comment 10y ago · link · parent

It can decouple you from the specific database implementation. The ORM can generate SQL that targets the database you are using by altering the generated queries to account for dialect and feature differences. For example, it can, potentially, make it possible to switch your application from using MySQL to PostgreSQL rather seamlessly. However, in my experience, this is rarely straightforward, and rarely done. It's not unusual for the application layer to become dependent on some quirk or unique feature of the underlying database, and sometimes that dependency is not obvious. The sibling reply is not far off the mark when it comes to using ORMs "in practice".

comment 10y ago · link · parent

https://urbanedge.blogs.rice.edu/2015/09/08/forget-what-youv...

1972.

Abuse Protocols to Load Files, Bypass the HTML5 Sandbox, Open Popups and More(brokenbrowser.com ↗)

5 points · by oftenwrong · 10y ago · discuss

comment 10y ago · link · parent

For me, digital is absolutely necessary for any technical or academic book. I have to be able to search in it. However, I am not a fan of PDF because it is very inflexible in its presentation, and it is hard to transform into other formats. I prefer a web document or even just plain text.

comment 10y ago · link · parent

Well, I didn't downvote, but I will say this about #1: The trouble with always storing datetimes in UTC is that the UTC offset observed in a given location is not predictable for future dates.

--

Concrete example:

I am in Massachusetts. Currently, Massachusetts observes two UTC offsets during the year. Eastern Daylight Time (EDT), which is UTC-4, and Eastern Standard Time (EST), which is UTC-5. EDT is our time zone for Daylight Savings Time (DST).

Currently, there is some discussion about how much this arrangement sucks due to the early sunsets we experience being on the edge of the time zone. Some (including myself) are pushing for Massachusetts to switch to Atlantic Standard Time (AST), which would keep us at UTC-4 all year.

So, let's say I want to schedule a meeting for November 18th, 2019 at 12pm in Cambridge, Massachusetts. I want a reminder 15 minutes before the meeting so that I do not miss it. I put that into your scheduling system, and you store it as the UTC datetime 2019-11-18T17:00:00Z because Massachusetts' current time zone observance rules say it will be in UTC-5 on November 18th, 2019.

Now, let's say I get my wish, and Massachusetts switches to AST year-round some time between now and my scheduled meeting. When 2019-11-18 comes around, Massachusetts will not be in UTC-5, as predicted, but in UTC-4! I will receive my meeting reminder at 12:45pm local time, a full hour after I wanted to receive it, and I will have missed my meeting.

--

There are different ways around this, such as storing the datetime with the predicted UTC offset, or storing a localtime (time-zone-less datetime) and the location of the event. The key point is that you need to be able to account for calendar changes.

Of course, there is no fool-proof way to store a future date. For all we know, 12pm November 18th, 2019 may not ever occur in Massachusetts because some decision may cause the commonwealth to switch forward past that time entirely. A calendar change could cause even more bizarre situations. In the British Empire, the day after September 2nd, 1752 was September 14th, 1752 due to the adoption of the Gregorian Calendar. Realistically, you are not going to be able to account for that sort of calendar change, but time zone observances change all the time.

comment 10y ago · link · parent

I'd be satisfied with 5-10 usb type-c ports on each side of a mbp

comment 10y ago · link · parent

Instead of building regulations around internet services to discourage bad driving, why not just enforce laws on bad driving directly? If a driver is not paying attention while driving, punish them.

comment 10y ago · link · parent

This meets my personal experience with Nigerians: they are extremely friendly people. I might say they are "oddly friendly" in a good way. To me, it is unusual to be that friendly with strangers, but I'm not surprised that such openness to others yields a rich social life.

comment 10y ago · link · parent

I am a long-time user of gnu parallel, but I feel it has a bit of "featuritis". Just look at all of those options in the man page!

comment 10y ago · link · parent

I wrote a small extension for personal use that can set various <video> preferences on a site-by-site basis. One of the main things I wanted to be able to do is disabled autoplay. However, I found that a lot of sites just start the video from js instead of setting the 'autoplay' attribute. I was able to put in some stronger defense by using MutationObserver to stop a video that was played without the user clicking play, but then I found that some sites have code that will force a video to be playing, so even a manual pause would be overridden, and the site's js would contend with my extension's js.

There's no way to stop autoplay if we allow free, programmatic access to videos (without blocking js too, which I use noscript for).

I had the same problem with the 'loop' attribute. I wanted videos to not loop. I found that some sites loop videos without using the 'loop' attribute. I would disable 'loop' on the <video>, but the <video> would be replaced by a new autoplaying <video> when the original video ended.

This is about the point that I gave up on my extension.

comment 10y ago · link · parent

Yes. I love programming, but I really dislike how inactive I must be to work as a programmer. I don't like sitting/standing all day, and being chained to the computer. Short activity breaks, and workouts in the morning and evening don't cut it.

When I'm outdoors and active, I am so much happier. If I am on a multi-day outdoor trip to hike or rock climb, I feel like a completely different person. This is especially true on long trips that last more than a week. I have much less stress. I smile compulsively, instead of baring my usual strained expression. I have more energy. You might think at first that is simply because I am on vacation and I don't have to think about work obligations, but when I am on a normal (non-outdoor) type of vacation, I don't get the same feeling at all. I think it has more to do with the outdoor environment and physical activity.

I recently met someone who works as a park ranger, and I became envious of her job. I would love to patrol the woods all day as a ranger, or to be a mail carrier walking from house to house. I make much more money as a programmer, but "money cannot buy happiness", and I wonder often if I should change course.

1
656667
83