Show HN: Array with Constant Time Access and Fast Insertion and Deletion - <AUTHOR> https://github.com/igushev/IgushArray <comment><USER2> For those reading along, the post describes a vector-like datastructure that has O(1) access time and O(sqrt(N)) insert and deletion time _at an arbitrary index_. The idea is pretty clever. The datastructure maintains sqrt(N) circular arrays each of size sqrt(N). For reference indexing into a circular array has O(1) access time and O(1) insert and deletion time at the ends.

For accesses, you can in constant time determine which circular array contains the element at the given index (it's simply _i % sqrt(N)_ ) and then in constant time access the element from the underlying array. For inserts and deletions, you find the circular array that contains the location you want to insert into. First you make sure there is space in the array to insert. You do this by moving one element from each circular array to the next one. Since deleting and inserting from the end of a circular array takes O(1) and there are O(sqrt(N)) arrays, this takes a total of O(sqrt(N)) time. Then you insert the new element into the middle of the designated circular array which is of size sqrt(N) so it takes in the worst case O(sqrt(N)). This means insertions take a total of O(sqrt(N)) time.

As immawizard pointed out, there is a generalized version of this idea called tiered vectors[0] that supports an arbitrary level of nesting. A 1-tiered vector is a circular array. A k-tiered vector is an array of n^(1/k) tiered vectors of tier (k-1). You can show that for a k-tiered vector, access time is O(k), while insertion and deletion have a runtime of O(n^(1/k)). The datastructure mentioned in the post can be considered a 2-tiered vector.

The post includes benchmarks comparing the datastructure to std::vector. I would be interested in seeing benchmarks vs a binary search tree. Even though the datastructure has O(sqrt(N)) performance, that's still a lot slower than O(log(N)). The square root of a million is 1000, while the log base 2 of a million is only ~20.

One nitpick is that the author names the datastructure after themselves. Naming things after yourself is typically a faux pas.

[0] [https://www.ics.uci.edu/~goodrich/pubs/wads99.pdf](https://www.ics.uci.edu/~goodrich/pubs/wads99.pdf)

<comment><AUTHOR> Thanks for feedback! Any naming suggestions? :-)

<comment><USER3> This is fun, let's have a naming party!

Here's my nomination:

Loop List

<comment><USER4> This seems like the winner. Although I would tweak it to looped list

<comment><USER5> That just sounds like a circular linked list. They were probably going for "list of loops", so I think the ambiguity here makes it a bad choice.

</comment></comment></comment></comment></comment><comment><USER6> I believe this data structure is called Tiered vectors, and is described in: [https://www.ics.uci.edu/~goodrich/pubs/wads99.pdf](https://www.ics.uci.edu/~goodrich/pubs/wads99.pdf)

<comment><AUTHOR> I need to read the paper, but on high-level looks indeed similar.

</comment></comment><comment><USER7> I don't want to detract from the cleverness here, but I believe your benchmarks could use some work. Here are a few suggestions:

1\. Simply testing something 1000 times and (presumably) presenting the arithmetic mean is not very informative. Looking at the detailed reported benchmark times (in the output file in tests), it looks like many of the timing outcomes have high variance. Rather than running the tests 1000 times and taking the mean, you might consider running 10 batches of 100 tests (or 1000, if you can) and presenting the mean and variance of the resulting distribution. In general, k sample groups each of size p will provide more reliable information about the underlying distribution than one sample group of size k*p (for reasonable k and p, obviously).

2\. Related to that, the results of the "inserting a number of elements" and "deleting a number of elements" tests are significantly worse for the tiered vector vs the std::vector than the "insert/delete a single element" tests. You don't mention this in the readme, but thinking about why it is might be informative. Thrashing seems like a possible explanation, and one you might be able to mitigate.

3\. Are you making sure your cache is warm before starting to measure performance? (Pardon, I didn't look through every line of your tests.) Particularly for std::vector, and likely your intermediate deques too, this will have a big effect on timing.

4\. Finally, it looks like you're primarily testing using ints (?). It would probably be a good idea to see if your results hold for a different payload size.

I don't know whether these will improve or worsen your comparison against std::vector, but they will make your claims more robust.

<comment><USER8> He's going to have cache issues since he requires one extra memory lookup.

His lookup should be roughly twice as expensive as a regular array when cache is cold - it will be dominated by the cache misses two vs one.

With a hot cache, the array lookup becomes a single load op of a few cycles, and even if he gets two cache hits, his will probably be about 6-10 ops with 2 loads, a div, and a few more ops to get the index of the sub bucket.

On one cache hit and a possible miss on the other (eg his top level index is in cache, but the bucket might not be), he's going to be getting high variance in his lookup timings. OP: to help the iterator access (sum), you might be able to prefetch (eg force a read) of the folling bucket before you need it. when you move over the bucket 2, cause a fetch of bucket 3 and the same time. You might be able to hide some of that cache miss latency then.

Also, with the DEQs you are potentially starting at the middle of a slab and having to roll around its front. That isn't going to prefetch well, so you might want to fetch the next next slab's base address and the address it logically starts at since those cane be different. Just try to hide as much cache miss latency as you can because that is where you are probably getting killed on in the iterator access.

</comment></comment><comment><USER9> There's some interesting pointers for how to improve your data structure here: [https://stackoverflow.com/questions/10478260/looking-for- a-d...](https://stackoverflow.com/questions/10478260/looking-for-a-data- container-with-o1-indexing-and-ologn-insertion-and-dele/10519240#10519240)

There's also some benchmarks for another implementation of the same idea linked to in the README here: [https://github.com/mettienne/tiered- vector/blob/master/READM...](https://github.com/mettienne/tiered- vector/blob/master/README.md). That implementation also just punted on growing the maximum capacity of the area.

</comment><comment><USER10> Correct me if I am wrong, but I think the insertion/deletion time complexity is incorrect. It should be O(N). If each DEQ is implemented using array instead of list, wouldn't the insert/delete operation of IgushArray still take linear time? Since popping or pushing (pick one) of DEQ implementation with array still take linear time, that means, let's say insertion is at position N/2, then N/2 ... N-1 elements still need to be moved to the right by one? Popping/pushing is only linear if the DEQ is implemented with linked list, but that would mean linear access time instead of constant.

Update: answer is to implement DEQ with circular buffer for O(1) pop/push.

<comment><AUTHOR> Insertion and deletion from DEQ indeed is linear, but in all of DEQs in the structure only one (!) needs insertion, the rest are just popping/pushing front/back.

<comment><USER11> > the rest are just popping/pushing front/back.

Sure, but this step would require a right shift for (in the worst case) every element in the structure. Suppose you have the following DEQ:

        [R0] -> [0, 1, 2]
        [R1] -> [3, 4, 5]
        [R2] -> [6, 7, 8]

And you want to remove 4. From my understanding of your README, the structure will look like this after the operation:

        [R0] -> [0, 1, 2]
        [R1] -> [3, 5, 6]
        [R2] -> [7, 8, _]

This was _not_ and O(sqrt(n)) operation, because you had to move elements 5, 6, 7, and 8 ( _not_ just 5 as suggested by your figures). So in general you still need to move O(n) elements upon any insertion or deletion.

EDIT: Just read some of the other comments and realized that this can be done with a circular buffer with a bit more memory than the subarrays themselves. Makes sense + clever! @OP, I really think you should clarify on this important implementation detail in your writeup.

<comment><USER12> 5 and 6 do need to move. 7 and 8 can stay where they are. In R2 you'd change the variable that stores where the front of the DEQ is to point to 7, but 7 and 8 themselves stay put.

</comment></comment></comment></comment><comment><AUTHOR> Interesting that some people found an article about tiered vectors, I didn't find it back then. I implemented this structure many many years ago and also published in Bauman Moscow State Technical University magazine back in 2012: [http://engjournal.ru/articles/101/101.pdf](http://engjournal.ru/articles/101/101.pdf) (in Russian)

<comment><USER9> Tiered vectors have been around for a while. The paper for them came out in 1998. They've just always been rather underappreciated. I only found out about them through this thread too.

I don't think any of us mean to imply that you copied off another implementation; independent discovery happens all the time! It's great you've made this a usable C++ library and have contributed your own thoughts on the structure!

It looks like you're having difficulty with some of the resizing. The two array approach described here [https://stackoverflow.com/questions/10478260/looking-for- a-d...](https://stackoverflow.com/questions/10478260/looking-for-a-data- container-with-o1-indexing-and-ologn-insertion-and-dele/10519240#10519240) makes resizing a lot easier. You just double the size of the main array and increase the size of the offset array by the square root of two, without needing to fiddle around with anything else. You also get unchanged amortized time bounds.

<comment><AUTHOR> I also found out about tiered vectors only in this thread. At the time of implementation I tried to Google for something like this but didn't find.

</comment></comment></comment><comment><USER13> This is very similar to what std::deque does under the covers already. It's a chunked array. The main difference AFAICT from std::deque is that this offers n^1/2 insertion and deletion within the body of the array. This guarantee is provided by allowing for the possibility of significant overallocation in the chunks themselves, if many modifications happen in the middle of the array. On the other hand, std::deque does not overallocate by as much -- just a chunk at the beginning and a chunk at the end. But as a consequence it has to move trailing elements when an element is inserted or deleted in the middle.

Interesting!

<comment><AUTHOR> DEQs also allocate internal arrays with hardcoded size only (8 in std, if I remember correctly)

<comment><USER13> At least in libc++ it's the greater of 4kB or 16 * sizeof(value_type). That's the default, it is configurable. 8 would be a pretty unfortunate design choice.

</comment></comment></comment><comment><USER14> I'd like to see the performance of growing the list (a common scenario):

        ArrayList list = new ArrayList();
        for (int i = 0; i < N; i++) {
          list.add(i);
        }

(Forgive me, Java is my mother tongue).

<comment><USER12> I believe this case is very badly handled in this data structure implementation. It seems to be saying that you want to occasionally manually recreate the DS as it grows bigger, as the deqs won't automatically resize. So you'll just have linear behavior in that case, with extra constants because the deqs are useless logic.

I suspect an amortized data structure could automatically and internally do this rebalancing operation, but I'd have to work out the scheme and the analysis. At a guess, something like normal dynamic arrays do, where you multiply the max size by a constant when it fills up, would give you decent amortized bounds.

<comment><AUTHOR> Correct. I need to add automatic restructuring. Currently structure sensitive and benefits a lot from using reserve() method

</comment></comment></comment><comment><USER15> This is cool. I wanted to comment on the necessity of knowing the approximate size of N a priori, but this is very clearly stated on the github page.

Interesting alternatives that also support insertion, deletion, and lookup (is there a name for this interface?) are AVL trees and hash tables.

As described in [https://arxiv.org/pdf/1711.00275.pdf](https://arxiv.org/pdf/1711.00275.pdf), tiered vectors can be improved further:

"We present a highly optimized implementation of tiered vectors, a data structure for maintaining a sequence of n elements supporting access in time O(1) and insertion and deletion in time O(n^ε) for ε > 0 while using o(n) extra space."

<comment><AUTHOR> It seems I need to add automatic restructuring to the structure, so it would maintain perfect lengths of DEQs

</comment></comment><comment><USER16> I wonder how this would compare to Judy arrays. Would anyone like to benchmark this?

[https://en.wikipedia.org/wiki/Judy_array](https://en.wikipedia.org/wiki/Judy_array) [http://judy.sourceforge.net](http://judy.sourceforge.net)

To install the Judy C lib:

      brew install judy
      apt-get install libjudy-dev

Then compile with -lJudy and #include <Judy.h>

Example: [http://judy.sourceforge.net/doc/JudyL_3x.htm](http://judy.sourceforge.net/doc/JudyL_3x.htm)

<comment><USER17> Interesting. I wonder how similar a Judy array is to an rrb-tree (relaxed radix binary tree), or if they're the same thing.

An rrb-tree is an effective O(1) time for every category. Scala's Vector type implements one.

If interested about the data structure: [https://youtu.be/sPhpelUfu8Q](https://youtu.be/sPhpelUfu8Q)

Scala bigO doc: [https://docs.scala- lang.org/overviews/collections-2.13/perfo...](https://docs.scala- lang.org/overviews/collections-2.13/performance-characteristics.html) Scala's doc on it: [https://github.com/nicolasstucki/scala-rrb- vector/blob/maste...](https://github.com/nicolasstucki/scala-rrb- vector/blob/master/documents/RRB%20Vector%20-%20A%20Practical%20General%20Purpose%20Immutable%20Sequence.pdf)

</comment></comment><comment><USER8> Why would you chose this over a Van Emde Boas tree where indexing, insert, delete are O(log log) and prev/next are constant?

[https://en.wikipedia.org/wiki/Van_Emde_Boas_tree](https://en.wikipedia.org/wiki/Van_Emde_Boas_tree)

(it basically trades a little more work on indexing for a little loser structure)

I like the use of the DE queue, but having to keep all the sub vectors packed to ensure constant time lookup might not be completely needed if you are willing to keep a little more information around or have two candidate buckets. Not sure if would be a win or not though, since they your probably just better using a VeB tree.

e.g., I don't think you always need to compress everything back to the front if you can make sure all the buckets are within 1 or each other, but you can hit cases where you have to look in two buckets which isn't that difficult since you how the high and low of each bucket at the head and tail of each DEQ.

But then you would need to keep some local coloring info keep the buckets perfectly balanced, as everything should be.

</comment><comment><USER18> Doesn't really seem much better than just a balanced size-tagged binary tree. You get O(log n) access, insertion, and deletion. Yes access is slower but insertion and deletion is much faster. Remember that for even one billion the logarithm is merely 30. That's hardly anything. Whereas the square root is more than 30 thousand.

<comment><AUTHOR> That sounds like trees are silver bullets but they're not and that's why we have variety of basic data structures.

<comment><USER18> I'm not saying they are a silver bullet but personally from experience I think they are a good choice in the majority of scenarios that programmers encounter. Of course our experiences could differ.

</comment></comment></comment><comment><USER19> Is there a reason you didn't just use std::deque? You're already in C++.

<comment><USER12> std::deque has O(n) insertion/deletion in the middle. Or do you mean replacing the internal deques with std::deque?

<comment><USER20> > std::deque has O(n) insertion/deletion in the middle

I'm curious to know from approximately which n this is a problem though. It can be easy to make something with a better O complexity that is actually slower for what computers can actually handle.

edit: nevermind, I thought deque was more "smart" than it is but it needs to move all _elements_ when inserting / deleting in the middle, so it won't have a great constant factor.

<comment><USER17> I believe a std::deque is an rb-tree (radix binary tree), which suffers from insertions in the middle.

An rrb-tree solves this problem by being relaxed, which means allowing for having random empty places in the cache line sized arrays within the structure. This way insertion is effectively O(1).

Modern languages implement these, like Scala, but C++ has been around for a while, so it's the stl is not the fastest in a few ways. std::deque is one of them. Another example, std::sort isn't the fastest, I believe.

<comment><USER12> I think the typical implementation of a std::deque is actually something like a vector of pointers to vector of pointers to T. (except they can't be std::vector exactly, because then you'd only get amortized bounds on pushes).

</comment></comment></comment></comment></comment><comment><USER21> It says in bold type at the beginning "The IgushArray class fully implements std::vector interface" but it's clear it cannot provide an equivalent of std::vector::data.

<comment><AUTHOR> There is a disclaimer about that: [https://github.com/igushev/IgushArray#limitations](https://github.com/igushev/IgushArray#limitations)

</comment></comment><comment><USER22> Side-question: is there any way to explicitly tell github whether a file is C or C++? I have this same issue, where C code is marked as C++ and vice-versa. Not a huge issue, but a bit annoying. It seems a bit weird that linguist (github's tool for doing language recognition) marks a file with namespaces in it as C, which is obviously not supported.

</comment><comment><USER23> All of those operations are achievable when replacing sqrt with log by using Skip lists ([https://en.wikipedia.org/wiki/Skip_list](https://en.wikipedia.org/wiki/Skip_list)), and probably with Zip trees as well ([https://arxiv.org/abs/1806.06726](https://arxiv.org/abs/1806.06726)).

That being said, the overload of a complex data structure might multiply the running time by a factor up to ~10 (mostly because of cache misses), so simpler structures will be more performant for short inputs.

There is a more general pattern in most tree data structures where you can transform the log(n) recursive operations on the tree into sqrt(n) operations on a simpler structure with 2 levels.

I happen to have described the solution to a problem where you must use a sqrt-decomposition datastructure to have updates in O(1) and queries in O(sqrt(n)) because O(log(n)) everywhere is not good enough as there are a lot of updates to do ([https://tryalgo.org/en/2017/09/01/path- statistics/](https://tryalgo.org/en/2017/09/01/path-statistics/)).

</comment><comment><USER24> The performance numbers would be most interesting if he benchmarked against std::vector, std::list, std::multiset and std::deque just to see how it compares to all the major collections. Using different items, say std::string, int64_t and a big POD struct might fill in a few things too.

</comment><comment><USER25> If deq had to be fixed length beforehand with length k but with many insertions k can be much smaller than n^0.5 I think you might end up with a much worse worst case for insertion? Something in the order of O(n) than O(n^0.5)

Or there has to be a readjustment of k.

Cab somebody point out my thinking error?

<comment><AUTHOR> Yes, the structure is sensitive for that and benefits a lot from using reserve(). I need to add automatic restructuring to maintain perfect k.

</comment></comment><comment><USER26> The Push Front time could be improved to O(1)* by making it circular. Assuming "*" means amortized. But as-is it does provide a better comparison to an array. A circular IgushArray would be better compared to a circular array (which an std::vector isn't).

<comment><AUTHOR> That's a good point. That would make computation of indexes much more complicated though

</comment></comment><comment><USER27> You could do this with O(N^1/K) for arbitrary K, using K layers of indirection, no?

This is similar to how you can do O(logN) for insertion / deletion & access using an indexed B-tree, except you're using a fixed height instead of a fixed branching factor.

<comment><USER28> True. If you go k levels deep you get indexing complexity of O(k) (because you do a constant time operation for each level) and insertion/removal complexity of O(k + n^(1/k)) (because that's indexing plus a linear insert/remove operation for the array at the bottom). If you push k towards log n you get O(log n) for both. (I'm ignoring rebalancing issues here but these can be dealt with too) The article did mention that you can push k to values larger than 2 in the Generalization section. I think it would've been nice if they had explored such values when doing the performance tests, but either way I found it clear and nicely written.

<comment><USER29> for insert/remove you also need to move the last element up for each deque with higher indices, and If I understand it correctly, there should be O(N^(2/3)) (i.e. N^1/3 * N^1/3) such deques.

</comment></comment></comment><comment><USER30> cool! looks like from that, you could maybe

1\. extend the construction to three dimensions, so that the insertion cost is a cubic root?

2\. iterate the extension to an increasing number of dimensions, so that the cost becomes logarithmic?

<comment><AUTHOR> I mentioned that extension in the published paper, but complexity of access becomes O(d) where d is number of dimensions.

</comment></comment><comment><USER31> The benchmarks compare this to standard arrays, but I'd be curious to see how tiered vectors stack up against persistent vectors (either Clojure's or Python's [pyrsistent's])

</comment><comment><USER32> As someone who doesn't know much about this level of CS, can someone explain to me why inserting/deleting an element in a linear array is expensive?

<comment><USER33> Are you a software developer? No judging, just curious

<comment><USER32> Turns out it was a misunderstanding on my part. I interpreted the word "insert" as "replace" and I was wondering why replacing an element in a linear array would be an expensive operation. And no, I am not a software developer, I'm a chemical engineering student. Though I've done a bit of work on Nintendo 3DS hacking by writing tools for various exploits, and also bit of STM32 tinkering ([https://github.com/jason0597](https://github.com/jason0597))

</comment></comment></comment><comment><USER34> Your idea appears to build upon the concepts in the [https://en.wikipedia.org/wiki/Hashed_array_tree](https://en.wikipedia.org/wiki/Hashed_array_tree) .

Alternatively, here's my list ADT implementation which has O(log n) access/insertion/deletion time: [https://www.nayuki.io/page/avl-tree- list](https://www.nayuki.io/page/avl-tree-list) .

</comment><comment><USER35> sqrt(N) can be described as "fast" only with significant amounts of spin added. Use ropes instead. [https://en.wikipedia.org/wiki/Rope_(data_structure)](https://en.wikipedia.org/wiki/Rope_\(data_structure\))

</comment><comment><USER36> I had some hard time parsing O(N^1/2)... ;)

( O(N^(1/2)), O(N^0.5), O(sqrt(N)), O(N¹ᐟ²), O(√N̅) would have been better... )

</comment><comment><USER37> Reminds me of a skip list.

</comment><comment><USER38> Nothing beats !a[$0]++

</comment><comment><USER39> My somewhat naïve question is: if indeed this is an objectively superior data structure as claimed, why hasn't anyone else thought of it before in the history of computer science? Extraordinary claims of devising a radically better implementation of a fundamental data structure require extraordinary evidence that A. the idea is indeed novel and B. it doesn't come with hidden tradeoffs that are only advertised in the fine print. The work seems impressive, and maybe it is somehow a completely new genius idea no-one has thought of, but whatever the case it needs to much more heavily reference existing literature to credibly make the barely-without-qualifiers claims contained in the README. (And to be clear: I actually hope that such references bear out the claims, because if so - awesome! But in the meantime: "trust but verify")

Edit: curious about the downvotes - care to explain? I feel like this is a legitimate and fairly uncontroversial take, but happy to hear differing perspectives...

<comment><USER13> The downvotes are probably because your question could be asked of any new thing. "If this is so great, why didn't someone do it before? Therefore it is probably not so great." I mean you could literally paste that same comment with almost no modification as a response to almost anything new thing posted on this site. That's a good signal that the comment is not helpful.

Also, I don't think the author claimed it's "objectively superior." It has objectively superior asymptotic performance in certain relatively niche workloads. However, its constant time factor is iffy due to all the pointer following and calculations you have to do for random accesses. And the benchmark results in the README show this clearly -- both the strengths and the weaknesses.

Actually, your whole train of thought around the claims in the README is puzzling to me. You seem to think they're grandiose and over the top, but the README seems mostly explanatory to me. What statements in there do you think ought to be qualified, specifically, and how?

If you want upvotes next time, explain in detail what claims you object to, and why. This comment I'm afraid did not add much to the discussion, at least for me.

<comment><USER39> Thanks for your explanation.

> It has objectively superior asymptotic performance in certain relatively > niche workloads. However, its constant time factor is iffy due to all the > pointer following and calculations you have to do for random accesses. And > the benchmark results in the README show this clearly -- both the strengths > and the weaknesses.

I got that impression after going through a fair bit of the README. My feeling is neither the post title nor the introductory statements in the README reflected these very relevant qualifications to the claim of "An Array with Constant Time Access and Fast Insertion and Deletion", and putting the onus on the reader to dig through the whole thing to discover this is either naïve or a bit disingenuous. As others have noted, and as I implied in my comment, there is in fact existing literature that captures the particular ideas and tradeoffs in this implementation - Tiered Vectors. I believe the author has a duty to cite that up front and prominently in the spirit of honest academic discourse.

<comment><USER40> > _As others have noted, and as I implied in my comment, there is in fact > existing literature that captures the particular ideas and tradeoffs in this > implementation - Tiered Vectors. I believe the author has a duty to cite > that up front and prominently in the spirit of honest academic discourse._

What "academic discourse"? This is a datastructure implementation with some documentation in a Github repo, not a submission to a scientific journal. You're insinuating a level of rigor that is completely unwarranted.

Just lean back, relax, and accept that you overreacted a bit in your original post. It's not the end of the world to admit that.</comment></comment></comment></comment>


Octane minus V8 - <AUTHOR> http://blog.mozilla.org/nnethercote/2012/08/24/octane-minus-v8/

<comment><USER2> <http://octane-benchmark.googlecode.com/svn/latest/index.html>

</comment><comment><USER3> At least for the optimization work I've done I've always had "real-world" test cases, and "drive the current bottleneck really hard" synthetic tests (I profile the real-world case, identify some bottlenecks, make tests that target those bottlenecks then optimize for that, then rinse and repeat), so I can understand why the various JS benchmark suites contain some very synthetic tests...

<comment><USER4> Except, unfortunately, they encourage people to keep optimizing that one issue even when it's long past being the bottleneck. Equally, what's a bottleneck in one implementation might not be in another.

Having the entire real-world case means you have to optimize for the actual case, and not just implement what was at one time the bottleneck in one implementation as quick as possible.

</comment></comment><comment><USER5> They should add it to <http://arewefastyet.com> ?

I wonder why firefox is radically faster at "splay" (but nothing else, sadly)

<comment><USER6> Also see [http://arewefastyet.com/?a=b&view=regress](http://arewefastyet.com/?a=b&view=regress) for the IonMonkey work. We really should make this the front page of AWFY....

<comment><USER6> Fixed - front page of <http://arewefastyet.com/> has IonMonkey now, thanks to David Anderson.

</comment></comment></comment><comment><USER7> IIRC if you use Emscripten to compile Bullet instead of using Mandreel (the closed-source compiler they used), it's faster in FF than Chrome. Probably explains the choice of a closed source tool there.

<comment><USER8> Do you happen to know which of the Empscripten or Mandreel compiled versions is fastest?

(After searching a bit, it seems that the emscripten version is the faster one[1], at least in February, but the testing methodology in that post isn't clear.

[1]: [http://mozakai.blogspot.se/2012/02/box2djs-box2d-on-web- is-g...](http://mozakai.blogspot.se/2012/02/box2djs-box2d-on-web-is-getting- faster.html) )

<comment><USER9> The main problem is that Mandreel is closed source. I don't have access to it, so I can't just compile two C++ benchmarks and compare the results.

However, I suspect the Emscripten version is faster, for a few reasons:

* Indirect measurements on Box2D in that link indicate Emscripten is faster.

* Looking at the generated code shows several things Emscripten does better, for example it uses the native JS stack for function calls (Mandreel pushes all the arguments onto the emulated C stack which is additional work), the Emscripten relooper implementation is more optimized, etc.

* Emscripten uses closure compiler to minify and further optimize the generated code while Mandreel does not. This mainly affects download size, but not only - closure can do optimizations at the JS level that can't be done before, like for example inlining handwritten glue code in JS into compiled JS code.

* Mandreel used to use an older version of LLVM and Clang than Emscripten, which always uses the latest, and there have been big 'free' speedups in Emscripten due to improvements in the LLVM optimizer. (But, perhaps Mandreel has updated, without access to it I don't know.)

* Emscripten has gotten a lot of issues filed about performance issues, pull requests, etc. as a benefit of being open source, which led to plenty of improvements. I can't be sure but I am guessing there are fewer people that bought a Mandreel license and contributed feedback.

Note though that the question of which is fastest is a little problematic - one compiler's output might be faster in one browser but slower in another, so there isn't an objective sense of "fastest" here. But with that said, there are aspects of the code that should be faster in all browsers, like as mentioned above the more optimized way that Emscripten does function calls.

</comment></comment></comment><comment><USER10> I love how Firefox and Chrome can compete while still upholding respect for each other and mutually progressing the web.

<comment><USER11> I think it helps somewhat that, for different reasons, this is not really about the money for either one of them: Firefox is a nonprofit organization, and Chrome is not Google's main product.

<comment><USER12> Actually the Mozilla Foundation (the non-profit part) owns the Mozilla Corporation (for-profit), the corporation handles all the development.

<http://www-archive.mozilla.org/reorganization/>

In some ways it is about money, Google pays Mozilla about $300 million a year for search engine placement and click-through ads. That accounts for the vast majority of all of Mozilla's revenue (in 2010, Google paid $115 million and that was 85% of Mozilla's revenue).

<comment><USER13> That is literally just an implementation detail.

The controlling interest is the nonprofit, the for-profit part exists for tax/etc reasons.</comment></comment></comment></comment>


Show HN: Generate memes in pure Golang - <AUTHOR> https://github.com/montanaflynn/meme-generator <comment><AUTHOR> Hey HN! Just a fun weekend project I made awhile back and thought someone might enjoy. Feel free to ask questions, provide code criticisms, or suggest a new feature or improvement.</comment>


Ask HN: Would you take a job that might suck over an already bad one ? - <AUTHOR>

I have been very unhappy at my current employer for a while now. It's very frustrating to come to work every day in the morning. The work is very boring and I'm not doing anything important. Also, my personal life has started suffering because I just don't feel like doing anything due to my mind being asleep/numb at work all day. The good part is however, that the people are nice, there's flexible timings and there isn't a ton of pressure. The work, however, is menial and I am not learning anything new at all.
Now I have an offer from a big corporate firm's IT department. From conversations, they are really eager to hire me but here's my initial feelings about it. The project 'sounds' interesting but I don't have a good feeling about the people I'd be working with. It also seems there will be a lot of  pressure to perform and the environment will be very corporate-ish (as compared to the laid-back casual environment at my current job).
If I don't take the corporate job, I'm afraid I'd be stuck at my current place doing menial work (which, at this point, is very boring and I'm not learning anything new). Also, the my current team (despite being nice) just talks about building a world-changing product but I (through my experience) know that the product won't be successful (the team has been working on it for 3 years and there still isn't anything to show for it). The corporate job could end up being worse with worse people and a worse project.
What would you do in such a situation ? Any anecdotes/advice from past experiences will be much appreciated!
thanks! <comment><USER2> What don't you like about the people at the new job? Maybe they are not as bad as you think?

<comment><AUTHOR> I didn't get a good vibe when I went in for the interviews. I didn't think I would fit it very well.

<comment><USER2> Maybe the were just a little bit nerdy... In any case, your old job sounds so horrible that I would try anything to quit. But there must be more than 2 jobs in the world?

<comment><USER3> Well, of all the jobs I could like, I narrowed it down to two. And of those two, only one of them made the offer. So even though I liked the position at first, I wasn't so sure after I was done with the interviews.

I think I'll give the team another shot and try to talk to a senior person about what I would be doing and what my role and responsibilities will be.

</comment></comment></comment></comment><comment><USER4> All jobs will suck. The key is to find a way to be happy that doesn't involve basing the entirety of your personal identity on your day job. Or just take lots of drugs.

<comment><AUTHOR> Well, I guess it's more of the delusion of my team at my current workplace that's causing a lot of mental pain. Too many people thinking they are the greatest developer ever and that their ideas are world-changing. The management apparently has similar delusions of grandeur.

After a day of seeing all this and good ideas being scoffed at, I feel so listless and drained that I don't feel like doing anything.</comment></comment>


Erik Naggum on Emacs and muscle memory - <AUTHOR> http://groups.google.com/group/comp.emacs/msg/821a0f04bab91864?dmode=source&output=gplain <comment><USER3> This essay was evidently written in 1997. I don't know what the competitors to Emacs were in 1997 other than Vi, but these days there are extremely powerful text editors which are exceedingly easy for a novice to pick up and use _right out of the gate_ and _then_ go on to offer vast arrays of substantially more advanced tools for those prepared to explore and become experts.

Just because it used to be extremely painful to become a towering expert at text editing doesn't mean it should continue to be so. It's not like riding a bicycle-- text editing actually _is_ _easy_. Or at least, it can be _made_ easy, and there is no argument for keeping it difficult.

Remember, text editing in and of itself is _of no value_. Tools should get the hell out of the way of their users.

<comment><USER4> >Text editing in and of itself has no value.

I just don't know what to make of that. It's true, but only in an incredibly over-technical sense. Text-editing is one of the primary forces that drives the world. Pen or keyboard or voice to speech, text is primary.

Yes, of course, the meaning behind the text is more important. But the meaning doesn't appear at all without some means of creating the text. It's like saying that the teeth are not important, it's the food. You can't eat the food without teeth.

<comment><USER3> I'm saying that the meaning of the text - be it prose, poetry or code - <USER2> _all_ that is important. Text editors are tools, like paintbrushes and screwdrivers. They only important or valuable to the extent that they enable us to create stuff of actual value.

You can go down the route of text editing as art, like that Vi Golf concept that was floating around. And a well-made tool is indeed valuable and beautiful to behold. Nevertheless, I maintain that a text editor is strictly as important as the text it is used to create.

<comment><USER5> This still isn't an argument against using powerful text editors. If you're doing carpentry, both a hand-driver and a power-drill can drive screws, but one will get the job done faster. The advantage is, of course, situational; but power is especially important when refactoring and modifying existing text/code where being able to automate repetitive changes can speed things up significantly.

<comment><USER3> Of course it isn't an argument against powerful text editors. It's an argument against _obtuse_ text editors.

</comment></comment></comment></comment></comment><comment><USER6> This is incredibly pedantic, and yet, fails to point out parts of the problem. Or maybe the guy just wanted to flatter himself in saying that people that does not want to learn how to use a text editor (can't refrain the old joke : or the editor it lacks) are necessarily stupid morons that can't have a proper opinion on the subject.

I tend to orient my tool choice to one that will require the least effort and still allow to achieve the task properly, even though the least effort might be, sometimes, a huge effort. I concentrate on the least effort for a simple reason : if a better tool I could not imagine comes out, I will minimize the hard learned knowledge I'll have to discard. Putting effort in something gives you momentum, you won't let it go easily, because you make the balance difficult to evaluate. Jump between easy to switch solutions, and you are guaranteed to mostly enjoy the best tools (for its class at least) you can get.

<comment><USER7> > This is incredibly pedantic,

Agreed, but...

> and yet, fails to point out parts of the problem.

Which parts? You don't go on to say.

> Or maybe the guy just wanted to flatter himself in saying that people that > does not want to learn how to use a text editor (can't refrain the old joke > : or the editor it lacks) are necessarily stupid morons that can't have a > proper opinion on the subject.

This is not the impression I got. Rather, he was expressing frustration at the concept of "intuitive" or "novice-friendly" software, emphasized by the commercial software industry, that saves initial learning time at the expense of training people to do mindless tasks over and over, instead of learning to use their computers more efficiently. I think he was saying that it is unfortunate that, due to the emphasis on this concept by commercial software, there is now a (perhaps large) segment of the population that won't accept any other kind of interface; and he was saying that Emacs development should probably not target these people.

Whether the expression was pedantic or not, this seems like a reasonable thing to be frustrated about, and a reasonable conclusion to draw.

<comment><USER6> Sorry for the late response.

I'll just point out one part of your comment, and use it to illustrate what I wanted to say.

> instead of learning to use their computers more efficiently

What i wanted to say is just that, you might be just more efficient by avoiding spending a lot of time learning complex tool, and concentrate on simple one, with the hope that the loop of improvements of your tools will compensate the loss of productivity due to a non-optimum usage. The general idea is, if you spend of lot of time to learn a tool, you are betting that it will worth it on the long run, at the hypothetical cost of losing the time use to acquire that knowledge we you finally decide that an alternative is a better option - with the added momentum you'll have before quiting your hard learned cherished tool. On the contrary, when learning quickly, less efficient, simple tools you bet on the future evolution of that tools : you will gain in productivity on the later tools that might pop up, ones that you will also learn quickly, but will be a bit more efficient.

While I would completely agree with the author on the fact that some people will refuse to learn what would be more efficient tool on the long run, he fails to recognize that a chain of more simple tools, that improves over times and allow quick adaptation and optimization can be in some circumstances be an approach that leads to the exact same efficiency.

This is why I complain that the article was pedantic, because it states too strongly that mastering complex software is the way to go, whereas, while there is a regrettable tendency to discard complex tools too quickly, diving in them might be not always as wise as it could seem.

</comment></comment></comment><comment><USER8> What is with this guy's aversion to uppercase?

<comment><USER9> The aversion is restricted to capitalizing the initial word of a sentence.

It's easier to rearrange words in a sentence and join or split sentences in a paragraph if the first word of a sentence is not capitalized.

Capitalizing the first word of a sentence can also lose information.

It's also helpful to identify people who focus on the trivial.

<comment><USER10> Except it isn't trivial; it materially damaged the ease with which I could read the essay.

As a long-time English reader, I've internalized the idea that there will be a capital letter at the beginning of a sentence. So when it's lacking, especially when the beginning of a sentence corresponds to a newline as in the beginnings of paragraphs in this essay, my immediate mental response is to assume that I've overshot the sentence's beginning, and immediately to backtrack to find it.

Overriding this behavior takes mental effort which detracts from the ease with which I can read. Making it harder for your readers to consume your ideas is hardly a trivial issue.

<comment><USER11> For Emacs users:

(defun capitalize-naggum () "Capitalizes text written in Erik Naggum's annoying no-caps style" (interactive) (save-excursion (goto-char (point-min)) (aux-naggum (point))))

(defun aux-naggum (current-point) "Recursively capitalize the buffer, moving sentence to sentence. Valid punctuation symbols are [.?!]" (re-search-forward "[a-z]" nil 0 nil) (if (= current-point (point)) t (capitalize-word -1) (re- search-forward "[.!?]") (aux-naggum (point))))

</comment></comment></comment></comment><comment><USER12> Blogs and Twitter killed the amazing Usenet rants.

<comment> loup-vaillant ?!?

The rants are still there. They just moved. Or did Usenet influence its users into writing thoughtful rants in ways that blogs and agregators don't? I never used Usenet, but this seems unlikely.

</comment></comment><comment><USER13> Great article even if it was '97'. And I found emacs easy to use after: C-h t

<comment> loup-vaillant Yes, but actually typing it is beyond the ability of most users: you have to read the presentation screen before hitting a key, and you have to guess that "C" means "the control key".

<comment><USER14> Sigh. The first (clickable!) item on the launch screen of the editor is "Emacs Tutorial". The first paragraph displayed in the tutorial after you select (with the mouse!) that item is contains:

C-<chr> means hold the CONTROL key while typing the character <chr> Thus, C-f would be: hold the CONTROL key and type f.

I'm not going to sit here and tell you that emacs is "easy" to learn (seriously: getting truly good at it will take months at least). But don't pretend that the documentation is hard to read. It's just documentation.

<comment> loup-vaillant First, Oops.

Second, I didn't want to say that it was difficult, but that many people behave like morons.

</comment></comment></comment></comment><comment><USER15> reminds me of QuickSilver talking about _wu wei_ , and seems fairly accurate-- the sequence "tap Command, pause about a quarter second, type "S", hit Space" for launching Safari feels a lot like "lean towards where you want to go" does on a bike (or maybe "steer one way and lean the other to make a tight turn without leaning the bike over as far", a more advanced technique).</comment>


Ask HN: Do you blog under your own domain? How? - <AUTHOR> I'm put off by increasing centralization (I won't name companies, you know them) and would like to know who still does it "old school", hosting their own blog. I'm especially interested in the technology behind it.<p>E.g. mine is grisha.org and it's hosted on github pages and behind cloudflare which is how I get SSL. Cost: $0. The blog itself is Octopress and it's kind of aging, I might look at Hugo next if/when I have time. <comment><USER3> Hey there! We use the following setup for our blog (link in profile if you're curious). I did a lot of research on this setup and think it's one of the best stacks to use provided that you're technical:

      - Our site is built using the static site generator Jekyll (https://jekyllrb.com/docs/). We use the Hydeout theme (https://github.com/fongandrew/hydeout) + some additional CSS styling, but you can really use anything.
      - Gitlab pipelines for continuous deployment
      - GoDaddy for domain management

Pros:

      - Fast out of the box.
      - Simple to get set up (on the order of hours to get production-ready with full CI/CD!)
      - Flexible (you can customize Jekyll all you like if you know a modicum of CSS - tons of control).
      - Managed and versioned in Github, collaboration and updates are a breeze.
      - <USER2>

Cons:

      - You need to be technical, but that's probably not an issue for the HN set.

We tried Medium and Blogspot as well. Medium looks great but the ecosystem is somewhat hostile, and Blogspot looks ultra dated. Wordpress is probably great if you're a Wordpress expert, but for us as engineers it was actually easier to just use Jekyll.

</comment><comment><USER4> Yes: [https://theandrewbailey.com/](https://theandrewbailey.com/)

1\. Namecheap DNS registration.

2\. Server is an old PC in my basement.

3\. Dynamic DNS client running on my OpenWRT router.

4\. Code is a homemade blog system. Linux, Java (Servlets + JSP + EJB), Payara, PostgreSQL.

5\. Uses a Let's Encrypt certificate.

It's totally old school, but fun to play with, and it serves pages fast.

</comment><comment><USER5> I feel you as far as centralization is concerned.

Personally I've been meaning to start writing for some time now but I keep kicking the can down the road for multiple reasons.

Problem 1: Lack of time, other more important things that I need to take care of and basically life in general - I've had serious time constraints during the last few years. Which I have been able to considerably improve lately. Which is completely unrelated to the lockdown and has more to do with me figuring out how to organize everything and catch up. And ultimately I've been looking into starting again lately.

Problem 2: The absence of a decent platform: I really don't want to deal with maintaining a database or a server for the purpose of serving text and images.

Problem 3: sphinx, hugo, and all other static site generators, while great, are not self-contained and a huge overkill imo for a personal site/blog. Meaning that managing them on the go is still painful - I'd have to setup a ci/cd to manage them, which I feel is the same as having a database and a server somewhere.

So I tried to somewhat fix problem 2 and 3 and built something from scratch myself - a small dartlang-based site(as I've stated a million times, i abhor javascript with a passion and just seeing it makes me vomit), which operates with either html or markdown pages, simple href and routing. The point is that at any given time I can unlock my phone, ssh into any of my servers, add a .md file, add a link, commit and push and forget about it.

I've been meaning to open-soruce the whole thing and if someone's interested they can use it. All in all, the end result is a transpiled js file from dart, which is ~90kb gzipped, an index.html and a yml file which allows you to customize stuff.

If anyone is interested, you can have a look at [http://axegon.com](http://axegon.com).

<comment><USER6> Would love you to elaborate on how you organize and catch up - it's a constant battle. I get a LOT done but I definitely sacrifice other aspects of life in the name of getting things done.

Back on the topic of blogging, I agree with your points about maintenance. I think if the goal is purely writing and having it be accessible on the internet, html and a minimal amount of css are going to have the lowest overhead, best performance, be portable, and be easiest to maintain, won't it? It depends on if you want extra functionality of course but if the intention really is just to write, html works fine?

<comment><USER5> Oh boy, this is a long one and a bit off topic but oh well...

> I definitely sacrifice other aspects of life in the name of getting things > done.

You kind of nailed it. It's just a question of what kind of sacrifices you're willing to make. In my case, at a young age(20-ish) due to a million and one reasons(parents far away and unable to help, those supposed to be "close" to me stabbing me in the back without any hesitation whatsoever), this became my personal life. It sounds pretty sad that I spent most of my 20's buried in work but long-term, if that hadn't been the case, my mind cannot even begin to imagine how I would have been able to handle everything that came after that. And even till this day, sacrificing my personal life is always the simple and obvious choice, at the expense of some occasional gloomy moods of course. As a side effect, I became very self-sufficient, which does come in handy when someone close to me is facing a problem - I can give a hand. It also pushed me to develop some extreme pedantism which would make the stereotype for German pedantism look like child's play. But one of the most crucial things I do is I spent 30 minutes before bedtime reviewing all my todo's, appointments, arrangements and issues, 15 minutes of which I spend sorting them by priority:

1\. Critical - near life and death situations, forget sleeping, eating or showering, tackle as soon as I finish the list.

2\. High - Something that needs to be resolved within the next 2 days.

3\. Medium - Can hold for a week but get to them asap.

4\. Low - Completely trivial but annoying stuff like being out of coffee.

The next 15 minutes I make a plan about each of the things on the list, and set alarms, notes, reminders and routes if that involves going somewhere.

On the subject of notes - English isn't my first language, however unless any of the things on the list are strictly local, all notes are in English, even the coffee shortage: more resources online, easier to search and get informed if needed. I can't tell you how much time that has saved me.

As soon as priorities of type 1 and 2 are clear, life can proceed as normal. Now that you made me think about it, this process might have taught me to build incredibly elaborate and complex plans with little to no effort and being incredibly flexible. I really hadn't thought about it but there might be something to this, who knows... Bottom line is, despite a number of brutal challenges in the last several years, those few simple rules have kept me sane, have helped me solve all of them while staying healthy and fit. And at the moment I can honestly enjoy my weekend.

\---

As for the blogging, and clean HTML - yes and no. It is definitely the easiest to setup and get running, I agree. But if I'm on the go and the only thing I have on me is my phone, writing HTML over ssh isn't really ideal. Which is why I built this - it renders markdown as HTML out of the box, so adding something is as easy as creating an .md file, adding a link, commit and push. This will take you 10-15 minutes to set-up but it renders well on all devices I've tried, and has absolutely 0 maintenance required afterwards.

</comment></comment></comment><comment><USER7> I use Pelican ( [https://blog.getpelican.com/](https://blog.getpelican.com/) ) and host on NearlyFreeSpeech ( [https://www.nearlyfreespeech.net/](https://www.nearlyfreespeech.net/) ) for my blog, [https://snafuhall.com/](https://snafuhall.com/) .

I don't have much traffic; the blog and email/etc runs less than $10/mo.

It's _possible_ to lease a bare IP range and set up your own DNS servers, etc. For small amounts of traffic theres no reason you couldn't use a RasPi to serve a blog that way. There's also drawbacks and headaches that make renting someone else's stuff attractive.

</comment><comment><USER8> Build+host: Netlify

Version control: GitHub

Editing: Netlify CMS or nano+git

I started setting this up from scratch using Gatsby, but then realized it would be much better and also easier to use this starter:

[https://www.gatsbyjs.org/starters/alxshelepenok/gatsby- start...](https://www.gatsbyjs.org/starters/alxshelepenok/gatsby-starter- lumen/)

It is as easy to set this up, as it is to install LAMP+WordPress on a VPS.

</comment><comment><USER9> I use Eleventy for my technical blog, and self-hosted Ghost for my tango music blog. I plan to migrate from Ghost to Eleventy such that my website is 100% static.

Eleventy is great for me because it's written in Javascript and I use Javascript every day for work. Very fast and capable. Can't say how it compares to other static site generators because it's the first one I've used.

My setup includes nginx and Letsencrypt, and that's pretty much it. The Ghost blog uses a SQLite database.

I wouldn't blog on any third-party service since they could kick me out anytime for any reason. My website is my digital garden. I don't monetize it, don't run ads there, don't sell anything. No reason to run it anywhere but on my own server.

</comment><comment><USER10> Unbeatable platform is [https://repl.it](https://repl.it)! You can edit code, deploy, host, and set up custom domains all from the same browser page. And it's FREE!

I host my custom HTML and CSS blog there and it's great! [https://www.towardssoftware.com](https://www.towardssoftware.com)

More importantly it's all just basic files I can export to another platform if repl.it gets acquired or shuts down. They can host a basic HTML, css and js blog, however I choose to use python flask because I like the templating and simple routing.

</comment><comment><USER11> WordPress (the self-hosting, WordPress.org flavour). Works like a charm. It's flexible, easy-to-use and performs very well on a mid-range virtual host. It's also reasonably secure if you apply common sense and best practices (e.g. use complex passwords) and don't install plugins indiscriminately.

There are plugins for every feature you could possibly need.

You admittedly have to put in some time for researching and comparing those and not fall for the temptation to install the first plugin you come across for a particular feature.

</comment><comment><USER12> I already had a PHP site so I wanted an easy way to integrate a blog in my site. I ended up creating a micro-blogging library[0], which just renders markdown as blog posts. The advantage is that there is no build step, you only write markdown files (VSCode has live-preview by default for markdown) and you have easy versioning as markdown is just text.

[0]: [https://github.com/Cristy94/markdown- blog](https://github.com/Cristy94/markdown-blog)

</comment><comment><USER13> A pair of $5 cloud servers and a Cloudflare load balancer for resiliency.

Ansible is used to build and maintain both servers, and the actual web content is in Git.

I use `receive.denyCurrentBranch=updateInstead` in the repo config on the servers, so I just do a push to each and the new content goes live instantly.

The reason for doing it this way is that I want to fully own my platform. I have fine-grain control over all of the web server headers, PHP configuration, etc.

[https://www.jamieweb.net/](https://www.jamieweb.net/)

</comment><comment><USER14> I use Uberspace [1] – they're a Germany-based shared hosting provider with proper shell access, a pay-what-you-want model and they're generally very nerd-friendly – to host a fairly basic Jekyll blog [2], among other things.

The domain is managed via Hover [3].

[1]: [https://uberspace.de](https://uberspace.de)

[2]: [https://excessivelyadequate.com](https://excessivelyadequate.com)

[3]: [https://www.hover.com](https://www.hover.com)

</comment><comment><USER15> I generate my website via me very own static site generator I've built for fun (and still working on it to make it open source for others to use).

The hosting is my local provider, I sent updates via FTP (oldschool huh?) and keep my website behind cloudflare to save some bandwidth.

[https://lukaszkups.net/notes/](https://lukaszkups.net/notes/)

</comment><comment><USER16> I host my site for $5 per month on DigitalOcean. [https://ybbond.dev/](https://ybbond.dev/), also git.* and rss.* subdomain. I use LEMP stack because the rss one needs PHP and MySQL, while the main site built with Hugo. All use LetsEncrypt.

Some of my subdomains hosted on netlify, because I won't bother myself installing node.js on my server.

</comment><comment><USER17> That's a great question!

How: github pages. How, you ask? I don't know. I set it up once, and now when I log in to github it tells me I set it up wrong and I should set it up again correct. I don't know what I did or how to do it correctly - but visiting my domain works, so I don't dare to fix what isn't really broken.

So I guess you don't need to know what you're doing to host a static site on your own domain :)

<comment><USER18> [https://help.github.com/en/github/working-with-github- pages/...](https://help.github.com/en/github/working-with-github- pages/managing-a-custom-domain-for-your-github-pages-site)

Short is create a CNAME file in your site repo with your custom DNS in it, then add a CNAME in your DNS pointing to the GitHub pages DNS.

</comment></comment><comment><USER19> I run Sovereign [1] on a Vultr VPS, $5/mo. Flask on Apache for blogging. (Sovereign is "a set of Ansible playbooks to build and maintain your own private cloud: email, calendar, contacts, file sync, IRC bouncer, VPN, and more.")

[1] [https://github.com/sovereign/sovereign](https://github.com/sovereign/sovereign)

</comment><comment><USER20> Namesilo DNS. Hosted on Netlify pointed from private gitlab repo. Hugo SSG.

I like your blog :) Subscribed in RSS.

OTOH, writing content is a challenge for me. If I try to start writing a tutorial, there seems to exist many others, with some of them being very high quality content. In the end it becomes futile to figure out what to write.

Would appreciate any tips to start writing about something.

<comment><AUTHOR> My take on it is - just write for yourself. If, when you read it, it sounds like a good write up to you for whatever your own reasons are, that is all that's required. If no one else reads it, fine. But you might be surprised, a lot of other people may find it interesting as well :)

</comment></comment><comment><USER21> Generated by Hugo, hosted on smallest AWS LightSail, own domain. Uses nginx, Lets Encrypt, FBSD. Auto-updates everything and if something breaks it breaks. 1000 days and zero maintenance. [https://blog.eutopian.io/the- stack/](https://blog.eutopian.io/the-stack/)

<comment><USER22> If these are static pages, why not S3 + CloudFront + ACM certificate?

This way you don't have to risk it may break and if it is a low traffic site it might be cheaper.

</comment></comment><comment><USER23> My blog still technically exists, though I haven't posted in several years. It lives on an instance of wordpress hosted by pair.com. I'm not sure if that's what you mean by "hosting their own blog", but I own the domain name, so I could move it somewhere else if I ever wanted to.

</comment><comment><USER24> Mine is managed using Github, generated using Hugo and hosted using netlify. Also costs $0 other than the domain name, which I use for other purpose as well.

You can check it out at: [https://about.houqp.me/posts/](https://about.houqp.me/posts/)

</comment><comment><USER25> My blog is built using Jekyll and the code lives in a private github repo. I use Netlify for hosting and SSL. Total cost is about $9 per year to renew the domain.

[https://www.exponentialbackoff.com/](https://www.exponentialbackoff.com/)

</comment><comment><USER26> Yes, I used Ghost for my blog, and hosted on DigitalOcean, and domain gotten from namecheap.

Monthly server cost is $5, Domain cost $15 a year

If you are interested to check it out, [https://fluffy.es](https://fluffy.es) (iOS development mainly)

<comment><USER12> Doesn't having a regional domain name (.es) affect SEO and user expectation? I thought the website is in Spanish.

</comment></comment><comment><USER27> I do something very similar, although I hesitate to claim that I'm doing it old school. I use a Hugo blog hosted on GitHub pages, and my biggest expense is paying ISNIC (the Icelandic domain registry) for a .is site that works well with my last name.

</comment><comment><USER28> I blog via blogger.com. You can use your own domain name with a blogger site.

I do so for some things.

</comment><comment><USER29> Https://blog.rraghur.in

Gitlab pages with custom domain. Ssl from lets encrypt. Domain managed by cloudflare.

Static site with Hugo and I use asciidoctor for authoring entries

Let's encrypt cert renewal is via a cron job running on rpi in my home network

</comment><comment><USER30> I have a Digital ocean droplet that costs me $5/mo. I host a static site at [https://mrosenberg.pub](https://mrosenberg.pub) using Jekyll, nginx, and Lets Encrypt.

</comment><comment><USER31> I've been using the self hosted version of WP for about 15 years now. That being said I'm always willing to test new services.

</comment><comment><USER32> I use Jekyll and netlify through github. It's a pretty seamless setup.

Like you I don't want my content locked up a proprietary site or platform like medium.

</comment><comment><USER33> I use [https://www.11ty.dev/](https://www.11ty.dev/) \+ Netlify

</comment><comment><USER34> Blixhavn.dev

I run a Ghost installation on a Debian VM, reverse proxied through Nginx and set up with Let's Encrypt.

</comment><comment><USER35> Simplier than yours. Just hugo on github pages. Good enough, and much better than Octopress.

</comment><comment><USER36> I didn't post anything yet but I've recently set up a blog using Hugo, s3 & cloudfront

</comment><comment><USER37> Wordpress hosted on Dreamhost.

I used to run Drupal, but it wasn't worth the effort.

</comment><comment><USER38> I use Perl and the common gateway interface on a 386 desktop pc.</comment>


Traffic Jam, a program that helps track prostitution rings by using public data - <AUTHOR> https://broadly.vice.com/en_us/article/the-young-woman-who-created-a-new-way-to-bust-sex-trafficking-rings <comment><USER2> Clever. One of the more interesting challenges that I've run into in the last few years is just the sheer amount of raw data out there. It's mind-boggling how many problems can be solved if we could sift through that data quickly, from human trafficking down to weather. I'm particularly fascinated by her intuition that writing patterns and templates can identify pimps. I'm not sure how long it would have taken me to come to that conclusion.. but now that it's out there, it's obvious.

I wonder what other problems we can solve with the same toolset.

<comment><USER3> The USGS learns about earthquakes in regions without censors via Twitter. [1]

I'm of the opinion we have only scratched the surface of what is possible to predict by analyzing realtime data from social networks, user groups and message board communities.

[1] [https://blog.twitter.com/2015/usgs-twitter-data- earthquake-d...](https://blog.twitter.com/2015/usgs-twitter-data-earthquake- detection)

<comment><USER4> You mean sensors not censors. Sensors sense, censors censor.

<comment><USER3> Indeed I did!

</comment></comment></comment></comment><comment><USER5> "When I asked her how detectives differentiate Traffic Jam's data between trafficked victims and sex workers, she said that they rely on their intuition and knowledge of the community they protect."

It sounds like she's busting low class pimps, and hoping that a few of them are human traffickers.

</comment><comment><USER6> This is interesting. The article doesn't talk about she implemented the Traffic Jam program, but it does discuss how she came to 'know' sex ads, as way to keep tabs on pimps.

""I would literally just spend hours on these websites, looking at ads, getting a sense for what was the norm," she said. She began to pick up the nuances of every post, understand how a template was made, and get a feel for the different voices behind these ads."

I don't know how this information fits with her implementation, but I was reminded of an old article by Paul Graham "A Plan For Spam" ([http://www.paulgraham.com/spam.html](http://www.paulgraham.com/spam.html)), where he talks about automating the process of detecting spam using Bayesian Filtering.

"I think it's possible to stop spam, and that content-based filters are the way to do it. The Achilles heel of the spammers is their message. They can circumvent any other barrier you set up. They have so far, at least. But they have to deliver their message, whatever it is. If we can write software that recognizes their messages, there is no way they can get around that."

Substitute the spam message for the sex message, and we're talking about the same thing. It would be an interesting exercise to try Bayesian Filtering on sex ads, or any other kind of message, to see where it leads.

<comment><USER7> I could imagine a naive Bayes classifier would do the trick when it comes to figuring out which ads were written by the same person.

</comment></comment><comment><USER8> But what does the software /do/ ?

<comment><USER9> If they told you, maybe you'd try to defeat it or create your own version in furtherance of patronage. Instead just be aware:

There's software. Out there. Doing _something_. (and it's always _watching_ )

</comment></comment><comment><USER10> Fascinating article, trying to automate what the CIA would call an Analyst. Back when I was building my old computer collection I would read hundreds of ebay listings to find the "good stuff" and started to recognize sellers that listed under a variety of user names, or buyers who were also sellers. Just by the way they talked about the hardware, and did they call it by its "common" name or the product catalog name, etc. Never thought about making a resarch project out of it though.

</comment><comment><USER11> The product page: [http://www.marinusanalytics.com/trafficjam/](http://www.marinusanalytics.com/trafficjam/)

</comment><comment><USER12> I'm really uneasy with police analyzing our social media data, it's heading into thought-crime territory. But there's tons of money to be made off of it.

<comment><USER13> Why are you saying this? There is literally no mention of social media in this article. The data (at least from the original project) is mined from publicly available data, which could be social media data, but that data has to be made public in the first place.

It is possible that the "Research Grade" version of the program does use that data, but there is no evidence of that here.

</comment></comment><comment><USER14> Some happy medium between this title and the original title could be found.

<comment><USER15> We changed the article's baity title to its subtitle (shortened to fit 80 chars) in accordance with the HN guidelines. If you or anyone would like to suggest a better title, we can change it again.

[https://news.ycombinator.com/newsguidelines.html](https://news.ycombinator.com/newsguidelines.html)

<comment><AUTHOR> Much better.

</comment></comment></comment><comment><USER16> Interesting software, horribly written article.

<comment><USER17> Word

<comment><USER17> why the downvotes? I meant 'Word' like I agree: [http://www.urbandictionary.com/define.php?term=Word](http://www.urbandictionary.com/define.php?term=Word)

<comment><USER18> The Hacker News community discourages comments that do not add value to the conversation. Simple statements of agreeing are best handled through the up vote mechanism.

<comment><USER17> I disagree

</comment></comment></comment></comment></comment><comment><USER19> Oh it's used to find them so you can CRAK DOWN on them. Yeah, that's totally what I expected, not an app or anything like that...

<comment><USER15> Please don't do this here.</comment></comment>


Programmers love writing (and mocking) tests - <AUTHOR> http://programming-musings.org/2006/01/25/programmers-love-writing-and-mocking-tests/

<comment><USER2> I am apparently one of the few developers that doesn't find it boring to write tests after the code. I actually find it more tedious to write it beforehand, in many cases.

Generally, any time that I know exactly where the code is going and how it's going to do it, I write the tests afterwards to actually test the code, instead of the time-honored practice of fiddling with it manually and hoping nothing gets missed. Any time that I am at all unsure where the code is going, writing the tests beforehand is usually better.</comment>


My Mantra to Blogging that Made $20,000: Remix, Reuse, and Republish - <AUTHOR> http://www.shopify.com/blog/6997620-my-mantra-to-blogging-that-made-20-000-remix-reuse-and-republish

<comment><USER2> Previously, _The Sprawling Guide to Content Marketing that Made Us $10,000:_

[http://blog.idonethis.com/post/36065976015/the-sprawling- gui...](http://blog.idonethis.com/post/36065976015/the-sprawling-guide-to- content-marketing-that-made-us)

<http://news.ycombinator.com/item?id=4805655>

</comment><comment><USER3> And on a slow news day apply the same formula to a meta-story.

I found it interesting for a different reason. I'm a bit out of date with the self-deluding language used by those "in the content game" to protect themselves from the cognitive dissonance involved in pretending to be pro- internet geeks/hackers/entrepreneurs while spending their time writing spam.</comment>


Ask HN: Is this a sustainable business idea? Buythese9things.com - <AUTHOR>

Hey HN. Total newbie here- this is my first "legitimate" submission here. http://buythese9things.com - I've posted this once before last night but got 0 attention, so I'm trying 1 more time.
It's called "Buy these 9 things". It's basically just a simple site that has 9 items that I get a referral fee from. I'm the seller and curator of the 9 items. Please check out the F.A.Q page to answer some more basic questions.
My (first) goal: make my money back for domain registration. If I can make this a simple business "model" to follow, then I hope to replicate it for someone else, and then eventually lots of people. Maybe it could lead to a whole new shopping experience for people, and a way to make money!
So, what I'm asking HN is this: What do you think of this as a simple idea to test the water? Do you love it? Hate it? Think I'm wasting my time? Please-- any feedback would be highly appreciated. My contact information is in my HN profile, if you would like to talk personally. Thanks for reading!
This went from idea to MVP in 2 days. I used Refer.ly's new service as the referral system. <comment><USER2> Be careful using Referly. In their words, "During the beta period we are not yet able to redeem your rewards, but we are saving them for you."</comment>


Ask HN: Would you use this product if it had React Native code generation? - <AUTHOR>

Dear HNers,
I'd like to get your opinion on a technical strategy question concerning a startup's future direction.
Neonto makes a visual tool that generates UI+controller code for native mobile apps:
http://neonto.com
Currently the tool covers the iOS and Android platforms by outputting Objective-C and Java code. The generated code is clean and tight... But end users sometimes find it problematic that the code is in a language that they don't understand. (Most people don't have good knowledge of both Obj-C and Java, and so the generated code becomes kind of a "scary black box" that requires special skills to modify.)
One idea that's been on the table is to add a React Native code generation back-end to Neonto Studio. This would either complement or replace the existing iOS/Android backends.
Would you find such a product useful? Generally speaking, would you consider using a GUI tool that generates React Native layouts and controller code for you? <comment><AUTHOR> Clickable link:

[http://neonto.com](http://neonto.com)</comment>


Shoddy Reporting, Invective, and Arrogance. Yeah, I Want Some of That - <AUTHOR> http://guidewiregroup.wordpress.com/2008/09/06/shoddy-reporting-invective-and-arrogance-yeah-i-want-some-of-that/

<comment><USER2> At this point, I'll be happy when this year's DEMO and TC50 have gone by and I can just watch the videos. No more drama, no more endless provocation.

Seriously, just focus on the more productive topics. This feels like the equivalent of whether Obama wears a lapel pin or not. Who cares?

</comment><comment><USER3> There's plenty of all of those things to be found in Northern California, though sometimes I think Sarah Lacy is determined to corner the market in Shoddy Reporting.</comment>


Support the Jobs Act and ease regulations on startups and investors - <AUTHOR> http://angel.co/jobs-act

<comment><USER2> A better jobs act would be "Healthcare that's actually affordable for someone starting out"

People would leave their deadend jobs in droves and start new companies if they didn't have to risk their health and that of their families by doing so.

<comment><USER3> As someone who has chronic back problems, I cannot agree with this more. I've wanted to start a company for some time, but my increased risk for significant medical care/procedures has somewhat anchored me to working for others.

<comment> wes-exp IIRC, assuming Obamacare is still intact come 2014, health insurers will not be able to discriminate against pre-existing conditions.

<comment><USER4> <pedantic> Down voted for using for using the pejorative 'Obamacare'. The thing actually has a real name (and it doesn't even make some bad acronym), it is the "Patient Protection and Affordable Care Act". </pedantic>

<comment><USER5> Odd. I know plenty of liberals/Democrats/etc who call it Obamacare. They don't mean anything negative by it. It's a hell of a lot shorter than call it the "Patient Protection and Affordable Care Act".

<comment><USER4> Perhaps I am just sensitive to being fairly liberal in a pretty conservative area. The vast majority (read: all, until now apparently) of the times I hear the term, it's definitely used negatively. I understand the formal name is a bit cumbersome, but it's accurate and a lot less ambiguous. Of those I know who don't use 'Obamacare' or the actual name, using the simple healthcare reform act seems to work well.

My apologies for turning this into a political argument. My intention was to try to check some perceived bias. Looks like I over-corrected.

</comment></comment></comment></comment></comment></comment><comment><USER6> Smells like libertarian BS.

Regulations aren't the problem.

Young, small companies are the job creators.

Not having affordable healthcare is the single biggest inhibitor to startups.

Single payer healthcare would be the single largest job creating boost. Lopping the 1/3rd of costs, decapitating the blood sucking "insurance" racket, would make a significant dent in everyone's overhead.

<comment><USER7> Single payer != free. Unless you manage to create massive efficiency gains in the health care sector you are going to replace health insurance premiums with health insurance taxes.

<comment><USER8> Single payer would lead to massive efficiency gains in healthcare.

[http://www.medicaltranscription.net/cost-of-medical- paperwor...](http://www.medicaltranscription.net/cost-of-medical-paperwork/)

[http://www.modernmedicine.com/modernmedicine/Modern+Medicine...](http://www.modernmedicine.com/modernmedicine/Modern+Medicine+Now/Paperwork- costs-are-far-higher-in-US-than-in- Canad/ArticleStandard/Article/detail/739129)

</comment></comment></comment><comment><USER9> I'm okay up until _Stay private if they have over 500 shareholders_

Honestly, You're not a startup if you have over 500 shareholders, You're basically a public company with no disclosure requirements for investors. Why would anyone go public if they can just sell all their shares on secondmarket and not have disclose anything? That rule is in place to protect investors.

<comment><USER10> I was under the impression that the raising of the 500 shareholder limit was to allow the crowdfunding aspect to be meaningful; 500 investors at $100 a pop is only $50,000 that makes a certain amount of sense.

However, I'm not familiar enough with the securities law of 1933 to gauge what section 302 of the proposed bill ( [http://www.gpo.gov/fdsys/pkg/BILLS-112hr3606eh/pdf/BILLS-112...](http://www.gpo.gov/fdsys/pkg/BILLS-112hr3606eh/pdf/BILLS-112hr3606eh.pdf) ) means in practice.

<comment><USER11> Couldn't this be solved with one level of indirection, such that the crowd funding company is the sole investor of crowd-sourced funds?

<comment><USER12> Wouldn't that render any limit on the number of shareholder meaningless?

</comment></comment></comment></comment><comment><USER13> I am not a lawyer, but I tried to read some of this. I don't see how it's targeted to anything I would call a startup.

[http://www.govtrack.us/congress/bill.xpd?bill=h112-3606&...](http://www.govtrack.us/congress/bill.xpd?bill=h112-3606&tab=summary)

First off, it defines an "emerging growth company" as anything with less than $1 billion gross yearly revenue. You all have heard of Netgear? Emerging growth company.

And then it exempts such a company from reporting requirements, shareholder approval of executive compensation, shareholder approval of severance packages, certain auditing requirements, and even conflict-of-interest provisions.

In my non-expert opinion it looks more like it's trying to make the first dotcom bubble look like a period of sanity and sobriety.

</comment><comment><USER14> This is something that needs to happen. I wish ProFounder hadn't close, however it's a clear example of how our institutions and legal frameworks are not evolving fast enough to foster creativity and innovation. I'm still waiting for Government 2.0...

Signed.

</comment><comment><USER15> Here's a collection of some contrary perspectives: <http://www.consumerfed.org/news/473> , [http://boss.blogs.nytimes.com/2012/03/13/in-latest-jobs- bill...](http://boss.blogs.nytimes.com/2012/03/13/in-latest-jobs-bill-a- billion-dollar-business-is-now-small/)

The legislation will certainly be good for founders and investors trying to take companies public, as well as the Wall Street banks which will underwrite them.

My concern is that gutting investor (self-)protections will bring in a flood of dumb money, with all the market distortions that creates.

<comment><USER16> _My concern is that gutting investor (self-)protections will bring in a flood of dumb money, with all the market distortions that creates._

That seems to be happening already, perhaps because there's no where else for investment to go right now.

</comment></comment><comment><USER17> I'm not sure about this. The summary says the law changes how any company with annual revenue <$1bn is regulated. That's a much larger group than just startups. The law would ease regulations, but some of those regulations are for investor protection and it's not clear to me that their removal is actually a good thing. Also, I don't see why it's called "the Jobs Act." There doesn't seem to be any estimate on how many jobs it may create.

</comment><comment><USER18> I'm all in favor of crowdfunding, but this sounds a lot like an excuse to gut transparency and disclosure regulations so _another_ stock-market bubble can get (back to) going.

<comment><USER19> If I read the bill correctly, it only reduces oversight when there are 2000 or so investors: quite easily not enough to really enable the Kickstarter-startup vision.

</comment></comment><comment><USER20> Signed.</comment>


How I Shipped a Neural Network on iOS with CoreML, PyTorch, and React Native - <AUTHOR> https://attardi.org/pytorch-and-coreml/ <comment><USER2> @steadicat I love this part:

> I think of convolution as code reuse for neural networks. A typical fully- > connected layer has no concept of space and time. By using convolutions, > you're telling the neural network it can reuse what it learned across > certain dimensions.</comment>


MIT researchers devise a secure anonymity network that's 10x faster than Tor - <AUTHOR> http://www.extremetech.com/internet/231817-mit-researchers-devise-a-secure-anonymity-network-thats-10x-faster-than-tor <comment><USER2> Code: [https://github.com/kwonalbert/riffle](https://github.com/kwonalbert/riffle)</comment>


Play Sports for a Quieter Brain: Evidence from Division I Collegiate Athletes - <AUTHOR> https://www.ncbi.nlm.nih.gov/pubmed/31813316 <comment><USER2> I train 20 hours a week for my sport, on top of full time study at University and running my own freelance business on the side.

While I advocate for sport, nothing beats meditation for increased focus!

I have tracked my stress levels over the last few years. During stretches of when I meditated, and did not.

I have absolutely noticed a difference in my internal thoughts and actions.

Before, my thoughts felt like I was in a forest surrounded by fog, visibility was impossible.

But now, I feel like the fog is slowly lifting, I am able to see the outline of the surroundings.

Give it a shot, It only takes a couple weeks of meditation to notice a difference :)

<comment><USER3> I've been very undisciplined when it comes to meditation! What sort of meditation do you prefer. Use any guided tools? How often?

<comment><USER4> The Waking Up and Headspace apps have been great for me. I've found that meditation is much like regular exercise, where consistency and long term adherence is more important than how much you feel you're getting out of each individual session. Those apps have helped me build habits.

</comment></comment></comment><comment><USER5> I used to run pretty competitively, however I'd always train with music / an ipod. In fact I still run with my iPod classic. Even with music I still daydream almost every run.

Concentration is a muscle that has to be trained like any other. There's probably a ton of selection bias in that individuals who can't focus don't go to D1 programs.

</comment><comment><USER6> I trained pretty heavily for a couple different endurance sports through college. I definitely felt that I was overall much calmer and less anxious when I was training hard. I was just too tired to be stressed out about anything. I recently picked up boxing (mainly for the workout, not doing many fights) and felt the same effect.

</comment><comment><USER7> I read this not as "playing sports gives you a quieter brain" but as "playing sports gives you a better ability to 'turn down the noise'".

As a former collegiate athlete I'd love to agree with this.

</comment><comment><USER8> It's probably a mental positive until you get hit hard in the head. Here in the US the association of football with universities is just so bizarre.

<comment><USER9> It's not just tackle football. Other college sports, played in many countries, have significant risk of concussion. Rugby, soccer, and ice hockey look quite problematic according to [1].

[1] [https://completeconcussions.com/2018/12/05/concussion- rates-...](https://completeconcussions.com/2018/12/05/concussion-rates-what- sport-most-concussions/)</comment></comment>


Facebook Offers work like a charm. Here is proof! - <AUTHOR> http://i.imgur.com/lvCSf.png

<comment><USER2> It's just a poorly written ad. The add is for the realty company, but they put the info of just one of their houses in the title to show what you can get.</comment>