« first day (2182 days earlier)      last day (2769 days later) » 

1:47 AM
Hey folks got a question about Mocking in Web API... So I have a Unit of Work pattern, Repo pattern to interact with the db stuff and then I have dependency injection going on in the controller's constructor. My question is, so I've mocked a IUnitOfWork which is what the controller interacts with, however, the Unit Of Work class actually accesses the repository so do I also have to mock a repository?
 
2:12 AM
is there a quick way to let developers know not to use an overridden method in a child class only?
effectively I inherit from a base class, but one of the methods is no longer applicable to this child class, but [Obsolete] is not appropriate because of the base class not being obsolete
I added the info in the remarks comment, but I was wondering if there was a more obvious way to let my team know
 
@hsimah Are you by any chance thinking of sealed?
 
I don't think so
 
Can you be more specific about "no longer applicable to this child class"?
Examples might help
 
I have class A (the base). B and C both inherit A, but only B will use this function, it doesn't apply to the tpye in C
 
ah
Why isn't it defined in B instead of A?
 
2:16 AM
because there are D, E and F too
 
You could throw a NotSupportedException
that seems to be the normal way of doing this
 
yeah, doing that
was just wondering if there was an attribute or something that I can put on to highlight it in VS when someone goes to call the function in that class
 
What happens when you put [Obsolete] on the overridden method? Just curious.
 
VS complains the base method isn't obsolete too
all good, thanks for the tips
for once I have tried everything applicable before asking a question
 
2:24 AM
that does not sound like a good concept of inheritance to me
should have used interface instead
 
it's not perfect, no
but sometimes we have to make do with our codebase
maybe I'll re-write this to fix it while I am doing this
 
 
2 hours later…
4:23 AM
Hi all, good morning.
I am working on one crystal report in web application where I am trying to show case the report but it is neither throwing an error or displaying the result.

I am using dataset to get the data from database and bind to the report.

Here is link to my code https://www.pastiebin.com/57f5d1891f6b3
Can some one tell me what is the issue with the code.
 
hey guys i'm trying to figure this logic:

I want to find out the number of duplicated elements in an array (e.g: 2 2 3 3 2). The array has 2 elements which are duplicated, 2 and 3.

How would you put this into computer language?
 
depends on what your restrictions are @Kuyo
an easy way would be array.Distinct()
where array is your array
 
each number that has duplicates i need to add 1 to a counter
 
if this is a programming assignment for school, then I imagine you need to implement it yourself
oh the number of them, my bad
 
i can't seem to figure out a way haha...
 
4:32 AM
you'd need to keep a separate tally of each element
can you use linq
 
So lets say in 2 2 3 3 2, I see that 2 has duplicates, so i add 1. I also see that 3 has duplicates, i add 1 again. The output will be 2, because there are 2 duplicates in the array
 
so it's just the count of the elements with duplicates?
 
yep!
 
ie [1, 2, 2, 3, 3] = 2 because 1 is only there one time, but 2 and 3 are duplicates
 
yup
this is a tough question my teacher kept laughing at me
 
4:35 AM
are you allowed to use things like linq to do it?
when I was at uni we weren't allowed to
 
Mmm he haven't taught me that yet so i'm guessing i have to do it in my own knowledge
 
ok
 
I only know stuff like loops... conditions.. boolean flags
 
yep, that's okay mate
you need to learn to come up with algorithms to solve these things
then you can learn to use stuff like linq which will make your life a lot easier - but if you don't understand the basics you'll never be a good programmer
 
Yeah i came up with one:

2 1 3 2 4 2
Store 2
2 1 3 (2) 4, Count + 1
Store 1 now
2 1 3 2 4, Count + 0
So basically i'm moving a step forward
but the problem with this algorithm is that on the 3rd element there is another 2
so i'm basically screwed
 
4:43 AM
nah
you just need to store it in a secondary collection
here you go
when you pull that up I'l walk you through it
 
okay lemme take a read...
Ah i haven't learnt list yet
I do know it is like a container, is it?
 
yeah, see an array is a static data collection
you have to decide how big you want it to be before you start
a list is a more user friendly data collection, it expands (and allocates new memory) as you add elements to it
lemme change it for you
 
I see...
 
you're forcing me to go back many years here. I haven't declared an array in forever haha.
 
hahaha! Very new C# programmer here :D
But I can understand your code definitely
 
hsimah, what does continue; do?
 
it exits the current loop
do just say you have an array of 10 items, looping over them, but you find your item at position 2
you may not want to loop over the last 8 elements, so continue will exit the loop at that point
 
ah i see...
 
wait, I'm telling lies
continue moves to the next element, break; would exit
it should say break; not continue;
 
ah yes break would exit
what about return?
i used return to exit methods
 
5:03 AM
return exits the current function
yeah
 
ah okay I understand
 
I updated the code to only use basic arrays
 
my teacher told me something about multidimensional arrays
 
yep, you could do that too
 
can you show me an example of that?
 
5:05 AM
my code won't work if 0 appears in the data set
a multidimensional array is an array of arrays
 
so in the multidimensional array i have my data and duplicates array
 
so, for example, if you wanted to store a pair of values together. Say your username and email address. you could make string[] pair = { "hsimah", "hsimah@email.com" }
then string[][] users would store my string[] in an array
so yeah, you could keep an element in your data array and the count in the array
 
I see i see...
 
@TomW have u worked with crystal reports any time before?
 
okay looks like i need some time to digest all these!
Much thanks for teaching me, hsimah!
 
5:14 AM
that's okay. I remember not doing too well on algorithms and data structures in school
it just seemed so foreign to me, you'll get there in the end
I updated the code one more time to make it a bit better gist.github.com/hsimah/0cb3d69f839a7dc1e47fde6b35ef8db4
 
thanks!
 
now I'd better get back to what they pay me to do
 
Haha okay!
 
5:39 AM
does anyone here use redis and in particular the stackexchange redis package?
 
5:50 AM
hsimah, for some reason the data (2, 1, 3, 2, 4, 2) comes out as 2 duplicates
why is that so?
the only duplicate is 2, hence shouldn't it be 1 instead?
 
probably a logic fail on my part, it's probably counting the three 2 twice
 
yeah thats where my algorithm failed too when my teacher pointed out "what if the next number is 2 again"
man... this is impossible to solve with the fundamentals i have
 
nah
anything is doable with computers mate
 
Hello mates, and i am back again with my questions ^^
Is it ok to handle object persistence using Event handlers?
 
@Kuyo
are you only using int ?
 
5:57 AM
yeap
The question here:
Write a program in C# Sharp to count total number of duplicate elements in an array.
Test Data:
Input the number of elements to be stored in the array: 3
Input 3 elements in the array:
element - 0 : 5
element - 1 : 1
element - 2: 1
Expected Output:
Total number of duplicate elements found in the array is: 1
 
ok
 
user6438653
6:12 AM
C#
 
did you know the # is meant to be four pluses, so it's C++++
 
@shad0wk have you used Events of Object like: EmployeeEmailChanged to Handle state change and persistence?
 
Good morning.
 
@AvnerShahar-Kashtan morning good
 
user6438653
@QuietNaN No sorry :(
 
user6438653
6:16 AM
@hsimah Oh, no. I'm sure it was because of the sharp music symbol or something.
 
user6438653
@AvnerShahar-Kashtan Sup man.
 
@shad0wk You know. Life.
 
user6438653
What?
 
@shad0wk "sup" -> "what's up". The answer to that is "you know. Life".
 
user6438653
Ohhh, okay, makes sense.
 
6:19 AM
@AvnerShahar-Kashtan Have you used such technique:
1. You got Domain Object Employee, it has behavior employee.ChangeEmail(...); which saves event in employee.UnprocessedEvents.
2. When i pass this domain object to Repository and call repo.Save(employee), save method gets unprocessed events and publishes them and then event handler handles each event e.g. Handle(EmployeeEmailChanged @event) which updates value in DB
?
 
@shad0wk it's 'sharp' because it's the muscal note, but if you look at # it looks like four little pluses stacked two by two.
 
@QuietNaN Not really, no. It looks like you're trying to implement yourself what your ORM should do for you.
 
user6438653
@hsimah true.
 
I would rather just change an Employee's Email, and rely on my ORM to know that the domain object is changed from its DB state, and update the changes.
 
@AvnerShahar-Kashtan Ok, and does EF detects changes in related childs?
atm i write like this
context.Entry(originalShoppingCartItem).CurrentValues.SetValues(newShoppingCartI‌​tem);
 
6:30 AM
@QuietNaN It should, yes.
 
@AvnerShahar-Kashtan but this thing:
context.Entry(originalShoppingCart).CurrentValues.SetValues(newShoppingCart);
doesn't detect changes in childs CartItems, like if i one is removed, one updated and one added, it doesn't detect
I am just comparing Original to New and than i make decision
Update or Add or Remove
I can link Save() method code if you have time to look at it
as i know CurrentValues.SetValues only updates scalar properties but no related entities, and if you want to handle related childs add/update/remove you should write it manually comparing Original to New
 
user6438653
7:02 AM
bye
 
7:25 AM
good morning
 
Good morning @ntohl
 
Morn all
 
o/
 
7:40 AM
\o
 
7:51 AM
Is there some add-in for VS that lets me launch a specific project without debugging?
Like the Debug->Start Debugging option in the project context menu.
 
Isn't there a "start without debugging"?
I have that, and the hotkey is ctrl + f5.
 
@scheien That's to start the project set as the Startup Project.
I want to start a specific project without changing the Startup Project.
There's "Debug -> Start New Instance" and "Debug -> Step Into New Instance", but no "Launch Instance Without Debugging".
 
I see. Damn, I need to learn to read. :)
No, not sure if there's any add-in for that.
 
you need the IDE to do this?
 
@Squiggle Why not? Sure, I can navigate to the output folder and run it from there, but that's a huge time waste when I'm already there in the IDE.
I'm debugging our client process, for instance. Then I decide I need to launch a server process, but I don't need to debug it. I can either launch it in the debug session and then detach, or detach from the current debug session, set the startup project, launch the second process without debugging and reattach/relaunch the original process.
I'm already in the IDE. That's where I manage my projects.
 
8:04 AM
You could write your own add-in though.
 
Probably.
 
44
Q: How to start a single project without debugging in Visual Studio?

Oliver HanappiMy solution contains multiple projects which can be started. SometimesI would like to start a single project without using my solution startup projects settings. When I right-click on the project, I can navigate to Debug->Start New Instance, which starts the application with debugger. But I woul...

that is the closest. Uses VS macro
 
Well, macros are dead since VS2012.
So writing an add-in is the option.
 
time for a little yak shaving, huh?
 
@Squiggle Nah, I've done enough of that already (added an SQL Server scalar function to translate unix time milliseconds to datetime, and added it to our EF DBContext to be auto-created for all code-first databases).
 
8:34 AM
Morning
What do you fine people do for deployments? Does anyone use AWS, Azure, GoogleCloud?
 
does anyone have worked with crystal reports? I had some issues in showing up the report in an asp.net.

Here is my code snippet, https://www.pastiebin.com/57f5d1891f6b3
there is no errors but nothing is showing up at the same time.
 
@tmutton I've used Azure webapps / sqlserver. It works fine.
Though we don't do CI.
 
How do you manage db migrations?
 
I manage them manually. (I know, it's stupid)
mostly because I do model-first.
Though that will have to change when I eventually upgrade/migrate to EF Core.
 
8:50 AM
anyone can tell how to send the descending as string parameter in this query ?
from alarm in recordsOfMeasAlarm
join element in treeElements
on new { x = (uint?)alarm.PointId, alarm.AlarmLevel } equals new { x = (uint?)element.ElementId, element.AlarmLevel }
where alarm.AlarmId > id && (element.AlarmLevel.Equals(AlarmLevel.Danger) || element.AlarmLevel.Equals(AlarmLevel.Alert))
orderby alarm.AlarmId descending
 
@tmutton but if I remember correctly, there are options for running your migrations when deploying your site, in the publish options. Not sure how that is for continous deployment though. Might have to set some rules for how to treat them.
 
9:05 AM
"Hey, how do I do a ng-model debounce in Angular 2?"
"Oh that's easy - just use the reactive extensions debounceTime() operator on a form control's valueChanges observable"
"Did you just tell me to go fuck myself?"
"Yes, I believe I did"
 
:D
 
I've never used EF
 
component-driven UI is really powerful, but boy does it take some time to adapt your way of thinking
 
Deploying and managing apps in the cloud interests me. I've thought about how the db might be managed and I'm struggling to think how migrations would work with multiple databases.
Ie you've got a db in serveral locations
 
use a distributed data store
 
9:14 AM
So right now my app will be using postgresql
I'm going to be deploying to AWS
 
will your app require scaling?
if not, don't worry about it :)
 
I'd set the database up manually. I suppose the management of the db will be done by aws in terms of here's the db location 192.139.2.1 and it could be a distributed db behind the scenes.
 
@Squiggle haha :)
 
That's the thing. I like to plan for eventualities. So it could scale.
 
"distributed db" is harder than it seems
 
9:17 AM
@tmutton In Azure you can attach to the databases from a remote location (e.g. your office).
 
because if you want all instances of the database to have the same data at all times, you're talking about distributed transactions - and that's really bad for performance
 
Yep
 
yeah, Azure has ways to mitigate this transparently
 
So insert record > passed onto primary db, then mirrored across instances
I think I'm overthinking things when I shouldn't be.
 
azure.microsoft.com/en-us/services/sql-database Azure SQL Database - build-in scalability
don't roll your own
 
9:19 AM
Ok
 
also if your database is a bottleneck, reconsider your persistence strategy in terms of performance
e.g. do data warehousing and analytics in a separate instance
 
Right now it's going to be a single db instance somehow
I'll cross the scaling bridge when I come to it
I don't want to be paralysed by it right now
Spending too much time planning for the future when I'm not shipping anything
It's a real problem I have!
 
what sort of data are you persisting? could that be better done using a NoSQL/document db?
hehe
yeah it's a programmer's nightmare. Just build it.
 
@tmutton Hey, we share the same boat.
 
That's the thing, the system isn't even up and running yet.
Never used a documentDB before
I'm planning the db structure and it's caused me a little headache but nothing too serious
The family tree system is based upon people
So a person will have an id and a name
Another table will be claims for that person. For instance birth date along with a link to evidence for that claim.
Traditionally with family tree structures you have all kinds of attributes for a person and those will usually be part of the same table. I'm separating them.
 
9:31 AM
Guys can anyone help me with a WCF hosting issue
I've hosted a wcf servce in IIS
 
Though this will come at a performance cost (if the data is to be searched upon).
Anyway, all good fun.
 
I'm getting error
The message could not be dispatched because the service at the endpoint address 'net.tcp://myusername.mydomain.com/RTAService/NAVFASService.svc/mex' is unavailable for the protocol of the address.
If the service is defined in the current solution, try building the solution and adding the service reference again.
Now I've enabled net.tcp enpoint for the application in IIS
and the config looks like this
 <services>
      <service name="RTAService.MDMService" behaviorConfiguration="Default">
        <endpoint address="" binding="netTcpBinding" contract="RTAService.IMDMService" bindingConfiguration="TCPWindowsSecurity">
        </endpoint>
        <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" />
      </service>
      <service name="RTAService.NAVFASService" behaviorConfiguration="Default">
        <endpoint address="" binding="netTcpBinding" contract="RTAService.INAVFASService" bindingConfiguration="TCPWindowsSecurity">
 
Does net.tcp have a default port, or do you need to specify it?
 
No, it doesn't have a default port
let me check again
 
hi all, I have a strange problem. I just started to move my app from WinForm to WebForm. I'm binding a list to GridView. it works but when a second user login, also that second user see that first user's list in GridView. why it happens ?
 
9:37 AM
yeah it has a default port
should I enable port sharing?
 
@LikePod No, not webforms! Why webforms?
@LikePod And as for your question - there's no real way of knowing without seeing the code, of course, but I assume you're using the Application cache to store user data, instead of the Session cache.
It usually means you've got your authorization and session handling story really screwed up.
 
@AvnerShahar-Kashtan there is no a particular reason actually..
@AvnerShahar-Kashtan oh thanks. do you think that instead of webform , MVC will be a better solution ?
 
@LikePod Yes, definitely. Much better.
Webforms is an outdated and clunky framework whose architectural vision - to be like WinForms, but for the web, erasing the client/server impedance - was a bad idea when it started, and proved to be untenable the more people tried to make it usable.
But mostly it's obsolete and only barely supported, doesn't play very well with modern front-end frameworks, responsive design and other expectations people have in 2016 for their web applications.
 
@AvnerShahar-Kashtan i understand, thanks god, i just started to develop it and didn't spend a lot of time, i will go with MVC
 
9:44 AM
@AvnerShahar-Kashtan thank you :)
 
Me me...help me next \o
 
@SamyS.Rathore Sorry, I've never hosted a net.tcp WCF service under IIS.
 
What about doing file..new..project.. ASP.NET web application?
so, not file..new..website..asp.net webforms
 
@AvnerShahar-Kashtan oh, okies
@barlop was that for me?
 
10:02 AM
@SamyS.Rathore no, for @AvnerShahar-Kashtan
 
@barlop Oh. I didn't understand what you were asking.
Yeah, you can still create WebForms applications in VS2015, but I really, really wouldn't recommend it.
 
i'm not asking if you recommend creating a webforms application in VS. I understand you don't
What i'm asking is, about doing file..new..project...ASP.NET web application (I guess maybe that's not webforms?)
 
can anyone explain to me this "-" sign in this statement ?
ascending ? x.Id : -x.Id
 
10:20 AM
@Kob_24 It's a minus sign.
Technically, -x is evaluated to (0 - x), or, more simply a minus sign.
No, no, I'm wrong. It's a specific, unary minus operator.
 
(0-x) multiplied by a number, is the same as a unary minus operator
in terms of the result anyway.
 
In the end result, yes, but I originally thought that the -x statement is evaluated to (0 - x) and the binary subtraction operator, but it isn't.
 
maybe it is evaluated to (-1*x)
 
x.Id * -1 would give the same result
 
yeah but that says nothing as to how it is worked out
 
10:24 AM
true.
 
I actually have a couple of places in our codebase with (-1*x) statements, simply because I didn't think to use the unary - operator.
 
I'm guilty of that as well
 
I even ended up adding a SubtractMilliseconds extension method to DateTime because I was tired of calling AddMilliseconds(-1*x).
 
yeah? i know what does it do?
lol
 
uhh, what?
 
10:42 AM
I did everything I could, but I can't get my WCF service to work
and the funny thing is it was working fine till last week and I've changed nothing at all
T_T
 
10:53 AM
WCF, ladies and gentlemen.
Did you reboot your machine?
 
Communication breakdown.
 
@scheien It's always the same.
 
I'm having a nervous breakdown.
1 week left. Countdown initiated.
 
11:20 AM
@Squiggle I did, didn't help
 
11:42 AM
did you enable tracing to help with debugging?
 
@SamyS.Rathore which guide did You use?
have You rechecked it?
 
12:14 PM
@JakobMillah braaaaahhhhhh
 
12:55 PM
Eversicne @JakobMillah has stopped working the C# chat just died :<
 
:D
at least I can read all the posts
 
1:20 PM
sup mates
do you know what is using Amazon for Order IDs
GUIDs? :D
 
@QuietNaN definitely not that
just looks like some arbitrary format
 
@KendallFrey Couldn't find any information about that in internet, i am interested :))
 
My latest order number is 3 digits, 7 digits, 7 digits, separated by hyphens
 
so it will be custom format string right?
 
looks custom
 
1:27 PM
They've got a monster shipping and tracking system in place. I wouldn't be surprised if there's a lot more than just uniqueness going on in those order IDs.
 
i have one question, if we will iterate through 0-int.maxvalue and convert each number into hexdecimal, will there be chance to have duplicate hexdecimals?
 
does anyone else see Nerd's profile picture fail to load properly?
 
@KendallFrey yup
 
@QuietNaN No, just like any other base system
 
1:38 PM
thanks
 
Good... ehrm... afternoon everybody
 
@Bechi just say good (ugt) morning. That means in universal greeting time, that You logged in to the chat. No matter which day part
 
2:07 PM
@KendallFrey crazy, it loads when I click his name, but the thumb in chat is half gray.
 
sorcery
 
Is doing per-user config in App.config reasonable? It's an in house tool used exclusively by developers. Or should I be using a separate .ini or similar?
 
What do you mean by per-user?
 
Eg, part of the "install" process (using it loosely because it's just copying down the folder) would be modifying the username/password in App.config.
 
2:17 PM
<jim>
     <someThing someValue="whatever"/>
</jim>
<bob>
      <someThing someValue="Some totally other thing" /?
</bob>
?
Because yeah, that's crazy
 
@KendallFrey evrybody ees it liek that
it also loads
when i write 3 or more messages
Tada
 
that's the same thing
it's the 16px version that's broken
 
@MorganThrapp I'm willing to be convinced otherwise but my gut says this is crazy talk. If the devs have access to the source, they can just edit it locally, otherwise make them input their credentials when the application runs.
 
So would you do it via an ini?
 
2:23 PM
I have never had to use an .ini for anything outside of installing video game mods, so I don't know.
 
@MorganThrapp I'm not sure why you wouldn't use app.config. That's what it's there for.
 
@KendallFrey Okay, I thought so. Just wanted to make sure.
I had read something that made it sound like it shouldn't be used for that, but it didn't make any sense.
 
Did a post build cmd line script, worked the first time
( ͡° ͜ʖ ͡°)
 
@KendallFrey on a per-user basis though?
 
Well, yes, that's what per-user settings do.
 
2:42 PM
@MorganThrapp yep, crazy. Do role-based auth instead
Ask your IT to add an AD role called YourAppUsers and check the user has that role
 
Per-user may be the wrong term. Each install will only have one user. Per-install would really be the better term.
Also, hahahaha, IT department. :P We're 15 people.
We just got a domain 6 months ago.
 
That actually makes it easier
If you don't have a Preventer of Information Services you can just do it
Rather than go through the bureaucracy
 
The problem is that it's being deployed on client machines. It's basically a microservice that gets called from our main software.
I don't have control over their user setup.
I'm really thinking app.config is going to be the easiest.
 
Uhhh
Your architecture is crazy
 
@TomW Yes.
Very, very, very terrible interesting.
 
2:47 PM
@MorganThrapp In that case, app-level settings will work just as well
 
@KendallFrey Yeah, that's what I'm doing now.
Is there a generic name for the string modification operators? Eg, @ and $?
 
Has anybody heard of a tool for consistent naming of methods / namespaces / projects , etc?
Maybe having something like this would be too constrictive
 
I suggest a crowbar and a willingness to get smacky.
 
I don't have enough time for that though, fun as it would be
 
Sounds like you need CaaS.
 
2:59 PM
What's Caas?
 
Crowbar as a Service.
 
haha
 

« first day (2182 days earlier)      last day (2769 days later) »