« first day (1337 days earlier)      last day (2663 days later) » 

5:00 PM
@skiwi It'll expire, and then start lobbing fireballs at your R# source dirs. :P
nah, just kidding, not really sure :P
 
Not what will R# do, but what will I do :P
 
heh
 
I suppose it's a bit unfair that I want to learn C# within a day just because I have Java experience
I end up mostly copy-pastaing and editing it
 
heh
 
Sounds like the best way ever to create a mess.
 
5:05 PM
Hmm, yield return really makes me think about using IEnumerable instead of IList
 
Hmm, time to write a function to take a FEN string and output a board.
 
@Hosch250 If you make it work, you get -$10 from me
 
@ThomasWard Why's that?
 
because challenge. Do it in the least amount of code :P
(I could also use it XD)
 
I'm certainly not going to pay you anything for the use of my brains.
Even assuming I had access to $10 to give you.
I've got about $1200 in the bank, but I can't withdraw a cent of it...
 
5:10 PM
ouch
@Hosch250 I'm glad you caught on the -$10 xD
i didn't notice that until just now :P
kicks laptop
 
LOL.
 
That was... not the intention?
 
0
Q: Comparing two (almost identical) implementations of Insertion Sort; one of them fails.

Kunal B.Basically I replaced n with aData[i] in the Non-working implementation. Am I missing something fundamentally wrong? Passing implementation: static long[] sort(long[] aData) { for (int i = 1; i < aData.length; i++) { long n = aData[i]; int j = i - 1; while (j >= 0 &&...

 
@skiwi nope. But i'm going to leave the -$10 there now :P
@CaptainObvious OT
someone bring a hammer down on that
 
5:27 PM
@Hosch250 your comment is obsolete (see mine I just added)
:P
 
Well, I'm more than happy to stay out of a potential fight.
 
I'm more than happy to bring down the HAMMER OF HELL, if I had it on CR.
when's your next mod election again? :) (just kidding xD)
 
Last I heard, Mat may or may not hold the hammer until spring, which is supposedly a better time for elections.
He may hold it indefinitely.
I'm pretty sure that Vogel or Phrancis will win, though.
 
Nah @Duga will win before them
 
Duga isn't running.
 
5:34 PM
I know... I was trying to make a joke well...
Didn't work I guess ehe
How are you @Hosch250 ? Having a good holiday time?
 
More or less.
Working on my checkers game.
 
@Hosch250 Nice! You're doing with which framework/language?
 
F# for the logic, C# for the UI.
 
Interesting combination! How is it going so far?
 
I have the basic minimax-with-alpha-beta-pruning AI done.
And I have sound effects and themes.
 
5:39 PM
That is quite a lot actually!
 
Yup.
Right now, I'm working on making a board from a FEN string.
After this is done, I'll be able to do takebacks.
I have move history implemented in the logic, but I don't display it in the UI yet.
 
Oh great! It looks really interesting. How does C# and F# talk to each other?
 
5:58 PM
Through .NET.
They are both .NET languages, although it is actually a little tougher than that.
C# uses mostly the .NET types, while F# has a lot of native types.
I build a facade that casts between the two types in my C# project.
 
@Hosch250 interesting. Never really done something similar as far as I remember.
 
Hey there, @robringstad.
 
Is anyone here familiar with Tkinter for Python?
howdy, @Hosch250
 
I'm not familiar with Tkinter; I've only used it once.
 
No worries, I'm muddling through it rather blindly and have been getting things to work, but want someone to see if my code needs major refactoring before I get any further.
 
6:08 PM
@Marc-Andre You can try Java and Clojure if you wish to :P
 
6:23 PM
Well, you can post it for review.
We have a few Python people.
 
0
Q: Matplotlib Animation inside of Tkinter Widget

robringstadLooking for almost purely code review, as I am new to Tkinter and am not sure if there are major style guidelines I have grossly overlooked. I am using Matplotlib to animate some functions and display them in a GUI using Tkinter. from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg im...

 
I just did :)
 
Wow I make stuff and it just works
 
Wait, I think that is off topic as broken code.
 
@skiwi Not sure I want :P I have other fish to catch :D
 
6:25 PM
Uh oh, why is it off topic?
i probably should have put the paragraph at the bottom, before the code, it explains my specific question
 
Because it doesn't work as intended.
 
I literally just understood what they meant by broken code right now
 
If you have a bug, then you ask on SO. If your code is working, we'll make it nicer.
 
It's clear now, thanks mate.
 
NP.
 
6:29 PM
@robringstad Could you clarify this perhaps? If we can find a wording that works better then we could make a meta to change it
 
monking
 
Users in general are having trouble to understand what broken code means
 
monking
 
nomking @janos
 
how's it going guys
I hope you're having a good new year's eve
 
6:31 PM
Clarify what, @skiwi ? I'm not sure what 'this' is, and I'm so new I don't even know what a meta change is other than I've read the phrase before
 
@robringstad he meant to make it clear in your question that the code is fully working as intended
 
Ah I gotcha!
 
@janos Spending my last hours writing code, it can never be done again in 2016 :P
 
at least that's what I thought he meant ;-)
 
I can edit the code to remove the bug'd bit
 
6:33 PM
in Hungary we say that whatever you do on the first day of the year, you'll be doing it the whole year
 
@robringstad Well actually, I'm trying to understand why you (and a whole lot of other users) didn't understand what we mean by broken code initially
I refuse to believe that the people are stupid, so probably our wording could be better :P
 
@janos Well, I'm programming on the last day of the year.
 
@janos Wow cool, means I'll have a job next year then :D
 
we say nothing about the last day
 
I guess I'd better be careful, because next year I get my first fulltime job.
 
6:34 PM
Literally my issue is, I read 'broken' code
 
Oh... first day, whoops
 
@skiwi you didn't get the last one you told me about?
 
and assumed it was the 'common' definition of broken, as in
 
many users seem to think broken means "doesn't compile"
 
doesn't work at all
 
6:35 PM
@janos Still negotiating, but the holidays are dragging it
 
i think differentiating buggy vs nonworking
would solve it
 
it's one interpretation. but we use a different one
 
but my issue is i just didn't read the whole page on broken code, i just read the phrase and assumed i knew what it meant
 
I always ask "does this work as intended?" -- that seems to clear things up
 
Yep.
 
6:35 PM
Ah okay thanks @robringstad :)
 
That's what most people do, so we should change that to make it more clear right off.
 
On the other hand there's users who will claim that their code is working as intended because they intended it to have the bug that they couldn't solve
 
^hahah
 
@skiwi LOL.
 
(Not backwards reasoning at all /s)
 
6:36 PM
So, at that point, it is a documented feature??
 
@Hosch250 Well it's only that way because then we might point it out here at CR :P
 
now that's a deep question
is a bug that ends up making stuff work, actually a bug at all?
 
@EBrown Documented limitations, more like it.
 
I was thinking more of a side-effect that produces a positive result in the end
 
6:39 PM
No mine produces a negative result.
Some really big negative number.
 
lool
 
@robringstad It can actually happen that you've got two bugs in your code that cancel each other out... Now, is your code bugged or not?
 
@EBrown Best pun ever.
 
What I had posted did have a bug, but am editing now
 
@skiwi Definitely bugged.
 
6:40 PM
i deleted that post
 
Hmm, does it make sense in C# when de-serializing JSON into objects to calculate a class property based on two JSON properties?
 
Why not?
Depends, really.
 
My JSON may have a playerClass and classes property, but in my object I want to have a HeroClasses property
 
So apparently SESE is rarely used.
 
Though I see a suggestion just now that I should keep a CardJson objects for deserialization and a Card object that uses the deserialized JSON to build up the real property
 
6:45 PM
@EBrown It's young yet.
And not many people know about it.
 
Is it young?
 
I'm not saying I'm upset about that or anything, just making a comment.
 
what is "SESE" ?
 
Built it months ago, been improving ever since.
 
oh I see
 
6:51 PM
In all fairness I do absolutely nothing to advertise it. Lol
 
(Tip: Start advertising)
 
Get SE staff to use it.
 
@Hosch250 Not likely, they have better tools at their disposal.
 
So it's like SESESE?
 
@skiwi Huh?
 
6:52 PM
Because SE is using it ^
 
Get the news out to the other mods--maybe get someone to post it in the mod room.
@skiwi "Stack Exchange Statistic Explorer"...
 
Oh... nevermind :p
 
Everyone getting ready for the chat hat, or something?
Lots of new users coming in.
 
Aha, so my properties were not being set anymore by the JSON deserializer because I removed the setter
 
you still have stars?
2
 
6:57 PM
@janos stars--;
 
072 097 112 112 121 032 078 101 119 032 089 101 097 114 032 033
 
I thought everybody here would be out until the next day
 
I haven't used any yet. ;)
 
@WiCK3DPOiSON happy new year to you too ;-)
 
The bots are taking over
 
6:58 PM
084 104 101 032 101 110 100 032 105 115 032 110 101 097 114
 
?
@janos Saved mine, I know what's going to happen :-)
 
@janos That doesn't happen until 5 minutes next UTC.
Of course it isn't.
I successfully built a board from FEN notation.
 
7:17 PM
Monking!
 
Now I need to make a board into FEN notation.
 
Monking @Phrancis
 
Monking!
 
Hmm am I blind or can I not easily print a list in C# as [..,..,..] instead of the class name + unique hash identifier?
 
You need string.Join(separator, list.Select(item => item.ToString()))
And you need to override ToString() on the item values.
Actually, you should be able to do string.Join(separator, list)
And that should call ToString() automatically.
 
7:21 PM
Hmm okay, not too bad, though Java does it automatically
It's mostly for debugging purposes though..
 
Make a Debug class.
 
Like System.Diagnostics.Debug? So you can Assert and WriteLine?
 
@Mast what is a Debug class?
 
@Hosch250 Another zombie bites the dust.
@Hosch250 And whatever other Debug statements you need to convert your data into something printable for debugging purposes.
So, yea.
 
(Just tell me if I'm asking too much)
private IList<HeroClass> CalculateHeroClasses()
{
    if (Classes?.Count > 0)
    {
        return Classes.SelectMany(clas => StringToHeroClassDictionary[clas]).ToImmutableList();
    }
    return StringToHeroClassDictionary[PlayerClass].ToImmutableList();
}
Why is if (Classes?.count > 0) working? I know that if (null) doesn't automatically coerce to if (False), but the former statement somehow does?
 
7:32 PM
 
@Mast Only Javascript can do magic (:
 
Has there been a single on-topic question today? Everything I see is closed and/or deleted...
 
1
Q: Gradient computation in JavaScript

Slater TyranusI'm working with some math-heavy code in JavaScript. I just realized that there's a render that currently takes about 30 minutes. 95% of that time is spent in a single ~40 line function that I've pasted below. I am not extremely well-versed in JavaScript math optimization, so my first attempts to...

 
Great timing @Cap'nObvious
I vainly searched all over SO and Google last night to find automatic struct initialization in C :|
Guess I just need to get in the habit of making all pointers assigned to NULL right after I declare them
 
C and... automatic?
 
7:46 PM
^that
 
Now that I can read FEN notation, I guess takebacks is the next step.
 
Ooooooooo finally, a new compiler error! I think I'm making a little bit of progress :D
 
0
Q: PDO Insert Method

Joe ScottoI'm currently creating a class that will have a bunch of my most common database functions. This is the first method I've made, I would appreciate any feedback, thanks! public static function insert($table, $params) { // Define initial query $query = "INSERT INTO `{$table}` ("; // F...

 
@Phrancis Sounds like you're trying to solve the wrong problem.
 
8:01 PM
Well, I'm really trying to find the real problem, but me writing C is probably about the equivalent of a 2 year old trying to solve a math equation
 
You're supposed to solve problems instead of trying to create new ones :D
 
If I get a compile error instead of a runtime infinite loop, I'll call that progress
Actually, this is exactly what I needed to do, now my (wrong) functions are breaking because the pointer is pointing (correctly) to NULL instead of random garbage memory location
Error: pushTest() expected length 1, but actual length was 0
@CaptainObvious uhhhhhhhhh that's not how you build queries
 
@Phrancis wow..
 
I believe the PDO is correct, but they string-building the queries...!?
That's essentially dynamic SQL, written with PHP.
 
8:09 PM
I feel sorry for that MySQL database server.
So, it does work. groan
 
So, going to tell him the full list of what's wrong with it?
 
It's really a design problem, not a code problem
Assuming $params is a K->V list/dict (whatever they're called in PHP)
You should really have a function/method for each different type of query, instead of a generic one for all queries that is built dynamically
 
@Phrancis They don't have a special name, you have to abuse ordinary Arrays to do it.
 
Does this property make sense on HeroClass? public IList<Card> AllClassCards { get; private set; }
 
$array = [
  "key1" => "value1",
  "key2" => "value2",
];
 
8:16 PM
I just realized I could also call it ClassCards
 
If you're going to type out all column names and then values each time, you may as well just type out the query directly and call it a day
 
That's 5.4 and upward though.
@Mast Currently using 7.0.0. — Joe Scotto 27 secs ago
PHP is already at version 7?
What did I miss....
 
6
 
Oh, right, they skipped 6.
5.5 is the last I touched.
 
FFS IIS
 
8:24 PM
Posted an answer.
Has anyone else been having issues lately with CR site pages loading really slowly?
 
I'm heading out and won't be back in a while, so Happy New Year to you all folks! (and save your stars, I already got the hat!)
 
@Phrancis In what way? Is it stuck on loading something cachable?
 
I know it's not my internet, just clocked well over 100 mbps speed downstream
 
Asking because I've been having major issues with my browser cache for quite a while already
 
@skiwi The page loads, it displays the content but without formatting, then keeps loading for a while, then finally the formatting etc. is loaded
 
8:28 PM
@Phrancis I've had that a week or so back, but that was my ISP being an asshat.
Other pages had the same problem.
 
Maybe I'll reboot the PC first and see if that fixes it :D
 
@Phrancis Sounds 100% like a cache problem to me
Except I don't know how to fix mine, it may have to do with having 1000 tabs open
 
lol the comment on my answer
 
If you don't like repeated code, you should not write SQL related code
 
8:34 PM
I broke my code and I don't know how
 
@skiwi Ctrl + Z is your friend.
 
A working version is actually under source control
But I still don't know why it broke :/
 
@EBrown What's next, supporting multiple intervals?
Would be interesting to see the same chart per week, for example. With deltas per week.
 
@Mast No, next is site-to-site comparison graphs and exporting of data.
 
It's literally that commit ^ I removed encapsulation via Lazy<T>
Hmmm... right
 
8:36 PM
 
I just realized I had not restarted my PC since about 3 weeks ago
 
I was using properties that were not initialized yet at that point and using Lazy<T> defers that until.. later, in this case after construction
 
CR pages load almost instantly now
 
Well my error alert is all borked.
That's going on the list for tomorrow, since I already hit 'Hibernate' on my PC today.
And that takes ~20 minutes which is when I have to leave lol
Blech
 
@EBrown wat? 20 minutes
 
8:39 PM
Yeah we've talked about this before.
Dec 8 at 5:38, by EBrown
Takes ~15-30 minutes for my PC to hibernate.
Oct 17 at 16:55, by EBrown
Speaking of which: there's a 15 minute delay between when I click "hibernate" on my Desktop and when the PC actually finishes hibernating.
 
I don't understand what I'm looking at in the first column here.
 
@EBrown Looks like the filter works great, but it's not clear what format you are supposed to enter the dates as. Thankfully, looks like multiple formats work (even mismatching formats on same query)
 
 
@Phrancis Yeah, it just uses TryParse, so any valid date format should work.
 
I entered start date as mm/dd/yyyy and end date as yyyy-mm-dd and it worked fine
 
8:41 PM
@Mast That is the date that the record was acquired.
 
Wow.
 
That means that it is data for the entire previous day.
 
Oh, the 16 is a year.
 
Yeah.
 
brainfart
 
8:42 PM
d MMM yy.
 
heh
 
@Hosch250 Cords are entirely too expensive
 
@Phrancis You can even use named months. 1 Jan 16 and Dec 31, 2016 will filter all of 2016.
 
@Hosch250 Wat.
 
$59.99/month.
 
8:43 PM
wait, wat
That's gotta be wrong lol
 
HDMI cable for 60 bucks a month? That better be miles long.
3
 
@Hosch250 Per month...?
 
It's from the Daily WTF.
 
And of course OP didn't like my answer
Truth hurts.
 
Lies hurt worse.
 
8:46 PM
@Phrancis As long as it was a good answer, that's not your fault.
So, dynamically building SQL queries is bad?
I'm doing exactly that in my Library project...
Or at least, trying to.
Same reason, avoiding repetition.
WTF...
5 hours from now?
I guess that makes me the new Doctor.
 
@Mast Dynamically building SQL queries I think is a bad practice, for the reasons stated in my answer
That's coming from a guy who is normally on the other side of the code (that is, the database side)
 
@Mast Thanks! :)
 
@Phrancis You say repeated code isn't a bad thing because that's more maintainable. I'm having trouble parsing that, it's usually the other way around.
Madness.
 
@Mast I agree in a general sense, but database/SQL related code is kind of a different thing
 
O Hai! Can I plz haz hat 4 n4w y34rz?
3
 
8:55 PM
@Phrancis So, how should we SQL our code?
 
throws sticks at @RubberDuck
3
 
CREATE TABLE Foo (Bar INT);
INSERT INTO Foo (Bar) VALUES ('hello'); --Incorrect integer value: 'hello' for column 'Bar' at row 1
INSERT INTO Foo (Baz) VALUES (42); --Unknown column 'Baz' in 'field list'
@Mast Notice how the first error message from MySQL^^ is vastly more useful than the 2nd?
 
lol
I prefer my code to be without errors though. But I see your point.
 
Dynamic SQL is riddled with issues like that
 
8:57 PM
Is that true for all database types?
 
All SQL databases. I don't know about no-SQL databases
 
I haven't studied no-SQL DBs enough to know how the query optimizers work or what kind of issues might arise
 

« first day (1337 days earlier)      last day (2663 days later) »