« first day (2578 days earlier)      last day (2363 days later) » 

5:04 AM
 
 
2 hours later…
7:10 AM
Good morning
 
ohayou
 
7:23 AM
hi
 
8:03 AM
good morning :)
 
8:14 AM
anyone here good with linq internals?
 
8:26 AM
good morning
 
I dont think its healthy if your internals are made of linq.
 
You can't decide for me what's healthy and what isn't
 
... at least they would follow a strict logic
i still feel dumb for friday :D
(almost ashamed ^^)
anyway
how does linq combines multiple delegates into one?
like: Delegate query = source.where([...]).Take([...]).OrderBy([...]).Compile();
 
why not take a look at the source code?
 
8:46 AM
Good morning.
 
good morning Avner
Is it OK to make an empty interface and make it base of some classes , to be able use them in generic way ?!
 
The term for it is "marker interface".
It's done occasionally, but it's usually seen as a code smell - if there's no functionality or data shared between the classes, why are they stored together?
 
@MohamedAhmed if you use such an interface to check if a type implements it there has to some common method which it could implement
 
9:16 AM
Trying to uninstall VS2015. For the past five minutes it's been updating the VS2015 Setup app so I can uninstall it.
 
@AvnerShahar-Kashtan in another interface I want to have a method that has a parameter of this empty interface
 
@AvnerShahar-Kashtan I'm not Avner, but I can easily tell your that's the whole point of interfaces (implementing them). Whether it has to be empty or not depends on you, however it doens't make much sense to implement an empty interface... Usually, as in 99% of the time, you'll want to implement an interface for your object type to feature whatever functionality you may require
Oh and I have no idea why that reply pinged Avner either...
 
9:33 AM
A yellow diamond is a yellow diamond. *shrug*.
 
I tried it:
in my interface this method:
public Ifc{
void DoSomeThing(IEmpty emp);}

in the class implementing Ifc I can't do this:
public void DoSomeThing(Empty emp)//should be IEmpty{}
 
@MohamedAhmed Why do you need it? You have a GetEntity method that returns an IEntity, but if that IEntity doesn't have any methods or properties, what will you do with it?
 
Why Empty, not IEmpty.
You want your implementing class to implement it for a specific Entity?
 
good question..
I have no answer :D
 
9:36 AM
So what you need to do is have your class do public void DoSomething<TEntity>(TEntity entity) where TEntity : IEntity.
Now you can have your method be generic, but still constrained to only a subset of classes.
Of course, it still makes no sense. What would DoSomething do, if it doesn't know anything about IEntity?
 
The only reason for empty interfaces is that you eventually populate such interfaces with common functionality. I bet there's that one exception somewhere or some hack that does whatever but...
 
@HéctorÁlvarez I've ran into some of those edge cases, yeah, but that's just what they are - edge cases.
I am still uninstalling VS2015. *sigh*.
 
Are You switching to 2017?
 
@ntohl Yeah, finally.
Started a new project yesterday.
Going to be very different than the last one.
That one was a WPF front-end with a self-hosted WebAPI2 front-end, all on VS2013.
 
nice. We need a lot of time till switching to 2017
we are also doing WPF front-end
 
9:46 AM
This one is brand new, so it's all new tech. Will probably be Xamarin.Android, Xamarin.iOS and UWP front-ends with an Azure SerivceFabric back-end.
 
Why not Xamarin.FOrms?
 
It's also on the table, along with ReactNative.
But the general consensus is that Xamarin.Forms is mainly good for simple data-entry UIs, not for anything flashier or more native-feeling.
And "flashy" is one of the requirements here.
 
10:07 AM
@AvnerShahar-Kashtan patience, think about something pretty, like a recursive method that returns permutations of a given float point number
@AvnerShahar-Kashtan Don't use Azure... dooooooooon't!
 
Finished uninstalling VS2013, VS2015 and Civ5. I now have enough disk space for VS2017 and all the azure SDKs.
*sigh*.
@HéctorÁlvarez That's non-negotiable, seeing as it's an internal enterprise app for Microsoft.
 
@AvnerShahar-Kashtan Oh the painful base requirements
 
Azure's not that bad.
 
Oh please tell me with Civ5 you don't mean Civilization 5, one does not simply uninstall Civ5 without playing one more turn
 
@HéctorÁlvarez Don't worry, I still have it installed on the desktop machine at home.
 
10:11 AM
@AvnerShahar-Kashtan So I'm there to deploy a shibboleth, a SQL Server enterprise and a bunch of other stuff around using their IaC feature, out of 6 tries it didn't work once, and at least 3 times it hung and took us about 30 minutes to wait until it completely crashed to start over.
 
Never touched the IaC stuff. Might be broken. Azure is a lot of stuff, some good, some not.
ServiceFabric mostly works.
 
I would use Amazon's elastic computing environment if I had the chance
then again, I'm still a scrub at cloud computing... haven't done much in that sense
 
Quiet this morning. Anyone up for a quick chat about a solution architecture problem?
 
I'm !(down for a long chat)
 
10:26 AM
So the opposite of "chat" is "chat"?
 
OK, here's the problem. I'm working with a propriety C++ class which threads as follows
First, you have to initialize it
Then you can create up to 32 "sessions" of it, each one of which can act independently on its own thread
(Each session has to be opened and closed when you're done with it)
 
@AvnerShahar-Kashtan hmm. I don't know what have to be inverted. For example !(I have seen a red car) should be I haven't seen a red car, not I haven't seen a non red non car.
 
Then you have to tidy it away
If you don't follow this sequence precisely, it will die and take the whole process down with it.
So my issue is this: those 32 session work best as instantiated objects. I can create a collection of 32 of them and work with each individually
However, the init and de-init methods don't fit that model
What I've ended up with is a wrapper class that instantiates but which ... don't hit me ... has static methods for the init and de-init. Which is I know if crap
But I can't think of a better way to model it
?
 
This is C++?
Or are your wrapper classes C#?
 
No, sorry - my wrapper is C#.
 
10:30 AM
wrap in Disposable
 
I'm pretty clueless when it comes to C++
 
Because either way, it's class RAII - you init the session in your wrapper's ctor, and deinit in Dispose().
As @ntohl says.
 
It's already in disposable
 
and use Dispose method's managed part as freeing part
 
That model is fine for the 32 "sessions" the thing can hold
But I can only init and de-init once ... and you need to do that before instantiating any single session
 
10:32 AM
Ah, that.
Have another IDisposable wrapper, for the main class.
That's the one that exposes the 32 sessions, so if you init in its ctor, you know you can only access them after it's initialized.
 
Yes, I wondered if it needed splitting in to two classes. I'm kind of averse to that, because it's neat to have it all in one place - SRP etc
 
That's not SRP. In fact, it's the opposite.
SRP means splitting responsibilities because each unit should be in charge of one thing.
Your main class is in charge of providing you with sessions.
Your session classes are in charge of perfoming the task.
 
So ... two wrapper classes: one for the init and de-init and the other for the sessions?
 
@AvnerShahar-Kashtan I think 'long chat' was a literal, that's why 'chat' does not need to be negated.
 
@ntohl Hmm. I'll accept that as a noun-phrase that is negated as a unit.
@MattThrower One for the main SessionContainer, and one for each Session.
Yes.
 
10:38 AM
@AvnerShahar-Kashtan OK, thanks. I work by myself and sometimes it's just nice to have a second opinion that what you're planning is the right thing to do.
Esepcially since unpicking this is going to be a fair amount of work
 
 
2 hours later…
12:11 PM
Hi, good morning everyone
 
12:42 PM
-1
Q: Database connection is not closing properly

Pankaj MishraI am using C# linq to sql application and my application is running 24*7 in servers. Now i am facing the issue database connections they are not closing so active connects reach to 200 and more. I used using syntax everywhere I am dealing the database directly. But this is not solving my problem...

please help me on this question
 
hi all
I want to convert to string 20170230 in the date format like 2017/02/30 in c#
 
@Bheesham csharp-examples.net/string-format-datetime ... use google, not a chatroom
 
@PankajMishra I added a possible solution, please check if it works.
 
12:58 PM
thank you so much let me check
@HéctorÁlvarez If i return before closing syntax of using so is this able to close the connection or not.
@HéctorÁlvarez don't checspelling and name please tell me on thing if i use like this
tblApiLinks lst= dbContext.tblApiLinks
means directly get the table from datacontext so the connection will remain open right?
 
it has nothing to do with whether the connection stays open or not
the connection's life starts when you open it and ends when you dispose it
if you don't open it, you'll get an exception when trying to fetch data because the object is closed
if you don't close it, then it lingers forever
please try the example I provided and tell us if it creates more lingering connections or not
 
1:30 PM
@PankajMishra
 
At what moment should I be thinking of using a NoSQL database? If I have 10k products? Or 10 million products?
 
NoSQL is intended for small structures
 
@HéctorÁlvarez My current code which have added in question is create 200 + open connections .it is running 24 * 7
 
@PankajMishra But did you check my answer?
 
@HéctorÁlvarez I'm kinda looking for a "use case" where NoSQL vs. SQL is a 50/50 choice. Where NoSQL is maybe a bit faster. Where for example SQL has Entity Framework ORM and easily maintainable.
 
1:44 PM
@ErwinOkken NoSQL is the crappy version of standard SQL. You lose all sorts of consistency in favor of speed, which is often used when you intend to consume services from more limited platforms, such as a mobile phone or a budget laptop
It is as scalable as a bunch of text files in a folder, you may keep adding files and files, and access to those files is lightning fast, but good luck if you want to join data from 5 of those files at once
Standard SQL is better if you have the resources to handle it in every single case scenario
The other reason would be storing massive amounts of information that nobody's going to check, but I don't really see the point for that sort of database
we are talking about a single table having over 50 million rows and 20+ columns
in that case, something like MongoDB might help
what's your case scenario @ErwinOkken?
gotta go, see you tomorrow guys
 
2:01 PM
@HéctorÁlvarez yes i check the answer but i can't use singleton whole system multithreaded
 
Hi, I have a question. I want to get the matching id from this list of operators but I get a bool instead of an int. Why?
What's wrong with my linq query?
   var opID = (await dataRepo.GetOperators()) //Returns Task<IEnumerable<Operator>>
                                .Where(a => string.Equals(a.ProcedureType, "ABC", StringComparison.OrdinalIgnoreCase))
                                .Select(x => x.ID == SelectedProc.Req.SPId);
 
You most likely want .Where and not .Select here
 
^ expand Your where clause with that x.Id == ..., and Select(x => x.Id)
 
also that, not sure what getting the id will help you if you already know it's equal to SelectedProc.Req.SPId
 
Perhaps FirstOrDefault will be the answer
 
2:13 PM
Sorry I meant the matching object and thanks guys lol
 
@HéctorÁlvarez Sorry, we had a break over here. You helped me already. The case is that I need to create an assignment for students where they have to choose for either NoSQL or (SQL in combination with Entity Framework). And I was to create a use case where both options could be an okay choice, depending on their reasons
 
and yeah firstordefault is what I was looking for thanks
 
2:37 PM
Hi everyone, this is Jaffal from Jordan, I'm new to stackoverflow community, nice to meet you all
we have a debate in our company if we should move entirely with Entity Framework and put all business in .NET and completely drop packages and stored procedures so we can switch to the cheapest database provider to cut costs, what do you think of that?
 
Hello Jafar :-)
 
> switch to the cheapest database provider to cut costs
 
!!welcome-c# Jaffal
 
It's Jaffal, hi Roel
 
@Jaffal Welcome to the C# chat! Please review the room guidelines and tips. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
2:40 PM
DANGER DANGER DANGER DANGER DANGER DANGER
 
I had been confused about asynchronous coding and threading for a very long time, and had almost given up all hopes of ever understanding it. But when I learned from a very good explanation on some other post that "synchronous/asynchronous really does not have anything to do with threads", and about how asynchronous tasks may also run on a single thread, then it all started making sense.

I do have a couple of questions though, and hopefully someone here can answer.

Context for my questions: When learning about coding a TCP listener with an asynchronous accept, I read that it would really
 
Noted Caprica
 
Caprica is a bot BTW
 
Ok
 
Jarar is funnier. Reminds me of Disney. Anyway.

I don't think this is a good think to cut costs on. If you have a problem with MSSQL licensing costs, you may want to migrate entirely to a different database engine, but that's not without hurdle. Idem, even if you use completely code-first EF (which has its own issues), switching SQL provider is not THAT easy and will require work.
Why exactly are you wanting to cut costs in DB?
 
2:41 PM
!!giphy guess ill die
 
not me the management
we actually against it and trying to explain to them especially that our system is legacy and complicated
Managements want to go cloud with MySQL or Postgre instead of Oracle
 
@PradeepPuranik Not necessarily. Tasks which represent asynchronous completion may or may not run on different threads. The task scheduler manages that. The default one just smacks them onto the thread pool and calls it a day (grossly simplified). You can replace the task scheduler with a single-threaded scheduler, which will work fine. That's because I/O bound tasks are based on completion ports, which essentially hands off work to the OS just to be notified later. That completion then runs.
 
reminds me of our german boss. He went in the server room (most likely high), plugged half the cables out, and called it a day. Now he saved half the electric costs...
 
If you absolutely, positively, 100% need to move off of MSSQL, consider MySQL or Postgres. They are similar enough that the transition won't be too painful.
However
 
2:44 PM
@ntohl pretty much the same here
 
If you work for a company that absolutely, positively, 100% must move off of MSSQL, consider looking for a new job.
Because your company is either full-on cargo culting or about to go bankrupt.
 
@mikeTheLiar I'm doing that already :) just trying to prove to them our point before I leave
 
So, I can just go ahead and write the asynchronous accept method, and not worry about the thread pool and such?
 
@Jaffal Just break it down into costs/effort/stability and give them an estimate of the involved work. Grossly exaggerate. They sound like they only see numbers, so give them numbers to worry about.
 
We were low in sales this year and the year before we're aware of that
thats why he is trying to sell the product on a subscription base to acquire new customers
 
2:46 PM
@PradeepPuranik Yes and no. You don't really need to worry about blocking operations exhausting the thread pool, but you do need to worry about multi-threaded access to shared resources.
 
@mikeTheLiar it was oracle before I think
 
Nice advice @RoelvanUden thanks
 
That's fine. Thanks a bunch.
 
@ntohl Oracle more like Cassandra amirite
 
5 mins ago, by Jaffal
Managements want to go cloud with MySQL or Postgre instead of Oracle
 
2:50 PM
Wait
Are you migrating off of Oracle?
You're currently using EF on Oracle?
 
hi all


I want to convert to string 20170230 in the date format like 2017/02/30 in c#
 
@mikeTheLiar currently using ADO.NET with Oracle where most of the business logic resides in Packages
 
I am so, so sorry.
 
The idea the management has is to switch to cheaper provider but in the same time move most of the business in the .NET so in the future we can move again to another cheap provider if things went wrong
 
I retract my earlier advice. Just kill yourself. It'll be less painful.
 
2:52 PM
lol
 
^
 
@mikeTheLiar talk to me what is on your mind?
 
I worked for a company before, where DB had all the business logic 800+ stored proc
You can't move it to .NET
 
@ntohl at best we can move the CRUD operations only
 
costs are just infinite
 
2:55 PM
thats what our company fails to understand, but I should've seen it coming, I worked here two years ago and finally convinced them to move to MVC instead of Webform and use VS 2015 instead of VS 2008 :D
 
for example EF can only support equi joins. You cannot do something like inner join A on A.foo >= '20171106' and A.bar = 'something' in EF.
 
yes and we do have other things that are much much complicated, like calculations and bulk imports
 
when You want to convert Your oracle stuff into EF, You will bump into a ton of obstacles like that
 
Hopefully I'll be out before that time comes
 
bulk import is also a thing, that You have to put EF aside while You are doing it. You can use them paralelly
 
2:59 PM
On another topic I'm planning to take Exam 70-483, anyone already took it? any advice? I've been coding C# for years now but some of the objects like multi threading and others never had the chance to work with
 
here exams doesn't have weight. You have to be good at the interview, and that's all.
 
@Jaffal that if you're already using Oracle with .NET just run.
 
Ok
on my freelance project I never work with Oracle I use MySQL or MS SQL with EF for small projects of course
but this company I work for Full time they've been in the market since 2003 the product was Oracle 6 Forms and in 2006 they switched to .NET and kept using the Oracle DBMS
 
> Oracle 6 Forms
> in 2006 they switched to .NET and kept using the Oracle DBMS
Fly you fool
 
@mikeTheLiar I just have a new project using oracle + C# + MVC 5.2.3
 
3:08 PM
Okay, so my advice to you - say whatever management wants you to say and GTFO
 
using devart without EF
 
My advice to your company - seriously reconsider your budget priorities. If you absolutely must have a free RDBMS, probably go with Postgres.
I have no idea if Linq to Postgres is a thing but that's the least of your worries.
 
I have the distinct impression the only projects that use Oracle databases are the legacy ones
 
my new project is just new for me. It is legacy.
just I'm joining it now
 
Is it possible to specify more than one file in <appSettings file="relative file name"> ? It seems not, but wanted to check
 
3:23 PM
@milleniumbug yes I believe so the only two companies I worked for that use Oracle had their products 10+ years ago
 
3:57 PM
Is there a benefit to using an action on an onclick event vs just using an onclick method? I'm working with a legacy system and I'm seeing in the code that buttons have a action associated with them and also have said action's action.onexecute() associated with the button's onclick event. ... I'm trying to figure out, from first glance, imo this is overkill, pick one or the other, but wanted to see what y'all thought. Also, the actions aren't being used anywhere else in the code.
 
4:11 PM
Any chance action was used to allow onclick and ontap events, for touchscreen compatibility?
I actually can't tell if you are using webforms, winforms or something else.
 
Does this look alright for a post request?
public async Task UpdateOperator(string requestId, string itemID)
{
    string cacheKey = "data.op";
    string url = "https:/foo.com/UpdateOperator/";
    var type = "Proc";
    url = url + type + "/" + requestId + "/" +itemID;
    try
    {
        Task<DateTimeOffset?> lastChangeTask = _localStorage.GetCreatedTime(cacheKey);

        string authToken = await Authentication.GetAuthToken();

        _client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
 
those urls should come from some dictionary, or controller stuff.
exception handling and logging should be also somewhere common with other clients.
 
ok will do but is the post request itself fine?
 
4:27 PM
@RichardHubley embarcadero vcl forms
 
I'm finished with the measurement of working hours of my new colleague. gist.github.com/mrtank/d442543e14fda57a58f3b23bddc84b0a
work / coffee break rate is 1.62214.
 
Sounds about right.
 
@HappyCoding Outside my expertise then
 
@RichardHubley I just found in embarcadero documentation that onclick() supersedes associated actions. Thank you for trying though
 
4:44 PM
I am using a data-image attribute in my view which is causing a 404 to generate
<div class="sidebar" data-active-color="blue" data-background-color="black" data-image="~/img/myimage.jpg">

the console says it cannot find '~/path/to/myimage.jpg'

what is the proper way to do this?
 
1) Here a traditional question... I have got two projects inside a solution that share libs from other projects inside the same solution... I set to false the copy local at the reference properties. All needed common libs are being outputed to the ..\\Common regarding the main programs.
2) I have read that basically you need to Assembly.LoadFile, but this seems to be not enough... I added also the GetType to create an instance but GetType gives me null.
3)I am quite lost here, even I tried with some of the stackoverflow proposed solutions, can somebody tell me how to properly load and use dynamically a dll/assembly? Thanks in advance!
 
So I'm sitting here in the debugger (VS2015), and I come accross an Action<bool>. Is there anyway to easily see the anonymous method/lambda behind it?
 
@MAW74656 The debugger should show private variables inside it, which contain the method
 
thanks @ntohl
 
4:56 PM
@KendallFrey I can see the variable, but looking into it isn't quite giving me what I want. Usually I follow the variable back through code and find where the lambda was set so I can look at that code. Just wondering if there's a more immediate way in debugger.
 
@MAW74656 Doesn't it have an option to see private members?
 
@KendallFrey Yes, but that doesn't give me code, just reflection info on the anonymous method.
 
Well yeah, you look up the method from there
If you mean it's an internal .NET method, your best bet is searching sourceof.net
 
Don't look up my method!
 
No, not internal, our method.
 
 
1 hour later…
6:04 PM
In WPF I have a DataGrid inside another control. In the DataGrid, I have both ScrollViewer ScrollBarVisibilitys set to Visible. But when I resize the window, the DataGrid refuses to shrink below the sum of the width of all the columns, blowing out the right side of the window instead. Does anyone know how to fix this?
 
6:29 PM
Set the datagrid to resize properly?
 
7:04 PM
Hi Everyone, Is it possible to print the context switch in a multi threaded application?
 
@RahulAgarwal There might not even be any context switching, because multiple threads can run simultaneously.
 
7:21 PM
@juanvan And how do I do that?
 
7:34 PM
Just believe in yourself.
 
7:45 PM
@KendallFrey ×÷
@KendallFrey, Well my to debug my application I want to find out, whether during execution of thread 1 C# Runtime is going to continue execution of thread 2. If you could suggest a better approach, It would will be helpful.
 
But why?
Threading is something that's designed to work regardless of context switches
 
There are couple of tasks executing as reader threads every 10ms. There are some shared resources between these tasks. There is Writer class which fills these resources. The Writer class generates data every 10ms. But the writer call gets blocked due to some reason. There are observations which show that before the completion of the writer method some reader methods are also executing. Note I dont have reader writer lock implemented.
So i wanted to log whether during execution of my writer method some reader method is being given some CPU time.
@KendallFrey
 
But why
 
8:01 PM
What's the reason why you want to compare threads?
Good code should just work
 
Well the Writer method is not able to execute its task quickly, reason of which can be cpu time being allocated to these multiple reader methods during the execution of this writer task, Which causes huge delays that is causing data loss. So i wanted to know do we have anything in the language framework which will give us details of the switch from one function execution to another function?
 
You're saying the Writer thread needs to have priority over the reader threads?
It seems the real problem though is the data loss. Maybe that should be fixed, rather than trying to avoid it.
 
8:51 PM
@RahulAgarwal "Note I dont have reader writer lock implemented." If you are going to be accessing data across threads without locking, you must know exactly how that data is being accessed. Reading data from a writer stream without locking sounds impossible at worst and insane at best.
You could try a double buffer like thing I guess. That way the one being read only needs to be locked when moving things from the writer thread over to be consumed.
 

« first day (2578 days earlier)      last day (2363 days later) »