PyFormat – Practical examples of old and new style string formatting - <AUTHOR> http://pyformat.info

<comment><USER2> A good reference.

My take home is that every single version that is possible to do in old style formatting is longer in new style formatting. Even more so if the old-style formatting were written without the extraneous 1-ples.

        '%4d' % 42

vs

        '{:4d}'.format(42)

It isn't surprising that so much code is still being written in old-style. The advantages of the new style, like padding with arbitrary characters; value reuse (particularly for I18n, though that tends to use a different mechanism for production systems that need it); and nested display; are really quite minor.

This feeds into the other python issue on HN today - why does py3 have so little uptake? Because it is a solution to a problem few people have.

<comment><USER3> Yes, very nice, helpful site.

.format() is mostly too verbose for my tastes. Even Guido himself put it into the "meh" category in a talk. To be clear, I do use it when I need quick lightweight templating, say building a very complicated string.

But for most simple output printf style is shorter, simpler and I know it by heart. There was a guy at work who insisted on using .format() for everything that soured me on it, sometimes even simple string concatenation:

        print 'result: {long_var_name}'.format({long_var_name=long_var_name})

Sometimes lines reached 200 chars. If lines were broken down, they might extend to 4 lines for each debug statement, adding tons of clutter. Said it was more readable because you could ignore the end. :/

As sago said, printf is more concise in the majority of use cases. Not to mention the logging niceties:

        log.info('result: %s %s', one, two)  # shorter and note that fmt is deferred!

A _big_ one in my eyes. Too bad logging doesn't support {} internally.

I've also wondered if .format could be improved if the % operator could be used with it, given appropriate precedence rules. Or perhaps use another char... dunno & or /?

        print 'results: {} {}' %  results
        print 'results: {} {}' %% results
        print 'results: {} {}' /  results

Pycon, are you listening? ;)

<comment><USER4> This is what your co-worker does now:

      'result: {long_var_name}'.format(long_var_name=long_var_name)

A similar option is possible with '%'-style formatting:

      'result: %(long_var_name)s'%{"long_var_name":long_var_name}
        -or-
      'result: %(long_var_name)s'%dict(long_var_name=long_var_name)

The first of these alternatives is indeed shorter, so long as there's only a single parameter. If there are multiple parameters then the .format() solution will be shorter.

My experience with '%(name)s' % dict formatting is that I would often forget the terminal 's', and write it as '%(name)'. For template-like strings, where I want named substitutions, I am very much in favor of {}-style formatting.

So if your co-worker insists on named substitutions, then s.format() is less verbose than s % dict.

Regarding logging, there's a section of how to use format templates in the logging system, at [https://docs.python.org/3/howto/logging- cookbook.html#format...](https://docs.python.org/3/howto/logging- cookbook.html#formatting-styles) . In addition to using a LogRecord factory, you could reduce the overhead in old-style logging to only an extra constructor calls:

      log.info(M('result: {} {}', one, two))

where M.__str__ forwards to str.format.

Personally, I would like a way to pre-compile the format string:

      fmt = format_compile("result: {} {} {}")
      for result in results:
        print(fmt(*result))

because currently (in Python 3.3) "%d %d %d" is about 40% faster than "{} {} {}".

EDIT: Never mind: It can be faster to interpolate the string each time than to call a constructor:

      % python3.3 -mtimeit 's="%s %s %s"' 's % (1, 3, 9)'
      1000000 loops, best of 3: 0.36 usec per loop
      % python3.3 -mtimeit 'class Spam:pass' 'Spam()'
      10000 loops, best of 3: 23.6 usec per loop

I did not expect a factor of 65!

<comment><USER5> Your timeit calls in the edit need the -s parameter before the first statements, so they aren't executed on each loop iteration. The overhead is in creating the class, not the instances.

      $ python3 -mtimeit -s 's="%s %s %s"' 's % (1, 3, 9)'
      1000000 loops, best of 3: 0.343 usec per loop
      $ python3 -mtimeit -s 'class Spam:pass' 'Spam()'
      10000000 loops, best of 3: 0.106 usec per loop

<comment><USER4> Thanks! That's a big forehead smack on my side.

The numbers are more in line with what I expected. Meaning it _is_ possible to defer some of the time cost by using a single constructor rather than evaluating the string.

</comment></comment></comment></comment></comment><comment><USER6> They missed my favorite trick! locals() will give you a dict of, well, local variables, which generally coincides with what you want, so:

        a = 4
        'A is: {a}'.format(**locals())

works as expected.

<comment><USER7> Might not work in some special cases though. Try:

      def foo():
          a = 4
          def bar():
              print("a = {a}".format(**locals()))
          bar()

      foo()

which will raise a KeyError, while it will work fine if you add a

      print(a)

to the end of bar().

<comment><USER8> In this case, 'a' isn't a local variable binding though.

<comment><USER9> Right, but it's accessible in scope though. It's just a "gotcha" for that method that might be easy to overlook if you aren't paying attention (or if someone with less experience stumbles onto this 'trick' in production code).

</comment></comment></comment></comment><comment><USER10> My last remaining complaint with new formatting is with Pylint and logging messages. The old-style way is to write:

        logging.debug('some value: %d', 123)

which avoids the cost of string interpolation if that log message wasn't going to be emitted, say because the log level is higher than DEBUG. If you instead write:

        logging.debug('some value: {}'.format(123))

then Pylint will complain that I "Use % formatting in logging functions but pass the % parameters as arguments (logging-format-interpolation)".

Yes, I can disable that particular warning, either by maintain a pylintrc file or adding annotations to the source code. Yes, this is a dumb complaint. But yes, it still bugs me.

</comment><comment><USER11> I really don't mind these apparent (small) improvements to Python.

However, the fact that Python 3 just went off and did it's own things rather than the usual cycle of:

        1) improve a language feature
        2) deprecate the old way of doing it
        3) give people time to update code (usually a couple of point releases)
        4) remove features that have been replaced

Python 3 should not have dropped lots of little changes with no backwards compatibility. They should still make 2.8 and 2.9 that are releases that remove features and add new ones until most python code works in Python 3.

<comment><USER12> Somebody should write a HN plugin that does something like this:

        if is_about_python3(post):
            insert_token_random_complaint_from_2008()

(edit: snake-case)

<comment><USER11> Can _someone_ write a filter for snarky unconstructive comments while they are at it?

<comment><USER12> Just make sure not to filter tedious unconstructive 7-year-old lists of grievances. We can't live without those.

<comment><USER11> I really don't see what I said wasn't true, Debian still won't escape Python 2 for many years for example. Are you saying the move to Python 3 was smooth and a resounding success or are you just pretending that it's done and no one is still using Python 2.x?

Sorry my comment has annoyed you so much but you really haven't made constructive points to disprove it.

</comment></comment></comment></comment></comment><comment><USER13> There should be two-- and preferably only two --obvious ways to do it.

\-- The Zen of Python

</comment><comment><USER14> Python 2.7 also added a non-locale aware thousands separator that be be combined with other options:

        >>> "{:>40,.2f}".format(sys.maxint)
        '            9,223,372,036,854,775,808.00'

</comment><comment><USER15>
        Basic formatting
        Old: '%d %d' % (1, 2)
        New: '{} {}'.format(1, 2)

It should rather be `{:d} {:d}'.format(1, 2)` but even that isn't strictly equivalent (try both styles with a float or a Decimal).

</comment><comment><USER16> I'm a c dinosaur, so I've always used old-style formatting because I know it off by heart. Having said that, the alignment operator (<^>) reminds me of my joy when learning python - power and simplicity!

</comment><comment><USER17> This fails to mention the str.format_map() shortcut method (new in Python 3.2). It's useful if you already have a dictionary of all your values!

</comment><comment><USER18> Really cool and the site looks great too! Was a css framework used for the styling or is it hand written? Can't tell from the minification.

</comment><comment><USER19>
        '%d %d' % (1, 2)

I would have done this as

        '%s %s' % (1, 2)

Because we're turning everything into a string at the end of the day anyway!

Yeah. Having finished the article, .format() just isn't really needed. If I'm at the point where I'm doing templating with key:values, I'll be using jinja.

<comment><USER15> %d converts the value to int first which might be useful:

        >>> '%d' % 3.14
        '3'
        >>> '%d' % 'foo'
        TypeError: %d format: a number is required, not str

</comment></comment><comment><USER20> I personally prefer the old style still, and I still don't see the value of deprecating it in favor of the new style. I started Python in 2008 (p3k was brand new), and I used new style formatting for about 2 years. After realizing that I was the only one using new style I switched and now I cannot imagines going back.

<comment><USER21> I use the new style for three reasons:

• it is supposedly significantly faster

• new, means, eventually we'll have to use it, so might as well get used to it now!

• it's a method on an object, which makes my brain happy. I never managed to get my brain wrapped around the old style syntax, it's inconsistent with the rest of the python syntax.

<comment><USER22> _• it 's a method on an object, which makes my brain happy. I never managed to get my brain wrapped around the old style syntax, it's inconsistent with the rest of the python syntax._

uhh... so you'd prefer to do something like `1.add(2)` ???

<comment><USER23> While arithmetic syntactic sugar is useful since it's much clearer, I agree that I'd often prefer a function call to some unintuitive symbol syntax.

Another example for me, in Python, is:

        print >> sys.stderr, 'foo'

vs.

        print ('foo', file=sys.stderr)

<comment><USER21> Ah yes, I've been doing

        from __future__ import print_function

pretty much since it has been available. flush=True, end='' etc.... much more intuitive.

</comment></comment></comment></comment></comment><comment><USER24> One caution that this document does not mention is that the new formatting is available only in recent versions of Python. One of my projects runs on a CentOS 5.x server, which has Python 2.4, so I had to convert all of the new style formatting to old in order to get it to run there.

<comment><USER25> Wow, Python 2.4 was last updated on October 18, 2006.

Since Centos 5 still has about 2 years of life but fewer and fewer Python packages support 2.4, it might be worth looking at Pyenv:

[https://github.com/yyuu/pyenv](https://github.com/yyuu/pyenv)

Good overview of what it lets you do:

[http://fgimian.github.io/blog/2014/04/20/better-python- versi...](http://fgimian.github.io/blog/2014/04/20/better-python-version-and- environment-management-with-pyenv/)

</comment></comment><comment><USER26> Can't tell you how many times I've Googled this and had to dig through the docs. Thank you!

</comment><comment><USER27> I use the format: foo = 'foo' bar = 'bar' print "%(foo)s%(bar)s" % locals() which I guess is what this is similar too.

basically locals(), vars(), and globals() I find very useful for string formatting.

</comment><comment><USER28> In Dash.app (on Mac), there's actually a nifty file that you can download that shows you how all the different formatting options work.

Its good, but I think this is even better.

</comment><comment><USER29> Its very lame that the new format kept the bad design from C hacks.

Why not 'field: {:center :minsize=8 varname}'.format(varname=123) ?

<comment><USER30> Once you start formatting more than one variable, isn't your proposed syntax going to be horribly long?

        '{:center :minsize=8 varname} {:center :minsize=8 varname2} {:center :minsize=8 varname2}'.format(varname=123, varname2=123,varname3=123)

instead of

        '{:^8} {:^8} {:^8}'.format(varname, varname2, varname3)

Concision is not always a good thing, but still...

<comment><USER29> top one is still much more readable.

also, if you are going to repeat always the same, you can standardize it in a string var and just use that instead of repeating.

and if you are NOT, then it beats '{:^8} {:*8} {:@8} {:☃8}' anytime, because now you have to know and notice the change in those cryptic chars.

</comment></comment></comment><comment><USER31> Hey, very nice. I knew about the "new" format() but didn't know it was so powerful.</comment>


A Faster Pseudopolynomial Time Algorithm for Subset Sum - <AUTHOR> http://arxiv.org/abs/1507.02318 <comment><USER2> Any simple explanation for this? I'm interested in learning more about it.

<comment><AUTHOR> Author here. The idea is a mix of many things. This is not how we write it in the paper, but just for intuition.

If Σ(S) is the set of all subset sums of S, where S={s_1,...,s_n}, then

Σ(S) = Σ(s_1)+Σ(s_2)+...+Σ(s_n).

Here A+B = {a+b|a in A, b in B} \+ is associative and commutative. Now we want to add parenthesis on that formula in a way such that it is fast. Similar to matrix chain multiplication. We make sure + can be fast if certain property are satisfied(Theorem 2), and the rest is just figuring out the right way to add parenthesis.</comment></comment>


Candy Japan Shipments Paused - <AUTHOR> https://www.candyjapan.com/behind-the-scenes/on-pause-due-to-covid19 <comment><USER2> What is the reason for the type of mail that got shut down? Is it normally by boat and the boats stopped running? It seems like on a global scale most delivery stuff is still going on, maybe a bit slower in some cases.

<comment><USER3> I have a friend who needs to ship out of Hong Kong. I can tell you that he's greatly effected by the lack of passenger flights. Much of his shipping went through a shipping aggregator, but ultimately, most of his shipping ended up as being extra space on passenger flights. His shipping costs are currently cost prohibitive on much of his volume business, from like $5/item to like $30.

And worse, there are package quotas now with many carriers, so he's had to stop using aggregators.</comment></comment>


PHP's ob_start() pre-allocates 40k memory per call - <AUTHOR> http://ilia.ws/archives/244-PHPs-Output-Buffering.html

<comment><USER2> If I'm reading the PHP source correctly, in 5.4 this is changed to 16kb (this entire code block seems to have been rewritten):

[http://svn.php.net/viewvc/php/php- src/trunk/main/output.c?vi...](http://svn.php.net/viewvc/php/php- src/trunk/main/output.c?view=markup#l808)

[http://svn.php.net/viewvc/php/php- src/trunk/main/php_output....](http://svn.php.net/viewvc/php/php- src/trunk/main/php_output.h?view=markup#l82)

       #define PHP_OUTPUT_HANDLER_DEFAULT_SIZE     0x4000

</comment><comment><USER3> I always treated output buffering/capturing like eval

\- if you have to use it, you need to question yourself carefully as to "why" and if there is a better way.

<comment><USER4> As any European user of HN knows too well, when you send tiny chunks separated by a few ms a time up to TCP, the majority of the planet will get a jittery half-rendered experience of your home page lasting seconds for a handful of actual kb downloaded.

The better question might be "if you want to turn it off, the question is why", or something.

<comment><USER5> Using one ob_start() could make sense for certain cases. But 16 of them? I can't think of any reason to nest ob_start 16 levels deep.

<comment><USER6> This is common approach in MVC frameworks, where every view (template/partial/widget) is rendered independently and then injected into main template.

</comment></comment></comment></comment><comment><USER7> It would surely be great if the PHP Docs would include such information right where the function is described.

<comment><USER8> It's probably hidden somewhere in the comments from the last 10 years, next to the awful comments written in foreign languages.

</comment></comment><comment><USER9> Why on earth are you trying to buffer 1-2K?

<comment><USER10> Because in PHP the return response begins as soon as you start non-buffered output, after which you can no longer modify headers, cookies, etc.

<comment><USER11> Of course, there's no reason to output everything all the time. It is possible to use string concatenation and output the result at the end of processing rather than 16 layers of ob_start(). That seems a bit excessive.

<comment><USER12> I would think the BEST way in theory would be to not output strings at all but rather build some kind of logical representation via datastructures (ie a DOM tree as in JQuery or HTML templates which are tied to a code-behind as in ASP.NET) and then output that after all processing is done.

What's the best PHP framework/library for that kind of thing?

<comment><USER13> Ummm, all of them?

The basic problem you run into is that PHP is basically a templating language at its heart. If you don't immediately open with a "<?" you start sending data. If you want to use PHP as it was originally intended -- as raw HTML with a smattering of dynamic bits in the middle -- without losing the ability to set headers, then ob_start makes sense. If on the other hand you want to use it in the way that most people do, you open with "<?php" and proceed to abuse a whole bunch of bastardized perl templating functions followed by an "echo $data; ?>" at the end of your source code.

Now, given that PHP as a templating language is basically terrible, it's not that far out to just say, "To hell with PHP's native templating features, we're going to use our own!" but at that point you are already pretty far gone.

</comment></comment></comment></comment></comment><comment><USER14> The more usual solution for growable buffers is to start small and just double each time you hit the limit, not grow it by a static amount. People have tried a lot of different strategies, but there don't seem to be any that work much better for general purpose use.

<comment><USER15> This is not merely a matter of trying and picking what suits you best. If you grow a buffer by fixed amounts, you end up copying O(n^2) items. If you grow it by a fixed factor, you end up copying O(n) items. The difference can be staggering.

<comment><USER16> You only end up copying O(N^2) elements if you copy elements at all. You need not copy: you just keep a vector of pointers to your fixed buffers, a la GCC's deque implementation. That vector of pointers will be copied (and thus ought to grow by doubles), but each fixed buffer remains the same as the deque grows.

I haven't looked at PHP's implementation, and I've long since learned not to expect intelligent, rational implementation decisions from that language community, but it's certainly possible to grow by a fixed amount and remain O(N) by never copying elements at all.</comment></comment></comment>


Winning the Blackbird Battle - <AUTHOR> https://blog.cloudflare.com/winning-the-blackbird-battle/ <comment><USER2> Hi. Cloudflare GC here. Some informed comments here. Feel free to AMA.

<comment><USER3> 1) How can the broader community help end this sort of nonsense?

2) Do you see any potential for a company to offer patent troll defense as a service and drive costs down, or does it seem too big a problem to productize/scale a solution for?

<comment><USER4> [https://www.theverge.com/2015/7/23/9021191/google-patent- sta...](https://www.theverge.com/2015/7/23/9021191/google-patent-starter- program-free-patents-fights-trolls)

<comment><USER5> The same Google that did this: [https://arstechnica.com/tech- policy/2018/06/inventor-says-go...](https://arstechnica.com/tech- policy/2018/06/inventor-says-google-is-patenting-work-he-put-in-the-public- domain/)

:thinking:

<comment><USER4> The reasoning here was that if they didn't patent it, some other bad actor / patent troll would, and that would cause far more problems. Google so far has a record of never using a patently offensively, and only time will tell if this will keep holding true.

Google also has a giant shared patent pool that they let other companies use to defend themselves, so this is part of that, alongside the article I shared.

<comment><USER6> > Google so far has a record of never using a patently offensively

[https://arstechnica.com/tech-policy/2017/07/waymo-drops- most...](https://arstechnica.com/tech-policy/2017/07/waymo-drops-most-of-its- patent-case-against-uber/)

[https://www.reuters.com/article/us-google-bt- lawsuit/google-...](https://www.reuters.com/article/us-google-bt- lawsuit/google-hits-back-against-bt-with-patent-lawsuits- idUSBRE91C1J920130213)

<comment><USER4> Those are examples of using it defensively. They use patents to defend themselves against lawsuit.

In this case, anyone is free to use the algorithm, and Google won't go after them with the patent.

<comment><USER6> The Waymo vs Uber one wasn't a defense against a lawsuit.

</comment></comment></comment></comment></comment></comment></comment></comment><comment><USER7> >In addition to vigorously opposing this case in court, we created and sponsored Project Jengo to push back against the incentives that empower patent trolls like Blackbird Tech. Now that the case is over, we will be wrapping up Project Jengo and will report back with a summary of the Project's successes in the near future.

I don't understand... Couldn't they expand the project to help others in a similar situation?

<comment><USER8> I think the idea of the report back is that the knowledge of how to use such a strategy, will be widely disseminated, and that will make other victims of patent trolling more likely to fight than settle.

</comment></comment><comment><USER9> The case against trolls is so clear and obvious, why does it seem so difficult to craft legislation to prevent this? I imagine a simple addition to patent laws invalidating a patent if the holder does not commercialize it after a certain period should get rid of NPEs. Is it not that simple? Also do you know if there's anything like patent-troll insurance that covers legal fees in cases like this? If not, why not? It seems like this has been a problem for so long not only for small businesses but for major players (with vast amounts of resources and clout) that I'm baffled why the problem continues to exist. Is there something about the US legal system or business in general that my simplistic mind is not understanding?

<comment><USER10> > The case against trolls is so clear and obvious, why does it seem so > difficult to craft legislation to prevent this?

Patent trolls (the most successful ones, anyhow) practice Batsian Mimicry as a defensive strategy: they specifically try to look as much like a small inventor who's invention has been stolen by one or more bad actors. It is never simple to disrupt an evolutionary arms race.

> I imagine a simple addition to patent laws invalidating a patent if the > holder does not commercialize it after a certain period should get rid of > NPEs. Is it not that simple?

Are you aware of how long it takes drugs, for example, to get from the patent stage to the commercialization stage? I'm sure there are other obvious industries where this would be problematic to the normal way of doing business.

On a more broad note: is it good to require that all inventors directly commercialize their own inventions? At best, I think this is an open question.

<comment><USER11> A patent is way to encourage inventions, awarding the inventors the exclusive rights to their own inventions.

The public good is a priority. The idea is that the invention is beneficial to the public. If somebody creates a good invention but deny it from the public, this patent should not be in public interest anymore.

<comment><USER12> > somebody creates a good invention but deny it from the public

for about 15 years.. After 15 years the public can make use of the invention without paying a penny. How it is not in publics interest?

<comment><USER13> Because even if removing the patent system meant that the invention was kept secret from the public, it would most likely be reinvented many times in that 15 year time. The worst part of patents is that they extend even to others who do the legwork themselves, and frequently stifle an entire area (for example, 3D printing exploded in popularity and accessability right after some key patents held by stratasys expired, and this was in the best case of a company actually developing the technology they had patented).

<comment><USER12> We are talking about an exceptional case here. The patent owner is a wealthy and extentric agent who disregarts potential profit from selling/licensing/using the patent. And even in such rare and unexpected cases the public eventually gains access to inventions - which is not neccessarely the case for inventions kept secret. Basically, the society trades speed of technological development for certaininity of achieving its goals.

</comment></comment></comment></comment></comment></comment><comment><USER14> I'm glad they won, and I applaud them for fighting for the good of everyone else. Thank you Cloudflare.

Unfortunately by not going to trial, they didn't set any precedent, and sadly I don't think they did much damage to the patent troll system. Hopefully I'm wrong. :(

<comment><USER15> IANAL; how would a precedent help future cases like this?

They make it sounds like the slow and expensive process of just participating in the legal system is what enables trolling, not the actual prior opinions of courts.

<comment><USER14> IAalsoNAL, but my understanding is if there were a bunch of opinions overturning claims of trolls, it would change the calculus of settlement and therefore make it too expensive to be a troll because of the high risk of loss.

Yes, the long trial lengths are also a problem, and maybe an easier one to fix, by adding expedited hearings just for these things. But at the end of the day the trolls troll because the reward is greater than the risk.

<comment><USER16> First of all, it's not clear that they _could_ have taken this to trial, as the judge didn't see a basis for argument (that's what summary judgment means).

Second, there is no legal theory or precedent that I'm aware of that would factor in the troll-ish nature of the plaintiff in a patent ruling. Patent trolls lose because they are usually stretching to apply vague patent claims to a large number of targets.

Finally, trolls have a heavily uneven playing field. Most troll farms have in- house counsel, so they have very low litigation costs. Also, they typically segregate every patent or patent family into a separate corporate entity so that any fee or damage awards won't claw back overall winnings.

</comment></comment></comment></comment><comment><USER17> It's also important to name and shame law firms that represent patent troll clients.

<comment><USER18> Is it also appropriate to "call out" attorneys and legal firms that defend defendants accused of unconscionable crimes (think Boston Marathon bomber)?

Attorneys are to help their represented either to make whole, or defend against the state. If they are truly acting in an unethical stance, then they need tried by the state board. If they were acting unethically, then perhaps their license should be revoked. But these ethics should apply to all lawyers, and not because they chose an 'unsavory' client.

<comment><USER19> If the Boston Marathon bomber was suing the government for not letting him set more bombs off, and a law firm was helping him file that suit, yeah, they should be condemned.

Everybody has a right to a defense. But helping somebody _attack_ another party is unethical.

<comment><USER20> Personally I find the idea of withholding civil justice from criminals to be entirely repugnant. No matter what their crimes are. I don't think there is any such crime that would justify withholding justice from an individual.

<comment><USER21> I don't think the point is whether they are criminals, but whether their legal action is at all reasonable. Suing the government in order to plant bombs is itself unethical. So is suing someone in order to enforce a patent which "attempts to monopolize the abstract idea of monitoring a preexisting data stream between a server" (quoting the judge).

<comment><USER20> One of the role of judges is to determine whether their legal action is reasonable at all. To say that a criminal should not be able to be a plaintiff in a civil suit, or that barriers should be established to prevent it, is simply to deny their access to civil justice. It's an entirely mindless position.

<comment><USER21> You keep focusing on the criminal part, not sure why. That wasn't the point at all, from what I can tell.

</comment></comment></comment></comment></comment></comment></comment><comment><USER22> I would love for someone to share an example of a good software patent. I have yet to encounter one. The only things I have encountered that match my idea of a patentable idea are algorithms, which are not patentable. I have yet to encounter something where there was value in the idea and not all the value in creating a robust, usable, production ready version of it.

<comment><USER23> Algorithms are patentable, if you add ", running on a computer". E.g. map- reduce [https://patents.google.com/patent/WO2012135319A1](https://patents.google.com/patent/WO2012135319A1)

<comment><USER24> I'm not familiar enough with US software patents to really comment intelligently, but my understanding is that machines are patentable. Many machines execute an algorithm. This is inevitable. For example, if you have a process for flash freezing fish and you build a machine to execute that process, then that machine is patentable. The algorithm that the machine executes is an integral part of the machine and therefore part of the patent.

Mathematical constructs are not inventions, but discoveries. This is why a mathematical construct can not be patented. You can't patent a method for finding the circumference of a circle because the relationships are not something you construct. It just _is_. You can discover it, but you can't invent it.

My understanding of the "running on a computer" type of argument is that building a machine to do something is an invention -- even if that machine relies on mathematical facts. In fact, all machines rely on physics, and chemistry, etc that can be modelled with these mathematical facts.

Building a machine that relies on mathematical facts and executes an algorithm, does not in itself mean that the machine is not an invention. It does not in itself mean that the invention is not of the same class of things that patents were meant to work with.

My personal favourite example to think about is PKI type applications. The fact that one way hashes are hard to factor is a discovery, not an invention. The actual algorithms we use in PKI, no matter how much creativity was used in discovering them, are still simply discoveries. We don't create math, we explore it. However, is a machine that uses this math to create a signature that is hard to fake an invention? Is it any less an invention than a machine that uses the laws of physics (which we also don't invent) to fly?

Please note that I don't think software patents should exist. However, there are many people who disagree. The first step in getting them to change their mind is to understand why they think the way they do. It's easy to oversimplify the situation and to just imagine that it is bad will and greed that drives your opposition. However, if you don't deal with their reasonable positions, you won't make any progress. The bad guy/good guy analogy feels good, but the world is unfortunately a lot more nuanced than that.

<comment><USER25> A flash freezer doesn't use the power of algorithms to make the fish cold. The algorithm it uses should not be covered by the patent. And in practice the algorithm is probably on a PLC in a nearby closet, not truly part of the machine at all.

With software, the machine is not merely "relying" on physics which in turn "rely" on math. The functionality is _purely_ mathematics. This is very very different from a patent on a machine.

</comment></comment></comment></comment><comment><USER26> I wish it were possible to pursue all the people involved on the troll side and burn them to the ground (financially and legally speaking).

People like that are the ticks of humanity, putting a drag on human productivity and progress (for their own gain).

What's worse, and this also applies to many groups who affect laws which benefit them at the cost of most everyone else, is that their gains are small compared to the overall cost to society. In many cases it would be more efficient just to get everyone to agree to each pay $1 to the leeches and move on. Still wrong, but less wasteful.

</comment><comment><USER27> Now if they can recover legal costs from Blackbird the circle will be complete.

<comment><USER28> They don't get that automatically? If so, that's really shitty if you get sued.

</comment></comment><comment><USER29> The current patent system helps the corporations at the cost of inventors (who will inevitably be bankrupted by suing them. Especially as with a small change a new patent can be issued and the inventor counter-sued * )

Hard to do anything about that, as the lobbyists and the common folk both want patents.

Perhaps a solution is to limit the number of patents an individual can hold to 100, and a corporation to 100 + 10 per employee (or some similar structure).

An exception could be made if the patents would be defensive [a not-yet- existing class of patent that prevents you from being sued but doesn't let you sue].

This would be perceived as anti-big-corp, so has a chance of working for the politician pushing it.

It would actually help the inventor, as it would keep the trolls out, and keep the mega corps from just patenting everything under the sun and suing right and left to prevent any startup from entering their area.

It would also put a certain amount of pressure to limit the size and power of the biggest corporations (at the least encouraging them to spin off subsidiaries and employ more.)

And lastly, it would cut down on the number of patents being filed daily, so that the patent authority could have time to actually review them.

* I have an invention that could improve the world. The patent attorney told me that if I brought it to market, I could expect to find a Chinese knockoff with weeks, and within months I would likely be fighting just to keep production, as "improved" versions will be patented by U.S. corporations (he told me which ones even).

He said it makes sense to patent anyways, and if another small time inventor doesn't see my patent and brings it to market, I could sue _them_. A path he assured me is less risky and possibly more lucrative that being the producer.

You cannot even imagine how many items never go to market because patents.

An even better system would be to simply use all the money that now goes into patents to provide grants for inventors. That would actually help me get to market (at all!) and would actually improve the world instead of hurting it.

</comment><comment><USER30> I'm not sure they shouldn't expand Project Jengo instead of shutting it down.

<comment><USER2> I can see the value but it's largely a question of resources. There are some strong collectives that are working in this space, not sure we have the time to run that as a side job. Plus, PJ is narrowly-focused on this troll, which is why we said from the beginning, it would last as long as the lawsuit was active. In the meantime, we're focusing our community engagement efforts on Project Galileo and Athenian Project.

<comment><USER30> I understand.. upon reflection, probably best to just support EFF efforts on this front.

</comment></comment></comment><comment><USER31> I wrote a letter to all the persons listed in an article of what I think about them. Suggest you do the same.

</comment><comment><USER32> To any legal experts present: at what point can patent trolls be charged with extortion?

<comment><USER33> You can threaten to sue anyone for anything basically but you can't threaten to call the cops on them unless they pay you. You can see the actual details spelled out in layman terms in (for example) the California jury instructions for CA PC 518 extortion. [https://www.justia.com/criminal/docs/calcrim/1800/1830/](https://www.justia.com/criminal/docs/calcrim/1800/1830/)

</comment></comment><comment><USER32> Were they able to get the patent in question invalidated? I know that's often one of the main outcomes hoped for when taking a stand against a patent troll.

</comment><comment><USER34> And once again the only people making money is the lawyers. There was no need for the Cloudflare lawyers to produce 900 pages of briefs. A few pages and a couple of hours in court would have been enough to persuade any judge that the claim should be dismissed. Instead I expect close to a million dollars worth of legal fees has been frittered away.

<comment><USER35> Um ... lawyer and former litigator here; I've done patent-case appeals at the Federal Circuit in a prior life:

1\. Especially thanks to the Supreme Court's _utter_ trashing of the analytical method (in _Alice_ and other cases), it's not all that simple to move for dismissal on the pleadings.

2\. I've looked at the patent and its claims; with a different trial judge and/or a different three-judge panel at the court of appeals, the outcome could _easily_ have been different. CloudFlare's lawyers must have done a pretty good job, because getting a peremptory affirmance in the court of appeals under "Rule 36" [0] is a non-trivial achievement.

[0] [http://www.cafc.uscourts.gov/sites/default/files/rules-of- pr...](http://www.cafc.uscourts.gov/sites/default/files/rules-of- practice/MASTERFederalCircuitRulesOfPractice-6.6.16.pdf#page=136)

<comment><USER2> See ccrglaw.com -- Great lawyers, they did a great job for us.

</comment></comment></comment><comment><USER36> It reminds me of Newegg patent troll case!

</comment><comment><USER37> How can I win the battle with endless captchas from cloudflare? Getting like one an hour, it's really annoying and I'm tired of training your machines or training your partner's machines.

<comment><USER38> That's an off-topic hijack. But I do understand the frustration.

However, it's important to keep in mind that the CAPTCHAs are entirely optional, and configurable. So it's the website that you need to complain to, not Cloudflare or Google.</comment></comment>


Stealth Search Engine Blekko Raises Another $2.5 Million - <AUTHOR> http://www.techcrunch.com/2009/11/04/stealth-search-engine-blekko-raises-another-2-5-million/ <comment><USER2> Rich Skrenta has written some interesting stuff on his blog (<http://www.skrenta.com> \- nothing recent though) but I have to admit Cuil made me nervous about a "stealth search engine". I haven no idea how blekko compares, but I like the DuckDuckGo approach much better. Best of luck to them both, they've got their work cut out for them.

</comment><comment><USER3> I'm really curious as to how search startups like this get funding. The search market is so polarized right now that only a couple sites (read Google and Microsoft) actually have any share. So you're either Google or Microsoft, or you get no revenue at all.

Are they showing the investors something radically new behind the scenes? Or are the investors simply ignorant of the market? Of the new search engines gone public so far (e.g. Cuil), it's pretty much been the same old "text box entry leading to a list of links" story, and invariably a flop.

<comment><USER4> Google was such a massive success that any search startup with a chance of being a "Google killer", or even just a worthy competitor, seems to be finding investors.

If 1% share is a billion dollars in annual revenue, there's some real opportunity there.

I think everyone is investing in search by looking in their rear-view mirror. I doubt the real "Google killer" will be a "text box entry leading to a list of links" search engine of the same nature as Google.

<comment><USER5> Isn't it a bit more "all or nothing" when it comes to market share and revenues though? I mean you can't just say you've got 100th of the audience of Google and thereby generate 100th of their revenues because of the way advertisers work - they'd probably still go to Google as they have 99% of the audience. Unless you were going for a niche market. Does that make sense?

<comment><USER6> 1% of google would put you in the top 500 of websites, you certainly will find advertisers.</comment></comment></comment></comment>


Show HN: Apple – Every Second - <AUTHOR> http://www.everysecond.io/apple/ <comment><USER2> [http://www.everysecond.io/youtube/](http://www.everysecond.io/youtube/) suggests that the ad revenue is less than what it takes to run YouTube. Is it really a loss making business?

<comment><USER3> Yes. YouTube exists solely to protect Google search.

<comment><USER4> Source for this?

<comment><USER5> Here's a source that they don't profit from it: [http://marketingland.com/report-youtube-roughly-break- even-e...](http://marketingland.com/report-youtube-roughly-break-even-even- billion-users-119735)

</comment></comment></comment></comment><comment><USER6> This is a beautifully designed page. The design is extremely effective at communicating the message. Well done to the creator.

<comment><USER7> What is missing is a justification for each of the counters (where do these numbers come from?) preferably with reference to the source.

<comment><USER8> Scroll to the bottom where is says "sources"

<comment><USER9> Not clickable for me (firefox)

Edit: ah the mouse pointer just keeps normal. Here are the sources: [http://www.statista.com/topics/847/apple/](http://www.statista.com/topics/847/apple/) [http://expandedramblings.com/index.php/by-the-numbers- amazin...](http://expandedramblings.com/index.php/by-the-numbers-amazing- apple-stats/) [http://www.computerworld.com/article/2858887/apples-2014-in-...](http://www.computerworld.com/article/2858887/apples-2014-in-33-stats.html) [http://www.statisticbrain.com/apple-computer-company- statist...](http://www.statisticbrain.com/apple-computer-company-statistics/)

</comment></comment></comment></comment><comment><USER10> I was really surprised with the R&D number and thought it was incorrect since I knew the spending to be small. Just checked that in the last 2/3 years there has been a major upgrade in R&D spending.

Not sure where all the money is going though. There hasn't been any major breakthrough improvement in Apple tech to match the spending. Any big stealth project? What does everyone thinks?

Nice UI btw.

<comment><USER11> The big jump in R&D will most likely go into project Titan, their stealth car project.

<comment><USER10> The car is the one that I was thinking. But can that single project use up that much R&D budget? You need time to scale any project even R&D. A quick check suggest Tesla's 2010-15 R&D budget is less than 3B. I guess Apple has the money to spend but still its a surprisingly big amount for a single project specially since in the other department the lack of innovation would suggest lessening of R&D.

Could it be that they are also not as efficient with their R&D spending since they have money to burn? Despite my misgivings about a lot of thing Apple, one thing I would like to see happen is actually to use the money they have and do R&D that can improve the state of the art. There is really few companies that have the budget to truly go after some lofty goals.

</comment></comment></comment><comment><USER7> [http://www.worldometers.info/](http://www.worldometers.info/)

</comment><comment><USER12> Would love to see this for the US debt

<comment><USER13> No you wouldn't [1]

1\. [http://www.usdebtclock.org/](http://www.usdebtclock.org/)

</comment></comment><comment><USER14> > $x from extracting gold from used iPhones

[http://motherboard.vice.com/read/apple-does-not-melt- iphones...](http://motherboard.vice.com/read/apple-does-not-melt-iphones-into- gold)

<comment><USER15> 2204 pounds of gold. Such an exact number. Except when you change it to kilograms...

<comment><USER16> 2205 would be closer though

</comment></comment></comment><comment><USER17> I'd love to see an "every second" of revenue for the Fortune top 50

</comment><comment><USER18> Nice design/layout

</comment><comment><USER19> Fake. .

.

.

.

Nobody uses Apple Maps.

Disclaimer: this is a joke.

</comment><comment><USER20> Also Apple section should have a count of the number of them broken or stolen. ^_^

<comment><USER21> Magsafe power cables needing replacement, due to the separable part being the side that never ever needs replacement.

<comment><USER22> Oh, that is separable to make manufacturing cheaper. They ship the same powersupply worldwide and just swap out the plug. It's not for your benifit. Although if you travel a lot it is handy.

<comment><USER21> That makes sense. But I've replaced more power cables than I can remember because the bit that connects to the laptop frayed. Had to replace the entire 80$ item every time. I'm really not that careless with them, they fray so easily.

<comment><USER22> Exactly. Apple doesn't really have much of an incentive to make the cables last longer, because you are GOING to buy a new one. People aren't inconvenienced enough by this to make Apple fix this issue.</comment></comment></comment></comment></comment>


Ask HN: How do open source apps like ghost blog run their multi tenant version? - <AUTHOR> This one might have a well known answer but I'm not entirely sure how to find it. I've searched quite a bit but nothing gives quite the right answer.
Basically ghost blog comes with a large set of features in its open source version. They make this version available on their own paid hosted option as well. But their source code doesn't point to a hosted multi site version. I was wondering how this is done architecturally.
On a slightly similar note, how do they maintain the open source version with basic features with a closed source version with premium features?
This is done with a number of open source projects. Was wondering how it's done architecturally. <comment><USER2> What you need is minimal 1 machine with a webserver that can host many virtual hosts under 1 or more IP numbers. On that host you run a database server of some kind, most used is MySQL (which can run many concurrent databases). Then each blog will run in a virtual host with a database connection to it's own database. If you use hppts, you need a wildcard ssl certificate that can accommodate all virtual hosts.

This model can be up-scaled to separate machines for the webserver and database server, or even N number of machines running the webserver and N machines running the database server all behind a loadbalancer. All this even under different IP addresses, or usage of CDN services.

In theory you can upscale this the size of Google services if you have deep pockets.

Short answer, it's not the open source package but the infrastructure behind it, that defines the scale (of course efficient source code will help run things smoother).

</comment><comment><USER3> There is no multi-site version of Ghost. Our Pro service runs the same OSS code that we release publicly. We use internal software to setup, manage and administer all the different instances which we run.

There is no difference in features between the open source version and the Pro service.

<comment><AUTHOR> Whoops with the misunderstanding!!! Thanks so much for replying. Was just wondering though if you'd be up for sharing how that process of managing different instancea is managed. I'm just super interested in learning how others have solved this problem. It might make for an awesome blog post too :)

</comment></comment><comment><USER4> There are a lot of ways to do this.

Most web applications have a parameter in them that points to one or more database servers of some kind, so you can create a new instance by doing, say, "CREATE DATABASE" in mysql and installing the software in a directory on a web server configured to point to the database. If there is a need for scratch directories and other resources that can be handled pretty much the same way as the database.

The provisioning system then is completely separate from the main body of the app so it is easy to keep one private and open source the other.

With the above you can often host a huge number of instances on one machine without any exciting tech (I was doing this at least as early as 2003) but obviously the idea could be implemented with containers, cloud servers, etc. today, for instance you create a cloud server for the user and auto-provision the software to the server.

There are more fancy "multi-tenant" systems such as Salesforce.com where you put a "tenant id" on the database fields so that many tenants can run in a single database, but that's another whole issue in which case some clever thinking would be necessary to add multi-tenant to the open source software.

<comment><AUTHOR> Oh ok... I kept thinking of the idea of running multiple instances on one machine would be expensive. Thanks for that insight. Since I work with docker stuff a lot I could experiment with this too I guess :) . Still curious what ghost blog's strategy is. Asked them to take a look at this if possible :)

<comment><USER4> The art here is balancing isolation vs sharing of resources.

If a lot of people share a file system and somebody uploads a lot of big files and fills the disk that can crash the system for everybody.

For a blog service you will have a lot of people who put in 2 or 3 blog posts and never get much traffic, you will have some people who get "lucky" and get 100,000 hits in one day, and a very few who create a lot of content and get lucky a lot.

Shared CPU & memory on a big machine is great when it comes to people getting lucky...</comment></comment></comment>


Great businesses that aren't being built yet? - ideas-are-cheap https://www.ideasaintworthmuch.com/ <comment><USER2> Nice list. In particular, I think consolidation of payments infrastructure and the anonymous credit card ideas are great though both are some what opposed to each other! Merchant acquiring doesn't need to exist anymore... Just look at the amount of small shops who refuse to accept AMEX or small card payments - they are price sensitive to acquiring fees and some of the savings could be offered to customers an incentives. As you note, network effect is the hard part but I'm sure there's a way. On anonymous payments, I think a credit or debit card like thing that offered anonymity online when buying things would be quite attractive. I would use it. In the EU, you could implement it with open banking and there are various services which already provide virtual card numbers. Problem would be dealing with all the payments regulations.

<comment> ideas-are-cheap Hey, thanks for taking the time to have a read! It's true that those two are somewhat at odds with each other. One builds on top of existing infrastructure and the other attempts to work, as much as it can, without it.

In a funny way, I feel like both could sort of angle towards a similar thing in the end. For example, while you might use a subscription based service to pay anonymously at first, you could, once/if established, also offer checkout options for businesses too. Once you own both ends of the payment, you can start connecting people directly. Paypal arguably do this already - when you pay someone's Paypal account from yours, it just settles immediately and internally.

> On anonymous payments, I think a credit or debit card like thing that > offered anonymity online when buying things would be quite attractive. I > would use it.

That is interesting to hear - I have spoken to a number of people who also say they would use such a service if available. What do you think would be the absolute minimum such a service could offer? I think it is the virtual cards and an email address, do you agree? How much do you think you might be willing to pay for it and how would you expect the pricing to work? A subscription? A small charge for each time you use it?

I agree with your general sentiment about merchant acquiring etc though - <AUTHOR> re AMEX, I don't know about the US but in the EU basically no one takes it. Payments is one of those systems where you draw a diagram of how it works, and you just think "if I designed this from scratch today... it definitely would not look like this!". I think it's inevitable it will change, and it is starting to already. The change we've seen so far is, in my opinion, mostly superficial though (much like the anonymous online payments idea would be).

> Problem would be dealing with all the payments regulations.

Yes the regulatory hurdle is a big hurdle to overcome for all the financial services ideas. I believe it is possible but you would need to get in touch with the regulator from day one and be clear about what you wanted to do. E.g. Monzo in the UK used this strategy. They just approached the FCA right at the start, and said what they wanted to do, and the regulator told them what they had to do.

I think this is tough but probably more tractable than people imagine with a bit of determination!

> As you note, network effect is the hard part but I'm sure there's a way

I think it's extremely hard! But then I think, it wasn't so long ago that not a single store or restaurant could take credit cards of any card (they didn't exist). How exactly did mastercard get going? Did they start with one location? I would like to research this, do you know anything about it?

My intuition is that by focusing on small businesses and their customers at first, you can actually offer something they don't have access to. I see many local shops stil advertising with flyers or street signs and using stamps on a card for loyalty programs etc. Word of mouth and perhaps a facebook group is the only way they reach their customers. A platform that connected them and their customers would potentially have real value to them. For example, as a consumer using the system, I might be able to quickly see which places have got lunch deals on within half a mile, then automatically claim my discount by paying with the app.

What do you think about that? What would incentivise you, for example, to put a small amount of money into that system and pay for things with it? Access to unique offers? Loyalty schemes? Supporting local businesses? A unique payment experience? Itemised receipts (not on a bit paper!)?

<comment><USER2> Sorry about the slow reply here.

With the virtual credit cards, you also need a billing address in most cases. I guess that can be the same for all customers. Perhaps they also get an email address with it and that handles all the receipts/invoices. Alternatively they can all be sent to some service/app where they can be sorted/managed.

I would like to use something like this if I'm not keen to share my card details with a company e.g. because I know they've had a data breach in the past or something. How much would I be willing to pay for it? Probably not much to be honest, maybe a few quid?

Must admit, I like the acquiring idea more.

On the merchant acquiring stuff I can see the attraction for merchants but what's the incentive for customers? I guess there has to be some other benefit... e.g. offering credit on decent terms to customers but here you are competing with credit cards? Or maybe offer discounts for paying using this service. Maybe you can offer a discount AND credit. I guess you'd need to find out how price sensitive the merchants and customers are. Experience suggests that small merchants are price sensitive to acquiring fees as they have minimum spend limits etc. Large retailers e.g. Tesco don't care so much.... though I was buying a car at the weekend and the dealer stopped accepting AMEX due to the acquiring fees... I guess they were cutting costs in the face of Corona Virus recession.

As you note, perhaps the app could collate all your receipts and warranties - could be useful. Itemised receipts would be particularly useful for some.

I imagine a company which offers this service (in the EU/UK) would be an open banking payment services provider. That is, customers add their bank account details and permit the service to "push" payments directly to retailers when they buy something via an API. Of course, customers would manually approve each payment via the app or whathaveyou.

Challenges: 1) how do you handle off-line payments? 2) how do you handle disputes?

On the history of merchant acquiring: maybe this helps: [https://blog.thesharmas.org/2020/06/05/history-merchant- acqu...](https://blog.thesharmas.org/2020/06/05/history-merchant-acquiring/)

<comment> ideas-are-cheap No worries - there is hardly an obligation for you to respond :).

Re that anonymous payments idea - you are thinking along the same lines as me re the email and billing address. Getting all the junk/advertising email sent to one place would be a good feature.

Really though, asking people to pay for anonymous transactions is simply an 'in'. I don't think there is a big market there, but I think there is _a_ market.

The goal would be to use that as a springboard to start offering banking services to consumers (e.g. credit, payment consolidation), and merchant banking to online retailers (similar services plus others, e.g. perhaps you could buy a saas business' future cash flows off of them).

If you were able to own both sides of that you would not only make it much easier for people to interact with new online businesses safely, but also provide an integrated identity/payments service to said businesses. You would aim to reduce the cost of the original product to 0 as you became able to generate revenue in other ways.

\---

The acquiring idea...

You have some interesting thoughts here. Yes I think you're right that finding an incentive for consumers to use the service is not immediately obvious. Long run, I do think that you would be able to offer credit (both to merchants and consumers) and other financial services but I don't think that is a viable 'way in' for the business.

To start with, I think it needs something simpler and more obvious that you can support with a relatively small number of customers. Ideally without stepping over more regulatory boundaries... you mention discounts and I think that they are the obvious target (though I may well be wrong). I also think that discounting (or other offers) for small businesses is not very well served currently.

Here's an example (fairly arbitrary) of how you could try and kick the thing off - it's obviously a sort of growth hack but its semi-believable.

Pick a student city and convince a load of local bars/restaurants to sign up on the merchant end by promising them no fees and a way to advertise offers to the next batch of students without having to put up flyers and so on. You would then get students to sign up with the promise that they will be able to use it to get cheap food and drinks. You would monetise by charging a referral fee on people redeeming the offers via the app.

If that worked, you would replicate the model in other cities while also trying to expand the number of merchants signed up in existing cities (to appeal to more than just students).

Long run, I think the goal of this business would be to offer both merchant and retail banking services on top of the payments system. In addition to that, you could also open up your platform for other financial service providers - with a referral fee or service charge model.

Your idea of implementing this via open banking is quite interesting - I must admit, I didn't actually think of that.

Would you be interested to talk about this in a more... tangible way? You can reach me on ideasaintworthmuch at mail dot com (mail is not a typo for gmail).

</comment></comment></comment></comment><comment><USER3> These are interesting but they just make me wonder why they're not being done already. Perhaps there's some fundamental reason you're missing? Also, the contracts idea doesn't seem that solid to me - my last tenancy already had digital contracts like this. Exactly what niche is the target?

<comment> ideas-are-cheap Fair questions and thanks for taking the time to reply. For many of them, I think some businesses are already working in a similar space. For example, the data science tooling idea is arguably being worked on by many businesses/oss projects. E.g. mlflow, metaflow, pachyderm, dolt (and more).

However, I don't think anybody has really wide spread adoption yet and I think it's because the tools aren't accessible to the majority of researchers currently. Take, for example, mlflow. It's a great tool in many ways but requires you to think fairly carefully about how to structure your application around the framework. Additionally, to run experiments, you need to set up your own infrastructure.

These requirements may be met in some settings (larger businesses with a modern engineering culture) but I think are not met in the broader market (university research departments, smaller businesses, businesses without the modern engineering focus, etc).

For the ideas in the personal finance space, there are, as we all know, a large number of fintech companies that are attempting to tackle many aspects of this right now. It's a very tough space to get into due to regulation and poor economics at small scales. It's a domain I'm familiar with though and that means a lot to me. I think the financial industry has a long way to go and will almost certainly look radically different in the future. As it stands, I believe the industry is too fragmented from the customer perspective, with different organisations offering parts of what to people are really all the same thing.

To plan and save for my future I need a current account with a bank to manage my day to day spending and as a 'hub', savings accounts (potentially with other institutions) to save cash, I need a brokerage account to diversify my savings, a company pension pot (with one or more providers depending on how you've moved jobs) and possibly an IFA to tie it all together and cut through the jargon and save you time. This should all be one thing - and it should be easy, and cheap.

Re the contracts idea specifically - yes I am aware of a few firms/organisations that independently manage contracts digitally. The idea is about trying to provide that functionality as a service with the intention being to make consumers lives easier as much as businesses (e.g. I would like one central place where I can manage all of my contracts, sign them, ask questions, be reminded of upcoming obligations, etc). Right now, I think most people have a drawer somewhere full of paper that could probably be organised better.

I'll be honest, I don't have a specific niche yet. If I were to validate that idea further, I would approach legal firms, landlords, and legal departments as saas businesses first most likely. I'm sure there are other sectors worth considering. It may also be that the business first way is the wrong way to approach it? Perhaps You could build a tool for consumers first.</comment></comment>


How to win a trade war: When the US took on Japan - <AUTHOR> https://edition.cnn.com/2019/05/24/business/us-china-trade-war-japan-intl/index.html <comment><USER2> How about we stop focusing on "winners" and "losers" and try to focus on mutually benefitting each other?</comment>


Ask HN: To which OSS projects are you actively contributing to? - <AUTHOR> <comment><AUTHOR> Trying to get a few suggestions. I'm good with JS (React/Node) and Swift.

I've contributed to apple/swift and the Linux Kernel in the past, but testing the changes and building these projects might get frustrating sometimes. And to be honest I don't like C that much.

I have a few hours free per week and maybe someone here on hn might need some help on their oss/project.

<comment><USER2> I haven't contributed to some open-source projects in a while, but I know many friends who have heard contributed to many projects through 'Google Summer of Code': [0]

Sure, you don't have to only contribute via GSoC. You can also contribute directly to them in your spare time which is how some of the contributors (not all) have done before being core developers.

[0] [https://summerofcode.withgoogle.com/organizations/](https://summerofcode.withgoogle.com/organizations/)

<comment><AUTHOR> aren't you required to be a student for gsoc? Or you're saying just to pick something of that list?

</comment></comment></comment><comment><USER3> [https://cuelang.org](https://cuelang.org)

[https://github.com/cuelang](https://github.com/cuelang)

Would you be interested in working on the browser based playground?

</comment><comment><USER4> Besides my own projects, the only one I've been contributing anything to lately is Apache River.</comment>


Why programmers will never be the brightest and the best - <AUTHOR> http://www.selectedintelligence.com/post/158441261184/why-programmers-will-never-be-the-brightest-and <comment><USER2> Great article. Sums up a lot about how I feel about programming as I get older (and what I hear older programmers saying). Having to consume and retain so much complex mind garbage every few years just to still be told what to do gets pretty old.

But the one thing I still enjoy about programming, after all these years, is being in the center of a number of concerns and having to negotiate them all, while still delivering something of value on a fixed time frame. There's a certain thrill to seeing the legislative, executive, and judicial branches of a huge process converge on one person, even it's for the tiniest moment about minutest of details, and have that person be you. Simply because no one else thought of some important problem, it fell into your lap and suddenly you were responsible for solving it, and you had to think on your feet. Then you get to explain to everyone else what you did, why you had to do it, and what the plan is going forward, and no one has any option but to nod their head and say, "Hey, thanks! Good job!"

There's a certain type of engineering mindset that sees this as a failure of process, and likes to hand out blame for letting such power fall through the cracks into the hands of a random developer. But to me, it's become the only fun aspect of the whole occupation. If it happens to me once a year, it's the highlight of my job for that whole year.

<comment><USER3> Fantastic comment. You totally explained how I feel, and I couldn't really articulate it.

</comment></comment><comment><USER4> > We all accept, to a greater or lesser degree, that the end user of our work > is the one that matters. In theory. In practise most programmers have a mix > of dread and revulsion for the user. Even when the user may be a future > self. Look at Dahl's language in this supposed paean to the user.

>> "The users - the one who just want to see a webpage - don't care."

> Yeah users. Those passive consumers of stuff. How he loves them.

I don't think you've got this right, here. When Dahl says that users don't care about those things, he's not insulting users. It's true, they don't care about those things. But that's not a criticism; why should they care about them? They've got their own things to worry about, their own concerns and goals and none of them are served by having to care about the morass that we've created. You're reading it as "users don't care because they're too stupid to know that this stuff is important", Dahl meant it as "users don't care because how dare we waste their time with this shit?"

<comment><USER5> I think a more descriptive, more accurate, less catchy phrase would be "The stakeholders - the ones utilizing the results of your software - don't care how the results are created as long as they're easily accessible, accurate and timely. And don't forget, developers are users too, often the way something is written or the way it behaves at a lower level is actually important to them."

</comment></comment><comment><USER6> Is this why I find myself awake at night reading papers about The Foundations of Mathematics, Quantised Inertia or Squeezed Light (for some random examples taken from my history). I've been writing C++ for "too long" now and subconsciously my intellect is grooming me to move into something else?

</comment><comment><USER7> > _But hacking on systems that are being used in production? Why would an > intelligent person would want to spend time fighting with 30 years of > someone else's errors and accumulating a vast store of arcane and ultimately > worthless knowledge?_

How about: because that intelligent person is paid at 2 to 3 times as much as an academic working strictly on original ideas, and $Infty$ more than a hobbyist working strictly on original ideas.

That work doesn't preclude them from having intelligent hobbies, and side projects that may well outstrip those of the impoverished academic or hacker.

</comment><comment><USER3> There are different types of users, and that is why the original user argument is strange.

On a large project, every programmer is a user, every engineer, stakeholder, analyst, tester, service desk guy, hundreds of people, all with different powers on the final system.

That is why we build all those complexities - different aspects for different target groups.

</comment><comment><USER8> I'd argue that there are essentially two problems in computer science:

1\. Math.

2\. Dealing with the hardware.

Virtually all the ugliness is a product of the interface between these two areas. Dealing with the hardware requires a fascination with minutiae and imperfection, while working in Math requires a fascination with generalities and perfection. The people on the math side create systems like Haskell, which let you express very abstract concepts, and reason very generally about your code, but make dealing with hardware issues difficult. The people on the hardware side use things like Forth, which is very powerful for building code that works closely with the hardware, but whose paradigms actively discourage the generality present in many other languages.

And so, what's needed is someone who can develop a system that can fully express high level math concepts in such a way that there is a straightforward mapping to the messy world of hardware capabilities.

However, I think the "killing blow" for pure programmers' motivations comes when they realize that mapping between the pure world of math and the messy world of hardware isn't enough. The focus on "end users" is the tacit admission that even if you do successfully build a beautiful system, most people don't want to work at a high level of mathematical abstraction. If you really want to revolutionize computer science, in order to accomplish the actual revolution, your system needs to be able to let people work in the terms they're already comfortable with:

(messy world of existing programming languages) -> (your pure math) -> (messy world of hardware)

But I don't think these hurdles constitute a "great filter" in the sense of the original article. Its just a quirk of human nature that the people interested in the pure math bit in the middle tend to find the messes on either side tedious and unnecessary for their insights.

What essentially ends up happening is that the people who are only concerned with intellectual satisfaction get such a big dose of satisfaction from the pure math in the middle, that they never bother with the messy bits on either side. So I've found that the people who do the most impressive work have some external-to-computer-science itch they're trying to scratch. People like Christian Schafmeister[1] whose chemistry aspirations led him to create a new Lisp to glue together C++, Mathematica, Maxima, and Fortran in such a way that he can highly efficiently express and compute the math he was trying to solve. These kind of people fight through the messy world of existing languages to express the pure mathematics of their field in such a way that it can run efficiently on the messy world of hardware.

[1] [https://www.youtube.com/watch?v=8X69_42Mj-g#t=17m25s](https://www.youtube.com/watch?v=8X69_42Mj-g#t=17m25s)

</comment><comment><USER9> Because money.</comment>


Check if robot really is Googlebot - <AUTHOR> https://github.com/kolodny/is_googlebot.php

<comment><USER2> Very nice. I was just reading yesterday that it's very common for spammers and the like to impersonate googlebot.</comment>


Even More Amazon Censorship - <AUTHOR> http://jamthecat.blogspot.com/2010/12/boycott-amazoncom.html

<comment><USER2> I think we've gone a little crazy with the censorship word. This guy can print his book somewhere else and distribute it.

Amazon (a private company) has decided they don't want these books on it's platform (for whatever reason).

Now if the gov't said Amazon had to take these down, that's a problem. But that's not what happened.

<comment><USER3> It's still censorship, and some would prefer not to support businesses that arbitrarily censor speech.

<comment><USER4> "Censorship is suppression of speech or other communication which may be considered objectionable, harmful, sensitive, or inconvenient to the general body of people as determined by a government, media outlet, or other controlling body."

It's not censorship.

<comment><USER5> You're not playing the "cite a definition" game correctly. You neglected to include the reference to the presumably-a-dictionary you used. How am I supposed to go back to the same work, cite another subdefinition that has about a 50-50 chance of actually applying, and then argue that I'm correct while simultaneously invoking some half-assed "Amazon is really a newspaper, or maybe something involving cars" metaphor? The Internet has a well defined protocol for this dance!

Anyhow, trying to shut things down by definition only works in mathematics. Redefining away what Amazon as "not censorship" won't mollify anybody, as they can still choose to be legitimately annoyed at the perfectly legal and arguably perfectly ethical actions Amazon have taken. Acting legally and even ethically doesn't mean you have the right to not be criticized.

And, seeing as how if this is "not censorship" we don't actually have an English word for what it is... yeah, it's censorship. It's not government censorship, but it's censorship. It's also a sufficiently different kind of censorship that simply knee-jerk applying our attitudes towards government censorship may not be relevant, but English simply doesn't have the granularity to deal with this. That's OK. _Everything_ works that way anyhow.

<comment><USER4> The first result on a Google search, but feel free to pick your favorite as the test still stands: [http://www.google.com/search?q=censorship&ie=utf-8&o...](http://www.google.com/search?q=censorship&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en- US:official&client=firefox-a)

Amazon is a media outlet but they are not suppressing his speech. They are not stopping him from publishing the work or even stopping him from writing it. They are choosing not to distribute it. Thus the suppression test fails and it is not censorship.

</comment></comment></comment></comment></comment><comment><USER6> It is censorship.

It's not enough to say that "it's a private company, it should be left to do as it pleases" (as the counter-argument goes). In many other domains there are rules enforcing general principles, _especially for private companies_. Employment is one of them.

A company cannot say "since, as a private company I should be free to make my own employment policies, I'll just engage in race discrimination".

Just the same, the First amendment should be enforced for private companies.

If your business is helping anyone publish content, then it should not be possible for you to filter out content or authors based on your own private rules/opinions.

Anything that's legal is acceptable -- and the legality is decided by a court of law.

I'm quite optimistic we'll get there eventually, but it'll take time and effort.

</comment><comment><USER7> I think the pedophile-guide incident has Amazon paranoid. Amazon has a huge task ahead of it in both shifting the publishing world to e-books and maintaining their lead in that market. They decided they can't afford negative publicity right now: unfortunate, but entirely understandable.

</comment><comment><USER4> This isn't censorship. They are not suppressing his speech, they are choosing not to disseminate it.

Another thing, if the title of your book talks about raping someone, some people are going to find it offensive and some businesses are not going to want to put it on their shelves.

</comment><comment><USER8> Now you can see why the government wants to privatize everything. If it's a private institution they can infringe upon your rights however they like.

<comment><USER9> Upvoted. Corporations are regulated significantly less, and as they become more and more powerful, it becomes more important to pay attention to what they're doing.

> Italian Fascism and most other fascist movements promote a corporatist > economy whereby, in theory, representatives of capital and labour interest > groups work together within sectoral corporations to create both harmonious > labour relations and maximization of production that would serve the > national interest. - <http://en.wikipedia.org/wiki/Facism>

(EDIT: I do take small issue with 'governments wanting to privatize.' I don't think the government does at all. Other interests, yes. The point still stands.)

</comment></comment><comment><USER10> Based on the titles alone I was tempted to side with Amazon on this, but if you read further, you find that these are novels that probably have redeeming value. I don't know about the quality of writing, but the content isn't any more pornographic than a romance novel or slasher flick.

<comment><USER11> I think this is the subject of the discussion:

[http://www.buy.com/prod/how-to-rape-a-straight- guy/q/loc/106...](http://www.buy.com/prod/how-to-rape-a-straight- guy/q/loc/106/207510301.html)

> Curt has been beaten, betrayed and brutalized by just about everyone he's > known. And his mother - once a prostitute, now "born-again" and married - > has banned him from the family. But six years in prison taught him a lot - > including how to force straight cons to ejaculate as he rapes them, and how > that can be a very satisfying method of revenge. Now he's out and trying to > stay straight, but problems with his marriage and zero prospects of earning > money enough to live on make that almost impossible. It's while he's > hustling two gay men in a bar one afternoon that he mentions what he's done > in prison. . .and the bet comes up.It seems the men, Wayne and Lenny, want a > little revenge of their own against someone who's caused them trouble. If > Curt can make this one "straight" guy "get off" while being assaulted, > they'll give him a car, cash and a chance at a new life. Being in the mood > to do some damage, Curt agrees and they start laying their plans. But step- > by-step, Curt realizes things are getting out of control, and he has no one > to pull him back from the abyss. And a stupid little bet is threatening to > plunge him headlong into disaster.

</comment></comment><comment><AUTHOR> It's not going to be a good world if Fox News is allowed to intimidate Amazon into censoring whatever it finds inappropriate.

Not at all.

<comment><USER12> Amazon doesn't care what Fox News says, they're doing this because it makes good economic sense. More people will be angry at Amazon for them selling it than there will be those angered at its removal.

So Risk > Reward.

And anyways wouldn't Fox News be the one defending the guy? They seem to always take the tea party side which the author would almost certainly be on.

</comment></comment><comment><USER13> > "How To Rape A Straight Guy" has a very provocative title, yes

I would say it did its job of provoking then.</comment>


Ask HN: As a mid-level ruby developer, should I learn Java or ObjC next? - <AUTHOR>

I feel I should learn one of the two main mobile languages. I own an Android phone, but I feel iOS is better to develop for (in terms of making something that could sell). However, there are external benefits to both that seem to favor Java; mainly, Java is used at larger enterprise places whereas Objective-C is only useful to make Mac Apps, and nothing really beyond that.
I can't decide, because they both seem useful. I have no other inclinations (I wish to continue development as a ruby dev, so this isn't terribly influenced by future career choices).
What are your thoughts? <comment><USER2> Learning Java to do Android and learning Java to write large web and server applications for the enterprise are two completely different domains which just happen to share the same language.

I think that one can learn the basics of Java to get started quickly, but the majority of one's time will be spent learning the intricacies of the SDKs and libraries.

So the bigger question to ask yourself is whether you want to write mobile apps or enterprise apps. Pick one, and go from there. Don't worry about the language.

<comment><USER3> This is probably the best answer here. The time to learn Java or Objective C (the language) is miniscule compared to the time it takes to learn the frameworks and the Way To Do Things.

Learning to write Android apps is going to teach you very little about writing J2EE apps, so don't let that weigh your decision.

</comment></comment><comment><USER4> Obviously C/C++. The most insane choice but also the only sane choice. C/C++ is supported by literally EVERY platform. Whatever platform you try, it will support C/C++, so that's most useful. Even you can't find usefulness from it, it will make you to feel any other language just easy.

<comment><USER5> I agree with @eonil. I'd recommend learning C. As someone coming from a Ruby background, the ability to understand the ruby internals could be very beneficial. I've started on this path myself. I bought an Arduino to make it a fun electronics / C side project.

</comment></comment><comment><USER6> The choice between the two doesn't matter much, as others have pointed out. The part that does matter is which language is going to keep you engaged?

Learning another language/framework and how to use it means an investment of time, and whichever one will provide that interest/motivation to keep using it will be the one for you. You note that iOS may be easier to make sellable apps for, so that might be the better route for you.

</comment><comment><USER7> Java. The whole world using it vs. ObjC only Apple.

</comment><comment><USER8> I think the premise of your question is wrong. Why do you have to decide to learn one or the other? Why not both? Another way of thinking it would be which one should I learn first? The answer to that is it depends on what your plans are? Are you trying to build apps to learn the platform or build a business?

Hope this helps.

</comment><comment><USER9> What type of apps? I ask because I'm using LibGDX to create games for Android and those games can run on iOS by using RoboVM.

Also Android development can be done on almost any type of computer while you must own a Mac to develop iOS apps.</comment>