« first day (2895 days earlier)      last day (2279 days later) » 

12:00
Sep 3 at 12:45, by Avner Shahar-Kashtan
MSDN is a terrible learning resource. There's nothing in it to tell you that, for instance, HttpClient is a safe, async-friendly and easy to use HTTP library and that you shouldn't use WebClient or HttpWebRequest. They aren't officially deprecated, but they're really not the tools of choice. Likewise with direct socket access, or goddamn ArrayLists.
Can someone show me a way to download something with HttpClient that is as simple as with WebClient where I just go .DownloadString(uri)?
throw new StackOverflowException();
@Squirrelkiller: using (HttpClient client = new HttpClient())
{
using (HttpResponseMessage response = client.GetAsync("http://some.domain/foo").Result)
{
using (HttpContent content = response.Content)
{
var contentString = content.ReadAsStringAsync().Result;
}
}
}
Stolen from stack overflow
I need a reality check. Who knows Winnetou and Old Shatterhand?
Eh.. at least use await when you're using async.
12:16
use ALL THE BRACKETS!
Use await when you want to run other stuff while the request is in flight, not just because async.
@Squirrelkiller I know winnetou
@HollyStyles It is unsafe. It was just an example.
But even with unsafe, it isn't possible to do
The fixed buffer syntax only accepts basic types.
ohai William
Hey Wietlol
12:19
how is Blizzard doin?
Good good
Just spent a month in China, working with our Chinese office and NetEase.
how are you doin?
Also good :D
It's nice to be back :P I hate living out of a hotel.
I hate living
but I guess that wasnt a surprise any more
That got dark
12:23
just the regular
im sad, I have to find a way to make libraries work with excel
because no library I have found so far comes close to it
currently trying to fix the issues in EPPlus
My work with Excel was using the interop API and then just running a hidden Excel instance.
which at least finishes tests
Not really great since it requires Excel on the machine running the code.
12:24
yea... we cant use interop
no Excel
I remember trying so many libraries, both paid and free
And it was like, all of them just had something wrong with it.
that is our problem now
Thanks for the example @Holly.
Would a very simple wrapper look like [this](https://gist.github.com/Regenhardt/05f0227199bf435d3fe0c704062749cc)?
I'm doing a bit of C# for once.
It's nice ... I've missed it.
*fuck half assed markdown implementations
12:32
@WilliamMariager what did you use before?
Considering I work on WC3, it's all C++.
Right now I'm just making C# examples for the observer API.
observer pattern?
Nah, we've made an actual API, for streamers/casters
So they can read out info about the game for custom overlays.
12:34
I suppose that can be done through something like http requests
We're using a memory mapped file.
you are using a... wait... WHAT?!
oh wait, people can have desktop applications run while they are playing games and those applications can read stuff from what the game is doing?
Yes
That's how it works :P It reads it from the game that's running.
You join as an observer, the API goes into action.
and communication is done via a file?
A memory mapped file yeah
It's 99% readonly
You can only write a single field, which is the refresh rate.
12:36
Wait what
I think I'm misunderstanding
im not sure if I would use a file for that
@LeeButler no, you are Lee Butler
Because if I'm reading correctly this is a terribad idea
Memory mapped file*
They're not normal files in case you think that
What are you reading from the games?
With memory mapped files, you get a chunk of shared memory that all processes can access using an identifier.
12:38
@WilliamMariager I know... but still
Wouldn't the API Interface programmatically with the application
I think there are better approaches
IE not a file
@RoelvanUden Player resources, units, items, etc.
one that doesnt need low level stuff or a library at all
12:39
I'd love to hear what that might be :P
how many applications are allowed to be an observer?
hmm...
@WilliamMariager Oh, that's interesting. And you somehow convinced the game to use the memory mapped file so you can just access it without jumping through hoops like ReadProcessMemory?
!!hmmm
12:41
@RoelvanUden I made the game, so I just made it a part of the game itself.
!!learn hmmm <>http://i.imgur.com/ZU014ft.gif
@LeeButler Command hmmm learned
Ahhh, I see. Too bad. I was hoping for a generic way to access game memory without jumping through kernel restrictions ;-D
So why not make a proper API for it then?
What makes this, not a proper API?
Update: What do you guys think about this simple wrapper?
wtf Frendall
is better
This is a proper API, and I must say, it's quite elegant. The game doesn't need to inform observers about every single change, and is not in any way bound to issues occurring with transfer from/to observers (e.g. queuing of changes over a slow socket and whatnot). The observers maintain their own responsibility to read data and are not dependent on other process, and don't need to clone information. I can only see observers going bonkers if they need to iterate over a changing set of entities.
That'd be awesome if it didn't end so abruptly
so would sex
12:48
HAH
@RoelvanUden Yeah exactly. The game isn't tied to anything. It basically just writes this information and then anyone is free to read it however they want. It follows a known struct layout, so you can just read it as a pointer to a struct to get all information.
Would copy-pasting MS sample of a specific question and linking to MS link be considered rude? Just saw a dude manually doing a RSA signing and there are actual BCL functions to do so.
Adapt the sample for his use case and then link the source
do you mean msdn?
what's an "ms sample"?
A hand of someone with multiple sklerosis
@WilliamMariager Yeah.. but that's a problem. If your game changes the layout of the linked list / array / list / whatever multi-entity structure you use, the observer is NOT GUARANTEED that the list doesn't change while it's reading.
We only use fixed size arrays
Thus, it could read a pointer, read a struct, read the next pointer from the struct (because it's a linked list) but the struct was cleared and now it's reading into unknown memory.
With an accompanying variable that tells you how many items is in the list.
Similar there, you can clear stuff the observer is still expecting.
13:01
also, non-.NET applications can use this memory shared file?
It's basic windows api @Wietlol
If there is no way to guarantee non-changes for an observer, bad shit can happen.
oh, copy pasting to stackoverflow? as an answer you mean?
well, that explains everything
@RoelvanUden In worst case, you'll be reading stale data, that you'll be refreshing within the next window.
The refresh rate is specified
There will never be bad pointers or similar
13:02
isnt there an easy way to send an application an array of bytes?
Yes, memory mapped files ...
just a byte array
no polling either
A memory mapped file is a byte array.
Also, polling is a must
Our game isn't going to attempt to know about all potential consumers
13:03
Observer: Read array length for players.
Observer: Read player at index 0.
Game: Delete player at index 0. Remaining players shift.
Observer: Read player at index 1.
Ta-da, you now read one player too much and one that's supposed to be read is never read (1 that goes to 0)
I would use something like protobuf models
That's the biggest issue in this design.
because well, you are not bound to a specific language
Like I said, at worst, that's stale data.
Which will be refreshed 200 ms later.
Memory mapped files isn't bound to a specific language either.
It's a core Windows features like WinSock ...
William, that issue I described is very real and you should be worried about it. :-(
13:06
What's bad about it?
Reading corrupt data is always bad o_O
Like I said, it's stale data, and you'll have it fixed in the next 200 ms window.
It's not corrupt
It's stale.
There's a difference.
Corrupt data can lead to crashes.
Stale data can lead to the gold display being a different value for 1/5 of a second.
Alright. I sure hope you know what you're doing :-)
I had to deal with a lot of these staleness issues back in the day.
We could introduce an "is_writing" member?
Game sets it to true when it is updating, sets it to false when it's done.
It's not perfect, but should reduce the chance of stale data greatly.
if(game.is_writing) sleep(1)
You'll be synced up with the game shortly.
> an assembly with the same simple name has already been imported
How can I find out, where that error occurs?
File: CSC
13:12
It's a bit of a hack. A 'next-update' timestamp might be better in that case, you can judge when to get a snapshot and how long you'll need to complete.
Still, both are a bit hacky
Indeed
The thing is, it has to be super light weight.
We don't want to make a big complicated system.
It should be simple to produce and simple to consume.
Then people that are consuming it can do what they want.
Someone made it write to a json file, so OBS could use it for overlay.
A JSON dump would work, too. :-P
Same issue though, you could be reading the file while it's being written :P
How about this:
Game writes new file -> games updates pointer to file
You could make the JSON structure append a new line.
13:18
No issues. Bad timing just means the data is one tick behind.
Then each new line is a new game state. After X size you can just rotate the file
That's how it is now thought @Squirrelkiller
Without adding an entire file IO overhead to all actions :P
That introduces the race conditions I talked about earlier. But, actually, @Squirrelkiller's idea has some merit. If your memory mapped file does indeed contain just a "thisfile.json" name, the file is read by an observer safely and without problems. A new tate just changes the pointer to "thatnewfile.json" which is then read, etc.
mr5
mr5
Guys
Serious question
Why do couples getting look a like with each other
Yes, let the random internet boys and girls (and dogs) answer this serious question in utmost earnest.
What
mr5
mr5
13:24
I'm observing this quite a lot now
@mr5 getting look a like?
I have no idea what you are asking
@Squirrelkiller you ion XING brah?
mr5
mr5
@Neil yeah. The longer they stay together, the more look alike they get
Because they have similar taste in general, which is part of hte reason they are couples?
mr5
mr5
13:25
I mean their faces
@Squirrel I didnt quite get teh verb there
brb rebooting because reasons
@mr5 well I can't help but noticing similarities between owners and their pets
can you point out a famous couple where they look like each other?
@mr5 They might just both be getting fat from eating awesome food together?
@Squirrelkiller got*
13:26
but I think that's just the mind's willingness to force patterns from things
mr5
mr5
You disappoint me with ur answers. Gonna ask Google
now I'm offended. People come here to ask questions so they don't have to go through the trouble of google!
mr5
mr5
@RoelvanUden I can't relate with the food part
@Neil yeah. You guys should improve answering questions seriously!
@Squirrel I do indeed, as your notification probably told you already.
you mean your notification?
I've added you first brah#
13:29
What's the airspeed velocity of an unladen swallow?
Yup, but my notification can ahrdly tell you that I got xing, since it's inside my phone!
I want answers people! Chop chop!
@Neil yes.
It can!
If you are next to me that is.
Anyways, check schwatziapp
👌
mr5
mr5
13:33
@Neil 42
It's always 42
mr5
mr5
Behold the truth about my question: "Why do couples look alike(sorry for bad english)"
> A little-spoken-about fact of dating is that we tend to select romantic partners who are similar to us in some way (or many ways). The technical term is 'assortative mating', which basically means we pick partners who might share similar facial features, characteristics, skills, talents, etc.
> The longer you're with someone, the more of your life you share - that goes without saying. So you'll probably smile at the same funny family moments and cry or frown when things go wrong, and these facial expressions can lead to your faces ageing in similar ways.
Bah, science.
pseudoscience
Scoff
maybe genes you make you select mates who share those genes are better at reproducing
mr5
mr5
13:38
And for the "psychological" answer:
> Most people are very fearful of people that don't look like them. It's taught to them from birth. Babies and children do not know the difference. The majority of us come here pure and innocent. Parents and the people around them teach them that kind of fear.
but then where's the incest gene
Look at your family history to find it @KendallFrey
Are you being jelly @mr5?
mr5
mr5
Lol
@RoelvanUden no u
Why would I be jelly? I'm human as far as I know
13:41
I read that they actually did find a direct link between the gene which causes red hair and the sensibility to sunlight
I don't think it's the same gene, but they for whatever scientific reason, is always paired with another gene which causes the other
I also read that the index and the 3rd finger over in men are rarely the same length
but in women, they are usually the same length
mr5
mr5
Which means?
nothing
just weird
mr5
mr5
Come on Neil, we want another fun fact about that middle finger
13:44
there's nothing particularly fun about the middle finger
Who else just looked at their hand?
mr5
mr5
Fun fact: raising just your middle finger means a salute
Not me
mr5
mr5
My middle and second to the last finger are almost the same length
All of my fingers are less than a foot long
13:46
@mr5 then it's true that your first and third fingers aren't the same length
mr5
mr5
@Neil which first is it?
I looked it up
It actually indicates a higher amount of testosterone in the uterus during development
so men would naturally have shorter index fingers since it's normal to have higher levels of testosterone
mine are the same length
to within a measurement error
well I doubt if it's a foregone conclusion
The digit ratio is the ratio of the lengths of different digits or fingers typically measured from the midpoint of bottom crease (where the finger joins the hand) to the tip of the finger. It has been suggested by some scientists that the ratio of two digits in particular, the 2nd (index finger) and 4th (ring finger), is affected by exposure to androgens, e.g., testosterone while in the uterus and that this 2D:4D ratio can be considered a crude measure for prenatal androgen exposure, with lower 2D:4D ratios pointing to higher prenatal androgen exposure. There are also studies that suggest that...
mr5
mr5
@LeeButler what do you think about this UI photos.app.goo.gl/cURddLSEBTWhbT6r9
13:51
Uhoh
I've downloaded Office 2019
Now you've gone and done it
It's not even released yet
mr5
mr5
Chrome in Android looks pretty good. The status bar color now matches the search bar color
The status bar color has matched the Chrome UI colour for literally years
mr5
mr5
No. It's just recently
13:54
I think since Jellybean
mr5
mr5
Afaik, there was a separator before
There's a huge list of traits associated with high/low digit ratios
mr5
mr5
Now the status bar seems like it's part of the app
@Neil which means?
I wouldn't want it to be seamless
@mr5 check out the table at the bottom of that wiki article
13:56
Hi all I have a question re HttpClient
cOrRElATion != cAUsaTiON
A website has blocked my IP address so I was wondering how I can spoof my IP address when sending Post Request using HttpClient
without using Proxy
Apparently I have an increased rate of schizophrenia, increased rate of anxiety, and reduced performance in sports
You can't spoof IPs
that's me all right
13:57
I came across this:
0
Q: How to use HttpClient to send a Request from a specific IP address? C#

metaseI have multiple IPs on the server and would like to chose which one of those I want to use when using HttpClient class to get/post data from an API. (or to even send requests at the same time but utilise the 2 IPs and not just one) I have seen some examples using HttpWebRequest (here) that utili...

but I don't see the part the IP address is specified in it.
To make it "come from another IP" you need to actually send it form another IP
so the only solution is Proxy right?
Yeah. Or getting your IP unblocked
mr5
mr5
Or modifying the http client so you could hardcode the IP
@mr5 could you please elaborate?
13:59
I think he want's to send from an IP that he doesn't have
mr5
mr5
@AmirNo-Family afaik, IP is just a header in a httprequest. Not entirely sure about this
@AmirNo-Family can you make a request using postman or curl?
I tried making a request using postman/curl but I need to somehow specify my IP address other than what it is at the moment or I will get a message that my quota for this month is finished!
No proxy
You need to ask for more quota, that's all you can do
the computer decides what nic/ip use base on destination IP
its a routing use
14:06
Or actually send the request from another IP
"I have multiple IPs on the server" so its just a routing tables issue
@bradbury9 You can actually specify which network adapter to send requests from.
mr5
mr5
@Neil for some reason, the link is not recognized in mobile so chat
@mr5 ok, it doesn't have to be recognized as a link
just search digit ratio on wikipedia if you're interested
SO Mobile chat has oneboxes doesn't it?
14:15
cya gzys I g2g fast
bb
!!welcome-c#
0 Welcome to the C# chat! Please review the room guidelines and tips. If you have a question, just post it, and if anyone's free and interested they'll help.
Info on oneboxing there
Time to go home, bye bye sharperinos, C# you tomorrow!
both squirrels are leaving :(
and so I too must depart
farewell all!
14:42
we have a working library!!!
we made a fork of EpPlus and fixed its issues
we also broke like.... 85% of the unit tests, but whatever
Who needs testing when you have something that looks like it works
it actually works
but I do have to say that those unit tests are rubbish
[TestMethod]
public void Stylebug()
{
    ExcelPackage p = new ExcelPackage(new FileInfo(@"c:\temp\FullProjecte.xlsx"));

    var ws = p.Workbook.Worksheets.First();
    ws.Cells[12, 1].Value = 0;
    ws.Cells[12, 2].Value = new DateTime(2010, 9, 14);
> new FileInfo(@"c:\temp\FullProjecte.xlsx")
you f****** tard
you can lick your shittests
That test did remind me of a coworker...
15:09
why is he creating/reading a file as part of a test?
what exactly is he testing?
the file system?
how about DateTime.UtcNow == DateTime.UtcNow?
what
that definitely does not guarantee to be true
i know
at the very least, our tests seem to be passing
so I think that all those features I removed werent necessary at all
15:51
a
16:03
sup all
How can one specify an arbitrarily-shaped GraphicsPath Region, as opposed to a rectangle, ellipse, etc.? Say I have a rectangular Form2 on top of Form1 (i.imgur.com/stZr9P4.png) and want to reshape Form2 to remove the gray areas covering the Form1 controls.
16:18
I'm not sure you can. What you could do though is use the TransparencyKey property on Form2, set it o Magenta or something, set the Form2 background also to Magenta and the background will be gone
Winforms is really awkward to do things like that because it relies entirely on Windows APIs. You could try drawing it with GDI and the System.Drawing namespace, but it's painful
My understanding is that your first solution will not allow the user to click the controls on Form1.
Since they are underneath an invisible section of Form2.
No you can click through transparencykey
Ohhh, that makes life so much easier.
I'm fairly sure. I know you can't click through a form with 0 opacity though
I guess I didn't even try and just assumed it wouldn't work, thanks.
16:21
I could be wrong, post results
Why are you doing 2 seperate forms anyway?
Workaround for producing semi-transparent controls that don't work with the Opacity property.
Yup, worked smoothly :)
You should try WPF, it's a steep learning curve using XAML, but it's awesome for laying things out with virtually no restriction. And it is handy for future as XAML is fairly similar to other layour methods in other frameworks
Visual Studio and the Mcdonalds Self Service kiosks are 2 very different examples of WPF based UIs
I have enough learning curve difficulty with the basic-intermediate level material lol
16:40
 
1 hour later…
17:53
Does anyone know if it's possible to deserialize an XElement into a Typed DataTable? My attempts just give me an empty table.
18:48
anyone: is there a built in class that will turn a "deserialize" a dictionary into an object, where the keys are property names, and the values it will attempt to cast into their types?
I can roll my own but it would be nice if I could save myself the trouble
@whatsisname I bet you could do it by serializing to JSON as an intermediate step
19:09
hmm perhaps
I'll have to try that, though everything is in strings so I'll have to see if they resolve to ints/doubles etc properly
ohh that's a whole other problem
"everything in strings" because this is being parsed from a yaml stream
the serialized and deserialize as silly as it is, is probably the best option
19:26
Does anyone know why Dataset ignores the XmlRoot attribute when using WriteXml?
 
1 hour later…
20:46
@whatsisname yea, serializationg should be pretty dumb, no attempts to cast some strings to datetimes for example
a csv parser should just give you strings, nothing else
a json parser should give you json values
etc
you could use more detailed serialization formats though, like protobuf for example, where you are serializing a very specific set of properties all with a very specific type
also, you could make a serializer attempt to map data to a model that you have, but I always want to ensure that that serializer uses the right approaches at things
for example, json to MyModel, is a datetime in json stored in ISO 8601? etc
20:59
Hello, I am new to c# and am trying to figure out how to properly extract data from a .txt File and save this to an array. I have gone through a few websites, questions on StackOverflow and am still quite lost. My list in the .txt file is set up in a manner of for example Kasey Smith, 123456, 12.34, 12.34. The list will eventually be organized which I feel comfortable figuring out but atm my main concern is extracting this data and placing it into an Array, not an ArrayList. Any suggestions?
@Wietlol: it's not that grim, json.net will easily cast back and forth for example
YamlDotNet isn't quite as sophisticated though which is what i'm using
yes, but I specifically only want it to work for ISO 8601 formatted datetime values
since in JSON, they have to be strings
@Twissted why the specific choice for an array?
also, take baby steps, first put it in a string, then try to split the string into an array of strings
hey friends....in e commerce web application, how does "notification" table stay updated? is there any scheduled-query fired everyday every time that fetches today's delivery-orders and stores into "notification" table?
also, dont use ArrayList, the C# ArrayList is old and doesnt work with new features and such, always use List instead
21:44
@Wietlol Because it's for an assignment for school. Which is sad but true. I just need a kickstart on how to properly take in this information from my .txt file and put it into an array. It's a basic assignment that works around ordering these lines of text based on name, number, pay, hours, etc. But in order to begin learning to order I need to figure out how to extract and put into an array.
> also, take baby steps, first put it in a string, then try to split the string into an array of strings
If I could remember what the website was to write code out in I could show you guys my failed attempts
I think that should be enough information
splitting things up in separate actions allows you to isolate the source of your issue and allows you to search for answers on the internet more easily
Fair enough
paste.ofcode.org is a website where you can share code
21:46
I have attempted splitting before and it sort of worked
paste.ofcode.org/LSqefaUbJRxhShweTzPdp5 So this will split up the data and actually for some reason outputs the persons name after Ray, which makes no sense to me.
I'm basically trying to figure something out based off of this in order to create the array of each line. I figure it can't be too complex it's just my instructor hasn't been doing code with us. He's been going over concepts we already learned about in Java
well... can you explain what this piece of code does?
per line
Okay so While line does does not equal null. A string array initialized with variable name employee is equal to the "line" variable split by a , .... line is equal to streamreader of .txt file therefore reading the next line of content. If the employee array at position 0 is equivalent to "Ray" write out the variable line.
okay, think about this line again:
String[] employee = line.Split(',');
what would be the value of employee after this line finishes execution?
Well initially I would assume that it's going to be my first line of the .txt file up until the first comma
I'm guessing i'm wrong
not entirely, it would be the first line of your file

« first day (2895 days earlier)      last day (2279 days later) »