« first day (437 days earlier)      last day (3585 days later) » 

12:00 AM
BTW this is what the ++ operator does now:
    public static Fraction operator ++(Fraction fraction)
    {
        return fraction + 1;
    }
 
yay :)
what's GetHashCode currently looking like?
 
would this make sense?
    public override int GetHashCode()
    {
        return Simplify().ToFloat().GetHashCode();
    }
 
Why is this room named "The 2nd Monitor"? What's the history behind that?
 
7
Q: What should be the name of our main chatroom?

Mat's MugOur main chat room is currently called Code Review General Room, with "General discussion about Code Review." for a description. I propose The Zombie Hunters' Lounge, but I'd like the community to post their ideas here (1 per post, include why it's the best name), the one with the highest number...

 
The first monitor was a CRT
or that, though it's the fourth monitor for me :o
 
12:05 AM
@AlexL I just came up with it, and since meta-activity was quite low back then after a while I just decided to call it that ;)
 
i was thinking (after simplifying) long x = (((long) _numerator) << 32) | _denominator; return x.GetHashCode();
 
@Mat'sMug Wow, kinda cool :)
 
@mjolka bit-shifting o.O ...I'm going to have to look into that at one point.
 
there's no way dealing with other people and implementing functionality you disagree with are that small in the pie
sometimes it feels like they should be the 49% :P
 
"implementing underspecified functionality" should be on there
 
12:12 AM
@mjolka seriously, ...that's a couple notches above my level :/
 
staying awake in meetings should be there too :)
 
@Mat'sMug the bit-shifting?
 
and the binary or with _denominator ...I don't get the why.
all I've used binary operators for, was for flag enums :/
 
well you've got two 32-bit values, so let's treat them like one 64-bit value
because some good folks already figured out GetHashCode for a 64-bit value
 
hence the cast to long
 
12:14 AM
you would get slightly more deterministic results since you're avoiding the floating point
 
right
 
but why shift 32 bits?
 
so we (arbitrarily) pick numerator to be the left-most 32-bits
 
oh
 
that's just packaging - you put one value in the top 32 bits and the other value in the bottom 32 bits
 
12:16 AM
right, so if numerator is xx...xx, we shift it 32-bits to the left to get xx..xx00..00
 
ok
 
now set the right-most bits by bitwise-or'ing
and then assume that whoever wrote long.GetHashCode knew more than we do about hashing 64-bit values :)
 
you could do it with addition, too
(((long) _numerator << 32) + _denominator) should do the same thing
 
so hold on, we have an Int32 which we cast to an Int64, leaving the left-most 32 bits useless, so we shift it 32 bits to the left.
 
yep
 
12:19 AM
then the bitwise or... ...fries my brain.
 
let's pretend int is 2-bits and long is 4-bits
 
lol ok
 
(i cannot type this morning)
 
so we cast Int2 to Int4
and 0011 << 2 becomes 1100
 
say _numerator is ab (in binary), _denominator is xy
^ yes
(long) numerator is 00ab
 
12:20 AM
yeah
 
((long) numerator) << 2 is ab00
 
still there
oh
 
((long) numerator) << 2 | xy is abxy
 
click
 
:)
 
12:21 AM
ya you just smooshed [ab] and [xy] into [abxy]
 
that's pretty cool
 
you earned the badge bit-wizard
 
hehe not yet
I need to play a.. bit
 
groans
 
There are some more toys then: ^ and ~
xor and negation
or maybe inversion is a better way of putting it than negation
shrug it flips bits
 
12:24 AM
0101^ == 1010?
(opens up sandbox console app)
 
^ is for xor, so 0101 ^ 1100 == 1001
 
(╯°□°)╯︵ 0101
2
 
~ is for negation, so ~0101 == 1010
 
ah
my gosh, haven't done that level of binary math since ...2000 or so
 
@Mat'sMug I noticed is not in your favorite tags ;)
 
12:27 AM
@Phrancis I shall fix that
 
I don't use bitwise operations that often anymore. I get a nostalgia buzz when I can figure out how to inject it into something I'm doing, though
2
 
@DanLyons some 15 years ago I was able to make a bitmap transparent with a B&W mask and some XOR magic. I would totally fail doing that today. well I think I would.
+250 anyone? ends in 14 hours:
7
Q: Mobile touch menu

ChrisWUnfortunately, the code in the original version of this question doesn't work, so I will rewrite this question. Please don't review this code until I have fixed it. See also this answer on Meta.

oh WTH
 
now, I think you can just tell the appropriate wpf and winforms controls what color to use for transparency, so as long as the bitmap has a solid background color, it's already done for you
 
yeah
 
@Mat'sMug He still hasn't responded to my super-ping. It appears that the code in the previous revision was reviewed, so it may just have to be rolled back after the bounty ends.
 
12:33 AM
@Jamal will the 250 be refunded?
 
It can be, if he wants. Mods are not obligated to refund bounties.
 
@Mat'sMug referencesource.microsoft.com/#mscorlib/system/int64.cs#83 well... that's not what i expected
 
    public override int GetHashCode() {
        return (unchecked((int)((long)m_value)) ^ (int)(m_value >> 32));
    }
lol
 
so i just gave a very round-about way of writing _numerator ^ _denominator
 
I like the Int32 implementation for GetHashCode:
    public override int GetHashCode() {
        return m_value;
    }
 
12:47 AM
@Mat'sMug Do let me know if you'd like for me to "translate" (downgrade?) your SQL Server example code into MySQL
 
@Phrancis yeah, I'm ...playing with some hash codes right now, you're right I should be working on that!
1/3 (float) hashcode: 1051372203
1/3 (fraction) hashcode: 1051372203
11/33 (fraction) hashcode: 1051372203
@mjolka indeed, both ways return... a hash code of...2
(for {1/3} Fraction)
and now I'm confused
 
What is a hash code?
 
> A hash code is a numeric value that is used to insert and identify an object in a hash-based collection such as the Dictionary<TKey, TValue> class, the Hashtable class, or a type derived from the DictionaryBase class.
 
hash != hasch, you can't smoke a hash code :/
2
 
1:00 AM
So... this brings the obligatory follow-up question what is hash? lol
 
<.<
 
Wow! This question wasn't closed back in '11, and 200 finally found it and closed it.
 
Why bother commenting?
where were the modz back then!
 
I didn't have to, but the closure doesn't notify the OP. I was tempted to delete anyway since the actual source code could be anywhere in there. I think the 15 rep would be lost, but the upvote rep will be retained.
 
Good call
 
1:10 AM
So hashing is essentially breaking out a large list/table of values of one kind or another into a bunch of much smaller table... and the hash code acts as a sort of reference key like a PK of sort... am I anywhere near?
Or completely wrong? (more likely)
 
@Phrancis hashing is breaking a big thing down into a small and theoretically unique thing
 
not so much unique, as there's obviously never going to be a bijection between a set of a larger cardinality and a set of a (generally much smaller) cardinality </mathematician>
 
that's why i said "theoretically" ... i meant something like "ideally"
@Phrancis check this out - en.wikipedia.org/wiki/Checksum
 
generally as long as it's randomly, uniformally distributed across the possible state space, you're good
 
@Yuushi you didn't do maths at unimelb or anu, did you?
 
1:15 AM
that being said, coming up with good hash functions is really, really hard
@mjolka Nah, at Adelaide uni. But I do have a friend that went to ANU and did math
 
ah, i did maths at anu/unimelb and was wondering if we'd met :)
 
So hash codes and equality are related; if two objects have the same hash code, they're equivalent. Hence if you override GetHashCode, you have to override Equals, or you'll run into problems. The kind that makes you say when you discover that the bug was because the developer implemented Equals but not GetHashCode, or vice-versa ;)
 
@Yuushi Your latest answer reminds me that I should be exploring the STL further. I haven't known about std::inner_product...
 
@Jamal It sits in <numeric>, which I think 99.9% of C++ programmers forget about
 
@Yuushi pure or applied?
 
1:16 AM
@mjolka What years were you there?
@mjolka graduated with honours in Applied, but I did a number of pure courses as well
 
anu 2004-2007, unimelb 2008, 2010-2011
 
hrm, you may have had some classes with a friend of mine then
 
(bows)
 
you would have been there at a similar time
 
@Yuushi Ah, I see. By the way, have you seen my question?
 
1:17 AM
@Jamal Nope, not yet. I'll take a look
eh, Morwenn already got to it, I probably won't have much to add :)
 
Okay. Maybe Loki or someone else will find something. :-) I am still proud of myself for using inheritance for a change. Having a list of getters and setters is just gross.
 
hrm, ok, I can see one thing he missed
 
should I remove this comment?
@VDohnal you're reading it wrong. 1 tournaments -> * tournament matches; 1 tournament match -> * results. A TournamentMatchResult can only belong to one TournamentMatch, which can only belong to one Tournament. The only associations in that diagram, are one-to-many.... — Mat's Mug 3 hours ago
 
@Mat'sMug "if two objects have the same hash code, they're equivalent" ?
 
as far as having a hash code goes, yeah... no?
objects that are equal should have the same hash code.
 
1:29 AM
i agree with the second statement
 
@Jamal Ok, added another small point
 
whatever the equality rule is
 
technically, hashing defines an equivalence relation
not equality
 
:-)
I don't think my compiler has default destructors, unfortunately.
 
@Jamal Just replace =default with { } then :_)
 
1:31 AM
@Yuushi that
 
@Yuushi Ah yes, of course.
 
@Mat'sMug ah, i read it as x.GetHashCode() == y.GetHashCode() => x == y. i see what you meant now
 
yeah; two objects that are equivalent should also be equal, and two objects that are equal are obviously equivalent. but equality and equivalence are two things.
 
Ummm I don't know. I'm more of a math geek and I'd say that's a false statement.
Equivalence means two things can be mapped onto each other.
Equality means they are practically identical.
Not sure how that applies to hashing though.
 
(4/2).Equals(2) == true; (4/2).GetHashCode().Equals((2).GetHashCode()) == true
        public class Foo { }

        static void Main(string[] args)
        {
            var foo = new Foo();
            var bar = new Foo();
            Console.WriteLine(foo.GetHashCode().Equals(bar.GetHashCode()));
            Console.ReadLine();
        }
outputs false because Foo doesn't override GetHashCode, and object.GetHashCode() returns a value that represents the reference held by the object instance, so unless foo and bar were the same object, GetHashCode() returns a different value.
 
1:54 AM
Ahhh. Yes. They are equivalent, but unequal.
Foo can be mapped onto bar, but it is not bar.
 
when we say that two things are equivalent, there's an implicit equivalence relationship (~) that we're talking about. as @Yuushi said, GetHashCode defines an equivalence relationship between objects via x ~ y <=> x.GetHashCode() == y.GetHashCode()
but it is not true that because two objects are equivalent under this equivalence relationship, that they should be equal
however if x == y then a properly defined GetHashCode will satisfy x.GetHashCode() == y.GetHashCode()
 
2:12 AM
Interesting discussion going on here!
 
2:23 AM
randomly failing unit tests -_- this is gonna be a long day
 
-2
Q: Embed watermark image to another image

suzzanecan help me solve how to embed watermark image to image? But the watermark image to image is invisible. Hope can provide code.

 
3
Q: Do AMD loaders need a way to initiate module resolution other than "define?"

Dagg NabbitIn a discussion about a tangentially related aspect of a minimal AMD loader I'm working on, James Burke wrote: There should to be some way to kick off the resolution of modules, besides just define(). define() calls by themselves should just register the existence of a module definition, but ...

^ any idea why this would get downvoted
 
2:41 AM
For whatever reason, people have come to expect SO questions to always contain code. It's a debugging service these days.
 
downvoter's way of saying "I think that one belongs on Programmers"?
 
That^
 
0
Q: Safely network reconnection (netty based)

jilenNettyConnectionManager.scala: class NettyConnectionManager(val config : NettyConfig) extends ConnectionManager { @volatile private var connection: Option[Connected] = None def get() = { if(isConnected) { connection } else { synchronized { if(connected) { ...

 
@Mat'sMug it does belong on Programmers, but the people I actually hoped to get an answer from (like the guy who answered) do no frequent that site, so posting there would probably be useless
also double-checked the SO FAQ to make sure it was not off-topic there; it's not afaict
 
bah, the upvotes largely buy back the downvote ;)
 
2:46 AM
lol, that's true... I have plenty of rep there anyway, just was confused by the meaning of the dv
 
3:06 AM
@Phrancis I got the
use Sandbox;

declare @result table (SizeIndex int, Units int);

declare @input varchar(80);
set @input = '                       1   2   2   4       4       2   2   1                    ';

declare @fieldCount int = 20;
declare @fieldLength int = 4;

declare @index int = 0;
declare @fieldValue varchar(4);

while(@index < (@fieldCount))
begin

	set @fieldValue = substring(@input, @index * @fieldLength, @fieldLength)
	if (isnumeric(@fieldValue) != 0)
	begin
		insert into @result
		select @index, cast(ltrim(@fieldValue) as int);
6	1
7	2
8	2
9	4
11	4
13	2
14	2
15	1
 
3:21 AM
I feel really bad for anyone trying to write anything in LibreOffice Basic. I tried once. For a few hours. Much cursing was done that day.
1
Q: How do I make vba code compatible with libre office

user3125707I have recently migrated to pclinuxos from windows and seem to like it. The only problem I am facing is that libreoffice, the default spreadsheet package is not compatible with excel macros. Below is the vba code I have: Option VBASupport Sub DeleteToLeft() Selection.SpecialCells(xlBlanks)....

Ohhhh. Here's a good one. Some one is having trouble installing a vb6 app on win 7...
-4
Q: How to instal visual basic 6 softwares on Windows 7?

user3819979I was a Visual basic 6 programmer 2 years ago, and now I need to run my software that made with visual basic 6 on windows 7 But when I install the program on windows 7 windows can't open and run my program. How to run it on windows seven? Why windows seven can't run it?

 
3:40 AM
@ckuhn203 I almost answered "rewrite it in , import the Microsoft.VisualBasic namespace"...
@ckuhn203 when the first thing you see is Option VBASupport, you know you're in for a ride
2
 
Lol. @Mat'sMug. Yeah... A bumpy one.
I just go to SO when I feel like down voting a ton of questions. Then I see something that makes me go "You poor soul. I'm so sorry."
3
(Libreoffice guy, not VB6 guy)
 
4:03 AM
0
Q: Put it in a bucket

Mat's Mug You're running a jeans company. Your system is collecting detailed orders' data, but it's a bit archaic and it's storing the number of units ordered per size in a delimited string with 20 "fields", each taking up 4 characters. You want to normalize this data to make it easier to eventually ana...

and TTGTB - 'night @all!
@Phrancis ^^^ the version I put in chat is wrong, use the one here instead! -- I really have no idea how could do that.
 
1
Q: Put it in a bucket

Mat's Mug You're running a jeans company. Your system is collecting detailed orders' data, but it's a bit archaic and it's storing the number of units ordered per size in a delimited string with 20 "fields", each taking up 4 characters. You want to normalize this data to make it easier to eventually ana...

 
4:28 AM
0
Q: Mutation to Lists; Values not mutating correctly

Hassan KhokharPurpose of code is as follows: My code is as follows: def align(points, max_diff): x_points = (map(lambda i: i[0], points)) x_avg = sum(x_points)/len(x_points) x_outer_bound = (x_avg+max_diff) x_inner_bound = (x_avg-max_diff) y_points = (map(lambda i: i[1], points)) y_avg = sum(y_points)/le...

 
4:45 AM
@Mat'sMug with difficulty :)
WTH is up with the spaces?
In @input etc?
Oh I think I get it. Empty spaces where there are no orders for said size
Man that is archaic
 
5:08 AM
0
Q: Strategy Game in Javascript with Three.JS

bazolaI've been playing around with porting a simple strategy game over to Javascript, the idea being to run it in a browser for testing. I've done some simple Javascript code in the past, but this is my first model/view setup. I'd love to get feedback on following Javascript best practices and avoid...

 
morning @all
 
Hello, @chillworld
 
hey @Phrancis still awake?
 
I suppose you could call it that :)
 
> You've earned the "Enlightened" badge (First to answer and accepted with score of 10 or more) for "FizzBuzz in Commodore Basic".
Code Review: the site where the questions, programming languages used, points, and badges don't matter.
 
5:25 AM
sounds like a certain TV show...
 
I think @Phrancis is atm Enlightened :)
but gratz @DaggNabbit
 
@chillworld nothing enlightening like writing MySQL lol.
 
thanks @chillworld :)
@Phrancis is an outspoken necromancer
Apparently I am an enlightened enthusiast outspoken necromancer yearling with a good answer
 
/D
I'm almost at the enthusiast badge
ow sorry almost fanatic badge
 
5:41 AM
how many days is fanatic?
 
100
 
gold badges seem ridiculously hard to get here
 
the fanatic still goes
that's completly in your hand
 
i could just set up a bot to ensure fanatic
 
tss, 1 min work
If I'm not home for whole day, I do it quick with cellphone
 
5:49 AM
same with electorate and steward probably
 
electorate we have to wait upon the event
 
i think electorate is just for voting on stuff
 
oh lol
indeed
 
@DaggNabbit Re: gold badges, it seems it's upvotes that are difficult to get lol.
 
@Phrancis especially if you're dealing with anything that isn't Java
 
5:51 AM
^^ that
 
I know 1 badge what will be hard to get here
unsung hero (and yet 1 time awarded)
-2
A: Union-set for ordered representation

Adeel Zafar SoomroYour implementation looks good. =)

-2 voted andyet accepted
 
nice
 
at least the downvoters may leave a comment
 
Reversal shouldn't be hard to get on sites like SO, where the downvotes mean "nooo you're doing it wrong" and the upvotes mean "yes, do it like this instead"
but here it seems like you get upvotes for doing it wrong =/
 
it's hard to get that reversal
I do hate the DBA team (or they hate me)
admin user has lost his rights :s
and gues the user do call admin :D
now break :)
 
6:00 AM
ahahah that sucks
 
brb in 30 min
 
Monking
 
6:14 AM
Hi @skiwi
 
moning @skiwi
@DaggNabbit time to write (again) the sql script to give admin user admin rights
 
Good morning
 
6:31 AM
morning @JeroenVannevel
 
wonder why some of my github repos say "0 contributors"
 
This SQL end statement always makes me feel sad face: );
 
@DaggNabbit cause github doesn't see you as contributor? :p
 
@chillworld but with other people's repos there's always at least one...
 
normally the creater is a contributor
 
6:43 AM
hmm maybe it's because my local git settings have a phony email address
1752
Q: Why does HTML think “chucknorris” is a color?

user456584How come certain random strings produce various colors when entered as background colors in HTML? For example: <body bgcolor="chucknorris"> test </body> ...produces a document with a red background across all browsers and platforms. Here is a Fiddle. Interestingly, while chucknorri produces a...

Originally, it wasn't going to be part of HTML 1.1, but it inserted itself into the specifications after the first time Chuck Norris used a browser. The color is said to be modeled after the color of his beard. Fact: setting your background color to chucknorris will crash IE6, IE7, IE8, IE9, and versions of IE yet to be invented. It will also crash your computer and roundhouse kick you in the face. — slothario Feb 6 '13 at 0:35
 
YES I found the stupid syntax error that's been bugging me for 2 days.
 
Does anyone know if this regex is correct?
private static final Pattern IBAN_NUMBER_PATTERN = Pattern.compile("^[a-zA-Z]{2}\\d{2}[a-zA-Z\\d]{11}$");
Not sure especially the [a-zA-Z\\d] part
 
@skiwi don't IBAN numbers look different in different countries
 
@DaggNabbit True, there's a second validation layer after this
So far I've found they always start with 2 letters (country), 2 digits (checksum) and must be minimal 15 characters
(I can't afford to validate all things that look like text in my OCR output)
 
6:59 AM
I've seen IBAN validators that are like 200 lines long =/
 
You mean... a regex of 200 lines?
 
no, a big switch with country codes
they usually don't even bother with regex
 
I can imagine
Ultimately it'll be checked against a database with real entries anyway
But cannot spam that web service/database
 
get yourself a few examples and have them as unit-test cases then
monking btw
 
@skiwi [a-zA-Z] is weird, just do [a-z] and make it case-insensitive
with /i
 
7:03 AM
That's a good point there
 
and yeah i'm pretty sure you can't do [\d]
 
Need to figur eout how that works with java
 
no i lied
[\d] works
Some things don't work in character groups, like [.] is a literal dot
 
[a-z0-9] is actually more clear though here
Yeah I need to build unit tests for this some time... soon
btw, from now on you really need to remember to incrementally build and test if you are upgrading to a higher Java version
Say you upgrade from Java 7 to Java 9 in one go
In Java 7 _ is a valid identifier for a parameter
In Java 8 it became deprecated and triggers warnings
In Java 9 it may get a different meaning
Single upgrade from Java 7 to Java 9 = have fun
 
so java 9 announced??
 
7:09 AM
there's a Java 9 already?
 
No of course there's no Java 9 yet :P They're not that quick.
But Java 8 has reclaimed the _ back as invalid identifier
 
skiwi don't make us crazy, just because you read some Proposal....
 
And some future new version will use it for a new construct
 
I hope some version of JavaScript make $ an invalid identifier just to stir things up
4
 
^^ or PHP lol. Those people would freak out.
 
7:18 AM
Something changed in my IBAN verification for sure
I should've had unit tests already up.
 
7:29 AM
A start of the day where everything works, is a good start of the day.
 
8:08 AM
@skiwi lucky you..
well I got my selectCheckboxMenu to work now..
sooo.
 
 
1 hour later…
9:25 AM
The last message was posted 1 hour ago.
 
1 hour later…
3
 
Nobody's answering.
 
Nobody's here!
 
Monking!
I just Bobby Tabled myself... ;DROP TABLE wcx_articles :/
 
This behaviour so makes no sense sometimes... I see I'm logged out on CR, I go to login page, and then it detects that I'm logged in and redirects me!
 
9:29 AM
Are you logged in somewhere else?
 
One month later...
 
I find if Im logged in to my email account it logs me back in here if Im logged out
 
@CodeX Not as far as I know
 
@Morwenn LMAO
 
I have a staged process consisting of about 6 subprocesses, was wondering why it doesn't work anymore after a refactoring of a few weeks ago...
 
9:31 AM
missed a . or , or ; or { or } ?
skiwi you code with C?
 
@skiwi always uses JAVA.
8.2
 
Now I notice that two processeses were inked to the same input and output and something else was broken
@CodeX Nah, I code in Java 8
 
lol @ "JAVA"
 
skiwi never uses JAVA, or Java at that...
he uses java.
 
Ah, what type of applications do you code?
 
9:33 AM
JAVA bins.
 
I like to Javla..
PHP - If it ain't one thing its a motherfuckingnother!
If my application relys on a secure login do i need to make sure ALL db calls are safe?
If someone logs in they can delete everything anyway
PDO doesn't allow me to use params in LIMIT or TABLE.. Frustration!
silence
 
9:48 AM
15 awkward minutes later...
2
 
why you!
 
How to *silence* a chat room 101:
Mention PHP!
 
Go to Lounge<C++> and mention PHP. I bet you will have results.
 
Im sure..
 
This sounds like a good idea... ahem..
 
9:53 AM
@Morwenn I'm looking for a secure password storage application in C# or a tutorial on using databases in C# can you point me in the right direction?
 
@CodeX I have very sparse knowledge about both password storage, C# and databases. I fear I cannot help you there. Sorry.
 
@CodeX I know there is the Credentials option in Windows Store Apps
It might also be available in traditional C#
but it is a Windows 8.x feature I think
 
@Morwenn NP thanks anyway :)
@JeroenVannevel Yeah its win8, ill just have to "play" with VS
@chillworld I don't know that that is..
 
mhhh fucking autocorrect spaces
 

« first day (437 days earlier)      last day (3585 days later) »