« first day (713 days earlier)      last day (3312 days later) » 

12:08 AM
11
Q: In the parchment the Goblet of Fire spit out, why wasn't the school name there?

Area 51 Detective FictionIn the Goblet of Fire, students were supposed to put their name and the name of their school in the Parchment they put inside the Goblet. It is clearly stated that Fred wrote "Fred Weasly, Hogwarts", in his. But when the parchments come out, the school's name isn't there. It simply says 'Harry ...

The Goblet returns the original parchment, but Moody called the new school "". That's right, he named the new school blank, what you'd call in computing an empty string. This way he has a fourth school, and Harry's would seem to come out with just his name on it.
So the Goblet was a program and Moody hacked it!! LOL. Moody is 'The One'
 
I haven't heard of that programming language... ...?
 
@nhgrif You need to get out more ;-)
 
Scifi.SO: clearly any time a program is hacked, that automatically becomes The Matrix. matrix puns ensue
 
Come on Gradle, how hard is it to use the package I define in my dependencies instead of the one your come with
 
Look out.
 
12:11 AM
NuGet does this without any problem. Why can't youuuuuuu
 
@JeroenVannevel is writing some non C# stuff.
Non-stop complaints about everything ensue.
 
And with reason!
 
If you count inexperience or ignorance as reason, sure.
 
What language are you writing in now Jeroen?
 
@Quill Java
 
12:12 AM
@nhgrif Shots fired
 
I'd probably have the same complaints as you're having now... so try not to take offense.
 
Crouch/Moody must've used SQL injection to fool the goblet into thinking There Are Four Lights er... schools. — Chahk 7 hours ago
 
The only reason I'd never complain about C# is because I've written so much VB.
 
I define a dependency on org.apache.httpcomponents:fluent-hc:4.4.1 which has a dependency behind the scenes on HttpClient. But HttpClient is provided by default by Android. So now it refuses to load my Fluent dependency because it is too dumb to realize it can use the dependency that I bring
Even explicitly declaring my own dependency on HttpClient doesn't go for Gradle.
 
Have you tried looking on Stack Overflow?
 
12:17 AM
I've found someone with the exact same error but I don't see what in his gradle script would have fixed it
It's a code dump so no direction from him
1
A: Gradle build dependancy throwing ClassNotFoundException

a.hrdieAfter some research I have used the following build script to build my Jar successfully. apply plugin: 'java' apply plugin: 'eclipse' defaultTasks 'clean', 'build' repositories { mavenCentral() } jar { from { configurations.compile.collect { it.isDirectory() ? it :...

 
"because it is too dumb"
I chuckled
 
0
Q: Remove K digits of a number N in order to maximize N

puwiThe first line has 2 integers \$S\$ and \$K\$ that represents respectively the number of digits in \$N\$ and the number of digits to be removed of \$N\$. A second line is given with \$N\$. (\$1 \leq K \leq N \leq 10^5\$) The problem asks to remove the \$K\$ digits in order to maximize the value ...

 
Oh brother, can't I just use Linq instead of SQL?
I don't get it :(
 
Knowing SQL is invaluable for creating performant LINQ queries
 
Maybe.
I can guess at the computational expensiveness of my Linq queries, and put them in ifs and the like.
This thing just keeps timing out on me :(
I think it is the same as an O(n^2) double-nested loop at a minimum, probably worse.
 
12:23 AM
uh
This is why you need to do pure SQL.
Because you need to learn how to think about data and data sets.
 
OK.
 
@sᴉɔuɐɹɥԀ and I have already solved the query you were trying to write.
It's possible to do it without a GROUP BY. ;)
 
I just need to learn it, but it is annoying.
OK, that is part of the problem.
 
What's part of the problem?
 
The time out.
 
12:26 AM
Yes, the time out is the problem... but the group by isn't necessarily the cause of it.
Let me see your current version of the query.
 
WITH FirstQs(QCreationDate, PostId, UserId)
AS
(
  SELECT
  MIN(p.CreationDate) [CreationDate]
  ,MIN(p.Id) [PostId]
  ,MIN(u.Id) [UserId]
  FROM Users u JOIN Posts p ON u.Id = p.OwnerUserId
  WHERE (p.PostTypeId = 1)
  GROUP BY u.Id
),

FirstQsA(ACreationDate, APostId, AUserId)
AS
(
  SELECT
  MIN(p.CreationDate) [ACreationDate]
  ,MIN(p.Id) [APostId]
  ,MIN(u.Id) [AUserId]
  FROM FirstQs, Posts p JOIN Posts p  ON u.Id = p.OwnerUserId
  WHERE (p.PostTypeId = 2 AND p.ParentId = PostId)
  GROUP BY p.ParentId
 
can you just give me the SEDE link?
 
Evening all °/
 
First off, it is only returning one answer.
 
@nhgrif I found a problem with mine after doing a sanity check on the data, also. Which is easily solved with an additional WHERE clause but didn't know it was there until I dug into the data
@DJanssens \o
 
12:27 AM
Just checked out the new star wars trailer #2. Oh boy, oh boy..
 
Second, I know this is wrong, but I am using MIN for now to avoid the GROUP BY in the main block.
 
FROM
  FirstQs
  ,FirstQsA
  ,Posts p
^ Ambiguous implicit join
That's gotta be it
 
OK, so what should I be doing?
 
Be explicit about how the tables join.
 
Gotta be what?
OK.
 
12:28 AM
Well first, stop using pre-ANSI-92 joins
 
What column in FirstQs links to FirstQsA?
This join takes 68% of your execution time.
 
7 hours ago, by sᴉɔuɐɹɥԀ
I found a nasty 68% cost nested loop in your execution plan, that's probably what is making it slow
 
@Hosch250 Check mark the "Include Execution Plan"
 
OK.
OK, great.
Now, it is returning just one value.
 
My query takes 143ms to return the 8,646 rows.
 
12:32 AM
@Hosch250 Found the problem
,MIN(u.Id) [UserId]
You're selecting the first UserId (in this case, user # 20) which matches your criteria, and stopping there
 
Did one of you change something?
 
Remove MIN() there and you'll be on to something
 
It started working all of a sudden, and I'm not sure if I did it or you.
 
I didn't change anything.
 
Oh, I think I did it.
 
12:34 AM
> (9173 row(s) returned)
^ without the MIN(), 168ms
 
I added the GROUP BY to the FirstQsA and it worked.
@sᴉɔuɐɹɥԀ Did you change my query?
I have 9173 in 301ms.
 
I can't change your query, only fork it (which is what I did)
 
Oh, OK.
Then I did it.
OK, so it is working right now.
 
You are not in it, and I am (that's how I test it).
 
12:37 AM
What?
 
So, you got rid of that nasty 68% nested loop, and it appears the data set makes sense, though I've found edge cases while writing my version (which has more information in the output)
 
How many rows are you returning, @Hosch250?
 
4.
 
Well, 4 is wrong.
 
No, that is columns.
9173 rows.
 
12:38 AM
Important distinction!
 
9173 is too high.
It's close though.
 
Hmm.
 
Found another thing
 
Should be 8,646. I'm not sure what the easiest way to determine the inconsistencies though.
 
  SELECT
  MIN(p.CreationDate) [CreationDate]
  ,MIN(p.Id) [PostId]
You're finding the lowest CreationDate, and the lowest PostId
 
12:40 AM
You need to find only the lowest CreationDate.
 
PostId is not guaranteed to be sequential, I would remove the MIN() check there
 
And add it to the GROUP BY clause?
 
Ids sometimes get reseeded, so they are not good indicators of a record's real age. Creation date is an auto-populate and cannot change
 
OK.
 
There are exactly 2 in 2008.
Then none in 2009 or 2010.
914 in 2011.
1443 in 2012,.
 
12:43 AM
I'm not getting it.
 
1937 in 2013.
 
ID-type fields are mostly for indexing, and for joins. They should not be relied upon for "understanding" the data
 
3394 in 2014
and 956 to date in 2015
 
Oh damn, that's good to see @nhgrif!
 
When I remove the MIN, it returns every post that has an answer posted within 24 hours or something.
 
12:44 AM
ID fields are for keys and indexes.
 
@Hosch250 How many?
 
16632.
 
By the way, @Hosch250, by no means is this an easy query...
 
@nhgrif That is alright.
 
It's an instructive query, though :)
 
12:46 AM
It actually hasn't been too difficult.
Frustrating sometimes, when I can't just walk through the debugger...
Sooo, I could just remove the IDs, but then I can't link to the post.
Wait, I can't.
 
You need them for joins
 
OK, so I remove the stupid MIN, and it gives this error:
> Column 'Posts.Id' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
 
Yep. Add that to your GROUP BY
 
No.
 
So, I put it in a GROUP BY clause, and it returns bad data (which is worse than crashing, IMO).
 
12:49 AM
How will that help?
 
It doesn't.
It times out, it gives bad data...
 
@Hosch250 Start a new query. Break this down into the data sets you need.
 
OK.
So, what do I do in my new query?
 
Dataset 1: PostID for questions where CreationDate = MIN(CreationDate) grouped by User.
Dataset 2: PostID for answers where CreationDate = MIN(CreationDate) group by ParentID
Right?
These are two of the datasets you need to get, correct?
 
OK.
 
12:50 AM
So work on these queries individually.
 
Yeah, at least, I thought so a while ago...
 
Don't worry about doing anything else until you can produce each of these individually.
 
Alright, sounds like what I would do in C#...
 
SQL is all about thinking in terms of datasets.
 
Preach it!
 
12:51 AM
Make one dataset work. Make another dataset work. Then make them work together.
 
Sounds like a feature for my app.
First, get a simple version working, then get the full thing working, then put it in the production code and really test it.
 
0
Q: One way encoding a password

QuillAlright, so I wrote a script that one way encrypts a user's password by generating a key, and multiplies by the ASCII value of the character and the ASCII value of the key character at (the position that the character has in the password string) and repeats this for the previous positions in the ...

 
@Hosch250 something is wrong with that.
Hang on, let me organize my windows
 
You bet it is.
 
You got 22377 rows
Mine gets 11675 rows
You're grouping by user ID and Post ID.
brb
 
12:55 AM
That is because it doesn't work the other way.
> Column 'Posts.Id' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
 
1
Q: One way encoding a password

QuillAlright, so I wrote a script that one way encrypts a user's password by generating a key, and multiplies by the ASCII value of the character and the ASCII value of the key character at (the position that the character has in the password string) and repeats this for the previous positions in the ...

 
So, why does that need an aggregate function and not this?
SELECT u.DisplayName'Display Name', u.Reputation'Rep', u.Location'Location'
FROM Users u
WHERE u.Location LIKE '%Australia%'
ORDER BY 'Rep' DESC
If I could get past that error, I think I could fix it.
 
@Hosch250 Because that one doesn't do any aggregation
 
Is it something to do with the JOIN?
 

« first day (713 days earlier)      last day (3312 days later) »