http://amitkapila16.blogspot.ca/2015/03/different-approaches...
> Oracle maintain old versions in rollback segments (also known as 'undo log').
421 karma · joined November 24, 2011
[ my public key: https://keybase.io/rraval; my proof: https://keybase.io/rraval/sigs/Ax1_hUoT2TVxiPextem1Y8Vwi61TqJ2pIbE4E19eXqE ]
http://amitkapila16.blogspot.ca/2015/03/different-approaches...
> Oracle maintain old versions in rollback segments (also known as 'undo log').
The linked blog credits a Chromium patch that led to the discovery of this exploit: https://chromium-review.googlesource.com/c/chromium/src/+/65...
foo = {
'a': 1,
'b': 2,
**({
'c': 3,
'd': 4,
} if bar else {}),
}
This adds `c: 3` and `d: 4` into `foo` conditional on `bar`.[1] https://docs.python.org/3/whatsnew/3.5.html#pep-448-addition...
loop do
DB.transaction do
# pull jobs in large batches
job_batch = StagedJobs.order('id').limit(1000)
if job_batch.count > 0
# insert each one into the real job queue
job_batch.each do |job|
Sidekiq.enqueue(job.job_name, *job.job_args)
end
# and in the same transaction remove these records
StagedJobs.where('id <= ?', job_batch.last).delete
end
end
end
Isn't this essentially a busy loop? You can achieve something much more performant by using `LISTEN` and `NOTIFY` to fire an event every time a row is inserted.Then the enqueuer can do a preliminary scan of the table when it boots up and then just a `LISTEN` instead of polling the DB.
Without ordering, you wouldn't be able to sanely run `sorted` on a iterable of namedtuples.
tl;dr: types are propositions and values are proofs of those propositions. Constructive logic is not concerned with (true xor false), but rather "I can prove A" or "I can prove not-A". There's also the middle ground of "I don't know how to prove anything about A".
For example, the P language [10] is a language for describing verifiable asyn-
chronous state machines, and used for example to implement and verify the core
of the USB device driver stack that ships with Microsoft Windows 8. Compiling
to C involves a complex CPS-style transformation [19, 26] to enable async/await
style programming [5] with a receive statement – using the effects library this
transformation is no longer necessary and we can generate straightforward C
code instead. Similarly, we hope to integrate this library with libuv [29] (the
asynchronous C library underlying Node [43]) and improve programming with
libuv directly from C or C++ using async/await style abstractions [12, 27]
Since the linked abstract doesn't actually mention this practical application, consider this comment as a goad to encourage more people to click through to the paper :)I have a love/hate relationship with CoffeeScript. I detest the implicit function call and object literal syntax. At various points in the language's history, it seemed like the language was essentially "done" and in maintenance mode. Especially when the eco-system stagnates around it and large parts of the community move on to things like ES6 and TypeScript. For example, the JSX tool was essentially a prototype [1], with tons of bugs [2] that were never fixed. And in the 6 months since its deprecation, there isn't a single tool to replace it.
Personally speaking, I consider the language dead and was considering alternatives so we could move off it. However, I still haven't been able to justify it because the alternatives don't make the same tradeoffs that make me love CoffeeScript:
- Minimal to zero runtime requirements. CoffeeScript generates a few things like `__extends` but that's it!
- One to one correspondence with generated JS. Source maps are nice but it's great to step through the JS debugger when looking at JS, and being able to convert the JS you're looking at with the CoffeeScript that generated it is not something I want to give up.
- Recognizes the warts, fixes what it can, and then gets the hell out of the way. `==` in JS is a mistake and IMO no language should carry that forward. Lexical `this` binding shouldn't require hoops to jump through. That sort of thing.
Ideally, if we are paying the cost of switching away from CoffeeScript, we'd move to a language with static type checking and solid support for sum types. I haven't been able to find any such language though, and the recent development spurt in CoffeeScript seems to have staved off that need for now.
PS: Yes, I'm aware of TypeScript. It's sum type support is rather weak. As part of my initial testing to see if it was a suitable language, I found a 5 line program that crashed at runtime. The bug report was closed as "Working as intended" [3]
[1] https://github.com/jsdf/coffee-react-transform [2] https://github.com/jsdf/coffee-react-transform/issues/62 [3] https://github.com/Microsoft/TypeScript/issues/13884
Do you have a link or something that I can read more about the "new approach" as you say?
> Waterline queries are case insensitive; that is, Users.find().where(name: 'FOO') will turn into SELECT * FROM users WHERE name = LOWER('FOO');. There's no way to turn this off. If you ask Sails to generate an index for you, it will place the index on the uppercased column name, so your queries will miss it. If you generate the index yourself, you pretty much have to use the lowercased column value & force every other query against the database to use that as well.
What the actual fuck!
The proposed solution to manually nuke the database state seems crazy to me. Some alternatives:
1. Run the entire test in a transaction, do flushes and assert as normal. At the end, ROLLBACK instead of COMMIT and now you have a pristine database again. [1]
2. Setup pristine DB state once and then use `CREATE DATABASE ... WITH TEMPLATE ...` to create a temporary database. Not sure what the perf hit is, but it's probably worth trying. [2]
[1] http://alextechrants.blogspot.ca/2013/08/unit-testing-sqlalc...
[2] https://www.postgresql.org/docs/9.4/static/manage-ag-templat... CREATE DATABASE actually works by copying an existing database. By default, it copies the standard system database named template1.
$ ls -li /usr/bin/{grep,egrep,fgrep}
1728040 -rwxr-xr-x 1 root root 28 Apr 23 12:12 /usr/bin/egrep*
1728041 -rwxr-xr-x 1 root root 28 Apr 23 12:12 /usr/bin/fgrep*
1728042 -rwxr-xr-x 1 root root 159024 Apr 23 12:12 /usr/bin/grep*
$ cat /usr/bin/egrep
#!/bin/sh
exec grep -E "$@"
$ cat /usr/bin/fgrep
#!/bin/sh
exec grep -F "$@"
The general point of them being implemented by the same executable still stands.Is there a more detailed write up of the inner workings floating around?
-R or --RAW-CONTROL-CHARS
Like -r, but only ANSI "color" escape sequences are output in "raw"
form. Unlike -r, the screen appearance is maintained correctly in most
cases.Non-funky behaviour would be to have an `enclosing()` that walks up the outer functions and returns the union of their `locals()`. Alternatively, a `vars()` which expands to all variables in scope (respecting LEGB) would be best given the context of variable interpolation.
Consider the following Python2/3 code:
def outer():
x = 1
def inner():
print(x)
print("x = {x}".format(**locals()))
inner()
outer()
This actually prints the right thing when run: 1
x = 1
However, if you remove the `print(x)` line, both Python 2 and 3 don't hoist the enclosing `x` into `locals()` (since it can't see a single usage of that variable), resulting in a `KeyError`: Traceback (most recent call last):
File "blah.py", line 7, in <module>
outer()
File "blah.py", line 5, in outer
inner()
File "blah.py", line 4, in inner
print("x = {x}".format(**locals()))
KeyError: 'x'
Python 3 has the `nonlocal` keyword that you can use to indicate that you're using a variable from an enclosing scope so that it's properly introduced into `locals()` but Python 2 doesn't have this facility.In that regard, Shake seems really compelling. It supports the file oriented nature of my build system. It's backed by an actual programming language, with lexical scoping, functions, a module system... all the things that suck about Makefiles.
Most importantly, it solves the one thing that drives me up the wall with Makefiles: supporting custom command line arguments sanely. I detest typing `make web TARGET=prod` and `shakeArgsWith` seems like it provides the flexibility of specifying targets and flags from custom command line arguments.
Thanks for this, I'm going to try and convert a few non trivial Makefiles to Shake. Any cons I should be aware of?
I initially tried the Leap Motion mounted on the Oculus Rift. As this blog notes, the top-down recognition was iffy at best but things really went to shit the moment the sensor was moved. I was unable to get even gun orientation working in the 6 hours or so that I tried, so maybe the new SDK + sensors can fix that.
I did end up building my demo, but with a alpha Thalmic Myo instead of the Leap. Video: https://www.youtube.com/watch?v=lihaqf3COw8
Link for others like me [PDF]: http://interactive.mit.edu/sites/default/files/documents/Gom...
I was playing with the demo linked elsewhere in this thread [demo], and noticed a bit of a hiccup when scrolling past multiple zoom levels. It seems like there'd be a bit of a pause as the tiles were rendered at each successive zoom level. It may be worthwhile to debounce the scroll event listeners with a small timeout, so you can catch multiple successive scroll events and zoom straight to the target zoom level without having to render each step along the way.
Quick video of the stuttering: http://gfycat.com/BrilliantActiveAfghanhound
[demo] https://seatgeek.com/senators-at-flyers-tickets/4-11-2015-ph...
[1] http://lhorie.github.io/mithril/comparisons/mithril.renderin... [2] http://lhorie.github.io/mithril/comparisons/react.rendering....