« first day (1503 days earlier)      last day (3428 days later) » 

12:02 AM
you broke it
 
apparently, you really broke it
 
fgs
 
so what broke
@BradleyDotNET - There shouldn't be any caveats to getting the types name using "+typeof(T).Name+" right?
@drch - "+typeof(T).Name+" should work to get T's name right?
 
12:18 AM
yep. but of course it can be different than the runtime type
 
what do you mean?
 
It will get the name
It could well be the fully qualified name
 
er sorry i was meaning if you also passed a param
public void PrintType<T>(T instance) { }
 
What are you then doing with the name?
 
typeof(T) may not necessarily be the same as instance.GetType()
 
12:20 AM
Using it to target a table
I am going to reflectively iterate a whole bunch of types to copy this database :)
 
Sounds like barrels of fun
I'm doing something similar, incidentally at the moment
Writing a WPF form generator based on EF reflected types
Though I'm not using generics
 
.Name should be fine. its not fully qualified
 
Generics + Reflection + Linq = love
 
typeof(Foo).Name == "Foo"
 
true
Well, if Foo Foo foo
 
12:24 AM
@drch Not sure thats true coming from another assembly. IIRC you get the namespace with it
But I may have been writing slightly different code
 
thats .FullName
 
^
 
theres name, fullname, and assemblyqualifiedname
 
I'll check tonight; I could easily just be remembering wrong :)
 
12:28 AM
Whats going wrong with that?
 
Nothing :)
Well, aside from that it is probably going to end up taking forever to run on some of the tables
25 tables with ~250,000 records each
 
is the source db mysql or mssql?
 
source is mysql, destination is mssql
 
No getting around that that I can think of
 
hopefully everything fits in memory
 
12:29 AM
Nope. I might have to do some finagling to make it either go faster, chunk, or not timeout
Luckily it is basically Thanksgiving so I kicked all the users off the system
 
on the sql side, in your configuration class you can set the command timeout
 
I didn't want to have to sync as I copied
 
cause inserting 250k records will definitely take longer than the default 30 secs
 
Yeah setting the timeout is pretty easy
It will probably take 90 minutes
Also, I might consider breaking the sections into pieces of 500 records, doing them 50 at a time asynchronously, and iterating those sets.
Although, I am not sure if inserting the pks out of order will mess with the db
 
not sure async will help in this case since you are 100% I/O on the same db connection
although a loop w/ 500 at a time sounds nice ;)
 
12:33 AM
each one would have its own connection
but I think I see your point
the bottleneck will be my upload bandwidth
 
would this syntax make sense:
fuu?.derp?.Invoke()
         : { handle error }
the you could do:
fuu?.derp?.Invoke()
         : throw new NullReferenceException()
:)
 
How often does that happen to you?
 
that situation
 
pretty common to check for null if that is what you mean?
@rightføld ^^
I just thought ?. combined with : could be clean
@TravisJ I have not started using C#6 yet though.
really want to.
must try to sleep again now
nite
 
12:45 AM
@Johan Don't think that works, though - ?. doesn't combine with :
 
calling methods seems awkward. foo.?Bar() ???
 
@ReedCopsey what do you think about the syntax/suggestion?
@drch will be sweet for events
 
@drch well, simplifies raising events
I think that's the main use case expected there
@JohanLarsson Not sure I love it - it also doesn't provide you clues as to where the error occurs, which means you couldn't handle it properly
 
so i assume it would only work for void methods?
or that you just had to live with the case that you don't actually know if the method was called or not
 
foo?.bar?.baz?.Do() : throw .. doesn't tell you what portion was null
@drch Nope - it'll work for any - you get a Nullable<T> or null if any portion is null
and the value in Nullable<T> or just hte value (if ref type) if it's not
 
12:49 AM
right, but what if your Do() can return null
 
you won't know why its null ;)
but if htat's important, you can always break out early
 
yeah
 
@ReedCopsey the throw nre part was a joke. a?.b?.c() : d() could perhaps be useful
and you can always do it the hard way if you need to know
 
?? would probably make more sense than :
Might not be what you're after though
 
so youll have to do:

var baz = foo.?bar.?baz;
if (baz != null) { baz.Do(); }
 
12:51 AM
@KendallFrey He's kind of after the opposite of ??
 
since it'd have to be compatible with existing syntax
 
I was thinking ternary ? : kind of thing
 
@ReedCopsey how so?
 
did not think long about it
 
@KendallFrey He wants the right portion to be a side effect, not a result
 
12:52 AM
? is the not null, would make : the null
 
@ReedCopsey Yeah, but expressions can have side effects
 
I don't think I want it any more, just tested an idea
 
but it has to return a matching value
so it can't just be a side effect
 
mm, yeah
 
the whole ?. thing just makes me appreciate F# more :)
 
12:53 AM
Odd, it makes me appreciate C# more
 
gonna try to get opentsdb.net running tomorrow
 
not me - makes me feel dirty every time I see it - it's a band aid
 
Could C# do more with structs as a way to deal with the null design flaw?
 
Do you dislike nulls in general, @ReedCopsey?
 
@MrDoom very much so
 
12:55 AM
who doesn't?
 
@JohanLarsson I think structs are prone to worse design
 
@JohanLarsson Not really, you can't really avoid it until you eliminate the separation between declaration and assignment
 
@JohanLarsson I've heard the arguments against nulls but I still feel like the fill a necessary void that structs don't quite fit correctly.
 
The only place I use nulls is to represent a non existent foreign relation
 
I do wish there was a better way to handle not allowing null arguments for functions though.
 
12:58 AM
I think it would be better if reference types weren't nullable
 
explicit null for ref types would have been the best I think
 
agreed
 
@MrDoom Option types are better ;)
but you need language support
 
There is the problem of field initialization though
 
@KendallFrey It's not a problem if you don't separate declaration and assignment
 
12:59 AM
@ReedCopsey Is that a monad? suspicious glance
 
ie: once everything's an expression, it works fine
 
@ReedCopsey well, how do you combine them? right now, assignment is in the constructor
 
@KendallFrey Option types? Technically, yes, though most people don't think of them that way
@KendallFrey you need something akin to a primary constructor, and then it works fine - I was very sad to see that dropped from C# 6
 
I guess it could work just like structs
 
well, structs break because they don't guarantee constructors run :(
 
1:03 AM
but a constructor has to initialize fields
 
you mean with readonly fields?
 
no, struct fields
a constructor is required to ensure all fields are initialized
 
but it still doesn't ensure that - if you just do new Foo() it won't run your logic to initialize
(with Foo as a struct)
or if you use it in an array, etc
 
no way to declare a default ctor in structs right?
 
right
 
1:05 AM
yeah, that's what I mean - you can't handle the default case properly
 
yeah, that is iffy
If only we had a value that could signify a reference type is unassigned... :P
 
side note: I saw array indexes cast to enums today.
 
nice
 
No way to recover when retardationlevel divided by zero
 
I usually do the other way around
 
1:10 AM
@KendallFrey Which is what Option types give you :)\
 
stahp D:
We don't have to worry about any of this in REBEL
strings are the universal data type
 
Oh yeah, that sounds great.
 
@MrDoom Unary math, oh it's so much fun
 
1:28 AM
Hello, can anyone explain me why returnValue gives me error when I use it in CopyDirectory but no error when I use it in CopyFile? puu.sh/d6ZVO/a9d37f3129.png
 
@EckV There is no guarantee it's been initialized
if there are no files in the directory, then it will never get assigned a value
local variables must be assigned before they are accessed
 
Here's the problem. I can do "bool returnValue;" in CopyFile but I can't do that in CopyDirectory
 
It's not defining it that's the problem
it's not assigning it
What should it return if no files exist in the directory?
 
false?
 
Then that's what it should be set to by default
 
1:39 AM
In that image I have this line "private bool cancelCopyOperation = false;", ReSharper says "=false" is redundant. So I can do bool something; in a class but I can't do the same in a method?
 
correct
That's one of the reasons I don't like Resharper
I like my fields explicitly initialized, for clarity
 
I still don't understand why I don't have to do "bool returnValue = false;" in CopyFile? It works if I just do "bool returnValue;"
Sorry, I'm stupid :(
 
Because it will always end up getting initialized
It's all about the possible paths your code can take
 
Hmm I see
 
In CopyFile, there's only one possible path
In CopyDirectory, there are two.
Incidentally, that number is called cyclomatic complexity
 
1:43 AM
Yeah I get what you mean now, yeah in CopyDir, there are two ways. First one is, where there are files in the directory, and the second way is when there are no files in that directory
 
exactly
 
So many thanks
 
user2985029
may i interject with a photo?
 
7:26 AM
sup dudes
 
8:07 AM
@Sippy Did you get it to save?
 
user1804599
8:27 AM
@JohanLarsson null is terrible use Option instead.
 
user1804599
This is useful: ideone.com/Bh5fvi
 
user1804599
8:42 AM
Even works with LINQ since Option is a monad.
 
9:06 AM
i started using Option once in C#, it confused the hell out of the other programmers, somehow they are more comfortable with null checks :(
 
9:37 AM
no wonder it confused everyone with this method names - Some? None? - GetPropertyOrDefualt would be waaaay better - Option? - the idea is not bad but the naming is terrible
 
It's an awkward approach to remedying a language flaw. Makes no sense.
 
10:03 AM
@RoelvanUden No
 
I guess C# 6 will make it a bit easier, compare option:
	optionalUser.Select(x => x.Name).GetOrElse("Username not found")
vs C# 6 null propagation operator
	optionalUser?.Name ?? "Username not found"
 
@Rovak Makes sense
Unless you have a situation where you don't want to declare a nullable type.
 
What proportion of your coding time is spent on what is basically munging?
Mine must be at least 2/3
 
Bro do you know what munging is
I don't even wanna urban that at work lol
 
oh...yeah, don't
munging (soft g) : translating data from one format to another, usually from something like a text file into either a type or a different sort of text file
e.g. this data is in csv but I need it in json and someone has messed up the data entry
<insert hours/days manual workarounds>
actually "...and someone has messed up the data entry" is probably the root of most of the hard problems in software
 
10:08 AM
munging, first result on google showed another definition nl.urbandictionary.com/define.php?term=munging
 
yeaaah. It didn't occur to me until Sippy said something
 
Rovak pls tag nsfw l0l0l
 
crap, can't edit it :(
 
can delete IIRC?
 
Nah you can't delete if you can't edit
For some reason ..
 
10:13 AM
only within a few seconds i guess
 
@Rovak I think it's a minute.
 
Holy shit, @Rovak you're a sick sick person
 
wowow, i had no idea what munging ment after i clicked the first result :(
 
He lies
He was the inventor.
That's what EF is doing
And I have no fucking clue why. It should read [CreatedDate] from the table, but [ModifiedDate] should be set, not read.
I can't find the setting in EF to stop it doing that.
 
 
1 hour later…
11:29 AM
Trolololol
 
 
2 hours later…
1:21 PM
I have to show the download and upload speed in my windows phone 8.1 application
how Can I do it,,,?
In C# there is networkinterface. But I cant find it on windows phone programming.
 
@TusharTushKhush Can you be more specific?
 
I made a application in windows phone application
I want to show the download speed
when user download something
In desktop application I have made it by using NetworkInterface
but in windows phone 8.1 SDK it is not available.
 
Here is an Example you can access with webclient
 
1:36 PM
I have made this type of application already for desktop. But how can i do it for windows phone. I have seen that webclient is also unavailable in SDK or maybe available by another name. @juanvan
 
@TusharTushKhush What are you using to do the download then?
 
@TusharTushKhush You can get progress updates. As soon as the content-length header is received, you know the total size of a file and you can calculate your speed, % remaining etc, from the current and total values.
 
@KendallFrey Actually I want to monitor the network. I am just trying to get how much bytes is going out and how much bytes is coming in into the phone....
 
you want to monitor all traffic on the phone not just in the app?
 
ya,,,
that's right
 
1:41 PM
Need some Turkey magic for that
 
is it too much difficult?
for a beginner?
 
He's saying you basically can't.
 
need to hook into Data Sense? NetworkInformation.NetworkStatusChanged
Na I was just playing with the Turkey - :)
 
@TusharTushKhush Actually, it's probably a limitation of the phone. It might not let you do that.
 
1:46 PM
Happy thanksgiving day
 
@KendallFrey I have seen these type of applications in android. Thought it will also can be made in windows phone
 
hi everyone, Diff between Com Heap vs Process Heap ??
 
2:47 PM
Can anyone tell which dateformat this is 2012-12-14 09:50:00.000?
 
posted on November 27, 2014 by Scott Hanselman

In case you missed it, make sure to read Announcing .NET 2015 - .NET as Open Source, .NET on Mac and Linux, and Visual Studio Community because there's been some big stuff going on. Here's the summary of the .NET 2015 Wave of awesomeness. We are running .NET as an open source project going forward. http://github.com/dotnet There's a home for Microsoft on GitHub now at http://microsoft.gith

 
dbContext.Database.ExecuteSqlCommand(@"UPDATE Till SET ModifiedDate = CAST('" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.FFF", CultureInfo.InvariantCulture) + @"' AS DATETIME) WHERE TillUid_PK = " + till.TillUid_PK);
Hack works.
Fuckin' entity framework
 
@shakthi Bit late there bro
 
3:21 PM
okies
 
 
2 hours later…
5:47 PM
I wonder why generic type inference doesn't work on constructors.
 
How open is .net?
 
Uh, referencesource is about it I think
 
Is copying a class ok?
 
Hmm
There's a License link up top
> "Reference use" means use of the software within your company as a reference, in read only form, for the sole purposes of debugging your products, maintaining your products, or enhancing the interoperability of your products with the software, and specifically excludes the right to distribute the software outside of your company.
so no, you can't just copy it
 
ty sir
I wanted it to be internal to my assembly
could probably use fody to manipulate it but maintenance nightmare
< derp
have you written adorners?
 
5:59 PM
I don't think so
 
unexpected answer :)
 
6:11 PM
Hello I have this code: http://puu.sh/d7KJR/87ea52a337.jpg
The problem is "dl.DownloadProgress" doesn't work when I do this:
"client.DownloadProgressChanged += DownloadProgress;"
But when I do that in lambda, it works
"client.DownloadProgressChanged += (sender, args) => DownloadProgress(sender, args);"
and if I don't add an EventHandler to DownloadProgressChanged, it will fire a null exception (which I don't want to check for that either because I don't there must be a way to avoid that without checking for null)
 
Please explain what "doesn't work" means
 
6:36 PM
It doesn't trigger/execute.
"dl.DownloadProgress += (o, args) => Debug.WriteLine(args.ProgressPercentage)"
I get debug output when I do:
"client.DownloadProgressChanged += DownloadProgress;"
I don't get debug output when I do:
"client.DownloadProgressChanged += (sender, args) => DownloadProgress(sender, args);"
 
What are you expecting, and what are you getting? Your problem is unclear.
 
@EckV you just changed the description of the problem between the two attempts at explaining it. First you said the lambda version worked, then you said it didn't
which is it?
 
Oh my bad
It's the opposite, yeah I made a mistake in my second post
It doesn't work when I add (+=) DownloadProgress to WebClient's DownloadProgressChanged
 
6:51 PM
Are you saying that the method doesn't get entered, or that it doesn't print anything?
 
Both?
 
your code sample doesn't demonstrate the problem
 
Can you reproduce the problem in a way I can try it?
 
oh, the commented-out part. I don't see an implementation of anything that writes to the console
 
Is there a Jsfiddle for C#?
I can put my code there
 
6:59 PM
dotnetfiddle works IIRC
 
ideone also
 
Good to use that because sometimes people go "oh, here it works. Wtf."
 
and runnable
 
7:27 PM
Now the both ways don't work for some reason...
 
Definitely don't instantiate WebClient inline
you have no control over its lifetime whenever you pass a Downloader around
 
So should I put it in Downloader's constructor?
Please feel free to change it, I enabled collab mode
 
creating it in StartDownload would make sense to me
 
Now I understand why it wasn't working as you expected
 
Other than that I honestly cannot see what you're trying to do. Maybe you're much more knowledgeable than me about events
 
7:37 PM
DownloadProgress is an event
 
To me it looks as though you never actually give DownloadProgress a method to call
 
You should call it in the DownloadProgressChanged event handler
 
Nothing happens because you haven't told it to do anything
 
If you just pass it directly, then any changes won't do anything
 
I really don't know anything about events or EventHandler
that's what I came up with...
 
7:39 PM
"client.DownloadProgressChanged += DownloadProgress;" You definitely don't want this
"client.DownloadProgressChanged += (o, args) => DownloadProgress(o, args);" You probably don't want that either. It should have a null check in there
 
@KendallFrey A null check.. lulz
 
y u lul
 
Because that'd be gone in CS 6
 
Why, what's changing?
 
7:43 PM
That doesn't have anything to do with this situation
 
Where were you suggesting the null check should be done?
DownloadProgressChanged ?
 
In the event handler, before it fires the DownloadProgress event
 
Then yes it does
> One particularly useful application of the null-conditional operator resolves an idiosyncrasy of C# that has existed since C# 1.0—checking for null before invoking a delegate. Consider the C# 2.0 code in Figure 1.
 
Do explain
 
Read from there
 
7:45 PM
eww, Invoke
 
I know eww.. but maybe they could map invoke to the () operator
Probably some syntax complexity
 
ewww this: Something?.()
 
Lulz
Picky fecker :)
What about
Something?()
Skip the dot operator
But not consistent :'(
Also I guess there'd be parsing issue with ternary operator
 
8:49 PM
@LewsTherin foo?.Invoke()
 
9:18 PM
Ah yeah
But you still use Invoke lol
Wait wait
@drch What do you mean? :P
 
9:40 PM
?
that is how it is meant to be done for events afaik
handler.?Invoke(whatever)
 
10:23 PM
I think it is ?. but meh
 
10:37 PM
yar
 
Hi everybody.
If you have a very generic method (in my case a method which exports any list to a CSV using generics & reflection) where would you put such a method? Would you make dedicated static class holding such a method? or etc..?
@BradleyDotNET if you're around I would like to hear your opinion on this.
:)
 
10:59 PM
@Mehrad It really depends on how you/your company/etc. handles thigns like this
On my team we created a specific API to use, and for any type of application we write, we just reference and use it's features.
other projects might hvae something like:
Project.Common
ProjectName.Utilities
or something like that
 
11:45 PM
@RyanTernier thanks for the ideas
When you say Project.Common you mean to create a folder under project same as my View and ViewModel and so on and put the class containing the method in there?
I just want to make sure I understood it right
 
I work for CGI, and my project is called Registries
we hvae:
CGI.Utilities
CGI.Utiliites.Soap
CGI.Utilities.*
Registries.Xml
Etc.
those are libraries, mainly static methods, that we use to do a bunch of common stuff (like connect to a security service at the ministry, which every team needs to do.)
 
Oh...
I see
never tool such an approach
took*
It's quite clever . I like it
 
if you only need them for a project, then i'd put it where it belongs.
 
The point is it doesn't really belong to any class in the project
I use it here and there
So I just kinda wanted to find a common place for in the proj then all could access it from there
I have couple of classes like that in my project
however this was only a method and was curious to know if a single static method deserve a single static class dedicated for it :)
Thanks for the input though
Nice meeting you by the way @RyanTernier
 
dont worry about only having a few (or even 1) method in a class
thats the whole point of single responsibility
and sure - if it doesnt have state, leave it as a static method
 
11:54 PM
beautiful
that's true.
 

« first day (1503 days earlier)      last day (3428 days later) »