Anyprint: use any language's print statements in Python - <AUTHOR> https://github.com/kragniz/anyprint <comment><USER2> Why stop at print statements? After all if you find yourself successfully using the print statement from some other language, you might accidentally also use its if, for loop, file handling and class declaration constructs among many others. Who's looking out for those people? This is just the beginning!

<comment><USER3> Coming from Powershell, nobody told me JavaScript copies arrays by reference instead of by value. Why would anyone want to pass a reference?

<comment><USER4> In Object Oriented Programming it can be useful if you want to pass the reference as the argument instead of the value.

</comment></comment></comment><comment><USER5> Ironically, what I miss most from Python is Python2's print, which for a language proud of getting rid of parenthesis, that is very contradictory....

<comment><USER6> print chevron in python2 is super awesome

        print 'hello'
        f = open(file, 'w')
        print>>f, 'world'

It just feels more "powerful" than Py3k's

        print(somestring, file=someopenfile)

<comment><USER7> > More powerful

But less obvious and readable, which is anti pythonic. If you want "power" over readability, there is ruby/perl.

<comment><USER8> I'm not going to discuss perl readability, but the fact is that I cannot simply 0%% to beginning of the block in "readable" python. ?:$<CR> does its job though.

</comment></comment></comment></comment><comment><USER9> Let's hope they also add

        (format t "hello ~a!" name)

for completeness...

<comment><USER10> To say nothing of vitally important format expressions like

      (format t "~{~a~^, ~}" list)

<comment><USER11> And of course the stuff necessary for word-wrap-in-`format`:

        (format t "~{~<~%~1,40:;~A~> ~}"
          '("these" "words" "will" "be" "wrapped" "to" "40" "characters"))

and the other `format` insanity in: [http://cybertiggyr.com/fmt/fmt.pdf](http://cybertiggyr.com/fmt/fmt.pdf)

<comment><USER9> Behold the mighty power of CL format!! I wonder if the format string language, aka "line noise", is turing complete...

</comment></comment></comment></comment><comment><USER12> Worth noting: the language's syntax must still be minimally compatible with Python -- this isn't some sort of magic parser hack, it's just adding functions and types with special behaviour (like having "cout" be an object that overrides __lshift__). Now, given that many Lisp and Lisp-likes support ridiculous parser hacks (Scheme/Racket come to mind), I bet you really could pull off "Anyprint" in one of those languages...

</comment><comment><USER13> The Testimonials section cracked me up.

<comment><USER14> It looks like your testimonial has been added to the project, ha.

</comment></comment><comment><USER15> Makes all these valid in Python:

        printf("printf %d\n", 10);

        fmt.Println("hello")

        cout << "Hello, C++!" << endl;

        Print["Hello from Mathematica!"]

        console.log("yes");

        System.out.printf("java stuff\n");

        Ada.Text_IO.Put_Line("Ada is cool")

Really funny, including the testimonials:

> Anyprint has many glowing reviews from its many satisfied users: > > * "omg > pls" > * "what is wrong with you" > * "That's stupid and not useful." > * > "Please add my testimonial: "very accurate testimonials"." > * "kragniz, > please stop writing questionable python metamodules :v"

<comment><USER16> > cout << "Hello, C++!" << endl;

For the love of god, please stop using endl. It performs a flush when "\n" is both valid and all that you ever want.

Also what happened to the std:: prefix?

<comment><USER17> Are you saying you never want to flush?

If flushing after every line is good enough for printf then it's gonna be good enough for me~

<comment><USER16> Buffering of Cs stdout is implementation defined. For Linux it is only line buffered in an interactive terminal session and fully buffered otherwise.

> Are you saying you never want to flush?

90% of the time not. The other ten percent include asking for user input, which causes an implicit flush since std::cin is linked to std::cout, and debugging an ugly heisenbug.

</comment></comment></comment></comment><comment><USER18> Lovely! The idea is very similar to NoFail ( [https://github.com/laurentlb/NoFail](https://github.com/laurentlb/NoFail)), a language I've described, but not yet implemented.

</comment><comment><USER19> How about Ruby, Perl or the Python 2 print statements?

</comment><comment><USER20> This project is so wonderful it took down Github

</comment><comment><USER21> Please add support for

        NSLog(@"Hello, %s and %s!", @"macOS", @"iOS");

<comment><USER22> Warning: Format specifies type 'char _' but the argument has type 'NSString _'

<comment><USER21> Whoops! Should have been `%@`

</comment></comment></comment><comment><USER23> Is Fortan's

      WRITE(*, *)

doable? How to handle the * isn't jumping out at me.

</comment><comment><USER24> Please add support for:

        `0:"Hello from K.\n"

</comment><comment><USER25> Ironically, it doesn't (and can't) support Python 2 print statements.

<comment><USER26> And by extension, QBasic's PRINT statement. 0/10.

</comment></comment><comment><USER27> In all seriousness, it never occurred to me before that because of access to "globals", an import statement can introduce (or alter the value of!) unexpected names.

</comment><comment><USER28> Can I have a D style:

      "Your text here".writeln;

<comment><USER29> You can monkeypatch str type with:

[http://clarete.li/forbiddenfruit/?goback=.gde_50788_member_2...](http://clarete.li/forbiddenfruit/?goback=.gde_50788_member_228887816)

</comment></comment><comment><USER30> Now implement printing to a string (sprintf, etc.)

</comment><comment><USER31> All your testimonials are belong to us.

</comment><comment><USER32> I already sent this to my co-founder

</comment><comment><USER33> 5

</comment><comment><USER34> Now we just need a nice restrictive license to grab all the patents.</comment>


Write a hash table in C - <AUTHOR> https://github.com/jamesroutley/write-a-hash-table <comment><USER2> I've heard of two possibilities (as a recommendation) for using data structures in C without having to develop them:

\- BSD queue.h offers linked lists, queues, etc [1].

\- UT-hash offers hash tables [2].

I've also read some people being frustrated with them, probably due to the quirky syntax/API. On the plus side (BSD at least) it's just a header file that you can download, include and start using.

[1] [http://bxr.su/OpenBSD/sys/sys/queue.h](http://bxr.su/OpenBSD/sys/sys/queue.h)

[2] [https://troydhanson.github.io/uthash/](https://troydhanson.github.io/uthash/)

<comment><USER3> Also there is the header-only khash.h [3], complete with benchmarks:

[https://attractivechaos.wordpress.com/2008/08/28/comparison-...](https://attractivechaos.wordpress.com/2008/08/28/comparison- of-hash-table-libraries/)

(Also provides kbtree.h, ksort.h, kstream.h, kvec.h)

[3] [https://attractivechaos.wordpress.com/programs/](https://attractivechaos.wordpress.com/programs/)

Also there are the stb header-only libraries. There is a hash table implementation buried inside stb.h

[4] [https://github.com/nothings/stb](https://github.com/nothings/stb)

</comment></comment><comment><USER4> "The language doesn't come with [a hash table implementation] included"

The standard library does come with a half-baked hash table implementation[1] (hcreate/hdestroy/hsearch) that only allows creation of _one_ global hash table. GNU libc[2] adds hcreate_r/hdestroy_r/hsearch_r that allows multiple tables to be created.

The APIs are strange and antiquated. On the other hand, the hash table implementation described in the article presents a much nicer interface.

[1] [http://pubs.opengroup.org/onlinepubs/009695399/functions/hcr...](http://pubs.opengroup.org/onlinepubs/009695399/functions/hcreate.html)

[2] [http://man7.org/linux/man- pages/man3/hsearch.3.html](http://man7.org/linux/man- pages/man3/hsearch.3.html)

<comment><USER5> The hcreate nonsense is POSIX, not C99, so a conforming C implementation might not include it.

<comment><USER6> How does junk like this ever get into a standard? Didn't a whole committee of very experienced systems programmers have to sit down and say, "yes, these are routines that i think people will find generally useful"?

It looks like the same header, search.h, also includes functions for working with binary trees, where the user passes in the root pointer, and so which support multiple trees:

[http://pubs.opengroup.org/onlinepubs/9699919799/functions/ts...](http://pubs.opengroup.org/onlinepubs/9699919799/functions/tsearch.html)

So this committee must have signed off on the hashtable stuff even though they had an example of how to do it properly right next to it!

<comment><USER7> A standards process is frequently about documenting what already exists in common implementations so that there is a specification for future implementations. POSIX was very much one of these processes.

<comment><USER5> OK... so how did junk like this ever get into enough implementations that people were forced to include it in the standard? ;)

<comment><USER8> tsearch/hsearch/lsearch have been around for at _least_ 30 years. My guess is that they've been around for a lot longer.

Why not have these anyway? Otherwise people will make their own (probably buggy) equivalents.

I'm actually surprised that people aren't aware of them.

<comment><USER5> This is specifically about hcreate/hsearch, which are utterly useless, since you only get one hash table at a time. The reason you don't want crap like this is just that: it's crap.

The _r versions look perfectly sensible.

</comment></comment></comment></comment></comment></comment></comment><comment><USER9> The link at the bottom of the intro is broken: [https://github.com/jamesroutley/write-a-hash- table/blob/v0.1...](https://github.com/jamesroutley/write-a-hash- table/blob/v0.1.0/hash-table) preventing the reader from advancing.

I think the whole thing would be best as a single page, to be honest. Even if it's long, people have scroll wheels. But it's a stylistic choice.

</comment><comment><USER10> "(long)pow(a, len_s - (i+1))" is both inefficient and inaccurate. You should store the current power in a variable which you multiply by 'a' and reduce by 'm' on each iteration.

Also, your double hashing scheme has a bug. You identified that it's problematic if hash_b returns 0, but adding 1 to the result doesn't actually solve anything, because now you have the same problem if hash_b returns num_buckets-1.

</comment><comment><USER11> Weird there isn't a src directory collecting everything together

Hashtables are one of those data structures one can easily get away with never having to write on their own, yet still use every day. In scripting languages it's impractical to roll your own, & in the more abstracted low level languages there'll usually be a pretty good generic version. Yet there's much room for variation

I had the joy to be out of reach of off-the-shelf hashtables for luwa,

init: [https://github.com/serprex/luwa/blob/436c7271120fcd116af30e9...](https://github.com/serprex/luwa/blob/436c7271120fcd116af30e906919afe7a7e55254/rt/alloc.lua#L156)

get/set: [https://github.com/serprex/luwa/blob/436c7271120fcd116af30e9...](https://github.com/serprex/luwa/blob/436c7271120fcd116af30e906919afe7a7e55254/rt/table.lua)

hash: [https://github.com/serprex/luwa/blob/436c7271120fcd116af30e9...](https://github.com/serprex/luwa/blob/436c7271120fcd116af30e906919afe7a7e55254/rt/obj.lua#L130)

Still need to implement Lua's sequential-portion-as-array logic. I do like the API not having a 'remove' method, opting intead for nil by default. nil value entries get vacuumed out when rehashing. This ends up acting as tombstone. In an earlier iteration I was using 0 as a marker distinct from nil, but an implementation detail is that nil is stored at address 0.. oops

</comment><comment><USER12> If you just want to see hash tables work as a data structure, here's a talk- as-blog-post I made on the subject.

[http://nathanmlong.com/2015/10/reimplementing-rubys- hash/](http://nathanmlong.com/2015/10/reimplementing-rubys-hash/)

<comment><USER13> Nathan, that was absolutely fan-fuckin-tastic. Pardon me for the potty mouthed tmesis but that was a highly _highly_ amusing run through. How did you do the graphs? (I'm always wondering how people do graphs.) And is that really you on the sofa waking up from the dream?

</comment></comment><comment><USER14> If your set is known at compile time, make a Perfect Hash Table with gperf instead. It's commonly used in compilers and other software with a parsing or interpreting stage.

</comment><comment><USER15> In the intro section, on extending to unicode being non-trivial...is the argument that if your input has some non-ascii data you probably have all non- ascii data and the above 127 bucket will be too full? Honest question.

</comment><comment><USER16> While the reasons for this that the author gave are valid, I think it would also be valuable to do this in a high level language. I'm sure lot of people who can read C code went through a CS program, and hopefully learned how hash tables work then. People without CS degrees and who mostly write JS/Ruby/Python/etc. and use hash tables on almost every line of code they write are much less likely to know how they work. Just saying, someone should do it for other languages.

<comment><USER17> The problem with writing hash tables or any fundamental data structures in JS/Ruby/Python/etc is that most of the hard work is done for them.

The hard part is allocation memory, keeping track of the structure(array) holding the hashtable, etc.

What else is there? Implementing the hash function/code?

If you don't have a CS degree, you probably don't even know how lists, queues, stacks, etc really work. But the kind of programming that is done at a "high" level, you might not even need know it.

Instead of saying people should implement it JS/Ruby/Python/etc ( all of whom are OOPs ), they should learn C and implement it in C.

<comment><USER18> There's room for both. There's a reason why a lot of CS programs have shuffled from primarily C to Python (some had Java in between).

Not having to deal with boilerplate and housekeeping lets you focus on learning the topic at hand. Especially in a classroom setting where you're probably focusing on the specific subject instead of real-world dirtiness.

But after learning the basic concept, you do need an actual implementation if you want to do anything.

<comment><USER17> > There's room for both.

Sure. I'm all for learning ML, Scheme, C/C++, Python, Ruby, Java/C#, etc.

> There's a reason why a lot of CS programs have shuffled from primarily C to > Python (some had Java in between).

The reason is called dumbing down the curriculum. My fall freshman year, my college tried to switch from C to Java in order to make it easier for the general population to get into CS and there was a major pushback from the CS student body, alumni and a bunch of the CS professors. We went back to C/C++ my sophomore year.

> Not having to deal with boilerplate and housekeeping lets you focus on > learning the topic at hand.

I disagree. Having to deal with the boilerplate and housekeeping helps you learn the topic at hand.

> But after learning the basic concept, you do need an actual implementation > if you want to do anything.

I disagree. Giving them "training wheels" will keep them dependent on training wheels. In an idealistic world, people go from Java/Python to C/Assembly, but that's rarely the case.

CS should begin with Math ( boolean algebra/logic/etc ), Assembly and C. Then go on to functional paradigms. Then to OOP. Etc ( in the language ). Of course they should also learn about OS( kernel/filesystems/etc ), networks, computation theory/etc, compilers, etc.

The dumbing down of the curriculum so that music/english majors can pass CS classes doesn't do anyone any favors.

<comment><USER19> _The dumbing down of the curriculum so that music /english majors can pass CS classes doesn't do anyone any favors._

You sound butt-hurt

<comment><USER17> Huh? I'm not butthurt. Seems like you are though.

I'm sorry having standards and expectations is something that offends so many people.

C isn't a "difficult" language. It's something any CS major should have an understanding of.

I can't believe on hackernews, I'd get attacked for saying people should learn C.

Nevermind that most OSes and most languages themselves are written in C. Even python interpreters are written in C.

Since when is saying people should learn C for a CS degree considered being "butthurt"? What's next? Saying people should learn latin/ancient greek for a liberal arts degree is considered being butthurt?

<comment><USER19> You're being attacked because of your condescending tone implying that music and english majors aren't smart enough to pass the CS curriculum

<comment><USER20> _You 're being attacked_

Regardless of how much you may disagree with what someone said or how they said it, attacking them for it (even verbally) is not an appropriate response. It only contributes to worsening the discourse. If you can't find a way to disagree or express an opinion constructively, it's better to refrain from commenting at all.

</comment></comment></comment></comment></comment></comment></comment></comment><comment><USER21> Don't allocate these items individually; don't store pointers to such items. They're tiny, and the pointer chasing + allocator bookkeeping overhead + potential randomisation make it inefficient for no gain. Just allocate an array of items. This way you'll also deal with fewer potential errors. Speaking of errors, please handle them and fix the API so that the caller can know if there's a problem.

<comment><USER22> Yeah, reading through that jumped out at me.

Also the use of strdup, while a reasonable choice, should also come with caveats about ownership and copying

I stopped at the use of pow for exponentiation in the hash function. Just iteratively multiply your factor and take the modulus on each round.

This would handle utf-8 just fine if characters are cast to unsigned in the hash function and a larger prime factor is used

None of these are real criticisms, I'd just love to see a pointer to more in depth information on how to really write hash functions

I hope that i missed it, but this definitely needs a clear statement that this is a pedagogical exercise and not a production ready implementation

</comment></comment><comment><USER23> This might seem academic, but I actually had a real reason to hand-roll a hash table implementation that would work in process-shared memory (as an Apache module). It was based on the hash table implemented in mod_ldap, and was part of an LRU cache.

</comment><comment> jay-anderson This is a good mostly simple overview. The appendix should also mention robin hood hashing as a method for addressing collisions. From my understanding it is cpu cache friendly and works well in practice.

</comment><comment><USER24> berkeley db 185. it has served me very good over the years and it was fast enough for real time market data and indexing and many more.

</comment><comment><USER25> Just go back to the table of contents. The link works from there.

</comment><comment><USER26> hah, just a few days ago I named a few files hshtbl.c trie.c and so on. All after a Raymond Hettinger talk about how they rethought Python 3 dicts.

</comment><comment><USER27> Link should be changed to [https://github.com/jamesroutley/write-a-hash- table](https://github.com/jamesroutley/write-a-hash-table)

<comment><USER28> OK, we've updated the link from [https://github.com/jamesroutley/write-a-hash- table](https://github.com/jamesroutley/write-a-hash-table).

<comment><USER29> What's the difference in the URLs, I can't see any.</comment></comment></comment>


The Tulsa Remote Worker Experiment - <AUTHOR> https://www.citylab.com/life/2020/02/tulsa-incentives-work-remotely-coworking/604873/ <comment><USER2> Smaller cities and towns are fantastic, both in terms of community and cost. Remote work incentives like this seem like a great way to draw people to less populated areas.

Honestly, I think that a lot of folks who feel stressed and cramped in metro areas like SF, Seattle, NYC, etc. might really enjoy living in a small town.

But a lot of states in the Midwest still present serious cultural barriers to many such people. Racism and bigotry against LGBT folks is less common than it once was, but it's still prevalent. Communities are usually less secular, with religion playing a huge part in peoples' social lives; sometimes it's almost a prerequisite to "joining the community". Pot can get you serious jail time. Raising well-adjusted kids can be harder because of how insular suburban areas are. And so on.

It's not like that everywhere, and most people are kind and empathetic at heart, but definitely spend some time in an area before you consider taking a stipend to move there. Places like Central Washington, upstate New York, and Eastern Colorado are hidden gems, but having spent a bit of time in Tulsa and speaking as someone with a slight countercultural bent, you would have to pay me a lot more than $10k to move there.

<comment><USER3> I wouldn't mind living in a smaller city (though honestly Tulsa ain't that small), but yes there's the cultural issues you bring up, and other problems as well.

For example, the US has generally awful land use/transportation setups even in progressive major cities, and in smaller/less progressive ones, it goes from generally awful to extra terrible. Walking for transportation is unpleasant and near-useless, biking is uncomfortable and dangerous, and public transportation is sparse, slow, and unreliable. Housing options are usually either a single-family home in a super low density area that exacerbates the above, or an apartment in a very ugly large complex in a neighborhood with terrible schools. Obviously generalizing here, but that's what you see most of the time.

To demonstrate that I'm not using these superlatives for no reason: I can't find stats for Tulsa, but Oklahoma City's combined mode share for commuters who use walking, biking, or public transit is a massive 2.2 percent, and Tulsa's is probably similar. I find that people are pretty rational when it comes to day to day transportation choices; if that few people are doing something other than driving, there's a very good reason for it.

Right now I live in the outskirts of Munich in a backyard duplex (there's a 6-unit complex up front), a type of housing option that largely doesn't even exist in the states. Plenty of people around here drive, but there's also a few different grocery options within easy walking distance (and a ton within easy biking distance), public transit is fairly dense and reliable (extremely dense and reliable by US standards), all three of those things feel safe even with kids. And Munich isn't some weird outlier in Germany, the other cities I've visited have felt quite similar overall. I wish US cities could stop being such a dumpster fire when it comes to land use and transportation, but there's so much cultural momentum there.

<comment><USER4> > biking is uncomfortable and dangerous

I live in a college town in Michigan and work for a company in San Francisco.

I don't find biking to be uncomfortable here whatsoever. In fact there are maybe a half dozen to a dozen coffee shops I can work from that are around two miles away from my house and I bike to them all the time- even in the winter if the roads aren't icy.

<comment><USER3> There are definitely confident cyclists who profess to be comfortable in some areas of the US. Ask them if they'd be comfortable with a relative who's 8 or 80 biking around independently in the same area and they usually become a lot less confident. Then look at what the actual data shows: how many people bike there? The numbers are nearly always dismal: even supposed cycling champion Portland has half Munich's numbers, and Munich isn't even trying very hard. Portland is quarter-assing things _at best_ , and it goes rapidly downhill from there.

Or if you want something more concrete to work with: how many mile lanes of protected bike lanes or off-street bike paths are there in your town? How does that compare to the number of mile lanes for sidewalks or general vehicle lanes? What percentage of controlled intersections use a protected design? How wide are the roads? What's the speed limit, and how fast do people actually drive? How common are pedestrian islands? How sharp are the curb corners? How many of the painted bike lanes in the door zone? How common are walk/bike cut- throughs? What percentage of intersection lights have a marker for bikes?

Most cyclists who talk about how comfortable they are in the US don't realize just how bad it is there. Yes, you can still often get by; I certainly managed, in the bay area, and Seattle, and Utah, and even Alabama. But it was still total garbage compared to the places that take biking seriously (which is exactly why so few people do it in the states).

We live in an area that is, by most Americans' standards, fairly dense, and yet we started having our son bike to school a mile away, by himself, when he was 7, and he started biking alongside us to a kindergarten 2 miles away when he was 5. He's 8 now, and he sometimes bikes himself to a friend's house, or a park, or a grocery store or bakery for an errand. That kind of thing is almost unheard of in the US these days.

<comment><USER4> I realize how bad it is here, but I'm not really sure what you're suggesting? Throw up my hands and give up? Move to the Netherlands???

</comment></comment></comment></comment></comment><comment><USER5> Nice! I'm in Tulsa Remote and am quoted a few times in this - I'm the one who "applied after seeing a post about the program on Hacker News" so things are really coming full circle right now.

I think an underrated grievance of people living in big cities is that feeling that you are a completely insignificant part of a community and culture that are so much bigger than you. It's something smaller cities can offer that big cities can't, and it's also something that Tulsa Remote has done really well by connecting participants with people in the city that have influence. The people who are happiest and most likely to stay are definitely the ones taking advantage of this - like Obum from the first paragraph (an amazing human, by the way).

Things like lower cost of living, traffic, and cheap housing get talked about a lot as reasons to move out of NY/SF/LA/etc, but are kind of just byproducts of the fact that more people want to live in these places because they have a lot more to offer in other ways. But this idea that you can move to a smaller city with momentum and become a meaningful part of that community is super compelling for someone with that mindset.

I think (and hope) the rise of remote work will keep pushing motivated people to move to smaller cities, like Tulsa, and wind up giving everyone a lot more options for interesting places to live.

</comment><comment><USER6> I wonder if the trend toward remote work is temporary, or if it will continue long-term. The plot in that article shows that the percentage of remote workers employed full time seems to be increasing fairly quickly.

If this is a real trend, my second question then is whether it will have an effect on the current migration away from rural communities toward cities. There are many beautiful places around the world that I think people would prefer to live in if they could work remotely. (Environmentally speaking though, I'm not sure it would be great to have huge numbers of people moving to all of the most beautiful spots on earth).

<comment><USER3> > (Environmentally speaking though, I'm not sure it would be great to have > huge numbers of people moving to all of the most beautiful spots on earth).

Nailed it. People often move to rural areas because they love nature, but ironically this is actually a terrible thing _for_ nature.

Not saying everyone has to live in skyscrapers, but denser urban living is definitely better for the environment, most of the time, due to both energy efficiency and reduced need for land.

<comment><USER7> > denser urban living is definitely better for the environment, most of the > time,

"Most of the time" is likely the key phrase in that statement. I would say it depend on where and how. Living "in nature" enables partial self sustainability, and far from all land is currently used efficiently. Low yield farm land is perfectly fine for raising a few chicken and supplementing other commonly food product with self grown items, and that reduces strain on high yield farm land.

As an example, here in Sweden the urbanization has been identified as a direct cause for lower biodiversity by land being overgrown with mono culture spruce forests. The previous small open plots and fields inside forests allowed for a more diverse environment for animals like birds and insects.

People moving to more rural areas would not top my list of terrible things for nature, or at least not around here. I do however agree that if everyone went to live in rural areas we would run out of unused low yield land, so there is definitely a balance to be made.

<comment><USER3> > As an example, here in Sweden the urbanization has been identified as a > direct cause for lower biodiversity by land being overgrown with mono > culture spruce forests.

Sorry, I don't see how those things are connected. People moving from rural areas to urban ones caused forests to be dominated by a single species of tree? What?

<comment><USER7> Some sources in Swedish: [https://www.naturskyddsforeningen.se/igenvaxning- gifter-hot](https://www.naturskyddsforeningen.se/igenvaxning-gifter-hot) and [https://www2.jordbruksverket.se/webdav/files/SJV/trycksaker/...](https://www2.jordbruksverket.se/webdav/files/SJV/trycksaker/Pdf_ovrigt/ovr3_29.pdf)

Biodiversity depend on diversity in environment, and as I understand it, more so in colder climate zones. In the last 100 years the decrease in farm land, grazing areas, and gardens is the primary cause why about 1 300 species is marked as endangered here in Sweden.

When small plot of open land in the middle of spruce forest (European spruce) get overgrown here in Sweden, the result is first a stage of small and thick bushes until later the trees reclaim the once open area. Spruce is the dominating tree in the southern part of Sweden.

If you are asking why spruce is so dominating you would have to ask a botanist, but I would suspect the temperature, the soil and access to water as being the usual suspects for why one type of tree can dominate an area.

I should make it clear that what I describing is the situation in Sweden. Rain forests are unlikely to have the same need for diversity throigh multiple small biomes in the same area. The US is pretty large area so I can't really say if any of its area suffers similar to Sweden, but I would suspect that Canada do.

The above linked sources (and references research in those) also point that diversity in how farming is done is also a key part of the decrease biodiversity. High yield farming of the same plant year in and year out is directly harmful to diversity. To enable this kind of farming people adds pesticides and fertilizer, both which links to a decrease in bio diversity through multiple factors. The redirection of water to more concentrated areas also pile on the problems for biodiversity. The more uniform and concentrated the farming become, and the more spill over of pesticides and fertilizer, the more damage we do to nature. Those aspects is true not only for Sweden but globally.

</comment></comment></comment></comment></comment><comment><USER8> As an atheist Indian-American who spent some of his childhood in Oklahoma, there is no way I'd move to Tulsa. Despite being rather socially conservative, I just would not fit in in Tulsa as well as in a liberal cosmopolitan place. And then you add in a lack of intellectual stimulation and it is even more dreary.

</comment><comment><USER9> Tulsa should be on more people's radar as a vacation destination. It's a fascinating city with good museums, galleries (including contemporary Native American art) and parks, a welcoming population and very interesting architecture (art deco downtown and Oral Roberts University's gonzo Christian version of midcentury modernism).

There's a strong local music and bar scene and good vintage shopping, and some great barbecue, kind of an Austin alternative.

<comment><USER10> Having been a few times.... This is a wild exaggeration.

<comment><USER11> Which internet stranger am I to believe?

<comment><USER12> The one that actually lived there.

<comment><USER13> Surely the opinions of visitors are more important when looking to visit somewhere.

I wouldn't ask tourists what it's like to live in NY, but I wouldn't ask someone from Queens of its worth visiting.

<comment><USER12> Some people are perpetual tourists who go to museums and the like while living someplace for a few years. Such people tend to have more familiarity with touristy stuff than either one-time visitors or regular/typical residents.

</comment></comment></comment></comment></comment></comment><comment><USER14> the quote "With its vaulted ceilings, rows of elbow-to-elbow workbenches"

Would make me run away screaming.

</comment><comment><USER15> A related thread from 2018: [https://news.ycombinator.com/item?id=18463553](https://news.ycombinator.com/item?id=18463553)

</comment><comment><USER16> Just for the people who are denigrating Tulsa and how it may be a backwards place for kids' schools. I graduated from a public high school in Tulsa. In our graduating class, we had students accepted to Harvard, to MIT, Yale, Penn, Michigan, and Duke. In the graduating class after mine, we had 3 accepted to Stanford. This was just one public school district, although definitely one of the best in the city.

I am not sure that there are that many cities with public schools that can boast such placement.

George Kaiser (the gazillionaire who started the foundation that pays for this program) is a very active Harvard alum in addition to being an impressive philanthropist.

<comment><USER17> People aren't worried about schools in culturally conservative areas because they think it'll make it hard for kids to get into selective private colleges; they're worried about raising their children in areas with a high density of bigots, lest the bigotry rub off on their children.

The paradox of tolerance partially explains this (frequently invalid) bit of discrimination.

But if getting a leg up on selective admissions IS one of your goals, taking your bright teenager to live in a conservative rural or semi-rural area is actually a great way to avail yourself of the many regional quotas these colleges use.

But it's also frequently a way to make your teenagers really hate you for moving them to such a place...

</comment></comment><comment><USER18> hmm paying people sounds interesting way to combat the brain drain problem. Kinda shameful though tech seems to only be in a handful of tech hubs. Seems like if I had a startup going, I'd be more likely to be funded in Texas or California than where I'm originally from. Seems like a lot of areas have leaders that don't even care about startups or tech... or maybe just statistically they don't think they can attract tech maybe?

Was watching a news segment about startups in Cleveland a while back and one of the big things is the lack of investors, so people are forced to leave their family and community to go elsewhere if they want to be successful. Not from Cleveland but it sounds like a similar story in a bunch of places.

Then probably smart people feeling disconnected or lonely because of the lack of resources and startup/tech culture. The census I think is going to be a big blow for places like Ohio and other places, no wonder younger people are moving for better opportunities, and then when they are ready to start their own families, wonder if their kids and future kids will stick around? Sounds like then Cities are losing generations of people, so long term this is going to compound and hurt cities and states even more for their inaction. Plus I think weather plays a bit of a role too, not all just economics - but then again there's a lady I know from Texas who wants to move to Ohio because she likes the cold, while I rather like the warm so sounds like we rather just swap places haha...

Plus people are anti-tech. Some people like their quiet small towns, and affordable houses. Tech money flows and then the rents and house prices go up. and then people stereotype tech people too. So sorta like a not in my backyard thing too. Not everyone wants tech I guess, so maybe it's easier to just move elsewhere than trying to turn your own community into the vision you have. Then people don't trust tech, I used Apple Pay at like one of the only places that take it and the lady commented on it about not trusting it. Then I was listening to a podcast segment and I guess some college in Michigan installed Apple Pay to pay for things and found sales went up, I mentioned that I thought that was cool and someone said they wouldn't trust their credit card with a vending machine... When I think it's, in fact, more secure than an actual credit card, but then again even the basic idea of public-private key cryptography goes over people's heads.

I kinda feel like if I grew up and lived in a better area for tech, I'd probably be more successful personally, meetups and networking with other like-minded people I think would help. Plus I kinda feel like I have trust problems, people online I was going to work on projects with me but some people are so flakey or just disappears instead of staying committed. Like wanted to do something media related years ago, and the person just disappeared on me. Then was doing another project where someone was going to focus on sales, and agreed to give them a % of the company but can't seem to get ahold of him(But I know now that's what vesting is for). So seems like a recurring theme I always get flaky people. So I feel like real in person could be a benefit too in that regard. It seems more real too, and plus people try to read emotions and stuff in between the lines - but even then there are stories of people working offline and it not working out too... So I guess that's why it's important to get the right structure, and contracts and stuff in place. Focusing on the tech part for my own project first on my own but hoping to take Startup School and pick up on things before I involve others just because I don't want to get burned. But personally I think I rather just bootstrap and own 100%, and then pay contractors or employees when profitable to work on features I don't want to personally do, so less conflicts and not slowing down making decisions, could consult people for advice but I'd have the final say.

<comment><USER3> Network/agglomeration effects are a natural thing for many industries, especially creative/information workers. And while remote tools are improving, it's still hard to beat on-site collaboration for coordinating teams.

If Google or Amazon or whoever could get enough skilled people to move to random other cities, they would, because that would obviously save them a lot of money, both in salaries and office rent. The fact that, for the most part, they stubbornly stick to pricey tech hubs is itself quite telling.

</comment></comment><comment><USER19> Good read!

</comment><comment><USER20> I Tulsa. Shame I live in UK.</comment>


K-Means Clustering in Python from Scratch - <AUTHOR> https://mubaris.com/2017-10-01/kmeans-clustering-in-python <comment><USER2> Home-grown implementation using PIL to find dominant colors in images: [http://charlesleifer.com/blog/using-python-and-k-means-to- fi...](http://charlesleifer.com/blog/using-python-and-k-means-to-find-the- dominant-colors-in-images/)</comment>


Ask HN: How to Evolve a Legacy .NET Application with Python - <AUTHOR> We have a legacy application that is built in Windows Forms and C# but in recent years we've been doing a lot of work in Python. We want to evolve this tool and gradually move all of the backend code to Python but still have a Windows desktop front-end either in Windows Forms (as is currently) or WPF.<p>I have already looked at different options building parts of the core libraries in IronPython or even using a REST web server to call the Python core but quite sure yet. Has anyone does this and are there any example applications that you know off using this idea? <comment><USER2> Why do you want WPF or windows forms for your application? Especially if you're doing a web based backend any way.

I know it's a tad silly to use web uis for everything, but the truth is, that it's where almost all of the ui innovations lie right now.

It's not just for design either, it's also automation. Like if you use Django, a lot of the basic forms for inputs will actually write themselves based on you'd datamodel.

</comment><comment><USER3> I've seen:

* .net product with embedded ironpython for scripting ;

* desktop client talking to a backend server that happened to be implemented in python ;

* desktop application implemented as a collection of command line tools for batch processing, with a windows desktop frontend. Some of the command line tools were implemented in python and bundled using py2exe, other command line tools were written in other languages

these were all proprietary things with varying numbers of enterprisey customers, apologies, no sample code.

<comment><AUTHOR> A collection of command line tools is something we tried years ago and didnt work very well unfortunatelly. Tempted to go down the REST server route.

</comment></comment><comment><USER4> Using Python via IronPython and trying to get C# to talk to Python sounds like it could have lots of issues. I would go with a Python HTTP(S) API that gets called by the Winforms or WPF UI.

This has the added benefit of forcing you into a more decoupled architecture and allows you to easily add a different type of UI (web, phone app, etc..)

<comment><AUTHOR> I think I prefer the RESTful API idea more than anything because it could keep the architecture decoupled. The only thing that worries me is having issues installing this to client desktops. A lot of our clients are banks and insurance companies so I wouldn't want to create issues with our installation and get things blocked by client IT.

<comment><USER3> yep, you'll definitely have to work through issues around getting network access, meeting requirements for keeping data adequately secured in transit and at rest. some places might really not want to run external servers, and run the server(s) on their premises

</comment></comment></comment><comment><USER5> Nearing completion of something similar:

Phase I C# -> python / Django / some simple html forms

Phase II (in progress) Django rest backend / react front end

We host the application internally, all our team members know at least basic python so updates are easy and deployment is much quicker.

</comment><comment><USER6> What is the reason to rewrite a legacy c# code to python?

<comment><USER2> Why wouldn't you?

C# is so unproductive compared to python. Everything is so low level and verbose, nuget packages are mostly undocumented and unsupported, entity framework is terrible, no graphql tools.

I mean, we still do a lot of c# at our place, but every chance we get, we use either python or JavaScript with an end goal of completely leaving c# behind.</comment></comment>


Google Play 25-cent app sale already started - <AUTHOR> http://www.talkandroid.com/133677-google-play-25-cent-app-sale-already-started/

<comment><AUTHOR> Isn't it strange that the last 30 days download graph of all apps in sale is downwards ;)</comment>


Best Sci-Fi books for December - <AUTHOR> http://www.booksumo.com/books/2011/December/science-fiction/

<comment><USER2> Since that Reddit list of best sci-fi books I have churned my way through 4 novels; all of them have been absolutely excellent (Armour, and three of the Hyperion saga [just started the last one])</comment>


Private subscription to sites: anonymous, boosting efficiency, running locally - <AUTHOR> https://chrome.google.com/webstore/detail/private-subscribe/jbpfefeppianfhnmpnhoeffmdcfghfol?hl=zh-TW <comment><AUTHOR> Just an old free tool I made back to 2016.

Private subscription to sites: anonymous, boosting efficiency, running locally

Why do you need this extension?

      Some sites update occasionally and you want to know the updates without checking the sites every day or week.

      You want to subscribe to a site anonymously / without providing a email / without a sign up / no subscription function for the site.

What is good about this extension?

      free.

      The scraping is decentralized, running locally.

How does it work?

      After you specify the content for subscription, it scrapes and checks for updates automatically , every 2 hours.</comment>


Researchers: movie studios sold more after Megaupload was shut down - <AUTHOR> http://arstechnica.com/tech-policy/2013/03/researchers-movie-studios-made-more-after-megaupload-was-shut-down/

<comment><USER2> I guess its not about the temporary bubbles during disruption. Its about the steady state. Has the increase persisted?

Ultimately its a pointless fight. Encryption, wireless etc make it impossible to control the spread of plaintext information. And entertainment has to be rendered plain to be enjoyed.

Hm... maybe not! Maybe we can implant decoder chips into people's brains, and make them pay-per-view that way!

</comment><comment><USER3> I could believe this only when related to TV Shows.

In the case of movies, Demonoid is more likely a cause.

</comment><comment><USER4> There a lot of movies available via YouTube...me thinks lobbying helps.</comment>


Oberon (2009) - <AUTHOR> http://ignorethecode.net/blog/2009/04/22/oberon/

<comment><USER2> Plan 9's UI works in a quite similar way. I'm not up to date on my history of those systems, but I wouldn't be surprised if there is heavy cross pollination between the two.

Additionally, the fact that the writer of this post mentions Oberon's zooming user interface and the Canon Cat means I have to encourage anyone interested in this topic to read this wonderful book: [http://www.amazon.com/The-Humane- Interface-Directions-Intera...](http://www.amazon.com/The-Humane-Interface- Directions- Interactive/dp/0201379376/ref=sr_1_3?ie=UTF8&qid=1380936948&sr=8-3&keywords=raskin)

\---

The article linked to at the very beginning is not available on the original site. Here is an archive.org link: [http://web.archive.org/web/20090416033922/http://stevenf.tum...](http://web.archive.org/web/20090416033922/http://stevenf.tumblr.com/post/94591835/warning- a-long-rambly-exploration-of-the-state)

<comment><USER3> Rob Pike says that Oberon was an influence on his Plan 9 text editor, Acme.

[http://plan9.bell-labs.com/sys/doc/acme.html](http://plan9.bell- labs.com/sys/doc/acme.html)

</comment></comment><comment><USER4> Eagle Mode ([http://www.youtube.com/watch?v=G6yPQKt3mBA](http://www.youtube.com/watch?v=G6yPQKt3mBA)) uses the zoomable UI concept and takes it to an extreme.

<comment><USER5> That's how it should be! Pity it's probably actually a pain to use in real life :P

<comment><USER6> That would be awesome to see on a modern tablet device. The gesture interface already exists and people are accustomed to it. It would be neat to see a demo of it at least.

Thinking about it, while not implemented for the whole experience, are there any apps that do this?

To some extent Safari on OS X does this now (since what version, I'm not sure). While you can zoom in and around a page, you can also zoom out when the page is at 100% and get a view of all the open tabs. iPad with its multitasking control is similar (swipe up with 4 fingers to see all tasks, tap on one to switch to it). A photo app would, as demonstrated, be an appropriate use, same with the calendar. Instead of having to hit buttons to move up the hierarchy allow the users to pinch-to-zoom instead.

</comment></comment></comment><comment><USER7> The text and GUI integration describes exactly why I fell in love with Linux. There is a GUI, but I will be damned if there are things (save some terrible GNOME cruft from personal experience) that cannot be facilitated the terminal commands and scripting. Around the same time in college as I discovered Linux and began really exploring, I started a sysadmin gig at school maintaining Winboxen, and the inability to script a lot of core stuff (this was before Powershell, but my opinion is little has changed beyond "this is the crap Microsoft thinks you should automate") is incredibly frustrating and what drove me to admire the utilitarian approach of Linux and other UNIX environments so so much. That is why Linux, *BSD, and even in a small way OS X make me really happy.

Oberon seems to harmonize both. That is very cool, and definitely would be an OS of choice for me.

<comment><USER8> You would love Mac OS 1 - 9, Acorn RISC OS, Amiga OS, Atari ST GEM. :)

<comment><USER7> Apple was one of the my first computers; I am familiar with the OS 1 - 9 line. That being said I was a child and I am not too familiar after all these years if they were like it.

When dealing with a current Mac, people look at me weird as I spend my time in only two apps: Console.app and Terminal.app. And people wonder why I bitch how Apple bastardized Unix (and to the fanbois: I know it is just as much BSD's fault, get off my lawn).

</comment></comment></comment><comment><USER9> _To launch applications or execute commands, you first type them somewhere (anywhere, it doesn't matter), and then middle-click them_

Has anyone used this extensively? I'm extremely skeptical about the cost of switching from keyboard to mouse constantly.

And then there's the following: _Need to explain to your aunt what application to launch? Tell her to click on a word in the e-mail you just sent her._

"Need to create a botnet? Tell your (or your hacked celebrity account's) Twitter followers to click on a word in the tweet you just posted."

<comment><USER10> Oberon was the programming language and environment used to teach first year programming classes at the university of antwerp when I studied there back in the late 90's. I ended up using it as my main programming environment for months at a time. There was a definite learning curve because of the weird mouse approach. They used mouse behavior that I haven't seen anywhere else, like interclicks (chorded mouse button click combinations). Mostly though there were keyboard alternatives, like ctrl-enter for middle click, so you didn't have to have the mouse in hand all the time. Once the learning curve was over I remember finding the keyboard/mouse behavior quite efficient, though you did need a three-button mouse to make full use of it.

I initially had a negative reaction to the clunky appearance of oberon and the weird conventions, but grew to like it quite a bit over the course of the year. It was really a programmer's OS, because there was essentially no difference between documents, programs and user interfaces. You could look at any application and decompose it into its building blocks and program code quite easily because "view source" was an intrinsic part of the system. The downside was that it didn't actually _do_ much, given that there was basically no way to port existing software so it ran inside the oberon environment. Had it somehow gained the ability to run other programming languages than Oberon within the same UI paradigm it might have been quite popular as a geek OS.

<comment><USER8> Not only that, for me it showed me that it is possible to have operating systems implemented in GC enabled systems programming languages, contrary to what C guys keeping on preaching.

Native Oberon System 3 was quite an improvement with the Gadgets interface.

I think only by experimenting such operating systems, in a similar way to Lisp and Smalltalk machines, one can be convinced of the viability of GC enabled languages at the OS level.

Sadly, most efforts that came after Oberon don't offer much more than a plain CLI, thus reinforcing the common belief that GC enabled systems programming languages are not viable for OS development.

We lost a lot in computing by having just the UNIX/C model as the only one to follow.

</comment></comment></comment><comment><USER11> So every time I see these threads about classic computing systems that did something interesting or novel (Oberon, Plan 9 Symbolics OpenGenera, BeOS, Amiga, etc), I want to be able to try them out on my own machine.

After discovering that OpenGenera was available, I tried a bunch to find a way to run it in a VM in OS X and had no luck finding an Alpha virtual machine host on which to install it.

Is Oberon one of those systems that I can get up and running in a virtual machine on OS X in an afternoon?

<comment><USER2> Yes, you should be able to get Oberon running in VirtualBox through Blue Bottle OS [1].

Some tweaks do need to be made though [2]

[1] [http://www.a2.ethz.ch/download.html](http://www.a2.ethz.ch/download.html) [2] [https://lists.inf.ethz.ch/pipermail/oberon/2008/005536.html](https://lists.inf.ethz.ch/pipermail/oberon/2008/005536.html)

<comment><USER11> Thanks. This is most appreciated. I started looking for details on getting it running after posting this. That second link should prove useful.

<comment><USER8> And if you feel like to research how Oberon was implemented, the language, the kernel level GC and all the rest, there are lots of information available here,

[http://www.inf.ethz.ch/personal/wirth/](http://www.inf.ethz.ch/personal/wirth/)

The book "Project Oberon" describes the system.

For the Native Oberon's sucessors, EthOS and Blue Bottle, you can additionally read

[http://research.microsoft.com/en- us/um/people/cszypers/books...](http://research.microsoft.com/en- us/um/people/cszypers/books/insight-ethos.pdf)

and

[http://e-collection.library.ethz.ch/eserv/eth:26082/eth-2608...](http://e-collection.library.ethz.ch/eserv/eth:26082/eth-26082-02.pdf)

<comment><USER12> I went to look for "Project Oberon" to buy, but 170USD for a used copy is a bit much for me.

<comment><USER8> Why buy when the university makes the PDF of the book available?

</comment></comment></comment></comment></comment></comment><comment><USER13> I still remember the days when we had those Oberon machines (not yet bluebottle) at the computer rooms at the ETHZ. Nobody touched them except the computer science students. You didn't even needed a login to use them, just a mouse with 3 buttons for the famous interclick to execute commands! :)

</comment><comment><USER5> This part is the most exciting to me. - "obsoletes the idea of opening a document. Essentially, all documents can be open all the time. All you have to do to interact with one is to zoom in close enough."

<comment><USER14> What about documents that can have multiple interpretations?

Where do I zoom to edit and HTML file as a set of tags? Where do I zoom to edit it inside a WYSIWYG editor? Where do I zoom to see it in a browser?

</comment></comment><comment><USER15> It's a bit silly to claim that outside of Oberon, all modern graphical UIs are descended from the Lisa. Unix and its many variations were very active in the early 1980s, and there were non-Lisa sophisticated window systems emerging around the same time as the Apple Lisa.

I remember seeing Oberon in the late 1980s, running on a Sun workstation which supported the SunView and X10 - simultaneously (at the time, we'd figured out how to run SunView in the color buffer and X10 in the overlay buffer, configured to be a separate virtual screen). In those three environments, I feel little could be ascribed to the Lisa, but much to PARC.

</comment><comment><USER16> Considering the bit about different European languages, it seems really strange that words would become links to applications. Sending instructions on how to do something from your home in <latin character set country> to your Russian aunt? Better know the Cyrillic version of what you want to launch.

Snark aside, there are some interesting aspects to that; I really like the idea of simple launcher lists, even if it means you have to know the names of everything you want to launch. I teach some kids with dyslexia and I can imagine trying to do this in a classroom environment.

</comment><comment><USER8> Implemented with a GC enabled systems programming language!

</comment><comment><USER17> I remember giving Oberon a try in the late 90's. As I recall, Oberon was available as both an application and as a stand-alone OS.

I really liked the interface of both Oberon and Plan 9. I wasn't really able to get much done with them back then, as I was a real novice, but I did find the UI attractive.

</comment><comment><USER18> That guy needs a new camera, idk. why, but his camera has a ghosting effect! I initially thought it's a built-in effect, but it's his camera..weird..

</comment><comment><USER19> After reading the article I thought Oberon might be really interesting, then I watched the linked Youtube video.</comment>


My Goto Postgres Configuration for Web Services - <AUTHOR> https://tightlycoupled.io/my-goto-postgres-configuration-for-web-services/ <comment><USER2> Revoking permissions from public and deleting that schema entirely is interesting. Seems like a reasonable step towards principle of least privilege. Though does make proper search path critical. Not sure all the different connectors would support that.</comment>


Google street view blurs cow's face in Cambridge - <AUTHOR> http://www.bbc.com/news/uk-england-cambridgeshire-37378007 <comment><USER2> Who thought that cows shouldn't have a right to privacy?

However, such pictures of cows grazing being posted openly might make them (the cows) vulnerable to a class-action suit.

</comment><comment><USER3> I'm often annoyed that road signs, shop windows etc. are blurred. Kind of defeats the purpose of street view.

</comment><comment><USER4> i seen this before in the ring...</comment>