« first day (1437 days earlier)      last day (3516 days later) » 

12:00 AM
that sounds complicated
 
It probably is, he likes to make you think.
 
@OMGtechy Just change firstValue and secondValue in the current lambda?
 
@user1112560 or...that xD
 
I feel smart just by knowing the word Tuple now.
 
exchange*
 
12:00 AM
@Tokencodingnewbie hahahaha
@user1112560 I'm tired mm k?
 
Same :P
@Tokencodingnewbie You're constantly improving, which is great :D
 
public void DeterminePosition(int x, int y)
        {
            Tuple<int, int> position = new Tuple<int, int>(DetermineRow(x), DetermineColumn(y));
        }
Right idea?
 
Yes, but your return type will be the tuple too :)
instead of void
so return new Tuple.... etc
otherwise yes it's fine
Also makes it very easy to read
 
So return the Tuple??
 
yes
 
12:03 AM
Say whaaaat
 
public Tuple<int, int> DeterminePosition(int element)
you don't want to pass in x and y, because the very reason you have this method is because you don't know what the x and y are xD
 
 public Tuple<int, int> DeterminePosition(int x, int y)
        {
            return new Tuple<int, int>(DetermineRow(x), DetermineColumn(y));
        }
It's working though.
MessageBox.Show(myButton.Name + " is located at " + DeterminePosition(i, i));
 
you're passing in i twice
why? :P
    public Tuple<int, int> DeterminePosition(int element)
    {
        return new Tuple<int, int>(DetermineRow(element), DetermineColumn(element));
    }
it makes no sense to pass in a position to a method called DeterminePosition
you're ASKING it for the position
if you already knew it, why the hell are you asking
:P
 
I CANT EVEN NAME MY CODE RIGHT
/me runs away crying
but yeah I get what you mean by passing in i twice, it just made sense when I wrote it. I thought they would be separate somehow, don't ask.
 
it's fine
everyone makes mistakes, some people just pretend not too
Example: Jon Skeet knows little of unsafe C# code
He admits to it in his book
but many regard him as a C# god
 
12:11 AM
Shit, I'll own up to it.
ok so now we got this data
and everything has to do one function right?
So I'm guessign it's time to make a function that determines if the area in the x,y axis is taken right?
 
:D yep
 
Yes
You've got it
Then if you need to work out the position somewhere else, you've got a nice bit of code you already made
 
Im getting smarter
 
Level up!
 
 public bool isSpotTaken(int element)
        {
            if (isX[element] == 1 || isX[element] == 2)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
Look right?
Is this where recursion is going to come in?
 
12:31 AM
No
It looks fine though
you can make it simpler
but this is not recursion
 
The isSpotTaken code?
 
yeah
 
return isX[element] == 1 || isX[element] == 2;
or even simpler
assuming the other allowed value is 0
return isX[element] != 0;
 
Return the ifcheck? wut
 
12:34 AM
(isX[element] == 1 || isX[element] == 2) evaluates to a boolean
 
user1881400
I have a simple question: how do I store binary from the BinaryWriter class in my code instead of in a file?
 
An if statement requires something that evaluates to either true or false, I'm just skipping the if and directly return the value
@FizzledOut what have you tried so far?
If you think about it, your code is a file
 
Oh
So if it meets the criteria it returns true
 
it does indeed
 
user1881400
12:36 AM
I'm attempting to create the binary for a .wav object and return it as an object. @OMGtechy It's one of those situations where I don't know where to begin. The IO.Stream class seems to write to files, otherwise I don't understand it.
 
I get it now, for some reason It wasn't making sense.
 
@Tokencodingnewbie and now you've learnt
 
@OMGtechy Man I'm going to have to buy you a pizza one day.
 
@FizzledOut a file is a binary object
@Tokencodingnewbie you're totally welcome to haha
 
        MemoryStream m = new MemoryStream();
        using (BinaryWriter b = new BinaryWriter(m))
        {
            //1337hex
        }
        byte[] result = m.ToArray();
 
user1881400
12:37 AM
@user1112560 Oh. Well that clears things up
 
Ask if you need the binaryWriter obviously, but that's a start.
 
@OMGtechy I'm not sure if I could order online since I have a US debit card :P
 
@Tokencodingnewbie hahahaha :P
I'm thinking of writing a new article for my website
But I'm wondering what to write about
Raw string literals is my only idea atm
Maybe lambdas
 
public bool isSpotTaken(int element)
        {
            return isX[element] != 0;
        }
    }
That looks so much better
 
So pretty
 
user1881400
12:39 AM
@OMGtechy if you send me a link to your website, then I can check it out and maybe suggest something that I had trouble with.
 
Yer name is Josh?
 
yes
 
Woo!
Clearly we're the best kind of people
Did you know Joshua is the greek translation of Yeshua - Jesus?
Therefore we are Jesus
 
12:41 AM
Yes
 
user1881400
@OMGtechy you have some C++ topics, I see. Why not cover the differences and best practices regarding C-style casting vs. C++ casting like static_cast, dynamic_cast, and reinterpret_cast?
 
My dads name is Jesus, but my mom didn't want me having an ultra cuban name.
So they picked Joshua.
 
user1881400
My name is Joshua....
 
Then I grew up and became an atheist lul.
 
@FizzledOut that's a good one, although fairly simple to answer. I'm quite happy to write about C# too though
ahahahaha
3 Joshuas
@Tokencodingnewbie Atheism is no different than theism really
 
12:42 AM
/me shrugs.
I just don't care enough to have religion.
I can't believe it, it's all so crazy to me haha
ANYWHO, I got all this data, what is the next step, nudge time.
 
Think :P
Try nudging yourself a little ;D
 
Well I guess the next part is having the computer scan the game board and seeing where it can make a move.
 
That's one thing you'll need to do yes
But you've just done that really
with your isSpotTaken
check every spot, if it's not taken, you CAN move there!
but the real question is, where should you move
break it down into steps, like a recipe
 
ok so I have the isSpotTaken
Now I have to have it find the most logical move.
It needs to find what spots it needs to play to give it an advantage.
 
Yes
So, as a player, what would you check first?
 
12:48 AM
if a row or column has 2 O's in it.
 
Good
So in other words, if you can win you should always go for that
 
user1881400
Tic-tac-toe?
 
Yep
 
I thought this was going to use minimax to find the best location, or have we moved on?
 
I have no idea what minimax is
All I know is that if you're playing O's and X's you should always make a winning move if you can ha
 
12:51 AM
Minimax (sometimes MinMax or MM) is a decision rule used in decision theory, game theory, statistics and philosophy for minimizing the possible loss for a worst case (maximum loss) scenario. Alternatively, it can be thought of as maximizing the minimum gain (maximin or MaxMin). Originally formulated for two-player zero-sum game theory, covering both the cases where players take alternate moves and those where they make simultaneous moves, it has also been extended to more complex games and to general decision making in the presence of uncertainty. == Game theory == In the theory of simultaneous...
 
Isn't that a bit heavy for someone who hasn't programmed much?
Actualy
reading it, I'm doing that, just without using Minimax
as a term
think the simpler way of thinking would be best for now
and that could be an improvement later
 
user1881400
@user1112560 How do you create that preview-like view?
 
Yeah I think so, until I get a grasp on this stuff.
I don't have the logical coding mind yet :(
 
@Tokencodingnewbie what you'll be doing is basically that though
Just less idiomatic
 
@FizzledOut It's built into the chat for wiki + SO links.
Possibly others too
 
user1881400
12:54 AM
Thanks
 
It's called onebox @FizzledOut
@Tokencodingnewbie so first you'll want to check if the player can win
if they can, make that move
otherwise, see if your opponent can win, and try to block them
 
Okie doke.
Is this going to use the get position?
 
Yes
As you'll need to know if the player can win
 
So a loop of some sort?
 
There is another way to do it, but I'd say this is more...intuitive
 
12:56 AM
I guess loop through the isX array?
 
You're on your own now
it's time for you to think a bit
otherwise I'll end up doing it for you
 
I'm just thinking out loud.
Like the pool ball thing
 
Looking for reassurance
:P
 
If you think something will work
try it,
 
12:57 AM
It's just thinking it will work and then coding it that way are two different things.
I just don't know what is available to be, like that tuple thing.
be = me***
 
If you end up trying to do something very specific (like returning both x and y), and don't know how, ask
Language features I will help with happily
but here, the logic needs to come from you
 
Thanks.
ok gotcha.
I don't want you to write it for me.
 
But what if your known unknown is a unknown unknown you think is a known unknown but is actually unknown unknown because your assumptions on the unknown unknown are actually known unknowns or even unknown unknowns?
God that's a mouthful @user1112560
 
It is unknown.
 
1:04 AM
It is unknown if your known unknown is an unknown unknown or the known unknown you thought it was.
So much unknown.
If you look at the word unknown enough, it starts to look weird.
 
There's a word for that
Semantic satiation (also semantic saturation) is a psychological phenomenon in which repetition causes a word or phrase to temporarily lose meaning for the listener, who then perceives the speech as repeated meaningless sounds. == History and research == The phrase "semantic satiation" was coined by Leon Jakobovits James in his doctoral dissertation at McGill University, Montreal, Canada awarded in 1962. Prior to that, the expression "verbal satiation" had been used along with terms that express the idea of mental fatigue. The dissertation listed many of the names others had used for the phenomenon...
 
user1881400
Lets break it down: what if unknown = !unknown you think is !unknown = !unknown because !unknown are really !unknown or even !unknowns

what if unknown = known you think you know because known is really known or even knowns. I think.
 
Can you really know anything?
 
user1881400
I think the answer to that question is unknown.
 
@user1112560 thanks
@FizzledOut doesn't that make it implicitly false? :P
 
user1881400
1:08 AM
Not without making assumptions
 
But the question is known.
 
There is no spoon!
 
user1881400
And the answer is known to be unknown
 
Therefore the fact that we know it is an unknown makes it a known unknown.
 
Paradox
 
1:09 AM
LOGIIIIIC!!!!!
 
user1881400
Error #2434564: parsing failed. Now crashing computer...
 
Zeno's paradoxes are a set of philosophical problems generally thought to have been devised by Greek philosopher Zeno of Elea (ca. 490–430 BC) to support Parmenides's doctrine that contrary to the evidence of one's senses, the belief in plurality and change is mistaken, and in particular that motion is nothing but an illusion. It is usually assumed, based on Plato's Parmenides (128a-d), that Zeno took on the project of creating these paradoxes because other philosophers had created paradoxes against Parmenides's view. Thus Plato has Zeno say the purpose of the paradoxes "is to show that the...
I love this one
Some infinities are greater than others it seems.
Programming is the only time I have ever actually had to deal with infinity as a finite value.
But when you think about it, you're surrounded by various degrees of infinity.
 
user1881400
Well, not necessarily infinity in the mathematical model, but more as an unquantifiable amount.
 
There's an infinite number of infinities.
double doesn't model for that very well.
 
The arrow paradox under it used to trouble me a lot
so I started trying to define a mathmatical model to deal with it
turns out that's calculus
it still troubles me now though
I genuinely lose sleep over these things.
 
1:12 AM
Saw this a few days ago, loved it: youtube.com/watch?v=23I5GS4JiDg
 
@user1112560 I really like the colourful drawings
 
Yep, although I tend to listen rather than watch nowadays, 1 screen is never enough.
 
@user1112560 That chick sounds cute, what does she look like.
inb4 its a guy and im gay
 
I don't think there is a "sounds cute", probably just because she's a woman :P
 
not all girls sound cute bro haha
 
1:21 AM
I just like the pictures
She lost me a while back
 
My application folder structure is as follows: rootFolder -> folder1 -> list.txt, rootFolder -> folder2 -> list.txt ...
How go I loop through it and get all the txt files?
I have the following:
var rootFolder = await ApplicationData.Current.LocalFolder.GetFolderAsync("rootFolder");
            var allFolders = await rootFolder.GetFoldersAsync();

            if (allFolders != null)
                foreach (var fol in allFolders)
                    await loadList();

            var files = await allFolders.GetFilesAsync();
Except it throws an error on the last line.
'System.Collections.Generic.IReadOnlyList<Windows.Storage.StorageFolder>' does not contain a definition for 'GetFilesAsync' and no extension method 'GetFilesAsync' accepting a first argument of type 'System.Collections.Generic.IReadOnlyList<Windows.Storage.StorageFolder>' could be found (are you missing a using directive or an assembly reference?)
 
throws an error, or causes a compile-time error?
 
error, compiler error
 
I can't test it out on this PC as I'm on Windows 7, 1 sec...
 
"In projective space parallel lines do meet at infinity". Whut.
 
1:28 AM
OK, got it working ish, what does loadlist do considering it's not taking any arguments?
 
user1881400
I'm trying to implement a way to create .wav files according to the .wav specifications, but the specification is particularly troublesome because header sections are encoded in big-endian mode, while others are little-endian. I looked at the BitConverter class, but I can't conclusively figure out how to decide whether data is encoded as big or little endian. According to stackoverflow.com/questions/217980/…, it seems like C# defaults to little endian.
 
From that very answer
"C# itself doesn't define the endianness"
 
user1881400
@OMGtechy and from the exact same answer, verbatim: "The BitConverter class has an IsLittleEndian field to tell you how it will behave, but it doesn't give the choice."
 
I believe it's hardware defined.
 
BitConverter.IsLittleEndian
 
1:31 AM
It basically loops through the files it finds in the folders
 
That's telling you the endianess, C# still doesn't define it
 
user1881400
@user1112560 but I need to encode data choosing endianness, otherwise it's impossible to make wav files per these specs: ccrma.stanford.edu/courses/422/projects/WaveFormat
 
        if (!BitConverter.IsLittleEndian)
            Array.Reverse(ba);
 
user1881400
@user1112560 I read the wikipedia article of endianness, but I didn't know reversing the byte array was actually the same. I figured it was more complicated than that. Nevertheless, thanks for helping me through my own stubbornness.
 
@DemCodeLines I see, you're trying to call GetFilesAsync() on a collection of folders, instead define a list and add to that.
 
1:34 AM
what do you mean?
 
As a basic example, if you don't want to have multiple concurrent tasks:

List<StorageFile> files = new List<StorageFile>();
foreach(var fol in allFolders)
files.AddRange(await fol.GetFilesAsync())
 
"Mary had a laser bat"
 
Once you get that working, have a look through: http://msdn.microsoft.com/en-us/library/jj155756.aspx
Although admittedly I don't know the Windows Store APIs at all, so there might be a nice "getAllTextFilesRecursively" method.
@DemCodeLines msdn.microsoft.com/en-us/library/windows/apps/… - code example might help.
 
1:53 AM
heya, anybody have experience with shopping carts?
 
I think I understand them conceptually :P
 
so i'm using a session-id cookie, to link to a database table for supporting non-registered user associated shopping carts
uses the anonymous user's session id to persist their cart
following?
 
yep
 
i'm wondering, if the session-id cookie is stored client side, what's stopping the user from changing it, and ending up with somebody else's shopping cart?
 
Nothing
But not using regular values helps prevent it
You'll also want to associate other data with it
Same goes for credit card numbers
Not all possible values are valid values
And these values must match in such a way that it's hard to forge one
Salty hashes.
 
2:08 AM
asp.net seems to generate one automatically by the key ASP.NET_SessionId
i'm not sure what you mean by "regular values"
as in, not easily guessable/generated?
 
Most sites use a token for saving user credentials, stealing a user's cookies and copying them into your browser will log you on as the user (See: Firesheep). From the server's POV, you can use IP Address geolocation (and many other fun strategies) if you want to to try and combat this.
From your perspective, even if you were to roll your own token generation scheme (don't). A GUID would probably provide a large enough keyspace that you'll never have a collision.
 
I'd say let people access non-sensitive data with the session ID, and require fast expiring tokens for sensitive data
eBay do something similar
 
The token would be created with a secure PRNG or better, so it wouldn't be guessable.
 
asp.net generates something like "nx003i1zb4wut4rz3tldfynb" by default
 
I've never even done anything like this btw, this is just what I think from the perspective of someone who looks to break everything he sees.
It depends how secure this needs to be really
As seeing someone's shopping cart might not be regarded as the end of the world, but seeing their credit card information would be
 
2:13 AM
does that seem like a guid?
yea, i'll only be using it for the shopping cart
 
I wouldn't worry too much then
 
We're talking shopping cart here. Once you move onto purchasing from that cart, you'll need to seriously step up your security game.
 
yeah
 
as for the login, i believe asp.net uses an authentication cookie as well to prevent unauthorized logins
 
One way hashes with salty goodness
They are a good place to start when you're getting to sensitive goodness
They are by their nature crackable, but not in a viable time span if done correctly.
 
2:16 AM
super high entropy and all that right
 
As a rule of thumb, make patterns as hard to find as possible
But that is best left to people who specialise in it
So I'd just use SHA-whatever (so long as it's not SHA 1) for now
 
RNGCryptoServiceProvider is used internally to generate the SessionID
 
so the automatically generated session id has "Session" listed as its expiration date
this means it'll expire as soon as the user leaves the site, right?
 
http://support.microsoft.com/kb/223799/en-us
> Per-session cookies are used to store state information only within a session. These cookies are cached only while a user is visiting the Web server issuing the per-session cookie and are deleted from the cache when the user closes the session.
So when the web browser is closed.
 
probably not what i'd want for a shopping cart
the session id on amazon seems persistent
do you think it would be viable to change the expiry of that session cookie? will it mess with anything else?
sorry for all the questions, this stuff is pretty new to me
 
2:24 AM
Are we talking Auth cookie or Session Cookie?
 
session
i mean, whatever ASP.NET_SessionId is
i'd assume that's the session cookie, lol
 
so what control is that on the left side?
 
@JoshBjelovuk Issue your own cookie rather than messing with the defaults.
No clue, coding a WP8.1 app at the moment, haven't even started to touch the UI stuff.
 
oh man, microsoft is really getting pushing me with this winphone stuff
 
Pushing in a bad or a good way? :P
 
2:33 AM
bad
I mean stupid things like this: I have a listview inside a hubsection and for some reason, I just can't get the page to reference it.
even if I add x:Name to it, I can't use that name in c# backend, so basically I can't do stuff to the listview behind the scenes in c#
 
Oh, auto code generation woes? :/
Oh goodie, faced those before.
 
And apparently, it's not possible to do that with Hubs, so I am forced to bind a collectionviewsource to the itemsource of this listview and then change the source of the collection view source.
sigh
 
ok so I think I need nudging, am I going to have to store in an array or something what spots are taken? I'm just not sure how to give this information to the computer. I start writing a loop, but I don't know how to make it work how too tell the computer if 0,0 and 0,1 are taken then take 0,2.
 
@Tokencodingnewbie as always, just try it
You'll learn by your mistakes
so they're not "wasted time"
 
Well I thought first I need to take my 0,0 0,1, etc and make it equal what part of the index it's going to be of the gameboard array
public int getPostionInt(int element)
        {
            Tuple<int, int> pos = DeterminePosition(element);
            if(pos == 0,0)
            {
                return 0;
            }
        }
Says I can't do that ;_;
 
2:45 AM
A Tuple has 2 properties of interest: Item1 and Item2
if(pos.Item1 == 0 && pos.Item2 == 0)
 
user1881400
If I swapped a big-endian character array to a little-endian one, then would it take all of the characters into a byte array and reverse it or take each character into a byte array and reverse them individually, then concatenate the results? I suspect the second.
 
user1881400
Because char is two bytes long, and I think all I do is swap the order of those two bytes on a per-character basis.
 
ok getting too tired to go on, need sleep, will try when I'm semi fresh tomorrow
 
user1881400
Okay, I'm fairly certain it's the second one now.
 
user1881400
2:58 AM
It makes the most sense
 
5:40 AM
I am looking for a solution for a problem I am having parsing JSON in my web service.
I have a webmethod that accepts a string
the string i feed it is a valid JSON string
I have tried doing something like this
var dict = new JavaScriptSerializer().Deserialize<List<KeyValue>>(EventHotelNights).ToDictionary(x => x.key, x => x.value);
with this...
 public class KeyValue
    {
        public string key;
        public string value;
    }
but am not getting results.
the string (of JSON) i am passing the webmethod is this:
{"EventHotelNights":["3e45e148-14d3-4e05-b651-2d671ca75ea6","3e45e148-14d3-4e05-b651-2d671ca75ea6"]}
Any better way to handle this? In all honestly I don't necessarily need to use JSON.
But, I do want to avoid a String[] in my web method's arguments... so I'd rather keep it a string.
thus, either stringified JSON or just the string of the array works for me. Either way I cannot seem to parse it.
 
 
1 hour later…
6:58 AM
I am integrating tally with my c# application, i have created sales order in tally. now i want to retrive that details from tally, so will you please help me out.
i want sql select query for fetching sales order details
 
 
1 hour later…
8:06 AM
Hi guyes !
hows everyone ?
Guys i wanted your help with some review on which loggers to use for a mono related application...

According to my search i find NLog good but just perplexed with one thing i.e. how do i handle stuff on crash with NLog , Could i or Could i not ? and besides that is there any other way i could know about the crashing situations on a machine ...
I am developing a desktop app, so in that case it gets difficult to know the situations where in crash is occuring and its necessary to know the same ...
 
Anybody had a problem in WPF where the window doesn't refresh?
 
8:36 AM
Hello everyone
 
9:19 AM
@Sippy no but you know
 
 
1 hour later…
10:35 AM
Hi guys. Is it ok to post an answer like this. What do you thing.
0
A: Singular, all-encompassing UnitOfWork vs. mutliple, smaller UnitOfWork abstractions?

gurunThe true architect answer would be "it depends". I will provide you with my own way of thinking about these things in the cases when code turns to abstract to think about. It will be a non-typical SO answer for sure. Let's see how many down votes I get. Try to think of this as people, and group...

 
11:05 AM
@gurun Both the question and answer are mostly opinion based.
 
Yeah, I agree. And I find it difficult when people ask questions about "best practice" or ask for advice on very broad concepts.
I find it difficult because it is still interesting questions, but they probably belong at programmers, not SO. Right?
I'm learning too. But I come to realize that the difference is somewhere along the lines of "how do I do it" and "why do I do it". And some "why questions" are phrased as "how". And that turns into borderline questions/answers.
 
@gurun Not sure, to be honest. Programmers would make a better match, since it's more around that particular topic, but every approach has advantages and disadvantages. To accept one answer as 'Correct' gives the wrong idea for a lot of other use cases, requirements, etc. I don't think it's a question that can be answered in a Q&A setting.
 
Reg. Q&A setting. I tried to cover more or less every theoretical possibility and give the parameters for a function that decided when to apply which strategy. But it doesn't work as the possibilities are basically endless.
 
ello ello
 
Yeah, exactly. I personally don't even consider that architecture, because, lazy.
 
11:20 AM
@OMGtechy yo yo
 
I want a yo yo now dammit.
 
@ohmygodtechy we will only say this once. Listen carefully!
 
Whaa?
 
I edited my answer to explicitly state that it is an opinion where the opinion is...
..and I flagged it for moderator review.
..and earned a new badge: community fascist patrol badge.
@omgtechy you obviously haven't seen that TV series :-)
 
I have absolutely no idea what you're even on about ha
 
11:50 AM
where is everyone tyoday
 
At work. Unfortunately. No vacation yet :P
 
My vacations in a week 8D
 
Same!
Well, maybe earlier, need to discuss that tomorrow :P
 
Watcha doing? :3
just chilling at home or actually going on holiday?
 
@Shaun I have about ~20 anime series to catch up on :3
Close the door, close the curtains, pump up the volume, and enjoy non-stop.
 
11:58 AM
HAMMERTIME!
 
Remember to eat once in a while.
@Shaun you going? :P
 

« first day (1437 days earlier)      last day (3516 days later) »