News for hackers. Stuff that matters.

ericmoritz

Re:Pyre: Fast Type Checking for Python on Friday May 11, 2018 @02:12PM (#17049578)
Java's verbosity made us all hate type systems in the early 2000s so many of us migrated to dynamic languages such as Python, Ruby in the mid 2000s that allowed us to work fast and loose and get things done.

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.

Re:Twitter Soars After Surprise Sales Gain, First Real Profit on Thursday February 08, 2018 @11:15AM (#16333146)
I've pretty much dumped Twitter for Mastodon. My mental health couldn't keep up with the air of constant outrage on Twitter.
I don't know for certain without digging into the code but they are probably using the WebCryptoAPI and doing everything client-side to encrypt the file.

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.

https://www.w3.org/TR/WebCryptoAPI/

Re:Raspberry Pi Zero W, with Wi-Fi and Bluetooth, priced at $10 on Tuesday February 28, 2017 @10:03AM (#13754181)
I would get a Z-Wave daughter board and use Z-Wave devices for controlling the electronics. Z-wave devices aren't Internet connected so you only have to worry about locking down the Pi.

Apparently there's already an open source project called Home Assistant for this purpose.

https://home-assistant.io/

Re:Easy XMPP: What are we doing here? on Tuesday January 17, 2017 @10:57AM (#13418547)
We don't need another federated network. Administrators of those nodes are putting themselves into danger. What we need to develop is a purely decentralized p2p network that is resistant to censorship and eavesdropping.
Re:How We Designed for Performance and Scale on Wednesday June 10, 2015 @02:30PM (#9694320)
Keep in mind that Erlang processes != System processes. Erlang processes are preemptively scheduled microthreads that are scheduled by the Erlang VM.
Re:How We Designed for Performance and Scale on Wednesday June 10, 2015 @02:28PM (#9694312)
No, usually there's an accept process spawning working processes and passing the connection off to it.

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.

Re:Tim Berners-Lee: 25 years on, the Web still needs work on Thursday March 13, 2014 @12:51AM (#7390089)
The comments here describe doom and gloom of the web dying.

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!

Re:Riak 1.4 Released on Thursday July 11, 2013 @02:40AM (#6024778)
Turner broadcasting uses Lua/openresty and riak: https://github.com/bakins/lua-resty-riak
Re:Awsbox: A DiY PaaS for Node.JS on Tuesday May 21, 2013 @10:53PM (#5748562)
Basically, open heroku
Re:Awsbox: A DiY PaaS for Node.JS on Tuesday May 21, 2013 @05:18PM (#5746911)
This is a fantasy of mine as well. A generic opensource PaaS would be awesome. Now if I just had the ambition... It is quite an undertaking.
Re:Mock your HTTP responses to test your REST API on Friday May 03, 2013 @02:22PM (#5651688)
this isn't any better than using a live server for testing.

Build a good client library for your applications to use, mock the client library and don't worry about tests failing because of availability problems.

Re:The McDonald's Theory of Bad Ideas on Wednesday May 01, 2013 @02:16PM (#5639764)
Works until you're forced to build a PHP site with GDBM as a backend because everyone but you thought it was a good idea.
Re:Why Python, Ruby, and Javascript are Slow on Saturday March 02, 2013 @02:52AM (#5308897)
Using generators in Python will get similar laziness in Python:

    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
        )
Re:Why Python, Ruby, and Javascript are Slow on Saturday March 02, 2013 @02:11AM (#5308816)
If you really want power, use NumPy:

    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 loop
Re:Why Use Make on Sunday February 24, 2013 @08:00PM (#5276739)
I can't tell you how many projects I've shelved for months and when I returned thought, "Damn it. How do I build this again? Oh look a Makefile. Thank you Past Eric."

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.

Re:Python vs. Node vs. PyPy benchmarks on Sunday February 17, 2013 @05:08PM (#5236933)
Yeah, because of cowboy and Erlang's design it is going to out perform a single process evented server hands-down.

  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.
Re:Heroku Blog: Routing Performance Update on Saturday February 16, 2013 @10:28PM (#5234074)
As far as I know, the one process per dyno is not a restriction that Heroku puts on the application, it is an architectural decision of the application.

Spawn up worker pool if you want > 1 req at a time.

Re:How Lisp is Going to Save the World on Wednesday January 09, 2013 @01:38PM (#5032654)
I'm missing something; how does LISP enable bug-free programs?
Re:Erlang OTP Tutorial For Beginners on Friday January 04, 2013 @02:55PM (#5009462)
"OTP in Action" is an excellent book for learning OTP.

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.

Re:FreezeGun: easy mocking of Python datetimes on Tuesday December 11, 2012 @02:56PM (#4906466)
nice project. I usually avoid this by making my APIs accept a datetime objects and make the client code create the datetime object.

Pure functions make tests simple.

Re:Should Gittip use an ORM or raw SQL? on Monday December 10, 2012 @01:44PM (#4900777)
The correct solution is to abstract away the database from the developer. An ORM forces a square peg into a round hole.
Re:Playing with Go: Embarrassingly Parallel Scripts on Monday December 03, 2012 @04:45PM (#4868043)
Or Erlang

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/
not as ridiculous as this. https://gist.github.com/969788
Re:HTTP 2.0 Draft – SPDY Protocol on Friday November 30, 2012 @12:03AM (#4851934)
oh man, this one is and its "clear host cache" will come in handing in the future. chrome://net-internals/#dns

Older »