« first day (1043 days earlier)      last day (3908 days later) » 

@Borgleader I only found one test file, the one of size 20.
 
The trick is mkdir which fails if already exists.
 
@FredOverflow right below that link theres a url to "percolationtesting.zip"
it has a bunch of them in there
 
… hash the file?
 
@minitech That's what I do but @CatPlusPlus is not happy with my hash.
 
11:01 PM
@StackedCrooked How not?
 
It's too long.
 
Truncate it?
 
Well, it is kinda long.
 
user1804599
makeKwParser :: String -> Q [Dec]
makeKwParser word@(c:cs) = do
    let name = mkName ("kw" ++ (toUpper c : cs))
    let body = NormalB $ AppE (VarE $ mkName "keyword") (LitE $ StringL word)
    return [FunD name [Clause [] body []]]
 
@minitech Plan B.
 
user1804599
11:02 PM
My first TemplateHaskell program!
 
How long is too long
 
@minitech Ask Cat :)
 
And why is that Plan B? Hashes are better in every way
 
I told you you can just hash the concatted hashes, and use shortest unique prefix of that in the url.
 
How about just truncating it
 
11:03 PM
view?id=e63bf25cabf9a0371a1a2418e127f3ab-b74be208b5990002942f66bcf7c0e91d
 
Is truncating just chopping of some characters?
 
You get hash(e63bf25cabf9a0371a1a2418e127f3ab-b74be208b5990002942f66bcf7c0e91d)
 
@StackedCrooked Yes.
 
And then find shortest unique prefix.
 
user1804599
Hmm nice.
 
11:03 PM
@not-rightfold You don't submit with prefix.
 
“Same unique prefix”
 
You use prefix to address.
 
user1804599
Yes you use prefix as directory name. :P
 
So internally you put the stuff in hash(e63bf25cabf9a0371a1a2418e127f3ab-b74be208b5990002942f66bcf7c0e91d) folder.
 
user1804599
It thought of looking it up every time but that won't work.
 
11:04 PM
And you put out an URL that uses the prefix.
 
@not-rightfold Collisions will result in the the user getting the output for a program that he did not submit.
 
user1804599
@CatPlusPlus No, that cannot work. You need to use the prefix as the directory name.
 
Bleh, you don’t even need a shortest prefix.
 
@Borgleader Thanks! But I think I need a day off from Algorithms :)
 
@not-rightfold Pourquoi pas?
 
11:05 PM
Using the shortest unique prefix as a url will fail eventually, because what if 2 hashes generate a prefix that's nearly the same?
 
user1804599
Submit snippet A: hash prefix is 12345. URL is 12345.
Submit snippet B: hash prefix is 123456. URL is 123456.
Go to view?id=12345 and it's ambiguous.
 
I got thinking about how to make the shortest possible URL length. And that would be incrementing ids starting with 0. And I proved it possible!
 
Then the old prefix doesn't quite work.
 
@FredOverflow Slacker ;)
 
What @not-rightfold said. :D
 
11:06 PM
Yes.
 
user1804599
You need to use the prefix as the directory name to solve this problem.
 
But even chopped in half, the space is very large.
 
user1804599
@StackedCrooked just do auto-increment and be done with this shit forever.
 
@not-rightfold That won't stop collisions from happening.
 
user1804599
@CatPlusPlus It will.
 
11:06 PM
No.
 
user1804599
Yes.
 
user1804599
Listen.
 
Truncate the darn hash
 
user1804599
You calculate the shortest unique prefix at submit time.
 
Okay, I see what you want know.
 
user1804599
11:07 PM
You use that as directory name.
 
user1804599
You don't need to store the entire hash.
 
http://coliru.stacked-crooked.com is still very long (reminds me Amdahl's law somehow)
 
Hm. coliru.com doesn't exist.
 
http://c.sc.c++/0 :D
 
Also get rid of view?id= :v
coliru.me
 
11:11 PM
Why don't you want to use an url shortener service again?
 
coli.ru
URL shorteners are the worst invention since… uh…
 
toraburu
 
Russian Online Compiler
 
coliru.io
 
coliru.me for typing, coliru.io for viewing? :D
 
11:11 PM
.su best TLD
 
1.com
 
TLD?
 
top level domain
 
Ah
 
@CatPlusPlus really? I thought you wouldve preferred .fu
 
11:12 PM
My math seems to be failing me at the moment.
 
user1804599
function onSubmitSnippet($snippet):
    $output = compileShit($snippet)
    $hash = sha1("#{sha1($snippet)}-#{sha1($output)}")

    $len = 0
    for $dir in ./* ORDER BY length($dir) ASC:
        if $dir != $hash && $dir isPrefixOf $hash:
            $len++
    $finalDir = $hash[0:$len]
    saveIn($finalDir)
 
What language is that?
 
user1804599
A combination of Python, Ruby, Perl, SQL and Z shell.
 
It’s like Python + PHP
 
shudder
 
11:13 PM
Why are we hashing the output?
 
@Borgleader It has nothing to do with slacking. I just can't see the bug in my code. I have been staring at it for hours, and everything seems correct to me.
And according to the visualizer, it is correct. But some tests are still failing.
 
@FredOverflow ;) --> I'm just kidding you
 
If this was C or C++, I would probably hunt for UB bugs.
 
After truncating you still have b74be208b5990002942f66bcf7c0e91d which is still long. Or do you also want to truncate that that?
 
First of all, don’t use hex.
 
user1804599
11:16 PM
src/Xen/Lex.hs:19:15:
    GHC stage restriction:
      `keywords' is used in a top-level splice or annotation,
      and must be imported, not defined locally
    In the first argument of `mkKwParsers', namely `keywords'
    In the expression: mkKwParsers keywords
 
user1804599
Fuck this shit. Fuck you Haskell.
 
Hey. Haskell is good.
 
In case of collision I should return EAGAIN :P Or EWOULDBLOCK.
 
Do what Zoidberg said.
6
But I'd use full hash for directory, and store prefixes separately.
 
user1804599
I'd store everything in PostgreSQL and use an auto-incrementing integral surrogate key.
 
11:18 PM
Evening lads
 
I'd use an integer
 
But that's no longer content-addressed filesystem and you suck.
 
user1804599
I don't care and you don't need it.
 
But cool
 
How would you go about reproducing a swf file in the background and take a picture of the flash canvas programmatically? (on a web server)?
 
user1804599
11:19 PM
You don't because you don't use Flash.
 
I wouldn’t, I suppose
 
user1804599
Use HTML 5 you fool.
 
inb4 I wouldn't (too late)
 
Ahaha you still haven't solved that
 
Yeah :(
 
11:20 PM
Told you to drop it.
 
user1804599
If you still use Flash, yes, you're way too late.
 
@not-rightfold for animations there are no other choices (except Pivot I guess)
 
user1804599
@Jefffrey HTML 5 canvas.
 
user1804599
WebGL.
 
11:21 PM
And no, I'm not using flash for web development
 
Wait, what are you doing?
 
user1804599
You can still use HTML 5.
 
user1804599
Embed web browser et voilà.
 
/coliru_storage/hash_prefix/full_hash_name ?
 
Make hash_prefix a file.
 
11:22 PM
@ThePhD No. Why.
 
Wait, I thought we were going with Zoidberg's idea to avoid ambiguous lookup?
 
There is no ambiguous lookup, use a database.
 
user1804599
I can write a unique ID generator with a TCP interface in Elixir. :P
 
storage/objects/full_hash
storage/refs/hash_prefix => full_hash
 
And when 2 hash_prefix's come out to be the same?
 
11:23 PM
@not-rightfold what? to embed the swf file?
 
Then make new one bigger.
 
@ThePhD Link a new hash_prefix
 
user1804599
@Jefffrey Wat no.
 
user1804599
To embed the HTML 5 canvas.
 
@Jefffrey Is this a SWF file you are making?
What is the situation? I just got here.
 
11:24 PM
Oh, also, best shortening service url name:
 
@not-rightfold Good luck using HTML to make animations like this one
 
http://l.nk/[hash]
 
user1804599
@Jefffrey Perfectly possible.
 
There is no such thing as a good URL shortening service name
 
user1804599
I don't see the problem really.
 
11:24 PM
If you have thousands to buy a one-letter domain name, sure.
 
@not-rightfold I'd be interested in how.
 
@Jefffrey Sorry, what is it?
I don’t have Flash installed.
 
@minitech a flash (cartoon) animation
 
@Jefffrey Probably pretty easy to do in HTML5. Flash is not magic.
 
user1804599
 
@CatPlusPlus It costs thousands?
 
@not-rightfold Using Javascript for frame by frame animations is just overkill.
 
user1804599
They're all taken.
 
@ThePhD Yes.
 
user1804599
@Jefffrey hahahaha
 
11:26 PM
@Jefffrey Uh, what
 
user1804599
Implying JavaScript is more costly than the equivalent ActionScript.
 
@Jefffrey lol
 
Or plugin in general
 
@not-rightfold there is no actionscript in my animations...
jesus christ help me
 
user1804599
than Flash.
 
11:27 PM
These are your animations?
 
user1804599
@Jefffrey I'm trying to, but you're avoiding solutions.
 
@minitech No.
 
Why in the world do you need to render them server-side
 
Flash is horrible.
I hate Flash so much.
 
11:27 PM
@minitech To take pictures of random frames
 
@StackedCrooked You have to do this in Bash?
 
I can choose any language.
 
I clicked that link. Then exited. Ten seconds later, the sound finally did too.
 
@Jefffrey Whose are they? If you have no control over them, why are we talking about HTML5?
 
@StackedCrooked Find shortest prefix.
 
user1804599
11:28 PM
@StackedCrooked Look at my pseudocode above.
 
Also, there are Flash-to-HTML5 compilers, and headless browsers, and you can use both probably
 
@not-rightfold I came here asking for a solution to take pictures of frame in Flash and you are telling me that I should animate frame by frame with Javascript (which is ridiculous).
@minitech ask zoidberg
 
@Jefffrey It’s not ridiculous but it may not be relevant
 
user1804599
And Flash isn't ridiculous?
 
@Jefffrey About whose they are?
You’re not being very helpful
Nobody is really being helpful
 
11:29 PM
@not-rightfold Flash is fucking ridiculous. But in real life people animate with Flash and/or Pivot. I'm not talking web development here, I'm talking cartoon animation.
 
user1804599
Nobody is helpful if you ask here about Flash.
 
@minitech Random animation by random people.
 
Okay.
Compile SWF to HTML5
 
@not-rightfold The code that ended with Fuck this shit ?
 
Then use a headless browser
Ta-da.
 
11:29 PM
@minitech Didn't know that was a thing.
 
user1804599
17 mins ago, by not-rightfold
A combination of Python, Ruby, Perl, SQL and Z shell.
 
It is. Pretty unstable, but that’s about as good as it’s going to get
 
user1804599
The code above that.
 
(Did Mozilla make one?)
 
user1804599
Also, compile-time errors are not code.
 
11:31 PM
Or make use of libflashplugin or whatever it is. This is apparently Lounge<FUBAR++>, after all.
 
@Jefffrey Yes, drawn animations surely need Flash runtime.
 
@CatPlusPlus People use Flash to draw static things just because it’s the most convenient vector thing
 
They cannot be exported to a video. No, sir.
 
user1804599
Oh wait nevermind it's not bugged.
 
user1804599
There shouldn't be a goto in the code.
 
11:32 PM
@CatPlusPlus Hmm. If that's sarcastic: No, they can't.
 
@StackedCrooked: Hash things together. The hash should be in Base32 or something. Truncate the hash.
Alternatively, use Postgres, which is the best solution.
 
user1804599
@minitech Illustrator.
 
Except you appear to want to do this in shell for some unfathomable reason, so…
 
Flash is getting obsolete. If people are using authoring tools that literally cannot output non-Flash shit, they need to get on with times.
 
@not-rightfold My school doesn’t have that
 
11:33 PM
Hell, Flash on mobile is non-existent already.
 
Hah, that reminds me
 
@minitech Compiling and running the user code involves using the shell and it naturally grew from there.
 
user1804599
CREATE TABLE snippets (
    id              serial PRIMARY KEY, -- Unique IDs!!! That was easy!!11
    code            text NOT NULL,
    output          text NOT NULL,

    UNIQUE (code, output)
);
 
Ok, let's talk about videos here. How can I take a screenshot of the window player that is playing a video, programmatically?
 
And I rather don't put too much code in the webserver.
 
user1804599
11:34 PM
Depends on what platform you're on.
 
@not-rightfold linux
 
flashplugin!
 
Uh, why do you want to do that?
It's trivial to extract a frame from a video.
Not the same category of problems.
 
@Jefffrey By writing a program that does it.
 
@CatPlusPlus I said the window of the player though
 
11:36 PM
@not-rightfold It should be hashes. Storing code in databases is icky.
 
user1804599
@minitech Why is it icky?
 
@not-rightfold You have to write it to a temporary file to compile it anyways, no?
 
user1804599
Code is data and databases are good at storing data.
 
Hash it, put it in a file, database maps ids to filenames.
 
user1804599
@minitech You do that once, before inserting it into the database.
 
11:36 PM
@not-rightfold See previous message.
 
user1804599
(Coliru caches all results.)
 
@Jefffrey Have fun.
 
lol :P
 
user1804599
Eww storing tiny amounts of data in files and linking to them from a database.
 
I'm glad you edited that.
 
11:38 PM
Hi there :)
 
@not-rightfold It’s not tiny
 
user1804599
It's not?
 
@Jefffrey No, really, it involves interacting with X11 directly and hoping everything will work.
 
Whatever, it doesn’t matter, just use a database for something
 
user1804599
PostgreSQL can store 1 GB of data in a text field.
 
11:38 PM
It’s better automatically
 
user1804599
You don't upload 1 GB of data to Coliru at once.
 
I wonder if filesystem can be used to lock.
 
@not-rightfold Why would you even do that ?
 
The files also get stupid big and exporting it would be harder
 
@CatPlusPlus I think I have an idea about that. I'll let you know how it goes in a day or two.
 
user1804599
11:39 PM
@Jivay Do I know? PostgreSQL records can be up to 1.6 TB.
 
One of my concerns was that the default program will be compiled many times. And it would be silly if those all took up separate storage space.
 
@StackedCrooked Unique columns are efficient.
 
user1804599
Oh I forgot shell_command text NOT NULL and adding it to the UNIQUE clause.
 
@minitech Yes but the recompilation would stress the CPU needlessly.
 
@StackedCrooked Are we talking about recompiling anything?
 
11:41 PM
YES
 
@Jefffrey btw the animation you linked is already a video, with Flash only being a player.
 
The code and command are unique
 
Just fyi.
 
@minitech That's the basis for my caching idea yes.
 
@CatPlusPlus yeah, maybe that was a bad example. I just randomly picked what seemed a flash animation.
 
user1804599
11:41 PM
@StackedCrooked When do you cache? I suppose you'll never have to recompile if you already have something with the same (code, shell command) pair?
 
user1804599
Oh. :)
 
No, that's why compiling the default program is very fast.
 
@StackedCrooked Yes. So what problem regarding this does a database introduce?
 
user1804599
CREATE TABLE snippets (
    id              serial PRIMARY KEY, -- Unique IDs!!! That was easy!!11
    code            text NOT NULL,
    output          text NOT NULL,
    shell_command   text NOT NULL,

    UNIQUE (code, shell_command)
);
 
user1804599
Problem solved!
 
11:42 PM
Well, I though you proposed getting rid of that.
 
Rid of what
 
Anyway I'm past 48 hours of wakefulness now.
 
user1804599
Lookups on fields that have unique constraints are insanely fast.
 
Yes. It’s a hash, except you don’t see it. Same thing
 
user1804599
@minitech And collision stuff.
 
user1804599
11:44 PM
(Actually, it depends on the indexing strategy you choose. I don't know what the default is for UNIQUE but I suppose it's a hash table.)
 
Print old result and exit, skipping compilation.
 
So
Use a database
 
I could do that.
 
user1804599
SELECT output
  FROM snippets
 WHERE code = $1
   AND shell_command = $2;
 
… 48 hours is dangerous to your health.
 
user1804599
11:46 PM
@minitech It's not.
 
But in the end I don't see the problem with the long urls :P
 
user1804599
@StackedCrooked fugliness.
 
@not-rightfold Sure it is.
Takes a lot of regular sleeps to fix sleep deprivation.
 
I've been only getting 3-4 hours of sleep for the last 4 days
It's not that big of a deal.
 
Do you feel tired constantly?
If not, whatever
 
11:48 PM
@ThePhD I'm always like that.
 
I don't feel tired constantly.
In fact, I stay up even later than I did the previous night some times.
But, I have several sleep disorders, so you can't really use me as a good case study. :P
 
Oh.
 
I don't have sleep disorders.
 
I feel tired whether I don't sleep, sleep 12 hours or sleep 24 hours.
 
I feel tired constantly and I get 8 hours of sleep
 
11:49 PM
No win.
 
I only feel tired right after I wake up.
 
I can only be awake for like 6 hours without feeling horrible.
 
Integer('18aa934a8d82d638dde2147aa94cac94', 16).to_s(36)
=> 1gkk027jwj2jitpqukbjvlims
Convert base-16 to 36.
That makes it a little shorter already.
 
Sounds like a plan
Now, truncate that base46
36*
If you like, you can also make it base 64 or even base 62. :P
 
Hm.. stdexcept isn't required to include string still.
 
11:54 PM
Yes, base-62 is what I meant. Sorry.
Actually, base-64, but with /_
And +- for good measure
Then truncate it to… 10 characters.
 
Ugh don't "truncate" anything.
 
Why not?
 
Don't truncate, just do a shortest unique match.
 
But that’s more complicated.
What’s wrong with truncating it?
 
But it scales infinitely.
 
11:56 PM
No, it doesn’t.
 
user1804599
@minitech more collisions.
 
Well, it scales up to original space.
 
It scales to the size of the hash.
 
If 2 truncations yield the same result, you die.
 
@not-rightfold Very very few
 
11:57 PM
THe chances of a base 62 or base 64 hash being exactly the same are pretty minimal
 
@ThePhD Actually, something feels a bit odd and you add a character and move on
@ThePhD Encoding doesn’t matter
 
With shortest prefix you can go lower than 10 characters.
 
Who cares, though
 
Shortest prefix can be 1 character.
 
Shortest prefix can be 0 characters
But the domain name matters way more
 
11:58 PM
No, empty prefix is common to every string.
It's not unique.
 
The first one submitted gets it.
i.e. default. Hey, that actually works out pretty well.
 
user1804599
Time to write an abstraction over HttpXMLRequest so I never have to use jQuery ever again.
 
You have the worst ideas.
 
@not-rightfold *XMLHttpRequest, also why do you need an abstraction
 
11:59 PM
Just use jQuery.
 
@CatPlusPlus Flagging that
 
user1804599
@StackedCrooked eh.
 
user1804599
You don't need a gem for that. It's included into the standard library.
 

« first day (1043 days earlier)      last day (3908 days later) »