734 karma · joined Jan 6, 2011 (15y ago) · 236 submissions
comment 8y ago · link · parent
After about 10 years of coding in a fit of passion we ended up with huge monolithic projects written in dynamic languages that where extremely brittle.
Fortunately languages with type inference (Rust, Golang, OCaml, Scala, etc) started becoming the answer to our problems. (We also collectively decided that Microservivces were another solution to our woes though that cargo cult is being questioned).
So we have a decade of code and packages written in Python and JavaScript that work well for our use cases (Data Science, MVP web apps/services, Database integration, etc) that is hard to give up. Often because alternatives aren't available yet in the statically typed languages (Hurry up Rust!).
There is often a lot of friction to get new languages introduced. I love Rust, but I don't think I can introduce it into our Golang/NodeJS/Javascript environment anytime soon.
comment 9y ago · link · parent
comment 9y ago · link · parent
The URL that is shared contains the key for the file. You'll notice that the URL contains a fragment identifier, i.e the #foo part of http://example.com/#foo, this isn't transmitted to the server by the browser and therefore the key isn't exposed beyond who the URL is shared to.
comment 9y ago · link · parent
Apparently there's already an open source project called Home Assistant for this purpose.
comment 11y ago · link · parent
Erlang can have two versions of a module present in memory at a time. At the moment of a code upgrade, the processes working with existing connections continue to use the old code while newly accepted connections are passed to the version of the module that was loaded in between connection accepts.
9.
Linking with Hydra and JSON-LD(eric.themoritzfamily.com ↗)
2 points · by ericmoritz · 11y ago · discuss
10.
Hydra Lite: A simple hypermedia format(eric.themoritzfamily.com ↗)
2 points · by ericmoritz · 11y ago · discuss
11.
How Linked Data made merging 3 data sources easy(eric.themoritzfamily.com ↗)
1 points · by ericmoritz · 12y ago · discuss
12.
Easy ETL with RDF and Python(eric.themoritzfamily.com ↗)
1 points · by ericmoritz · 12y ago · discuss
comment 12y ago · link · parent
I doubt the web is going anywhere. The future is going to hyperlink driven link data services that can power both native and web clients.
I have started to architect such a solution for my employer and let me tell you, it is the freaking future!
comment 13y ago · link · parent
comment 13y ago · link · parent
from itertools import imap
map(f, imap(g, imap(h, someList)))
I think Python 3's map built-in is a generator so you no longer have to use the itertools module.Unfortunately we don't have . or currying in Python so no pointfree python :(.
from itertools import ifilter
# ugly python function with a "Maybe dict" return type
def query(data, date):
"""Return the first dict where date is > x['date'] or None"""
is_greater = lambda x: date > x['date']
return next(
ifilter(
is_greater,
data
),
None
)comment 13y ago · link · parent
from numpy import arange
def squares_numpy(n):
a = arange(n)
return a * a
$ python -m timeit -s "from squares import squares_append" "squares_append(1000)"
10000 loops, best of 3: 130 usec per loop
$ python -m timeit -s "from squares import squares_comprehension" "squares_comprehension(1000)"
10000 loops, best of 3: 95.4 usec per loop
$ python -m timeit -s "from squares import squares_numpy" "squares_numpy(1000)"
100000 loops, best of 3: 5.31 usec per loopcomment 13y ago · link · parent
Even for projects that use more sophisticated build tools like rebar, leiningen or npm I write a Makefile so I don't have to remember those tools. Make provides a universal interface to those tools.
comment 13y ago · link · parent
1. The evented servers are bound to one CPU, Erlang will use all CPUs
2. any bit of blocking code will stall the other code, even it just for a moment.
It is a little unfair to compare the two approaches.comment 13y ago · link · parent
The following reading will take you a long way with Erlang:
Learn you some Erlang http://learnyousomeerlang.com/
OTP In Action http://www.amazon.com/Erlang-OTP-Action-Martin-Logan/dp/1933...
On Erlang, State and Crashes http://jlouisramblings.blogspot.com/2010/11/on-erlang-state-...
"Making reliable distributed systems in the presence of software errors" http://www.erlang.org/download/armstrong_thesis_2003.pdf
The last two links are "Erlang propaganda" describing the hows and whys of Erlang.
comment 13y ago · link · parent
https://gist.github.com/bb01a85404e6b445dcb3#file_resolve_do...
% -*- erlang -*-
%%! -smp enable
worker(Hostname) ->
{ok, IP} = inet:getaddr(Hostname, inet),
io:format(
"~s => ~s~n",
[ip_to_string(IP)]
).
ip_to_string({N1,N2,N3,N4}) ->
io_lib:format(
"~w.~w.~w.~w",
[N1,N2,N3,N4]
).
main([DomainFile]) ->
{ok, Bin} = file:read_file(DomainFile),
String = binary_to_list(Bin),
Domains = string:tokens(String, "\n"),
plists:foreach(
fun(Domain) -> worker(Domain) end,
Domains
).
This uses https://github.com/eveel/plists/