Hacker Newsnew | past | comments | ask | show | jobs | submit | thezorg's commentslogin

Poor [Cloud Tasks](https://cloud.google.com/tasks), they're the actual GCP message queue, but everyone forgets they exist and use Pub/Sub instead.

What's funny is Pub/Sub is a fundamentally different model from message queues: queues are normally tightly coupled, meaning you enqueue a message to be processed by a specific system. Pub/Sub on the other hand is fundamentally loosely coupled: the publisher doesn't care who (if anyone) gets the message.

(I've heard "orchestration" vs "choreography" to describe this dichotomy, but I can't say I'm a fan of the jargon.)


Pub/Sub is truly the stuff of nightmares compared to Tasks. I wish Tasks were a little more loved, because I keep ending up using Pub/Sub inevitably.


Pub/Sub is meant to follow the Kafka "insane amounts of data" firehose pattern. Everyone thinks they need that scale unfortunately and skips over Cloud Tasks.


The Kafka pattern isn't about the size of your data, it's about accommodating heterogeneous consumers and easy fan-out. I don't love the ampq exchange model because it adds state to the middle of the queue.


Wasn’t this on AppEngine in the early days? Yeah, if this is the same thing it’s probably the first queue I learnt / used. Will add it in.


(as someone who has pitched orchestration vs choreography) why don’t you like the jargon?


I recently learned about the `])` motion (and similarly, `]}`), and it's probably my absolute favorite.

I used to rely on e.g. `df)` to delete function parameters. The problem is that 1. it doesn't work when the function call spans multiple lines, and 2. it doesn't work if there's a nested function call.

With `d])`, Vim will delete until the next unmatched ')', regardless of which line it's on! And to think this motion is buried under "Various motions": https://vimhelp.org/motion.txt.html#%5D%29.

Edit: an example:

  // This will become my_func(foo);
  my_func(foo, MakeBar(), MakeBaz());
             ^


About 20 years ago I had two computers at work: a Windows PC and a Sun workstation. I used Vim on both. I knew about the vi ]] command, and I'd learned some Vim script. I thought it would be great to have a key binding to take me to the innermost surrounding curly braces, so I wrote a vim script to do this. I picked ]} and [{ as the key bindings.

One day I used the key binding and then realized a few minutes that I hadn't installed the script on that computer yet. After some searching in :help I realized that I'd not only reimplemented a feature that already exists in vim, but I mapped it to the exact same keys.


In most cases `di)` is what I want, deleting everything inside the current parens, forward and back. I can see use-cases for "forward only", though.


I’ve learned to favor using c instead of d if I want to edit after deleting… it keeps things in one logical command from vim’s perspective, so that I can repeat it a second time on another line by just using `.`. Using d and then i, vim treats as two commands and thus `.` only repeats the insertion.


That's a great one, I should read the docs more often...

Two very useful ones I just saw on there, for undoing movement mistakes:

`` to jump back to where you jumped from

`< to go to the starting character of the last selected visual mode region


I recently saw a recommendation for Practical Vim by Drew Neil (https://pragprog.com/titles/dnvim2/practical-vim-second-edit...) in an other vim thread and decided to pick it up. It's been really enlightening and provides more than just reading documentation. It also goes in depth to how the author thinks about vim motions and how to effectively accomplish your goals with them.


I'll second this. Is an excellent book. After each chapter I recommend to take your own distilled notes. After reading the book you will get a very solid base command knowledge in Vim. What I really liked about it is that you can read it without being distracted: go immediately to the computer to test things out, this is because he painstakingly took the effort to show in pages what actually happens after each time you press a keystroke. I truly appreciated this, because you can read the book anywhere and focus on Vim mechanics without the need to try everything out on the fly.


You can go even a step further using the <c-o> and <c-i>.

These will allow you to go back and forward in your jumplist.

I mapped them to <Tab> and <S-Tab>, this way I can easily move to previous locations.

This is BY FAR my most used shortcut.


gv to reselect the last selected visual mode region is also often handy in my experience.


Now I'm mad at you for not telling me years ago. I've been missing this functionality since forever.


‘. to take you back to where you last made a change


In These cases I'd recommend text objects. For example,

  ci)
Will delete everything inside parentheses and put you in insert mode.

Even works for HTML tags with t I think.

Edit: should be ci) to preserve the parentheses.


Text objects are cool, but `ca)` would remove the parenthesis too. There's no shorter way to get to `my_func(foo);` when your cursor is at the comma, than using the motion OP indicated.


I didn't know `])` but `%` to jump between matching brackets seems just as good?


Wow this is awesome, thanks for sharing. I used to use visual mode for this edit in particular but this feels much more intuitive and faster


Speaking of B-trees, I find CouchDB's implementation really interesting: the backing file is append-only, meaning that modifying the tree implies appending the modified nodes at the end of the file (for example, if I change a leaf, than I rewrite it at the end of the file, and rewrite its parent so that it points to the leaf's new position, and so on until we reach the root node).

Sounds like a waste of space, but it solves a bunch of problems, like being crash-proof (since we never overwrite anything, it's always possible to just find the last root) and allowing reads concurrent with a write without any synchronizing necessary. Plus, it's actually optimized for SSD's due to its log-like structure!

CouchDB B-Trees : http://guide.couchdb.org/draft/btree.html Log structures in SSDs : http://lwn.net/Articles/353411/


Massive waste of space though. LMDB is also copy-on-write and crash-proof but doesn't require compaction like CouchDB does.

http://symas.com/mdb/

Read the LDAPCon 2011 paper (and slides) to see how it works and why it's better than CouchDB.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: