« first day (1496 days earlier)      last day (3342 days later) » 
00:00 - 21:0021:00 - 00:00

9:22 PM
I have a work related puzzle that I can't seem to solve. There's a database with two million records. I need the average of every record timestamped 10:15 on Monday. Sounds simple right? The simple query doesn't meet performance criteria. It takes far too long to run on two million records.
 
Sort by time?
 
Huh? Sort the results?
So anyway, we started over. Now every interval has unique integer associated with it. So midnight is 0, 12:15 is 1, 12:30 is 2, 12:45 is 3, so on and so forth. Now instead of comparing dates, we are searching for integers.
Still takes too long.
I need all the records that have a unique integer of, for example, 5. Takes 35 seconds to run over two million records
 
"if in doubt, add an index"
 
I knew that would happen. The guy who knows how to add indexes and has built the one we already have is on vacation until Monday
Meanwhile, I'm being stubborn I guess.
I'd better just learn how to do it
To me, indexes seem like a cop out. I can't put my finger on why though
 
well it doesn't really make sense to throw indices at everything. but they do have their uses and they can make a huge difference in performance
so if this is an important query to you, then why not
(well if it doesn't yield much of a speedup, then it's not worth it, but you can always try)
 
9:28 PM
Ok, after only a tiny amount of research, I think I have something I want to try
We have a bug in currently that says that the data is not being read in fast enough.
We also have a ton of indexes already in place
"As with most performance optimization techniques, there are tradeoffs. For example, with more indexes, SELECT queries will potentially run faster. However, DML (INSERT, UPDATE, and DELETE) operations will slow down significantly because more indexes must be maintained with each operation"
I'm gonna try wiping out every index we have, so that the inserts aren't hogging all of the resources
Then, maybe the selects will run faster
begins copying 2 million rows...
 
9:45 PM
@Optimizer it makes me sad that no one has beaten (or even reached) my own (unposted) attempt for Shotgun yet :(
 
there is a 22 pyth
mr catch
 
what?
oh
but that one isn't posted
(as an answer)
 
but you are beaten.
if not technically
 
He's technically beaten.
 
9:46 PM
only by Pyth though
 
and I did not figure out the non array manipulative way of getting the nth number
 
that makes me even sadder :(
@Optimizer just look at any other answer :P
 
I did :(
 
oh right
 
Are there any known properties of the sequence?
Besides the "fun fact"
 
9:54 PM
I don't know
OEIS didn't link to any papers
the plot looks pretty interesting though
and yesterday I looked for n whose S(n) is greater than 4n
the first such number is 3465... interestingly the next 10 or so are all multiples of that number... but their S(n) don't seem to be related
 
Here's an idea...maybe.
By working backwards.
 
that's how most answers solved it
 
Each swap swaps the index of an even multiple of a prime with an odd multiple of a prime.
 
not true
 
Index-wise, not the number itself, right?
 
10:00 PM
at step four, you're swapping indices 12 and 16 (for instance), both of which are even multiples of primes
 
@MartinBüttner You can do: if s=='>=':r=(a>=b) but not r=apply(s,a,b).
 
JK then.
 
@xnor I see, that could probably use a rewording then
 
suggestions?
 
Well. make that "an even multiple of the number" with an "odd multiple of a number"
 
10:01 PM
hm
@PhiNotPi yeah
 
Well, my line of inference doesn't work as well now.
I'll need to think some more.
 
@xnor "So are methods which look up a method or operator given its name as a string."?
 
looks good, thanks
 
make that "functions"
 
Haha "BILLY MAYS here. Bringing you STRUCTURED QUERY LANGUAGE!"
Oh, that joke was from 2010. Is it ok to say that now that he is dead?
 
10:10 PM
i don't get it
 
Probably because you don't know who Billy Mays is
 
exactly
 
@Martin If you have time (and a headset) youtube.com/watch?v=ZTpXh33Mbeg
 
are speakers an option as well? ;)
 
"He was very well known for shouting in an abrasive manner during infomercials."
According to Wikipedia lol
Just like my SQL queries. SELECT MyColumn FROM MyTable WHY AM I SHOUTING
 
10:14 PM
lol
 
GIVE ME THE DAMN COLUMN;
 
@MartinBüttner so ... when is the first ever RETINA quine coming ?
 
I've thought about it
 
more than 5K bytes long ?
:P
 
but I don't think quines are well-defined for multi-file programs
I guess for regex you could define a quine as a pattern that matches only itself
that has been done
 
10:21 PM
The way I see it, if the contents of each file involved are output, you win
 
43
A: Regex that only matches itself

user23013261 289 characters Regex with backreferences, 289 characters Yes, it is possible! /^(?=.{64}2\)\?\.\*\\.{204}\\2\\\(\)\{2\}\.\{11\}\$\/$)((.*)(\2\2)?.*\/\2\^\2\(\2\?=\2\.\2\{64\2\}2\2\\\2\)\2\\\2\?\2\\\2\.\2\\\2\*\2\\\2\\\2\.\2\{204\2\}\2\\\2\\2\2\\\2\\\2\\\2\(\2\\\2\)\2\\\2\{2\2\\\2\}\2\\\2\....

 
why is it multi file to begin with ?
 
I thought the output of a regex was truthy or falsy. How can that possibly be made into a quine?
 
replace
 
@Optimizer because I can only produce output without input with a replacement
even then I can't match anything, so I'd have an empty pattern and an arbitrary replacement, which would print the replacement
it's either boring or not a quine
 
10:23 PM
my question was why are the two things put in diff files ?
why not like ///
 
oh, to save bytes
 
regex supports newline ?
(inside the regex)
 
yes
but even that newline would be an unnecessary byte
 
what is the use ?
 
matching newlines?
 
10:26 PM
is it ?
not \n ?
 
that works too
 
ic
 
@Rainbolt btw, even without replacement the output of a regex is usually a match, not just truthy/falsy
 
0
Q: Are C# LinqPad answers encouraged?

Thomas W.The question Find i^n, given n does not clearly state whether the solution must be a compilable program or can be an expression, neither does it identify where the input shall come from. This leads to answers like this, which are a mixture of both and neither short nor compilable. For verbose l...

 
@MartinBüttner I thought a regex was a DFA that accepted input and spat out yes or no
 
10:38 PM
that's a regular expression :P
 
Regex is not a regular expression? Mind blown.
These are the kinds of stupid things people have to actually tell me
 
most real-world regexes are so far from regular expression that "regex" has come to refer only to those real-world regex engines
no it's not stupid
regex is obviously short for regular expression
but what we call regex in programming rarely actually "regular"
 
It seems to me that if you apply a regular expression to a body of text, and also highlight all the matches, then sure, you have output. But the part in bold is not a regular expression (the way I learned it anyway)
So I guess regex is short for take a regular expression and also highlight all the matches
 
sort of... except a regex isn't necessarily regular ;)
 
I give up. I hereby dub regex "irregex"
 
10:43 PM
I like that ;)
 
Well, they're not always irregular.
"mayberegex"
 
Schrödinger's Regex
 
callmemaybex
(Martin won't get that one unfortunately)
 
why not?
 
Does US pop culture typically extend to the UK? I mean we get the Strokes and Arctic Monkeys but not much else has made it overseas.
 
10:46 PM
call me maybe is pretty popular in Europe
I think generally, American music, film and TV series is pretty popular in Europe
 
Huh, turns out she's Canadian
Which is basically American. Three Days Grace sold way more albums in the US than they ever did in Canada
Green Day is American. Wouldn't have guessed that
The Strokes are too. Wouldn't have guess that either
 
Haha
@Martin Did Friday by Rebecca Black make it to the UK?
 
I don't know
it might have
 
I was certainly very aware of it, and I mostly listen to the same 7seconds of music on repeat (I'm in the UK)
 
10:50 PM
@VisualMelon That's an interesting way to explain to someone that you like electronic music
 
I don't listen to a lot of radio or music channels on TV, so I really only know the most popular songs (and sometimes not even those)
 
hehe, actually recently I've been listening to randomly generated white-noise, which changes in volume every second
 
sounds pleasant
 
So dubstep?
 
and I used to listen to 35seconds of music on repeat when I wasn't miserable
 
10:52 PM
do you... like... need help?
 
yeah, it also has some saw-tooth waves thrown in
 
The sad life of a melon that's been cut
 
you can have the program if you like, it was fun to write
that was a good weekend
 
Hmmm... spend all weekend listening to saw tooth noises on repeat, or spend all weekend pitting wolves and lions and bears and rocks against each other in an ultimate battle royale? I think I'll pass on the saw tooth noises
 
oh, looking at pictures of wolves is what I do on week days
 
10:54 PM
Unless Skrillex made them. I'll listen to any noise he makes because I'm a fanboy.
 
1/2 the tabs in my browser are pictures of wolves
this is my favourite at the moment, but I'm not allowed favourites, but don't tell the wolves that wolf.org/wp-content/uploads/2015/02/wcs_2_5_15AD-1024x680.jpg
 
Is Skrillex popular in the UK?
Seems like electronic music is more universal than other genres
 
not as far as I'm aware, I don't know anything about them, but I've certainly heard discussion of them on a number of occasions
 
I like classical
 
Is classical the best one?
 
10:56 PM
my brother introduced me to William Walton recently, that stuff is fantastic (proper British orchestral anthems)
 
I'd say Skrillex is pretty popular
 
How about country music?
 
not so much
but I might be the wrong person to ask for any of these
 
I'm also probably not representative
 
@Rainbolt Next favorite.
 
10:58 PM
I'd love to visit the UK some day
@TheBestOne I still have every word of "I like it, I love it" by Tim McGraw memorized from when I was a child
 
as far as I am concerned, the best things about the UK are the food and the weather, though I'm pretty sure this is not a commonly held opinion
 
the food?
have you ever eaten anywhere outside the UK?
 
@Rainbolt I don't like country music quite that much.
 
yes, I've been to Europe a few times
 
I agree with the weather thing though
the food is definitely the thing I'm most looking forward to when I move back to Germany
(well and the beer, but that's pretty much the same)
 
11:01 PM
I'm vegetarian, which was always quite hard in Germany in the past ;)
again, not representative
 
really?
but... German bread...
 
@VisualMelon Ugh...
 
have I offended you in some way, TheBestOne? ;)
 
No. I just can't imagine eating only vegetables without getting sick.
 
Fruit, Vegtetables, Bread, Butter, Milk, Cheese, the fun is endless
I definitely don't eat exactly the same 2 meals every day
 
11:03 PM
just out of curiosity, moral, medical or culinary reasons?
 
I became vegetarian when I was 7, I think I just didn't like the idea of eating animals, I have empathy/apathy issues
 
these days, it's mostly just because I have been for so long, I think
I can't really comprehend eating meat
(I'm very strict, and frankly it doesn't make much sense)
 
When was the last time you tried it?
 
yeah a friend of mine (from the UK) was like that, but he started eating meat again a couple of years ago
 
11:06 PM
my father lied to me and I ate something containing Pork many many years ago
this may be why I'm a paranoid nutcase
my brother is much more sensible, he's vegetarian at home by virtue of not buying meat because it's expensive and such, but he doesn't decline food that other people try and give him, which I always will
 
0
A: Sandbox for Proposed Challenges

Martin BüttnerAddition with Regex code-challenge (code-golf?) regular-expression arithmetic I want to try a new type of regex golf challenge, which will ask you to use regex substitutions for tasks it really wasn't meant for. We'll start simple: given a string containing two positive integers, as decimal nu...

 
@MartinBüttner Slightly related
(replacements make it pretty interesting though)
 
that's unary though ;)
here is something that's much more closely related: stackoverflow.com/q/12941362/1633117 ;)
 
:P
 
11:43 PM
@Sp3000 I've restructured the post
could you let me know if you prefer this or the previous form?
 
@MartinBüttner You want to discuss the regex stuff?
 
sure
did you try /a.*b/.test('a\nb')?
 
I like the format explanation of this one, but I think having the task first helps more
So you have an idea what the format is for
 
@MartinBüttner No, I didn't before. Now I did and returns false.
 
thought so ;)
I think what happened when you tried is the same reason that /a*/.test('b') returns true
 
11:48 PM
/a.*/.test('a\nb') returns true
 
yes
because .* matches an empty string
try /ba*b/.test('bb')
@Sp3000 swapped the sections
with the modified first paragraph it even makes sense again this way around
 
:P
I'm not sure if you'll want to add the "this doesn't solve the problem" note back in though
 
oh right
 
You are right. In some situations, using /.*/ for newlines might help. But using /.+/ will be a shot in the foot
 
If you're trying to use .* to match newlines, you might as well leave it out
because it doesn't actually match the newline
it matches the empty string in front of it
 
11:53 PM
You are right again
 
should we clean up the comments?
 
sure, they aren't doing anything there
done
 
00:00 - 21:0021:00 - 00:00

« first day (1496 days earlier)      last day (3342 days later) »