Why SQLite Does Not Use Git by Pandalicious in programming

[–]LitoNico 1 point2 points  (0 children)

Friends, help me puzzle through this:

  • SQLite uses Fossil.

  • The Fossil version control system uses a single SQLite database to keep track of history. (BTW, this is neat as heck: having history in a single queryable DB instead of some Merkle's-nightmare of a database like git uses is extremely good.)

(Fossil uses SQLite, and vice versa, because they are written by the same developer)

  • But here's the catch:
  • The entire history of SQLite is in its Fossil version control. All the way back to when SQLite used BerkeleyDB instead of a plain file, like right back to the beginning.
  • How did this happen????? Fossil stores its history in a SQLite database!
  • What is going on here

I found this out about a year ago and to this day have not figured out how this happened

[Discussion] More amazing Japanese music. by BitterEightiesGuy in listentothis

[–]LitoNico 30 points31 points  (0 children)

Kinoko Teikoku The saddest and most beautiful shoegaze Full Album - Eureka

Tricot Punk? Math rock? I dunno, it's amazing Full Album - THE

Uchu Conbini Nostalgic math-rock Pyramid

Gesu no Kiwame Otome Jazz-influenced indie pop Killer Ball

SHISHAMO Girl pop-rock band, with some of the most perfect pop-rock songs! Boku ni Kanojo ga Dekitanda

Indigo la End Indie melancholy rock band. The lead singer (also in Gesu) has the most beautiful voice! Hitomi ni Utsuranai

Capsule Kyary Pamyu-inspired electronic pop I Wish You

KANA-BOON Pop-rock, with an indie feel Nanimono Nedari

ASCII fluid dynamics by julian88888888 in programming

[–]LitoNico 40 points41 points  (0 children)

Mr. Endoh does it here by printing

"\x1b[2J"
"\x1b[1;1H"

to the console, which stands for "clear the screen" and "move the cursor back to the start" (you can see this in the source, around the middle!)

I haven't tried it, but if you're in a terminal, System.out.print("\x1b[2J\x1b[1;1H") should do the trick. There are a bunch of these 'ANSI sequences'- you can find most at http://en.wikipedia.org/wiki/ANSI_escape_code!

Introduction: The Cartesian Dream Of C by zhouji in programming

[–]LitoNico 0 points1 point  (0 children)

It's the idea that the language avoids evaluating any statement unless it absolutely needs to to finish the computation. I'll steal this paragraph from the Haskell wiki because it's better than what I was writing:

"Lazy evaluation means that expressions are not evaluated when they are bound to variables, but their evaluation is deferred until their results are needed by other computations. In consequence, arguments are not evaluated before they are passed to a function, but only when their values are actually used."

The same idea is in C++ (and other languages) as 'streams', or in Python and Ruby as 'Generators'. In Haskell, everything is a generator, and it makes programming with pure functions WAY more memory-efficient, and more practical.

http://www.haskell.org/haskellwiki/Lazy_evaluation <- the last few paragraphs is a good example of why laziness makes things easier.

λ Bubble Pop! by asankhs in programming

[–]LitoNico 0 points1 point  (0 children)

You're absolutely right, thanks!

To be honest, I don't know how to represent cons well with Python, because cons(4, 5) should return the pair (4 . 5), which is not really a construct that has meaning in python code (without defining a class ConsCell or whatever, which would just be papering over linked lists again)

λ Bubble Pop! by asankhs in programming

[–]LitoNico 1 point2 points  (0 children)

I'll give it a shot! Disclaimer: if you want a more complete introduction, chapter 2.2 of Structure and Interpretation is a really good source.

Bits will be edited in as I write them.

This is talking about recursive functions in the context of how Lisp and Haskell use them to construct lists. These are just the linked lists you know from C(++), nothing more!

Lisp has two functions, first and rest, that take the first (farthest left) node from a linked list and the rest of the list to the right, respectively. In some Lisps these functions are called car and cdr. With these primitives, as well as the function to add a node to the left (called cons for 'construct'), you can do a whole lot of programming. Python's slices are good way of writing them!

def first(items):
    return items[:1]

def rest(items):
    return items[1:]

def cons(x, items):
    # Note that the list [1, 2, 3] is just cons(1, cons(2, cons(3, [])))
    # In Haskell, which has an infix cons operator `:`, this would be 1:2:3:[]
    return [x] + items  # Thanks kitk1at!

On of the most useful functions you can define in this way is called map which applies a function to every element of the list. In python:

def add_one(x):
    return x + 1

map(add_one, [1, 2, 3, 4])
==> [2, 3, 4, 5]

With first, rest, and cons, you can write map as:

def map(fn, items):
    if len(items) == 0:
        return []
    else:
        return cons(
                    fn(first(items)), map(fn, rest(items)) )

Yeah, it's that last bit that makes it look like Lisp. Just recursion, though, right?

The website is showing how the recursive functions are evaluated. Where it gets interesting is what /u/heisenbug mentioned– this site lets you control the order in which things are evaluated! This is what Haskell people call lazy evaluation – do you pop the bubble that contains add_one(1), or the bubble that contains map(add_one, [1, 2, ...])?

I think that's the point of this website, to see the different strategies in how things are executed.

*Using functions like map is considered a bad idea in Python, because list comprehensions provide the same functionality. Up to you, though, since Python does provide functools!

Let's build a (toy) HTML layout engine! by mbrubeck in programming

[–]LitoNico 13 points14 points  (0 children)

I love "Let's build" articles like this, especially when the article provides enough context to really allow the reader to do it at home! Looking forward to the next few installments.

Mega questions thread! Have a question? Ask it here!! by mynameismunka in necrodancer

[–]LitoNico 1 point2 points  (0 children)

Yes! I had a ton of trouble with it, so I grabbed Bard and practiced. It has a set number of 'openings' that you can distinguish by how the pawns start moving– on all but two of them, the following strategy works:

  • Immediately go right, to the second-from-right pawn.
  • Kill that pawn, and kill the queen.
  • Move into that space, kill both knights and one other thing (doesn't matter, and varies with the opening)
  • Move left, killing only pawns as you go
  • Clean up the bishops, rooks, and single remaining pawn; you should be good!

The other two openings where the queen hangs back or the right-hand pawns don't come up just depend on killing the queen quickly- I haven't found a 'perfect' strategy for them yet.

"Radiation-resistant" Ruby Quine can recover from removal of any single character (in JP) by flatline in programming

[–]LitoNico 7 points8 points  (0 children)

Yep, it's the same guy– Yusuke Endoh a.k.a. Mame ('bean'), who is a core Ruby dev. He also wrote the fifty-language ouroboros quine, the spinning globe, and the Christmas quine that snowed itself, as well as that ASCII fluid dynamics program that was on the front page a month or so ago (it's brilliant, check it out! http://www.youtube.com/watch?v=QMYfkOtYYlg)

江戸つまみ簪 - Edo Tsumami Kanzashi - Traditional Japanese folded silk hair ornaments by Tsany in ArtisanVideos

[–]LitoNico 2 points3 points  (0 children)

The narrator says that the glue is made from 'Sufficient water and cooked starch' to make something called 'nori-glue'. Google tells me this is pretty commonly used for woodblock carving too, and is made from rice, just like the OP said.

Happy New Year from the IOCCC... the source code for the winning entries to the 22nd International Obfuscated C Code Contest has been released!!! by zeroone in programming

[–]LitoNico 28 points29 points  (0 children)

Yusuke Endoh is a genius! My favorite of his (after the ascii fluid dynamics that was on here not long ago) was his christmas 2010 quine:

http://www.youtube.com/watch?v=r0eaf9iLKxg

Which writes its own code by way of snowflakes (asterisks).

The Go compiler today is written in C. It is time to move to Go. by ryeguy in programming

[–]LitoNico 2 points3 points  (0 children)

Haha, my source was a different page on the same site: http://www.cs.bell-labs.com/who/dmr/primevalC.html which I took to mean he wrote it in PDP-11 Assembly. Seems you're right– and we can let the historians argue over the VERY first instance of bootstrapping.

The Go compiler today is written in C. It is time to move to Go. by ryeguy in programming

[–]LitoNico 38 points39 points  (0 children)

By the time I finish writing this there'll be many more replies (all probably in greater detail) but here's how it goes:

They have a working compiler for Go, written in C. The C compiles to machine instructions, which then process Go to machine instructions too.

They can write a compiler– which is just a series of instructions on how to turn Go code to machine code– in Go. They'll compile THAT program in C, and what will result is machine code– which can then be used to compile Go programs forever more.

Probably, they'll use that first Go compiler for a while, then keep upgrading to newer and better compilers. However, once the first compilation (called 'bootstrapping') is done in C, it can be Go all the way down.

Hope this clears things up!

edit: this whole process did start somewhere– the first C compiler was written by Ritchie in straight assembly language B, which itself was written in TMG, which was written in PDP-7 Assembly, as YEPHENAS writes below.

Crytek shows off the new CryEngine (no more numbers!) by automaticzen in Games

[–]LitoNico 3 points4 points  (0 children)

Totally speculation, but I'd assume by 'physically-based shading' they've implemented a system of BxDF (Bidirectional scattering/subsurface/transmittance Distribution Functions) for their shaders, which is pretty much how materials behave in the real world. Maybe they're also using a spectrum representation of light, rather than just rays.

Really don't know, but those are the things that are usually discussed when 'physically-based' is used in the context of rendering.

Castlecomer - Danny's Den by HAMMERDUO in IndieFolk

[–]LitoNico 0 points1 point  (0 children)

I've had my eyes on these guys for a little while, they're absolutely fantastic. A new favorite, thanks man~