« first day (2385 days earlier)      last day (2580 days later) » 

6:05 AM
first!
(hello)
 
I am wondering how to merge a List of objects, that have sub object Lists, based on matching Ids of the parent objects? I created an example of the problem I am looking at here: gist.github.com/pwen090/0c08e0064d5fc597ec1d1d4cf51b42ef
Thank you so much for any help or advice on how to accomplish this.
 
6:22 AM
ohayou
 
Hello!
 
Morning
 
Any Linq wizards have any idea on that code I posted? I feel like I must be missing something obvious.
 
@PaulW. I think you want SelectMany
Takes an IEnumerable of T1 and a delegate from T1 to IEnumerable of T2 and concats all the T2s together. The delegate in this case would just return the child collection of each T1
 
morning :)
 
6:46 AM
@tom
@TomW do you have an example of what you mean? Not sure I follow
 
7:00 AM
public static string StringName; versus public string StringName { get; set; } ?
 
@mark333...333...333 what do you want to use it for?
because static vs nonstatic is perfectly defined
 
Morn all
 
7:19 AM
@SebastianL for login session
what do you prefer the most? :)
 
7:34 AM
@mark333...333...333 is the class where you are using it static? if not don't use static for such things
@mark333...333...333 there are some exceptions
 
Here's the scenario, I stored the static variable in a class. When the user login, the static variable will have a value. and that value will use across that web application.
 
for Example when there is only one session or you absolutly need global access
and there is only one user in the entire application? @mark333...333...333
 
@SebastianL as I've noticed, it's working properly. account is properly referenced. But there's an instance where the user login from main and branch and the main has the value of the branch. which is wrong. when the user logoff, then they get properly reference instantly.
@SebastianL no, it's a multiple users. Like main and sub branch logging in one application. and that application hosted in our IIS server vm
 
@mark333...333...333 then don't use static, static is only useful if you only have a one
 
@SebastianL thank you bro. It looks like static variable is not application for login accounts where static string login details are changing. :) Isn't it? :)
 
7:47 AM
yes
 
8:46 AM
yarr good morrow ye landlubbers
 
yarr harr fiddle diii dee
 
wot
are you mocking me
YOU'LL WALK THE PLANK
 
do what you want cause a pirate is free
 
Sebastian is a pirate
 
8:50 AM
yar
i replaced you are with sebastian is
 
 
@PaulW. I'm Linq wizard>
            var newSomeObjects = objects.GroupBy(x => x.Id).Select(x => new SomeObject() { Id = x.Key, Name = "Random object " + x.Key, ValuePairs = x.SelectMany(y => y.ValuePairs).ToList() });
You needed group by first to match the ids, and selectmany for select all the valuepairs in the group
 
@ntohl you forgot to add an anonymous object in the groupby to make it complete
 
You mean make anonymus object that SomeObject is for?
it's complete by the way. I tested it
 
was just joking ;)
 
8:59 AM
Wizards don't get jokes. Sorry
 
pirates do not get jokes either, we don't really have a good sense of humor
 
Top 100 best Question and Answers for a c# interview. So that I can crack some major interview. Thanks in Advance . :)
 
When do you use Singleton?
Explain Delegates.
2
what does SomeObject?.SomeFunction() do
^ those are easy ones
 
9:24 AM
explain delegates @SebastianL
:)
 
Hey Guys
I have a basic question sorry
How does the 'for' loop work?
I know what it does. But internally what is it?
 
for ( int i = 0; i < 10; i++) {
		// Do something here exactly 10 times
}
 
for(int i=0;i<5;i++)
{
}
is for a method?
with int i=0;i<5;i++ as parameter?
 
@SebastianL never
@SebastianL "don't call us, we'll call you"
@SebastianL null propagation
 
@milleniumbug ples tell me milenieum bug
 
9:29 AM
@ILikeToMoveItMoveIt it's a loop. it's explicitly not a method.
it doesn't get translated to more primitive statements because you can't express it in terms of while without rewriting continue statements
 
i think in assembly it uses jump comand
to return to previous lines
 
for () is a loop operator and not a method, welcome to C# :P
 
loop statement, if we want to learn terminology
 
operator in it too :P
youre lucky, Im using keyword jumps for doing a loop when I was beginner.
XD
 
if You foreach through multidim array, it will go through all the dimensions
it's not as simple as for (int i = 0;...)
 
9:39 AM
some deep terminology there.... programming multiverse
 
in the last book I read foreach was better than for i to arr.Length in 2 ways. First was looping through all dimensions, second was about foreach(XType ...) does the right element as XType for you
 
Hi people, I got a prblm, I used <%=data%> as some button's "OnClientClick" event. But in my browser it's shown as: OnClientClick="<%=data%>" and the server doesn't convert it to data.ToString() as I expected, what is the problem?
In asp.net
 
@AmitGuleria what happens when You foreach(XTYpe element in collection) if a.) XType is not type of the elements in collection b.) XType is only subtype of the elements in collection c.) XType is supertype of elements in collection.
 
@milleniumbug but interesting is why anyone shouldn't use this pattern
13
A: What are the real world applications of Singleton Pattern

jalfSimple. What does a singleton do? It provides global access to an instance of an object, and It guarantees that no more than one instance of that type can ever be created. So you use a singleton when you need both of these things. And that is rare. Globals are generally speaking, bad. We ten...

 
so is foreach a method?
which gets translated to for
 
9:46 AM
@ILikeToMoveItMoveIt check my question above. You will see is not as simple as that
 
you can easily express foreach with for, yes
 
no
 
of course as-if rule still applies
It's still not a method
 
22
A: How is foreach implemented in C#?

Jon SkeetIt doesn't use an anonymous function, no. Basically the compiler converts the code into something broadly equivalent to the while loop you've shown here. foreach isn't a function call - it's built-into the language itself, just like for loops and while loops. There's no need for it to return any...

 
and using .GetEnumerator() and calling its MoveNext() and Current can be perfectly done in the continuation sections in a for loop
 
9:54 AM
@milleniumbug and write abismal lot of reflection code to get the right .GetEnumerator() for Your type, "which returns a type with suitable Current".
 
I don't see how is that relevant. The dispatch on .GetEnumerator() is done on its static type
 
foreach doesn't create instance of the right List<XType>.Enumerable, while implementation with for does
check third bullet point
of Jon Skeet's answer
foreach is magic
MoveNext implementation must check if the Enumerator is Disposable...
 
It still doesn't affect rewriting. var enumerator = collection.GetEnumerator() // done
 
Surprise me you know JS as well ? anyone ?
 
@milleniumbug foreach doesn't do that for arrays
I don't know javascript well. Kappa
 
10:01 AM
@ntohl yes, this is true. Now the interesting question is whether this affects observable semantics
 
interview questions will be about why You should always use foreach over alternatives
not about can You write alternative
 
IOW if your hypothetical alternative C# which didn't utilize special casing for arrays would still behave the same from the perspective of the user (except for possibly worse performance)
 
10:17 AM
ok, not only you have the disposable issue, but I think such rewriting with calling .GetEnumerator() would fail with explicit IEnumerable<T> implementation
@ntohl ok, you're right
 
Joe
can you say so in english : oscilloscope is very sensitive when it makes measurements
makes??
 
"does" would be more appropriate, I think
or just "measures" instead of "x measurements"
 
Joe
thank you
 
Disclaimer: not a native speaker
 
10:31 AM
the oscilloscope is very sensitive when it takes measurements
@Joe
 
Joe
thank you
 
No one fancy doing some code review ?
 
War
@Mathematics I do them pretty much all the time but i'm not that fancy
 
10:48 AM
@War even for JS
 
War
yeh I regularly review my entire stack, usually focus more on WIP though
but every now and then I dip in and ask "is this still relevant / correct" on pretty much everything
can be quite time consuming though ...
tbh though, it's worth it ... you end up with a much cleaner codebase
 
Yeah, I agree with all that :D
we never done any code reviews lol
 
I usually ask for it, so at least my lead developer sees what I have done
 
War
yeh my guys do too
they like to have their stuff reviewed every now and then ... gives them a bit more input in to the process
It's actually a really way to highlight training issues or to give targeted guidance on concepts
 
@War how much experience (in years) do you have?
 
War
10:59 AM
professional or just "using code"
 
professional
 
War
about 15 years
 
so you are in a somewhat teamleaderlike position? how long did it take to get there?
 
@SebastianL depends on company, at some places less then year and at some never possible lol
 
I was surprised now, that non of my colleagues know about double locking
 
11:04 AM
@Mathematics less than a year is fast :O i'm still a student, but i worked as a professional right after Highschool so i got around 4y of experience, but while i am still studying i wont get a higher position
 
:O you worked 4 years before?
that was smart
 
@Proxy no i work while studying
 
oh
 
its hard since i often have a 50-60h week ^^
(work + university)
 
you work full time?
i see
nice
 
11:06 AM
@Proxy no, thats not possible
 
21
Q: Candidate talks over me during interview

HBv6I'm not an HR person at all, but today I interviewed one candidate who applied for the role of senior embedded software engineer. Indeed, I'm an embedded software engineer, and for 50% of my time I work as R&D Manager of one of our products (I got promoted last month). "Manager" is an excessive w...

^ look at the experience detail provided by this guy
 
Hi guys
In my project , I have a situation where I need to use drag and drop on the rows of a datagrid, In the datagrid, i have a column for checkbox which is being used to select or deselect a particular item. But the problem is after implementing the drag and drop feature on the datagrid , I am unable to check or uncheck any checkbox. As i left click on the checkbox the PreviewMouseLeftButtonDown event is getting fired.
One idea which came to my mind I can restrict the region for the mouse drag to few columns excluding the first column which is the checkbox column but I don't know how to implement it.
 
@Mathematics thanks i'll take a look
 
I have worked 5 years before, but You have to sell Yourself as senior/lead developer at the interview. That is the only way, to make Your bosses consider You as a teamleader
 
War
@SebastianL I'm the development manager / Architect / Team Lead here ... I've had senior roles for a while now
 
11:10 AM
war is "the man"
 
War
@SebastianL moving from junior dev to senior dev type roles took me about 3 years if I recall but I got lucky early on
one of my first mentors was shit hot!
 
the company before, just hired me as a junior. They didn't realized my C# knowledge was better than 95% of the company. When I tried to change the ways, it just stuck like it was before. My seniority index was too low.
 
War
There are ways to handle that
Lead by example is a key trick
If you know how to do something better and can show the team hwy it's better and get "genuine agreement" on that it should fall in to place.
genuine agreement is tough though ... most people just say "yeh sounds cool" then do what they are used to
the idea behind handling that is to hand it off as a "team idea" not your own
if a dev feels like they owned the idea at some level no matter how small that buy in becomes much simpler
It takes time to learn that, it's a politics / social game basically
devs of course are notoriously bad at "social situations" which could be a good thing for you (setting the bar low for getting your idea across)
 
team ideas were ignored, or prohibited in some cases. No refactor allowed for example. We don't have time for that
 
@War if you are interested in teaching me some modelling etc.. :)
1
Q: Query builder consuming an OData Web API

MathematicsI am developing a query builder which consumes OData Web API (won't go into details on how it works in the back end). I have this EDM/Metadata which I am using to generate UI components. I created a JSFiddle as well. Is there any way I can improve this code? // if (!String.prototype.singula...

 
11:23 AM
literally 2 of us had any tests in the code
 
War
@ntohl Yeh I faced that one a lot "no time" or "it's not proven to work" or "the benefits don't appear to be valuable enough"
the trick with that one is to kill the time needed (suggest a series of smaller changes which are generally easier to do)
then after awhile go "oh and if we do this one more "slightly bigger effort thing we can sav the company X per year in time and money paying off in Y period of time""
through statements like that business managers above the IT dep and they will basically decree it as corporate policy of all a sudden
and claim it was their decision that "saved the company"
@Mathematics looking now
 
to suggest something, You need ears to talk to. That was not the case. The task was always clear, and given with deadlines. We had to estimate the work after given the task. And were clubbed if our estimation didn't met the deadline. Than if we didn't met the deadline we were the responsible, because we give the estimate...
 
War
If people take that attitude then they clearly don't care enough to judge when you do something differently
In such situations I started writing myself "small helper classes" and such in the codebase, over time people started saying stuff like "did you now we had this tool that does X, it's so cool, i've been using it for a while now, makes life a ton easier"
you then go "yeh thats one of the changes that got rejected ... i did it anyway"
people then start to look at you differently ... over time they click that they are way out of their depth in some stuff and start askingfor advice
 
their judgment was about, "how much chance, that this feature will be developed further (we can ask for more money)". If it was low chance, than developers mustn't dare to refactor that code. No matter how hard it will take to maintain
 
War
11:32 AM
1 hour of dev effort = 4 in testing effort + 2 in client time + 30 mins PM time + 30 mins systems or "ops" time + ect ect ect
Pretty much any change can be justified with the right view point
the beautiful thing about stats ;)
@Mathematics seems fine
 
Don't suppose anyone here has had the pleasure of making a custom theme for wordpress
 
War
@Kieran oh dear
 
Yep.
 
War
that's a PITA
My old blog was built in wordpress
it's full of "bullshit hacks for x scenraio"
 
really ? I thought it was awful and I use something like
http://www.dofactory.com/javascript/builder-design-pattern
 
War
11:34 AM
I hate wordpress for this reason
 
Yep
I'm not going to go into it because we've already had this convosation at work
 
War
@Mathematics if you were a bit smarter you could package up most of that in to lib then do something like ...
 
and for some silly reason, its not our decision as to what software we use for this
which is why im having to do wordpress
but in any case
its not as difficult as it seems
...right?
Please agree with me
 
oh. Yes. I got asked for advice a lot. On of my collegues were great partner to talk about "how should we write this to be SOLID". That guy had the same problem. Went to another company, because the bosses promised him a lead tech role. They give it to him for staying with the company for 2 years at least. He had much better seniority index.

After giving him the tech lead role, the guy went to other company after 1 year, because he still did footwork... Needless to say, that the bosses went rage, and called him a liar.
 
War
<div id=qb />
<script>
   $(function() { $("#qb").QueryBuilder(); });
</script>
@Kieran it's not that bad
just takes time and is a bit fiddly in places
 
11:36 AM
i have a day
 
War
tbh ... there are way worse systems out there
 
I know
 
@War you read my mind, that's the end goal xD
 
@War ever had to maintain VB6? :D
 
now this guy is working for EPAM as a lead dev. Doing real lead dev stuff for triple the salary
 
War
11:38 AM
@ntohl I tend to say to my team "anything you ask of me, think about what I have to ask of the CTO / client" ... anything that takes time has a cost, if we can do it for effectively free though, lets talk and justify it internally!
@SebastianL yeh but not for some time now ... must be at least 10 years
@ntohl i'm hugely underpaid for the role i'm in ... i'm waiting though
one day I think this effort will pay off
@Mathematics I basically started doing all that some time ago with my stuff
oddly enough my workflow stuff that i'm building atm works a bit like that
 
sorry but I think seniority index with the respective salary index changes only with interviews
 
@War we still have one solution in VB6, but fortunatly it doesn't have much flaws/bugs anymore ^^
 
@War hmmm, I got an idea, let me see if I can make it work :)
 
our codebase was C# converted from VB6. Most of the business logic implemented in stored procedures in database
it was pain. Try to debug/test code in that environment...
 
War
@ntohl yeh justifying pay increases is tough ... I happen to know i'm the highest paid person in the company atm
any money I ask for comes with that hanging over me
 
11:43 AM
oh. Than You have reached the company's limit I think
 
War
I'm easily worth £10k to £0k more than i'm on though ... £60+ if the latest "salary calculators" are to be believed
@ntohl yeh but in the last 2 years i've basically rebuilt everyhting from the ground up
and i'm basically on a senior dev salary
@Mathematics can't wait :)
LMAO
 
haha ok, I will try my best, but this won't going to happen in a day, probably by next week,
I will need to look into bower for this and type script
 
War
@Mathematics I use knockout, jquery, and for some of the more complex stuff kendo UI
that's it, everythign else I put in to my own framework
 
12:06 PM
@War is knowckout similar to Angular?
 
War
@ILikeToMoveItMoveIt it's purely a templating library
 
@War I use AngularJS and no kangroo UI :P
 
War
angular tries to do everything from MVC, to DI, to templating, to MVVM
 
So it is safe to say that Angular borrowed some concepts from KnockoutJs?
 
12:25 PM
Hi
Do we can inharite multiple abstact class to an non-abstract class?
 
No
 
@HardikPatel use interfaces
 
you can only inherite one class
 
interfaces must need implementation
 
yes and interfaces have no properties
only methods
 
12:29 PM
I need to get some string data.
public string Fullname { get; }
like this
but if I declare it in interface then I must implement it in child class.
 
@HardikPatel you can also reference a class in a property
 
how?
 
just pass it in the constructor
and assign it to a variable
 
public class abc : xyz
{
public abc(string name) : base(name)
{
}
}
you mean like this?
 
nope i mean like this:
public class MyClass
{
  private Class1 class1;
  private Class2 class2;
  public MyClass(ClassInstanceINeed1 class1, ClassInstanceINeed2 class2) {
    this.class1 = class1;
    this.class2 = class2;
  }
}
 
12:37 PM
in your case, I have to create instance of MyClass first.
 
yes
 
right?
ok
Thanks
 
your only choice if you want to reuse multiple classes
without reimplementing Interfaces
 
yes, you are right
 
12:55 PM
halp #shamelessplug
0
Q: How can I run tests from a folder other than the test project's output folder, using MSTest?

Kendall FreyScenario: I have multiple C# projects in my solution. Each project is built to bin\Debug\. From there, the output from all the projects is copied to a few common output folders using a post-build step. The post-build also creates some necessary files in the common output folders, to create an en...

 
XD
hallo freinds
 
1:08 PM
@War £10k to £0k?
 
War
typo ... was meant to be £10k to £30k
@KendallFrey from the build process (in tfs) or VS ?
 
hi
 
@War both
 
anyone knows of a better way to check if a byte array starts with another (fixed)?
if (image[0] == 0xFF && image[1] == 0xD8 && image[2] == 0xFF && image[3] == 0xE0)
            {
 
You could read it as a string or an int in one operation
 
1:14 PM
@War lol. £21k is my full salary. That would be Your raise, if You switch company...
 
War
@ntohl you in a junior role?
 
@War no
 
War
then you're under paid
@KendallFrey did that help
brb
 
@War not yet
 
I got a 3.2 k raise by changing company
 
1:17 PM
@ntohl per month or annual?
 
annual
gbp
 
@ntohl still nice enough
 
@War I am on more then 34 and less then 40
@ntohl that's it ?
@ntohl I agree with @War
 
@ntohl thats extremly low :O
 
@Mathematics my position is like. I got 1 year developer stuff, which is medior level, then they expect me to lead a scrum. The salary will not change.
 
1:24 PM
@ntohl what do you do?
 
WPF desktop app
atm
 
@ntohl fulltime?
 
full time
 
dammit, utf8.GetBytes(utf8.ToString(byte[])) doesn't work.
 
7,800,000 huf annual salary for that (Hungary)
 
1:25 PM
@ntohl do you have bachelor/master or something?
 
bachelor degree in a well respected uni
 
@ntohl i do not know what the livingexpenses in hungary are, but here (germany) you would earn around £35k minimum with a bachelors degree
 
that 7.8 M annual base salary have HUGE taxes. So net monhly I got 470,000 huf
I worked for a German company for 1 year, but it was a massive rip off. It was nice salary by hungarian standards, but £950 monthly.
tho the workplace was here in Hungary, so living costs were cheaper
 
and I'm tired I meant GetString() not ToString()
 
@ntohl i just checked the bigmacindex (upload.wikimedia.org/wikipedia/commons/9/9b/…) and apearently you're better off than i expected ^^
 
1:31 PM
@SebastianL I'm now thinking about going to germany :p
 
@satibel go for it :D
 
j/k, in a few months, I'll still need to fix my truck.
and I'm still working for a month or 2
and also, I did quit my school.
 
@satibel why?
 
@SebastianL That was my first normal working place, I had 80 eur for living in Berlin for 2 weeks. That was a magic trick to survive there... Every workday meal was burger in macdonalds... The company paid for apartman, transport, but that's it.
they wanted to pay back the 50 eur monthly ticket for transport at the end of the month. It was a bit pity to tell them, than I won't have money for food.
 
boring, I learned nothing*, never went in class, read the course 1 hour before the exams, got 13 to 17/20 grades.
* not actually nothing, I did learn by reading the courses from year 5 in year 3 and doing my own stuff.
 
1:38 PM
@ntohl thats more like an internship payment o.O
and even for an internship it would've been kind of a ripoff
 
internship is 450/month I think.
 
hello friends
 
   ^  darkness my old
 
^ I've come to talk with you again
 
bool why = (new DisposableClass().Answer);
Will DisposableClass Disposed after this line?
 
1:45 PM
that is up to the GC
but probably yes
since bool is not a reference
 
I got it, thanks (≧▽≦)
 
@nyconing in other cases, you can use using just to be sure it's disposed (when GC isn't lazy).
 
ROFL this is decided by who is lazy
 
@nyconing Don't do, always dispose them yourself
 
@nyconing long story: when you call dispose() or at the end of an using, func etc... it is only marked as disposed, but it is only truly disposed when the garbage collector (GC) does it's job.
 
1:55 PM
@satibel you could erase its traces from the ram tho, even in C# :D
i did this for fun until i got yelled at ^^
 
@SebastianL you can force the GC to do it's job, or use an unsafe method to nuke it via the pointer.
 
@satibel That's just plain old confusing misinformation
IDisposable has nothing to do with the GC.
 
@KendallFrey doesn't it work like that?
 
No
Disposing has nothing to do with memory consumption
 

« first day (2385 days earlier)      last day (2580 days later) »