Hacker Newsnew | comments | show | ask | jobs | submit | sophacles's commentslogin

And an armed insurrection in the US would do different? Further, as pointed out above, anything popular enough to become a huge deal would have an awful lot of military members supporting it. The fancy gear would find it's way into the hands of both sides.

reply

sophacles 2 days ago | link | parent | on: Amazon Cognito

Is there anything like this in the enterprise space? Many of our customers want authentication against their internal Active Directory or other single sign-on solution. It would be nice if there was a company that exported an api, and did all the work of connecting up the various types of auth, so that we can focus on our own product rather than redo integration work that has probably been done by many other companies already, probably even for the customer's other services.

reply

kriro 2 days ago | link

There's a pretty big market for this/enterprise level identity management in general. At least in Germany, companies usually prefer inhous/more control over hosted solutions though (especially in the light of the last 1+ year). SAP IdM is the big dog here (it's somewhat messy though since SAP bought the technology and it shows that it's somewhat of a hodgepodge imo) and the only one I've worked with. I'm sure all the big ERP companies provide this in some way.

Not really the API you're looking for but I thought it was worth mentioning.

reply

idea_shot 2 days ago | link

Check out Mobile Identity Connect -> http://www.kinvey.com/blog/3856/mobile-identity-for-the-ente... and http://devcenter.kinvey.com/ios/guides/auth-link-for-ldap

reply

sophacles 2 days ago | link

Thanks for the pointer. This particular service is useful to know about, but a bit more mobile focused than is appropriate for our current product. Noted for future reference tho!

reply

cobralibre 2 days ago | link

For various meanings of "like this", there's also Okta, Ping Identity, UnboundID, Forgerock...

reply

skram 2 days ago | link

Have you seen Stormpath?

reply

sophacles 2 days ago | link

I have now. Thanks for the pointer!

reply


The only thing I disagree with is "use nested comprehensions" thing. In my mind: x = [letter for word in words for letter in word]

is inside-out or backwards or backwards. I want the nested for being the less specific case:

   x = [letter for letter in word for word in words]
makes more sense in my mind.

(It's also my first answer to the "what're some warts in the your language of choice).

reply

jules 4 days ago | link

Even clearer:

    x = [for word in words: for letter in word: letter]
This also has the advantage of being readable left to right without encountering any unbound identifiers like all other constructs in Python.

reply

hueving 3 days ago | link

As someone who spends a significant amount of time in python that is much harder to follow. There is an expectation for order in list comprehensions and what you wrote completely violates it.

reply

njharman 4 days ago | link

I'm in the camp that if your list comp needs more than one for clause, it's complicated enough to be broken out into actual for loop.

reply

jevgeni 4 days ago | link

Everybody, listen to this person!

reply

jules 3 days ago | link

Then it turns into this:

    x = []
    for word in words:
       for letter in word:
          x.append(letter)
Which in addition to being far more verbose and less readable, is also less efficient.

reply

sophacles 3 days ago | link

I'll tell you what I tell my team: it's barely more verbose, and the readability is up for extremely serious debate (I mean, everyone understands nested for loops, but the nested list comprehension thing is wierd... why is something that appears way way before the innermost "for" the same as something in that for loop's declaration?)

It may also be less efficient. When I'm shown numbers that the difference between the comprehension and the for loops are (in each specfic instance, or in aggregate for the program in question) is above statistical noise AND it's a significant factor in overall runtime (I won't ever worry about a millisecond when the runtime is 1s), then I'll gladly say: put them in.

Until then, just use the loops. Use of really strange language features that are surprising, not exactly idiomatic (this argument is common for this case) and not shown to be of actual benefit, are detrimental in a polyglot environment.

reply

jules 3 days ago | link

When I see a list comprehension I can see with a single glance what it's doing. Not so with the 4 line for loop. Comprehensions aren't a strange language feature in Python either...it's one of the central features of Python.

Don't use something until it's proven to yield a great benefit is a very conservative approach. That may be appropriate in some cases, but I'm very glad that I am not in such a team since that would be incredibly frustrating. I much prefer an approach where you go with the choice that's most likely the better one, even if it's not 100% proven better or not a big difference.

reply

sophacles 3 days ago | link

I'm talking strictly about multi "for" comprehensions. They just are too confusing to me and most of the people I've worked with ever. But we also use lots (most) python features fully, just that one has been the source of dozens of bugs in this one codebase, not to mention others I've worked on with other people. It is a shitty non-intuitive syntax.

Nested for loops, flatten(), various itertools functions and chained generator expressions all suffice, and I have yet to see them provide measurable slowdown to actual code compared to good algorithms and decent factoring. Like I said, I'll even use multi-for comprehensions if there is a measurable difference over nested for-loops.

Also, I think you are intentionally misrepresenting what I said - when I said don't use "weird stuff" I explicitly excluded idiomatic language things. That includes (for python) single for comprehensions. The multi-for comprehension is something I rarely come across in the wild despite it's long time existence in python - it's a weird one.

reply

hueving 3 days ago | link

I think you are trying to justify your strange preferences after the fact. How exactly were there bugs caused by nested for loops that you encountered? It's not like if you mess up the order it will actually run without throwing an exception. Nested list comprehensions are idiomatic python. It's really strange that you don't let your team use them because you are afraid of them.

reply

jevgeni 3 days ago | link

Well, Google doesn't recommend it either (http://google-styleguide.googlecode.com/svn/trunk/pyguide.ht...), but I guess they are all bloody noobs or whatever.

I mean, single level comprehension is good. Nested list comprehension is OK only in most trivial cases. In my opinion, if I see how a person uses list comprehension, I can tell, what kind of person this is.

There are people who, for example, do this def all_is_okey_dorey(lst): return all([some_predicate_fn(x) for x in lst])

instead of this def all_is_okey_dorey(lst): for x in lst: if not some_predicate_fn(x): return False return True

and can live with themselves somehow.

Or there are people, who refuse to acknowledge the existence of anything besides Python 3.x and when forced to write in 2.x use list comprehension instead of iterator comprehension.

Thing is, the validity of using nested list comprehension depends not on the amount of for loops you have, but on the thing you want to do with the item. If it's just selection, then it might be ok. If you want to apply some kind of function to it, then it's most probably the case of trying to be too clever.

reply

hueving 1 day ago | link

If you think two loops is not a "simple case" of a list comprehension as Google suggests to use them for, perhaps you shouldn't be doing code reviews. It sounds like your team would be held down by your weak grasp of the language.

reply

jules 2 days ago | link

The only thing wrong with that list comprehension version is those [ ]

    all(some_predicate_fn(x) for x in lst)
Much better than the loop.

reply

ghshephard 3 days ago | link

It's much more readable, people won't make mistakes on it the way they do when trying to be too clever with their multiple-for statements in list-comprehensions.

Trying to pack too much on a single line is one of the sins of perl, and I'm happy to read python code that is comfortable being multi-line.

reply

rbonvall 3 days ago | link

For loops can often be avoided. I would write this particular example in one of these ways, that I think are readable:

    x = []
    for word in words:
        x.extend(word)

    from itertools import chain
    x = [letter for letter in chain(*words)]

    x = list(chain(*words))

reply

YokoZar 3 days ago | link

Wouldn't chain(*words) require unpacking all of words before feeding it into the chain function, storing a second copy of the word list in memory?

reply

rbonvall 3 days ago | link

Yes it would, but I don't care about these small efficiencies, say 97% of the time ;)

The lazy version in Python 3 would be this one:

    list(chain(*map(iter, words)))
For Python 2 one has to use itertools.imap instead of map.

reply

njharman 3 days ago | link

It's not all or nothing. One, last? for loop can be list comp.

reply


Not the op, but I'd accept the confusion response of: [[]] [[],[]] [[],[],[]]

because the behavior is the same, whether or not they misread an 'l' as a 1.

reply

pyre 4 days ago | link

Python doesn't seem to agree with you :^)

  In [1]: a = []

  In [2]: a.append(a)

  In [3]: a
  Out[3]: [[...]]

  In [4]: a[0]
  Out[4]: [[...]]

  In [5]: a[0][0]
  Out[5]: [[...]]

  In [6]: a[0][0][0]
  Out[6]: [[...]]

  In [7]: a[0][0][0][0]
  Out[7]: [[...]]

  In [8]: a.append(a)

  In [9]: a
  Out[9]: [[...], [...]]

  In [10]: a[0][1][0] is a
  Out[10]: True

  In [11]: id(a)
  Out[11]: 4547140064

  In [12]: id(a[0][1][0])
  Out[12]: 4547140064

reply

sophacles 3 days ago | link

Yeah, the whole infinite loop thing. Wasn't fully thinking when I wrote my reply. Good catch.

reply


Not defending google. Actually just slightly ranting on a tangent... Google today is not google 5 years ago. There are different employees, different managers, etc. To say that google (an entity with a single agency, as if it was a single person) "hustled" us by going through these changes is just not an accurate statement .

reply

[deleted]
dragonwriter 4 days ago | link

> Why would middle management changes affect their culture and principles significantly?

Because middle management acts as a filter on upper management's view of operations, and a filter between upper management and the people actually doing the work when it comes to directions going the other way. The effect Bruce Webster calls "thermocline of truth" [1] is one significant manifestation of this.

[1] http://brucefwebster.com/2008/04/15/the-wetware-crisis-the-t...

reply


One thing this solves is the pronunciation of odd spellings of names, and to an extent, names that are foreign to the recipient (e.g. to an anglophone many eastern European and Asian names don't have an immediately decipherable pronunciation from spelling).

However, one of the problems it doesn't help with, is that different languages and language families have sounds that are not used in other languages. This means people will still get your name wrong, because they don't necessarily know how to make those sounds, nor do they even know how to hear the subtle distinctions - e.g. the classic r/l confusion, or my own inability to get tones right when trying to learn mandarin words/phrases.

I guess what I'm saying is I don't think anyone should expect this to suddenly make everyone pronounce their name perfectly all of a sudden.

reply

taejo 9 days ago | link

People with such names might adapt them to be pronounceable (I do: my name has an English vowel which doesn't exist in German, and I introduce myself with a German approximation when I'm speaking German). But even the pronounceable version might not have an obvious correspondence with the written name. For example Nguyen might be happy being called [wɪn] rather than [ŋʷĩəŋ], but many English speakers will say something like ['guyɪn].

reply


So as I read this comment at my favorite coffee place, a UPS truck is blocking 2 parking spaces. It's been parked there about 5 minutes, and several cars stopped, thinking it was leaving soon, messing up traffic on the road before driving away because it was taking too long. That's lost business and serious inconvenience for other people. As I type this the guy has left, but the package he took in was small enough for a drone to deliver.

Now a different truck has pulled up and double parked across the road, with the driver taking a document tube into the office building across the street.

I wish this example was contrived, but I just watched it happen.

Several drivers were inconvenienced (an ongoing situation at the moment, and I've had to listen to the sound of the idling engines, which are definitely louder than the cars passing by. Drones on the other hand would have zipped in and out, without disrupting the traffic or making me listen to idling truck engines for several minutes in a row.

It's not only about just-in-time delivery for ME, it also reduces a bunch of secondary hassles.

-----


It's even worse than that... I live in Illinois, a state where there are not statewide quotas... however:

The cities have the ability to add extra licensure requirements, so quotas can and do exist at the city level. Further, there are strange rules about entry to taverns - for example age of entry need not be legal drinking age which differ by city. There are also city or even smaller administrative district rule over what can be sold, pricing rules (e.g. near the college campus there is a rule about the minimum price of a drink special that doesn't apply to a lot of other parts of town) and so on.

-----

verboten 27 days ago | link

Regarding the age of entry, I recently walked past a bar in Chicago with a posted minimum age of 23. This struck me as odd (and somewhat offensive). I did a few searches, but had trouble locating any relevant information. Do you happen to know if the legislation provides insight into this sort of practice?

-----

kgermino 27 days ago | link

I know of quite a few places in Chicago with a mid-20's minimum age. To my knowledge it has nothing to do with any legal requirements but is based on the idea that slightly older people are less rowdy/better able to handle their drinks.

When I was 21/22 I rarely had a problem getting passed the bouncers in places with the higher age limits because "you don't look like you're going to do anything stupid"

-----

verboten 27 days ago | link

Legality aside, because I don't doubt it is legal, something about the deliberate act of posting an age makes me deeply uncomfortable.

What I don't quite understand is they can turn away anyone for any [non-protected] reason already. What could be the thought process behind posting this? Especially when the establishment is unlikely to enforce it, as you noted.

As an establishment, feel free to turn away a large, intoxicated group. Similarly, it is your right and responsibility to avoid over-serving. And furthermore, you may choose to establish whatever ambiance you choose through your decor, music, lighting, and even pricing. Between these things, you can maintain the atmosphere and attract the customer base you desire.

-----

kgermino 27 days ago | link

I think it just makes things easier. Sure people over 25 are still capable of causing problems, but I’d bet they are much less likely to be trouble and much more likely to politely leave when told they are. It also makes things much easier at the door. If a group of college kids decide to show up one night it’s much easier to say “can’t let you in, too young [and I don’t make the rules]” than “won’t let you in, I don’t want to have to kick you out.” It lets the bouncer deflect the decision and appeal to an authority that’s not in the conversation.

-----

sswezey 27 days ago | link

It may be a college thing, they want to prevent college students and/or handed-down fake IDs from college students.

-----

ceejayoz 27 days ago | link

That strikes me as illegal age discrimination...

-----

hellogoodby3 27 days ago | link

I am pretty sure age is only a protected class over fifty-five (somewhere around there). People can legally discriminate against young people.

-----

ceejayoz 27 days ago | link

Fascinating. Looks like it's 40+. http://www.eeoc.gov/laws/types/age.cfm

-----

verboten 27 days ago | link

That appears to be with regard to employment discrimination. I wouldn't be surprised if there were slightly different standards for serving customers, etc.

-----

TheCoelacanth 27 days ago | link

I don't think there is any prohibition on age discrimination for public accommodations. Title II of the Civil Rights Act forbids discrimination on the basis of race, color, religion or national origin and Title II of the Americans with Disabilities Act covers discrimination on the basis of disabilities, but there doesn't seem to be anything preventing public accommodations from discriminating based on age. The Age Discrimination in Employment Act, which is what prohibits employers from discriminating based on age, doesn't contain anything about public accommodations.

-----

mabhatter 26 days ago | link

Lets take alcohol away from everybody that claims Social Security!!!

-----


Some of it also depends on use case...

Some people use containers like lightweight vms.

Others use it as a way to ensure a solid/consistent userland per process.

Others still blend the two in various ways... I tend to think of it somewhere "a little more than just a consistent userland" but not a full running os image.

-----


I like to phrase this as "style doesn't matter, consistent style does".

It's important to have consistent style, because once a programmer internalizes the local style - some types of bugs become transparent: the upon understanding what something is supposed to be doing, the style provides visual cues to the flows and a certain predictability in the code. When something is wrong it looks wrong.

-----

goblin89 33 days ago | link

Yes, indeed. I think consistency within one file is a good rule of thumb.

As an aside, are there any editors that could automagically infer formatting rules (to use for indenting, folding, etc.) upon opening a file? I'm using vim but I think I'd be willing to switch for such a feature.

-----

More

Guidelines | FAQ | Lists | Bookmarklet | DMCA | News News | Bugs and Feature Requests | Y Combinator | Apply | Library | Contact

Search: