proj-oot-ootNotes13

Difference between revision 39 and current revision

No diff available.

https://wizardsofsmart.wordpress.com/2015/03/19/web-apis-vs-rpc/

---

django release discussion:

"

bebop 3 days ago

Some great things in this release:

and it is an LTS. Time to get upgrading.

reply

crdoconnor 2 days ago

>uuid field

This one is good.

I kind of wish it were default for primary keys, since the number of times I got burned by having databases I couldn't easily merge (which UUIDs help a lot with) way exceeds the number of times I had performance/memory issues caused by actually using UUIDs. "

so, we should support things like UUID keys

--

being able to do stuff like:

[(k,v) for (k,v) in geneName2Idx.items() if v == 0]

is just great. Note the destructuring bind.

--

some stuff coming in C++:

"

hendzen 14 days ago

I think C++ has a very bright future - due to two driving forces:

1) The C++ Standards committee has been doing a very, very good job. Aside from the big one (compiler enforced memory safety), some of the best Rust features are on their way into C++. For example:

Other great stuff coming to C++ over the next few years:

... much much more "


hsivonen 14 days ago

Fun times ahead if document.write isn't already supported. When I rewrote Gecko's HTML parsing, accommodating document.write was a (or maybe the) dominant design issue.


realusername 14 days ago

I'm quite curious, why document.write is so hard to implement compared to other methods ? Is it not working a bit like innerHTML ?


hsivonen 13 days ago

It's quite different from innerHTML, since document.write inserts source characters to the character stream going into the parser, and there's no guarantee that all elements that get opened get closed. There's even no guarantee that the characters inserted don't constitute a partial tag. So document.write potentially affects the parsing of everything that comes after it.

For this to work, scripts have to appear to block the parser. However, it's desirable to start fetching external resources (images, scripts, etc.) that occur after the script that's blocking the parser. In Firefox, the scripts see the state of the world as if the parser was blocked, but in reality the parser continues in the background and keeps starting fetches for the external resources it finds and keeps building a queue of operations that need to be performed in order to build the DOM according to what was parsed. If the script doesn't call document.write or calls it in a way that closes all the elements that it opens, the operation queue that got built in the background is used. If the document.write is of the bad kind, the work that was done in the background is thrown away and the input stream is rewound. See https://developer.mozilla.org/en-US/docs/Mozilla/Gecko/HTML_... for the details.

For added fun, document.write can write a script that calls document.write.

reply

Animats 13 days ago

What a mess. To support a stupid HTML feature, the browser's parser has to be set up like a superscalar CPU, retirement unit and all. Hopefully the discard operation doesn't happen very often.

---

"

In addition to bi-directional data binding, we can also bind parameterized functions to events:

var vm = todo.vm

m("button", {onclick: vm.add.bind(vm, vm.description)}, "Add")

In the code above, we are simply using the native Javascript Function::bind method. This creates a new function with the parameter already set. In functional programming, this is called partial application.

The vm.add.bind(vm, vm.description) expression above returns a function that is equivalent to this code:

onclick: function(e) { todo.vm.add(todo.vm.description) }

Note that when we construct the parameterized binding, we are passing the description getter-setter by reference, and not its value. We only evaluate the getter-setter to get its value in the controller method. This is a form of lazy evaluation: it allows us to say "use this value later, when the event handler gets called".

Hopefully by now, you're starting to see why Mithril encourages the usage of m.prop: Because Mithril getter-setters are functions, they naturally compose well with functional programming tools, and allow for some very powerful idioms. In this case, we're using them in a way that resembles C pointers. "

---

http://picat-lang.org/ is cool

---

" We use Go for a lot of our server development here at Mailgun, and it’s great. Coming from Python, though, there is one thing I really missed:

import pdb; pdb.set_trace()

I could insert this little line whenever I was confused about what was happening in the code and see exactly what was going on. But in Go? Not so much. When I started this project in January, gdb failed on every program I tried it on. delve didn’t work on OS X, and print-statement-debugging was too slow and limited. What's a developer to do? "

" godebug

    All that stands in the way [of a good Go debugger] is the writing of a lot of non-portable low-level code talking to buggy undocumented interfaces.

godebug is a different kind of debugger. Traditional debuggers for compiled languages use low-level system calls and read binary files for debugging symbols. They’re hard to get right and they’re hard to port.

godebug takes a different approach: take the source code of a target program, insert debugging code between every line, then compile and run that instead. " -- http://blog.mailgun.com/introducing-a-new-cross-platform-debugger-for-go/

discussion: https://news.ycombinator.com/item?id=9409423

 DannyBee 5 hours ago

"Since it's modifying the source before compiling it, I expect that the compiler will conclude that most optimizations can't be applied when they cross breakpoint boundaries."

While true, this depends on the compiler knowing this is a magical breakpoint barrier it can't move things across. The compiler has no idea this is a magical barrier unless something has told it it's a magical barrier. Looking at godebug library, i don't see this being the case, it looks like it translates into an atomic store and an atomic load to some variables, and then a function call, which the compiler is definitely not going to see as a "nothing can move across" barrier.

(Also, having the debugging library alter the semantics of the program is 100% guaranteed to lead to bugs that are not visible when using the library, etc)

reply

skybrian 3 hours ago

I think you're right that it's going to introduce bugs in concurrent code. For example, it's legal to send a pointer through a channel as a way of transferring ownership and never access the object again. If the debugger rewrites the code so that "never accesses it again" is no longer true, it's created a data race.

On the other hand, godebug generates straightforward single-threaded code that creates pointers to locals in a shadow data structure and accesses them later. There's no reason it shouldn't work if you're not using goroutines.

In particular, a previous call to godebug.Declare("x", &x) will add a pointer to what was previously a local variable to a data structure. This effectively moves all locals to a heap representation of the goroutine's stack, to be accessed later. It's going to kill performance, but it's legal to do.

---

 tormeh 1 day ago

The one I'm writing now: "Creating and implementing deterministic multithreading programming language significantly harder than hoped"

reply

thechao 1 day ago

Finished this five years ago: "Stepanov-style generic programming is the bees knees; we don't understand why."

reply

seanmcdirmid 1 day ago

It's not that hard. I'm thinking the song "let it go" can help (define determinism as an eventual goal; at least, that is the approach I find that works for me).

reply

tormeh 1 day ago

It's not that it's theoretically hard, but writing a compiler with typechecking and all is just a lot of work. It's a master thesis, btw, not a doctoral one.

reply

seanmcdirmid 1 day ago

My own project, Glitch uses replay to work out glitches (bubbles of non determinism in a deterministic execution), it incidentally also makes writing incremental compilers easy (see http://research.microsoft.com/en-us/people/smcdirm/managedti...), and I recently used it for a new type checker (see https://www.youtube.com/watch?v=__28QzBdyBU&feature=youtu.be). Ok, it's still a lot of work, but if you look at the problem you are solving, solving it can make the compiler writing aspect easier also.

reply

---

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments

---

" Sony's Open Source command line tool for performing python one liners using unix-like pipes

They call it "The Pyed Piper" or pyp. It's pretty similar to the -c way of executing python, but it imports common modules and has it's own preset variable that help with splitting/joining, line counter, etc. You use pipes to pass information forward instead of nested parentheses, and then use your normal python string and list methods. Here is an example from the homepage:

Here, we take a linux long listing, capture every other of the 5th through the 10th lines, keep username and file name fields, replace "hello" with "goodbye", capitalize the first letter of every word, and then add the text "is splendid" to the end:

ls -l

pyp "pp[5:11:2]whitespace[2], w[-1]p.replace('hello','goodbye')p.title(),'is splendid'"

and the explanation:

This uses pyp's built-in string and list variables (p and pp), as well as the variable whitespace and it's shortcut w, which both represent a list based on splitting each line on whitespace (whitespace = w = p.split()). The other functions and selection techniques are all standard python. Notice the pipes ("

") are inside the pyp command.

http://code.google.com/p/pyp/ http://opensource.imageworks.com/?p=pyp "

---

https://news.ycombinator.com/item?id=9446980

" At the same time it demonstrates everything that is wrong with traditional shells and what PowerShell? gets so right.

jq is not a "Unixy" tool in the sense that it should do one thing and do it right. jq implements its own expression language, command processor complete with internal "pipelines". Why would a tool need to do that? find is another utility that does many, many other things than to "find" items: It executes commands, deletes objects etc.

Consider this challenge that included parsing json, filtering, projecting and csv-formatting output: https://news.ycombinator.com/item?id=9438109

Several solutions uses jq - to good effect. But the PowerShell? solution uses PowerShell?