« first day (1565 days earlier)      last day (3381 days later) » 

12:00 AM
@BradleyDotNET are you around by any chance Brad?
I have a quick question on Async n Await
 
12:19 AM
@Mehrad Yep, I'm here
Though Reed's more of an expert than me :)
 
Reed as a user?
Thanks for coming over though. It's not a complicated situation
I have written my code on .NET 4.0 and later on bumped it up to 4.5 to be able to use async and await
although the code in mature and fairly big.
and as the rule of thump if I use Async/await I should go all the way down into all the sub methods until I hit a .NET command that is awaitable
am I making sense so far?
 
maybe
 
cuz I might be wrong
 
your rule of thumb seems like it could be a bit off
If you use await/async you should await something
that could easily be your own function that is async and returns a Task
No real need to hit a .NET async function
 
but my own function with async should have a await in it so it's kind of contagious and doesn't stop. not until I hit the end :D
but I think you basically said it better than I did. I couldn't put it into words that good
However the last method that needs async has this chunk in it
                            var select = "SELECT * FROM [" + sheet + "]";
                            OleDbCommand cmd = new OleDbCommand(@select, conn);
                            cmd.CommandType = CommandType.Text;
                            DataTable outputTable = new DataTable(sheet);
                            output.Tables.Add(outputTable);
                            new OleDbDataAdapter(cmd).Fill(outputTable);
which the main action is done in the Fill() which isn't awaitable
is it a right thing to do if I go something like
task.Run(()=> { and put the fill here});
 
12:27 AM
Assuming you are awaiting that, sure
 
Yes...
 
Seems like a reasonable way to make that async
@ReedCopsey Any input on that?
 
and this is just an idea. I need to turn probably 5 methods inside each other to return and async Task. Does it break any rules if I stop in level 3 deep, say, and put the 3rd level method in a Task.Run() rather than going all the way in?
 
I can't think of any problems off the top of my head
 
Okay. sounds reasonable. Hopefully @ReedCopsey would comment on it as well for me :D
Cuz at start I only have a method to turn to async but inside that I have 5 methods and inside each 3,4 and so on and it means I should turn probably 30 methods to Async over all :D
So I though I might be doing something worg
@BradleyDotNET I really appreciate your time though.
 
12:34 AM
in general, you should typically avoid Task.Run
 
thanks for listening to my long quick question. didn't think it's gonna be this long
 
but there are times it makes sense
is there a reason this method has to be async?
because it's basically a sync operation
 
@ReedCopsey, mainly because it takes a fair bit of time and makes the UI irresponsive (wpf)
 
well, normally, instead of awaiting a method, and using Task.Run in it
 
So I though I'll go with Async and also hook up some progress bar to it
 
12:36 AM
I try to "push up" the Task.Run to the caller
ie: instead of wrapping the Fill method here, I'd just leave hte method sync, and have the caller Task.Run it
etc
 
@ReedCopsey Is there a reason for that besides the semantic?
 
Stephen Toub and Lucian Wischik have a few talks where they go into the why
but what you're doing here is basically, in their terms, "async over sync"
there's a blog post from teh team about it ;)
 
@ReedCopsey Sorry Reed, I didn't get the last section after comma. would be expand on that, please
 
so, your "last method" that you showed, above
if that method is synchronous - just leave it synchronous
instead of making it async and adding a Task.Run around the fill line
leave it alone, and Task.Run the entire call to the method
 
I understand.
That's exactly what I meant when I said, how about if I stop in the 3rd level deep out of 5 methods inside each other and make the put the whole 3rd inside Task.Run().
It's interesting that I get some ideas in my head which accidentally can be good practices :D
@BradleyDotNET, @ReedCopsey can't thank you both enough for expanding on this issue and explaining it to me. Cheers
I was very hesitant on which way to go
 
12:43 AM
@ReedCopsey If I'm understanding that article correctly (and it was excellent) they are saying don't expose something that just does a Task.Run (which you also suggested)
 
in general, only keep things async when they're doing actual async IO, (except at the "top level" in a UI app, where sometimes you Task.Run for responsiveness)
 
But using Task.Run to offload stuff is ok
 
@BradleyDotNET Yes - but that typically will be "high up" the chain, and only in UI scenarios where you have thread affinity issues
 
Sure, that makes sense
 
but the big issue is not to do it in libraries
because if you ever end up using it in another scenario (like a server), it does bad things ;)
 
12:45 AM
interesting
 
@BradleyDotNET That article has a sister article about why not to do sync over async, too, btw ;) also worth reading
 
I'm sure the apparent contradiction would be solved by reading it :)
Happen to have a link for that one?
 
and I assume Async over async is what I am doing in this case, right? @ReedCopsey
 
This would be async over sync
(Task.Run or Task.Factory.StartNew is making an async wrapper over synchronous calls)
 
Does that article also recommend alternatives for scenarios such as mine?
 
12:48 AM
well, in your case, you're offloading work for UI purposes, which is says is one reason to do it
it just makes it clear why to think twice before doing it, and where to place it in the call stack
read it - it's pretty short :)
 
Is this article you're talking about is a different one than the one you posted it's link @ReedCopsey?
since you said it's his sister article so I assume it should be another
Cuz I already started to read the one you shared and it's quite interesting
 
-4
Q: Publish a c# aplication

רות סלמוןI wrote a c# application with notification. I tried to publish it but when I opened the published file it failed. Thank you for answer!

 
1:10 AM
Nice. :D I almost thought it's the same article. @ReedCopsey
thanks
@BradleyDotNET, you wanted the link as well
 
Yeah, I saw it, thanks
That article scared the *** out of me
Now I'm terrified to use await :)
 
1:25 AM
Hey, if i would like to start with some kind of Design Pattern(to get a good architectural style), which would be the best way to start? Should i take a look at Design Patterns or is it architectural pattern? Which are the most common and most used patterns?
If someone has a good book he would recommend or a good website - Thanks in advance.
Btw: is there a difference or are architectural patterns and Design patterns the same?
 
@BradleyDotNET await is a mixed bag
and with that, I'm out ;)
 
@Proton The canonical book of Design patterns is the gang of four book
Architectural patterns are not the same
The apply on a "grander" scale
design patterns solve common programming problems in a consistent way
Super common patterns: Strategy, Factory, Command
With design patterns its more about learning where they apply
Then you come across some problem and can say "I know a pattern that solves that!"
As with all programming, you really learn by doing it not just reading a book
And I would certainly master good design before trying to master good system architecture
You cant have good architecture without good design
And with that, I'm out for a few hours
@Proton Feel free to ping me if you have more questions.
 
2:13 AM
Somebody also recommended this book to me the other day. Haven't gone too far in it but can be userful
 
 
3 hours later…
5:00 AM
 
 
2 hours later…
6:41 AM
morning all
 
7:10 AM
morning
 
M J
8:08 AM
hi
 
Morning
I just reinstalled Windows and have downloaded my Git repository
When I committed before the reinstall it worked fine. However now when I run the app I get a JSON error in the output reading:

A first chance exception of type 'Newtonsoft.Json.JsonReaderException' occurred in Newtonsoft.Json.DLL
I haven't changed any code at all. What could this be? I have just installed JSON.net again after reinstalling VS
 
Could it be that the settings of VS changed?
@James A "First change exception" means there's a possibility for an exception, not that an exception occurred
And you can set that warning on or off in Visual Studio
 
@BenjaminDiele Thanks. Well it is definitely causing issues because when I load my app, where some data should be displayed (and was before reinstall) I get the following error:
Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: <.Path",line 0, position 0.'
 
"Oh, I have 30 minutes to do some work from home. Let's do this!". Turns out the work VPN is down; wonderful. Well I'll just read the code articles I had pending then..
 
@James Sure the json isn't changed?
 
8:14 AM
I'm guessing a VS setting change is more likely, but I'm not sure where to look.
Nothing at all, I literally downloaded my repository and then opened it in VS.
I've even re-downloaded it to make sure.
 
@James you're supplying the json yourself?
 
Yes, I'm querying my web service which is returning JSON which I'm then taking and formatting into an ObservableCollection
 
and nothing changed on the service side? Or does that belong in the same git repo?
 
Let just do some more debugging and see if anything obvious comes up, I was just suprised that it was working and now it isnt!
 
@RoelvanUden VPN software is awesome. Especially when each customer has its own vpn software, and some don't allow internet access once you're on the network
 
8:18 AM
That's it.
I realise what I've done, and it's really stupid!
 
Let me bring out my paddle
 
I am developing locally at the moment using a local MySQL database set up through XAMPP
I forgot to backup my database before I wiped the PC :-s
It only had test data but now I need to create it again with matching schema, grrr
 
that's a great realization, after you formatted the computer :D
 
Actually, I made a backup of the XAMPP folder so it should be in there right? You have any idea where it stores the database?
 
Don't know it out of my head (on top of my head?)
 
8:20 AM
Ok, I'll do some googling - thanks for pointing me in the right direction though!
 
grrrr, why losing values on postback
Microsoft can't really fix such small issues with ddl
Windows 10 the next chapter - all Crap
 
Such negativity.
 
I'm quite liking the new preview (from a user POV)...
 
@RoelvanUden today am feeling like questioning everything around me
 
M J
Attempted to read or write protected memory
error is coming again nad again
anybody else can help me
 
8:35 AM
@James Windows 10 preview?
 
Why the hell does Chrome need 11 background processes for 5 tabs?
Such a hog of a browser, really winds me up!
 
I'm using Vivaldi as a main browser for the moment
 
@BenjaminDiele Yeah, the new build they released last week. It's not super special, but a worthwhile improvement.
Not heard of that, what's different about it?
 
@James You never know how good a OS is really until you spend 2-3 years using it
 
@James from the original dudes of Opera
 
8:37 AM
You liking it so far?
 
ye
but it's a browser. I mean, how different can it get. It shows webpages, it has tabs, it has a search bar.
 
Haha, true. I guess dev tools make a bit of differance if your doing front end?
I also quite like what is being 'suggested' by MS for their new Spartan browser in terms of getting rid of search for common things like Restaurants, directions etc
 
Pff, I think browsers are doing waaay too much these days. I just want something that does websites, tabs, sound per tab, and process isolation. No user tracking, no GB of memory, no cpu hog.
 
I agree. But I think most people see it as going the other weay - that you'll basically use the browser for almost everything.
 
I hate it
"hey, let's use javascript for everything!"
 
8:44 AM
Haha, I think most of it comes down to user experience though - people want to know as few things as possible to use their devices.
 
and then you have bleeding edge demos of some 3D stuff in javascript, running only on chrome, needing an i7 and 16GB of ram. To show the same stuff we did 20 - 30 years ago.
 
Stick it all in a browser and they can work it out.
 
but you still promote it? :D
 
@scheien It's a decent browser, Vivaldi. But it's still a tech preview.
 
Indeed
I found a bug though
or, it revealed itself
 
8:45 AM
You couldn't close your porn windows?
 
wow, good guess!
 
@BenjaminDiele I kind of feel similar about apps though. I hate the fat that everything is an app. I get the benefits of something have a dedicated job but I hate needing 50 different programs to do stuff
@BenjaminDiele Haha
 
Full screen slider thingy. Then Vivaldi said, "showing fullscreen etc, hit f11 to close". I tried it, and then the message didnt disappear
Kind of annyoning when browsing other sites :p
 
I'm not going to try it now :D
@James Yeah, that's annoying too. Ideally an app should do basic stuff, and allow plugins for more functionality
 
Reopened the browser, and can't replicate, so I guess it was just passing by
:p
 
8:49 AM
Also, i decided to quit with inheritance and relations on inherited tables, so I changed my relation from 1 - 0..1 to 1 - *. And now EF decides that I can only insert 1 related item per item.
I just love it when software decides to work with me
 
would adding my controls to update panel will keep values they loose on postback ?
@Steve did you purchase this domain name ? csharpchat.com
 
@BenjaminDiele: Couldn't you have a property(column) that specify the type (Gas,Electric,Water etc) and then in the Premise you could have fields like GasMeter,WaterMeter,ElectricMeter with foreign keys? Or even a list with all the meters that exist for the given Premise
 
Well, that's how it works in the tables. EF generates a Discriminator column in my Meter table.
And that seems to work, but as soon as I make another Meter for the same premise, EF starts complaining about conflicting primary keys :D
 
:(
 
Oh well, it's a challenge, right?
 
9:02 AM
It can be
Are you using table per type or hierarchy?
 
Defaults, I don't know where to change that :D
 
hello
Is there any difference between Response.Redirect("./Home.aspx"); OR Response.Redirect("~/Home.aspx"); OR Response.Redirect("../Home.aspx");
 
@CodingDefined yes
 
@CustomizedName Can you please explain?
 
The first is Home.aspx in same directory
the second one is relative to path
the third is home.aspx one level up
 
9:12 AM
@scheien Thanks a lot
 
Np
 
 
1 hour later…
10:20 AM
I had an issue yesterday. When I try it now, it is a different issue. Self mutating code!
 
@RoelvanUden So you're making SkyNet?
 
It doesn't appear that way. If that were the case, I'm sure I'd have been assassinated as a child from agents from the future.
 
Perhaps you're the first zombie
or your code has something like if(date == Monday) { bug1(); }
 
11:14 AM
In those cases I usually think: What I observed yesterday was one symptom, today I observed another - now I need to collect data to find the more elusive root cause.
 
F4z
11:59 AM
How does one count all replaced words using regex?
 
How does one answer a very vague question?
 
F4z
@KendallFrey do you have any idea where I can start when it comes to counting all replaced words in a string?
 
You mean counting all matches of a regex?
 
F4z
yes. along those lines
 
counting how many matches there are in a string is a trivial task
 
F4z
12:06 PM
Regex.Matches(TheTextBox.Text, "copy").Count trying to find "copy" in the text which is in TheTextBox however returns 0
 
then "copy" isn't in the text
 
F4z
@KendallFrey i got it solved
it was 'trivial'
 
Good for you! :P
 
12:25 PM
How was the pursuit?
 
UUUAAAUUUGGHGHHRRRRrR
 
1:22 PM
@scheien Vivaldi takes loads of memory though. Around 8 tabs == ~800MB ram. WTF
 
I wouldn't say that it is unusual. Chrome also use a lot of memory
 
For a browser in technical preview with almost no features, I think it's a bit much :D
 
I have 1 chrome process (amongst ~20processes) that use 3GB memory
20 chrome processes that is
 
1:41 PM
Hello guys
i am having one data table
A B
100 200
300 600
800 900
i want to remove the "B" column
dt.Columns.RemoveAt(1)
will remove entire column ? including data ?
 
user1804599
2:37 PM
Is the scope of checked and unchecked lexical or dynamic?
 
@рытфолд Pretty sure it's lexical, let me double check.
 
user1804599
@KendallFrey dat pun
 
checked does not apply to the bodies of methods called in the checked block. Does that answer your question?
 
user1804599
Yes.
 
user1804599
Thank you, Gandalf Ray.
 
2:49 PM
@NETscape Yeah, I'm not sure why so many poor questions have been asked lately. I feel like alot of duplicates occur.
 
@Greg The quality of questions has steadily been decreasing for the past several years.
Probably since the birth of SO
 
user1804599
More publicity means more morons.
 
@KendallFrey Well, it doesn't help that people treat the site like a personal consultant.
@KendallFrey In essence, they don't want to learn but rather someone do it for them.
 
hi ,In aps.net gridivew there 1 Bound Fields Price, one ASP.Net TextBox for quantity of the item and Label control to display the Item Total which is Quantity * Price . totalprice change at run time depend on quanity .i'm doing this job by using Jquery. this work fine for me. but now if i'll click paging of Gridview then return back to first page then my perivious total value in gridview wil be zero... How to handle this issue?
 
@Greg I was helping my dad with that last night
He wanted to sort an array, I didn't want to do it for him
 
user1804599
2:56 PM
@KendallFrey Achievement Get; use a semicolon appropriately
 
Tried to teach him, think I failed
 
@KendallFrey Yeah, I know what you mean. Why do you say that?
 
say what?
 
user1804599
Here's a function that sorts an array:
 
user1804599
int[] Sort(int[] xs) {
    return xs;
}
 
user1804599
2:58 PM
There are 4294967297 arrays for which this function works correctly!
 
@KendallFrey truer words have never been spoken
 
user1804599
Words are either true or false, so that's true.
 
Hello, i dont really know id this is the right place to ask.. Im making n app in phonegap with html css and ja and i have an windows app written in c#. I want to issue commands to the c# application by using the local network but i dont really have an idea how to realise this can someone help me find a way? Thanks
Do i need some kind of remote method inv?
 
@рытфолд This statement is false.
 
words are words
 
user1804599
3:04 PM
@HuubS Use an RPC library.
 
@KendallFrey That you didn't help him.
-1
Q: Can I convert my query result to a string using C#

Emeka SkerrittI have a simple LINQ query below. Name is the only column in the database together with ID as the primary key. var query = from b in db.Database where b.Name == "Paul_O'brien" select b; Is there a way of converting 'Paul_O'brien' to a string?

I'm so baffled by that question, his answer is a string already.
 
3:26 PM
Greg, i'm changing totalprice in grid view based on Quantity at run time using jquery. but when pageindex change then its will make totalprice zero . .how to solve this issue??Is i have to rebind gridview using jquery ??
 
3:39 PM
Wait, what @Tariq_ASp.net did you randomly ping me?
 
no greg .,i need your help
 
anyone know how FHSS works?
 
@Tariq_ASp.net With what?
@NETscape FHSS?
@Tariq_ASp.net Where is your question on Stack Overflow so I can see your code.
 
using jquery i am changing some row data of gridview . LIke here..
http://www.aspsnippets.com/Articles/Calculate-Running-Total-in-ASPNet-GridView-using-jQuery.aspx
but on pageindexchange i lost my changes value on Gridview,its get value again from database....
i want keep changes value of gridview row even i pageindexchange ... .what is the best way??
 
!!wiki frequency hopping spread spectrum
 
3:48 PM
Frequency-hopping spread spectrum (FHSS) is a method of transmitting radio signals by rapidly switching a carrier among many frequency channels, using a pseudorandom sequence known to both transmitter and receiver. It is used as a multiple access method in the frequency-hopping code division multiple access (FH-CDMA) scheme. == Spread-spectrum == A spread-spectrum transmission offers three main advantages over a fixed-frequency transmission: Spread-spectrum signals are highly resistant to narrowband interference. The process of re-collecting a spread signal spreads out the interfering signal,...
 
@NETscape I'm not familiar with that, but that seems really, really cool!
@Tariq_ASp.net Your pricing on your Grid is bound via the database, so the proper approach would be to utilize CommandArguments to send an Id then update the record in the database. So once it rebinds, the price is properly changed for that record. If you use jQuery, it is Client-Side and will change as soon as the page refreshes because the actual context of the price is being dictated by your db / server.
 
@Greg its a standard for wireless security it seems like, i'm just wonder how devices sync on the same frequency so they can see data come through
unless frequencies are decided after initial link is made
... that would made sense
 
do you mean i have to update table and rebind Gridview onchange texbox of gridview :O ?? . i don't think its good idea. i using Jquery cuz i don't want my page do post back there.
I'm updating table after click on update button in last.
 
Can any one explain what is the difference between a string and a string literal?
 
@NETscape From my understanding of wireless, they have a base frequency. Then within the frequency, they have a spectrum of channels to avoid interference of too many on a single frequency. So in theory, if you can intercept those packets as a mediator device then inject it back to the host router or device you could read those packets.
 
3:58 PM
Why does this word 'literal' get appended and what does it indicate?
 
@Greg its not to avoid interference per se, it was created as a security implementation, so its more of a way to avoid people from intercepting recognizable packets
and yeah, i think i'm right. two device establish a connection, and have the same freq hopping algorithm. when data gets sent, the master/host decides where to start, and since they both have the same algorithm, the slave can receive data transmitted
 
@NETscape I know, your FHSS is to solve the exact thing I described I'm assuming.
 
ohh gotcha
right, you can intercept all packets on the 2.4GHz band, however they will just appear as noise
 
@NETscape Yeah, they'd have to both share the same key. So they can properly communicate, otherwise one may be orphaned. It may work similar to HTTPS
I'd assume, not positive.
 
"key"
 
4:09 PM
@NETscape Horrible, I answer a question with a comment that solves the OP's issue. But, don't answer because it is a bad question then other people answer it with my comments answer :(
 
in my device, that is called destination address
 
@NETscape Oh, I'm not sure how it enforces the communication between host / destination.
 
well you configure devices, in WiFi it would be the password, in my devices its a destination address... slaves would also use the same destination address, so when host says "who is out there with address 4, i'm about to send you data." the slave says "hey I can hear you, i'm channel 4, i know your frequency hopping algorithm, start transmitting"
if addresses were different, slave address wouldn't listen
 
@NETscape That is pretty cool.
 
4:14 PM
Hello
^ is a string.
"Hello"
@"C:\log.txt"
"John said \"Hello\"."
^ are string literals.
 
@NETscape I want to get into stuff like that.
 
A string literal is a way to write a string so that a compiler will understand it.
 
Hello -> looks like a word
 
It is
 
Hello
^ is a character string
 
4:36 PM
Opinion question: .SelectMany(.SelectMany()) or .SelectMany().SelectMany()?
 
...?
 
a.SelectMany(b => b.SelectMany(c => c))
a.SelectMany(b => b).SelectMany(c => c)
 
@KendallFrey Option One.
 
0- or 1-based? ;)
thanks for your opinion
 
fuck balls
 
4:42 PM
I'd... rather not
 
trying to find out why our oauth tests are failing. i know squat about oauth.
this sucks
 
You might say it's causing a lot of oaths.
 
i know the basics
 
@Steve It moans for success? O-O-O-Auth!
 
i dont know how it's implemented in this huge f'n solution
 
4:43 PM
wat
 
haha
but no really, i dont know what to do
 
fire up the debugger
 
i think they call it debug
 
can't test it locally, have to get it up on dev, and it takes forever to pub cloud shit, and then 30 minutes for the tests to run
and i dont even know what to change, lmao
i have to debug it old school.... log values?
 
4:46 PM
remote debugger?
 
to azure?
is that even possible?
 
zure, why not?
I have no idea
 
Azure supports it.
 
I DONT KNOW LOL
no, the guy in charge of this solution said "i knowthese tests are flakey, but if they're failing, figure it out before going live", was supposed to pub 4 hours ago
not even my tests
team city + log
nothing useful
well, thats not true
 
well how do you know its failing
 
4:50 PM
it's half useful
 
cause it says test isn't passing?
 
because the site crashes when trying to log in via organizational account
 
ask server guys if they are seeing log in failures
 
no i think i'm just going to quit
 
that'a boy
if you're going to do it some way, do it the right way and quit
 
4:52 PM
@NETscape Ha, priceless.
 
or slam a printout of the test results and say you found the problem, the test failed, and say its not my job to fix it.
 
When life gives you lemons, fuck it and quit.
 
he said figure it out, not fix it, right?
 
lol
 
@Steve Or you could be a total douche, The boss asked me to look into this, but I've got a higher priority I'm delegating this to you. Enjoy, let me know the results thanks.
 
4:56 PM
this is going to take me like 2 weeks to figure out if i have to spend an hour for anything i try, because it pubs so slow
oh i can, and i do, but the tests are so shitty, different ones fail locally
and the ones that fail on dev pass locally
yup
they're smart guys, so i wont name names, they're in the process of trying to make them not so flakey
smarter than me, at least
 

« first day (1565 days earlier)      last day (3381 days later) »