« first day (2826 days earlier)      last day (2123 days later) » 
04:00 - 11:0011:00 - 22:00

4:33 AM
LOL how to make System.Timers.Timer make elapse first when Start
14
A: How to fire timer.Elapsed event immediately

user1791983I just called the **ElapsedEventHandler** with null parameters.

Found.
Finally I found local method helpful
 
mr5
Why not directly invoke the method inside the Timer.Elapsed event?
 
4:56 AM
Hello guys, is it possible to set up a relationship in EFcore between a property and a collection in the same entity?
 
5:15 AM
Good morning Sharperiños!
I'm not sure I understand you correctly, @JSON
 
You know I am kind of stuck in a model design
 
Within an EFCore class?
Since those represent tables from a database, they're connected anyway. THe collections are other tables.
What kind of property, and what kind of collection?
 
So I am trying to have all my uploads in one table
and use their Ids to store in other tables
 
So you wanna store files and make an index, and link other things to the index?
 
sort of
the idea is here
UserAvatarId represents just a record in the table File Uploads
 
5:19 AM
So you're going code first I assume?
 
yes
the issue here, if the record is deleted from the upload table there is no RI that maintains the UserAvatarId
is this a bad design?
 
How is the upload table connected to the avatarID? Is that where oyu want to connect a property with a collection?
 
yes exactly
avatarID now is just sitting there and the upload table knows nothing about it
 
Well it shouldnt - it hold Uploads. Doesnt have to do anything with Avatars for now, right?
 
The avatarID is holds a value that is stored in the Upload Table
 
5:32 AM
Of course the user uploads something and uses it as avatar. That avatar...is it stored in another table where AvatarID si the ID? Or should AvatarID refer to the uplaodtable?
Oh ok
So you have a foreign key referencing the upload table
 
AvatarId is linked to RecordId in Upload table
 
Is RecordID a PK?
 
Yes
I Tried to add a nav. prop like this
public FileUpload UserAvatar { get; set; }

builder.Entity<ApplicationUser> ()
.HasOne (c => c.UserAvatar)
.WithOne ()
.OnDelete (DeleteBehavior.SetNull);
 
So you just have to link AvatarID to RecordID, so EFCore can cascade it when an Upload gets deleted, right?
 
yes this the idea,
 
5:34 AM
The njsut make AvatarID a foreign key
 
but the problem is that The same table is holding the collection
 
So? It's a navigation property, isnt it? Since the Upload table holds a foreign key on ApplicationUser?
 
so basically the relationship will be
AppUserTbl - UploadTable (One to Many)
AvatarId - UploadTable (one - one)
yes but there is no RI
 
Wait whats RI
 
Referential Integrity
 
5:37 AM
So cascading basically?
 
yes sir
 
EF has that...there's gotta be a way to enable that in EFCore
 
EF does it by default, the problem here is my design i guess
 
What about your design?
Is AvatarId not a foreign key?
 
no
 
5:39 AM
Make it a foreign key then
 
I Tried to add a nav. prop like this
public FileUpload UserAvatar { get; set; }

builder.Entity<ApplicationUser> ()
.HasOne (c => c.UserAvatar)
.WithOne ()
.OnDelete (DeleteBehavior.SetNull);
the above is supposed to make AvatarID a FK
 
I'm not familiar with code first, so you're on your own here. I can just help with general db design.
 
Opps
ok, can I pick your brain on some ideas
 
There's a reason I always go DB first
 
how would upload your files
 
5:43 AM
Never tried, probably would take a random ASP.NET MVC example from google
 
I tried, there is no much out there
 
Not much means there is something though
 
just basics
 
ohayou
 
something like, just how to store file and thats it
 
5:49 AM
Morning Proxy o/
@JSON Maybe you can adapt this
 
Thank you @Squirrelkiller
 
Someday, and that day may never come, I will call upon you to do a service for me. But until that day, accept this justice as a gift on my half hour before work in the morning.
 
GoOoOoOoOoOoOoOoOoOoOoOd Mornin' neglecterinos!
 
@Squirrelkiller, That got me more confused lol
 
6:00 AM
Then jsut make a new project and copy it exactly
(And make it work)
The nyou should have an understanding of how it works
 
no, the thing is that there is no relatioship set up there
[BindProperty]
 
6:22 AM
...relationship?
I mean, just upload a file. After that, you can put it somewhere and link it in your upload table.
Different tasks, different responsibilities, hopefully different classes
 
6:37 AM
Good morning everybody
 
good morning, can someone help me? I am trying to use swashbuckle for my odata, how can I do this properly?
 
Good morning Dr. Bechi!
♪ Teenage Mutant Ninnja Tutrles ♫
 
@Squirrelintraining Turtles in a half-shell! Turtle power!
 
@RanielQuirante Swagger?
/OpenAPI?
 
@Squirrelintraining Dr. Bechi? Straaaange
 
6:49 AM
!!giphy Dr. Nick
 
Not what i was going for...
That is distrubing CAP!
 
!!urban distrubing
 
@Squirrelkiller distrubing The quality of being or ability to become homosexual or metrosexual.
 
Oh shit
@RanielQuirante You might find this useful.
 
6:54 AM
Shiet*
@Squirrelkiller you feel excited for holiday?
Maybe you could visit @HéctorÁlvarez :D
 
Good morning.
Finally solved my ServiceFabric deployment errors, which were a pain, so, hey, good morning!
 
Congratz Avni
 
Good Morning !
 
!!giphy party
 
7:02 AM
Turns out I had a new, partially-developed service in another branch. In this branch the code for that service didn't exist, of course, but git only removes tracked files when switching branches - the DLLs were untracked, so they remained when switching branches, and the script picked up on them and tried to deploy them.
 
@AvnerShahar-Kashtan ouch
 
mr5
o/
 
currently I am using .net core and swashbuckle.odata doesn't support .net core yet...
 
mr5
I'm on Schooling today (for certification)
 
how'd you fix it? hopefully you didn't commit the DLLs
 
7:08 AM
so do you guys know any workarounds or how to make this work?
 
mr5
I'm learning new terms in Azure: SaaS(use it), IaaS(host on it), PaaS(build on it)
 
I tried using the code posted by acjh
 
mr5
Is that exclusive terms for Azure only?
 
@Neil No, I just erased them. I don't want them in this branch. I don't need them at all - in fact, it's from a branch I discarded, as it was an approach we decided against.
 
but there is this error that pops up
'cannot convert from 'System.Net.Http.Headers.MediaTypeHeaderValue' to 'Microsoft.Net.Http.Headers.MediaTypeHeaderValue'?
 
7:09 AM
@RanielQuirante Dunno. We're using OData on ASP.NET Core, but we're running on .NET Framework, not .NET Core (ASP.NET Core can run on both)
@RanielQuirante Notice "System" vs. "Microsoft" in the namespace.
They're different types - one is probably older WebAPI2, the other ASP.NET Core.
 
mr5
@RanielQuirante specify the whole namespace
 
@mr5 What, SaaS/PaaS/IaaS? No, they're the common industry terms.
 
mr5
I'm very outdated in terms of Cloud computing
I know some run their WS in VMs, some run on the actual OS
So, if I plan to make a WS, I only need to subscribe to SaaS right?
 
@AvnerShahar-Kashtan Ah, well if you don't need them, then yeah
 
on our part were running .net core 2.1 framework @AvnerShahar-Kashtan
 
7:14 AM
We have binary output from compilation of a project, and of course the binaries aren't commited
 
@RanielQuirante ASP.NET Core uses the Microsoft.* namespaces, IIRC.
 
But the process involved with creating the executable always deletes the binary before beginning
 
Any code which expects System.Net.* is probably written for WebAPI2.
@Neil The CI server clears the binaries beforehand, but when deploying locally from VS, it doesn't.
 
I see now, thank you for pointing that out
 
well I suppose you could make it do so, no?
 
7:15 AM
I have a team member who's falling in love with value tuples. We're going to need to stage an intervention soon. :)
 
Seems like that would be somewhat important
 
@Neil Probably. Now that I know it's an issue.
 
ah tuples.. the bane of programmers everywhere
 
@AvnerShahar-Kashtan Out of curiosity: Why is it a problem for you?
 
mr5
I never had the need to use tuples
 
7:18 AM
I sense that I can learn something interesting here :-)
 
@Bechi Because it's often a lazy shortcut, instead of creating a new type.
 
posted on July 10, 2018 by Scott Hanselman

Last week I looked at "dotnet outdated," a super useful .NET Core Global Tool for keeping a project's NuGet packages up to date. Since then I've discovered there's a whole BUNCH of great projects solving different aspects of the "minor version problem." I love this answer "Why" from the NuKeeper (inspired by Greenkeeper) project with emphasis mine. NuGet package updates are a form of change t

 
Sure, you can pass around a value tuple of (double,double,object) representing an object and its x/y coordinates. But if that happens in more than one place, you probably need to have an explicit type (or interface) of an object with its coordinates.
 
Java doesn't have tuples or duples (unless you consider Map.Entry as a duple)
 
@Neil Sure it does. pair and triple.
 
7:21 AM
I can see why they didn't, but it's a pain everytime you need that association
 
pair.create().
 
@AvnerShahar-Kashtan In java?
 
I used it a lot. Maybe it came from a library and not from java core?
 
Okay, this is straightforward. I see. I did run into this issue one month ago, don't know what was happening to me at that time.
 
7:22 AM
Seems the one I used was from Apache Commons, yes, which was deeply integrated in the Java projects Iworked on.
 
Apache commons has a lot of useful things like that
really when you think about it, stuff that should have been in the standard java library
 
Here's a different place he used valuetuples which I did like:
 
mr5
.
 
public string ReplaceColors(this string svg, params (string originalColor, string updatedColor)[] colorTranslation)
 
mr5
seems inefficient
 
7:24 AM
Would you really ever need to replace more than one color?
 
I liked it because, unlike old Tuple<T1,T2>, the tuples here have meaningful names (not Item1,Item2), and passing an array of these color-pairs makes more sense than passing two lists (string[] original and string[]updated) and correlating them, or creating a very basic Translation struct for this one-off.
@Neil Yes, that's the use case. We receive an SVG and need to invert it, so you build a list of colors, get the inverted color for each, then pass the pairs in to invert.
 
mr5
how do you instantiate tuples of those anonymous types?
 
ok, then, I see no problems here :)
 
@mr5 You just pass them in, surrounded by ().
 
I normally don't like "enhancing" methods to do what would otherwise be done with multiple calls
 
mr5
7:26 AM
"".ReplaceColors(("blue", "red"), ...) like this?
 
For me, if the method handles multiple parameters, it does something differently than a bunch of calls individually
like maybe drawing a polygon as opposed to drawing a line between points
 
mr5
would you rather design your CreatePolygon as a series of calls to CreateLine?
 
what does this error mean ?

InvalidOperationException: Unable to resolve service for type 'Swashbuckle.AspNetCore.Swagger.ISwaggerProvider' while attempting to activate 'Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware'.
Microsoft.Extensions.Internal.ActivatorUtilities+ConstructorMatcher.CreateInstance(IServiceProvider provider)
 
Good morning
 
@AvnerShahar-Kashtan (and all others): I want to implement an interactive Drag And Drop Designer with nested controls. In order to be able to follow MVVM pattern, I have stolen an approach [1] that defines an attached property that I can use to bind the drop event in my View's UserElement to an ICommand of my ViewModel.

[1] http://www.wpfsharp.com/2012/03/22/mvvm-and-drag-and-drop-command-binding-with-an-attached-behavior/
 
mr5
7:33 AM
You probably forgot to register an implementation for your ISwaggerProvider
 
@mr5 how can I register an implementation for my Iswaggerprovider?
 
Now I woudl liek to take a similar approach to create an attached property for the mosueDownEvent
That I want to use to call the DragDrop.DoDragDrop within the ViewModel
 
@mr5 Both in this case
They do different things
Even if they're very similar
Creating a line is more "low level", but you could emulate a call to CreatePolygon by repeating calls to CreateLine, and finally one connecting the beginning and the end point
But you couldn't even get rid of CreateLine, because sometimes you only want to create a line, not an entire polygon
 
Swagger is called OpenAPI these days, isn't it?
 
Now my question (that somehow seems totally unrelated to the approach I'm following):
I see that I should check that the MouseButtonState of the MouseButtonEventArg is "Pressed", but do I have to take care? Wouldn't the DoDragDrop immediately stop after the mouse button is released?
 
7:40 AM
@Bechi This check is in the OnMouseMove event handler, right?
 
@AvnerShahar-Kashtan yes if I am not mistaken, sir do you know how to register an implementation for my ISwaggerProvider?
 
Well, I'm not sure. When I first tried to accomplish this in code behind, I created a test-method for the MouseDown Event, not for the OnMouseMove Event. This worked.

I did so because I thought that after DoDragDrop(...) gets called, the application transitions into a DragAndDrop state...
 
@HéctorÁlvarez where in spain do you lives?
 
mr5
@RanielQuirante I have no idea. Sorry mate
 
@mr5 its okay, you were helpful enough to point the problem which I am really grateful for :)
 
mr5
7:46 AM
@RanielQuirante try this link stackoverflow.com/q/38265064/2304737
 
@RanielQuirante Looking at our server code (not my code), we have this call:
 app.UseSwagger(c => c.RouteTemplate = "{documentName}/openapi.json");
 
mr5
That stack sounds gay. I don't like it lol
 
UseSwagger comes from Swashbuckle.AspNetCore.Swagger
 
mr5
ridiculous names xD
turns out swashbuckle is a legit word
I wouldn't be surprise if they also own the Calabash plugin we use in Xamarin
 
@Squirrelintraining Castilla y León (I believe the english version is Castille and Lion)
 
7:51 AM
TBH I Like that name already!
My cousin lives in Sevilla, so baisically on the otherside of spain from your point of view :D
 
Damn thats like 400KM from where I'll be
 
LMAO
You're coming to Spain?
 
18th Barcelona, 20th to tarragona, end of 23rd back to bcn and 24th I'm off to Milan
26th I'm back home
 
Oh I see, la vuelta a España
 
I'll be in Portugal around the same time :D
But in the Algarve
 
7:57 AM
The best you can do in Spain if you feel like it, is drinking, partying and eating a lot. In Portugal you can buy towels... a lot of towels.
 
They dont dry towels there, they just buy a new one each day they go to the beach.
Hey where do people from Spain/Portugal/Italy go on holiday?
 
@HéctorÁlvarez Don't forget your towel.
Have you even been to sevilla
As kids we went to Isla Magica quite often.
'tis super!
@Squirrelkiller One thing is for sure, not germany :D
 
Nope, never went down there.
 
My cousin quite often comes down to the algarve with us with her family.
 
We're in the middle, for us southern countries are great for holiday because they're warm and have nice beaches. Swiss and Austria have mountains. Northern countries have glaciers and shit.
Germany does have unlimited speed motorways though.
 
8:09 AM
some*
 
Yeah, that was more like a general statement.
o7 General Statemet
Can I use a string holding the name of a var to call that var from a dynamic reference?
(Without maeking 5 lines and using reflection)
Context:
My View wants to read a value on PropertyChanged by its datacontext, and I'd like to not have my View know my ViewModel
 
Did You Know: You can't really get the Bing Maps control to zoom out to show the entire globe.
@Squirrelkiller That string is a compile-time construct. A local variable inside a method doesn't keep its name at runtime.
 
@Squirrelkiller Let your view know your IViewmodel
 
@Squirrelkiller Isn't that just binding?
 
Yeah, manually.
But binding uses reflection. I don't like to manually use reflection.
@Squirrel then I could even do my own event. It's an option.
 
8:22 AM
I still don't know where the variable name comes into play.
 
ViewModel has variable, loaded from server or wherever.
View has control to show it, but one that cant bind. Has to call a method in c# code and pass the value from said variable.
How get value to view and make view call method?
 
@Squirrelkiller +1 IViewmodel is thway to go in my eyes anyways
Every view should have it's IViewmodel in my eyes.
 
Generally: No.
In this case: Probably.
 
It specifies what the view expects
Generally: Yes.
 
If you have a control without a DependencyProperty, the easiest workaround is to create a behavior that binds to the VM property, and updates the control.
 
8:25 AM
Generally, it's sufficient to get passed an INotifyPropertyChanged IMO.
 
That's a common pattern for adding MVVM support to non-MVVM controls.
 
I'm wondering here why you don't want your view to communicate with its ViewModel
 
Oh it does communicate, it jsut doesnt know what the viewmodel looks like
 
@Squirrelkiller No, because that doesn't ensure a Property "Name" is in the viewmodel
SO the calee fucks up and get's mad at you :D
 
@Squirrel that's for the dev to ensure
 
8:27 AM
@Neil did they announce what the discovery was? or is the announcement on a later day?
 
I'm missing the big picture
 
@Squirrelkiller And for us to enforce:D
 
Take a PasswordBox control, for instance. Its Password field isn't a DependencyProperty, soyou can't bind it. So we wrote a behavior that listens to changes to the PasswordBox's Password property via the PasswordChanged event, and binds to a SecureString on the VM, and updates.
 
Nope. I build a view that shows certain things. Dev wants to sue my view? Has to ensure he delivers those things.
 
That way you get to keep the easy-peasy binding syntax, and don't have to care about reflection or the VM's structure or whatever.
 
8:27 AM
@AvnerShahar-Kashtan Isn't that a bit unsafe?
BRB gotta buy a bocata for lunch
 
Gonna go with Avners idea, because I wanna get used to behaviours.
 
<PasswordBox >
   <my:PasswordBoxBinding Password="{Binding Password}"/>
</PasswordBox>
@HéctorÁlvarez It just passes the SecureString around.
 
brb meeting
!!afk Meeting
 
Bocata de tortilla. @Squirrelkiller must eat 10/10
 
@Squirrelkiller Aswell {DataContext d:IViewmodel } Q.E.D i just pawned you you dead, i win, nothing to be added. ALWAYS IViewmodel!
shots fired
killer got killed
the padawan supremed his master
is supremed even a word
don't know do care a bit
@AvnerShahar-Kashtan Can't bind to secure string afaik
--> Event on char enter --> put string into secure string
Okay maybe i should read messages before :D
 
8:41 AM
if I put this code

r.MapODataServiceRoute("ODataRoute","odata", builder.GetEdmModel(), new DefaultODataBatchHandler());

the odata doesn't show up and it says this "This localhost page can’t be found"

but when I use this code the odata shows up

r.MapODataServiceRoute("odata",null, builder.GetEdmModel(), new DefaultODataBatchHandler());

can someone explain why?
also, I would like to know what is wrong on the code that I used in this case... because the desired result that I want on swaggerui isn't really showing up...
 app.UseSwagger();
        app.UseSwaggerUI(c =>
        {
            c.RoutePrefix = "swagger";
            c.SwaggerEndpoint("/swagger/v1/swagger.json", "ObjektBrief OData API V1");
        });
when I go to this https://localhost/swagger/index.html

it will display this

ObjektBrief OData API
v1
/swagger/v1/swagger.json
No operations defined in spec!
 
I noew have finished the approach with creating an AttachedProperty thast can be used to bind MouseDown Event with an StartDragCommand of my ViewModel. It works.

Could you tell me why it might still be better to create an behaviour for the MouseMove Event?
 
@Bechi It isn't, necessarily. using AttachedProperties as behaviors is perfectly good technique - in fact, it was the only techniques before Blend added the Interaction.Behavior option.
 
@AvnerShahar-Kashtan Oh, that is clear to me (now). But I was wondering what additional use I could create (for dragging) by creating an attached property for the MouseMove Event.
 
9:04 AM
I added app.UseSwagger(c => c.RouteTemplate = "{documentName}/openapi.json"); and now I get this message

Errors
Hide
Fetch errorundefined /swagger/v1/swagger.json
 
@ntohl Oh, @ntohl I have overseen your response. Well, yes, there is some sort of drag and drop functionality for UserElements (in the XAML/ CodeBehind of the view). However, I want to be able to drag nested controls into and out of each other. This needs access to logic that is present in the (View-)Model, not in the View.
 
@Bechi ok. I don't know the depths of the problem. I haven't used that drag and drop functionality, just checked on it once.
a behavior is a good place to have common functionality of view and viewmodel
 
Yeah, thanks to Avner I'm making awesome progress here
I hope I can finish the basic nesting abiltities today. Moving stuff is then almost straight forward I think
And, man, I really LOVE the Resharper Licence my company bought
 
Resharper is usually cool
Beware is often breaks intellisense, or generally shits the bed in some way. Significantly more likely to happen if you have multiple instances of VS running
 
9:26 AM
I like R# too
I have no trouble with it yet
 
@LeeButler Multiple instances of VS on the same project?
 
Nah just multiple instances
 
Maybe setting R# to store its settings per-project and not in the shared settings folder might help
 
do you guys know a reference in regards on how to do OData with Swagger?
 
Do you actually need swagger? Doesn't Odata support exposing its $metadata endpoint?
 
9:38 AM
Have you read through these answers?
 
9:49 AM
@AvnerShahar-Kashtan yes, because the swagger ui is helpful to show the available endpoints to users & developers

@Squirrelkiller yes I did, but I am just using Swashbuckle.AspNetCore to make swagger work somehow
 
10:01 AM
Isn't there just the one endpoint - query?
 
available CRUD* on the API
 
$metadata exposes it, but as a detailed EDMX schema, which might be too much information.
Although just querying your /query/odata endpoint does returna a list of entitysets and functions available, it seems.
 
@AvnerShahar-Kashtan {"swagger":"2.0","info":{"version":"v1","title":"OData API"},"paths":{},"definitions":{}} there is no paths and definitions when I clicked this "/swagger/v1/swagger.json" at swagger
@AvnerShahar-Kashtan is this related as to why it shows 'No operations defined in spec!' at localhost:44361/swagger/index.html?
 
10:17 AM
@Proxy They're supposed to announce it at 3 o'clock GMT (4 o'clock my time)
 
@RanielQuirante AFAIK The Swagger module creates information for all controller endpoints, but for OData there's just hte one endpoint.
 
Announce what?
 
But I assume, if there's a Swashbuckle.OData package, that it should create a swagger page for the actual operations.
 
@AvnerShahar-Kashtan yes, you are right about that (its more like I am wrong on explaning why we needed it, sorry about that and thank you for clarifying it)

yes there is this swashbuckle.odata but it doesn't support .net core
at least for now
 
Sorry if I sometimes just don't answer, I'm a bit busy today
I see you are installing swagger... having trouble with that?
 
10:26 AM
@HéctorÁlvarez yes...
 
Can you summarize your problem?
Because I can't really read 50 messages right now
 GlobalConfiguration.Configuration
    .EnableSwagger(c =>
        {c.SingleApiVersion("v1","Whatever you want to put here")
        }
Do you have something along those lines in your swagger config file?
 
@HéctorÁlvarez Basically, I am having trouble creating information for all the controller endpoints that is related to the odata I am currently using. and currently I got this message when going to swagger ui

'No operations defined in spec!' and when I click the link

https://localhost:44361/swagger/v1/swagger.json It shows on the page this

{"swagger":"2.0","info":{"version":"v1","title":"OData API"},"paths":{},"definitions":{}}
@HéctorÁlvarez as of now, there is none I'll try putting it
and also I have no swagger configuration file... I thought I was suppose to put it on 'Configure'
 
Morning. Anyone feel like helping me with a corrupt Git repo?
 
If you installed from scratch you should have an auto-generated file for configuration and all the possible options
SwaggerConfig.cs
 
Git failed with a fatal error.
fatal: 'src/ERS3/ERS/.git' not recognized as a git repository
Which is not surprising since there's no such file
 
10:41 AM
@RanielQuirante Check this out:
                        // You can use "BasicAuth", "ApiKey" or "OAuth2" options to describe security schemes for the API.
                        // See github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md for more details.
                        // NOTE: These only define the schemes and need to be coupled with a corresponding "security" property
                        // at the document or operation level to indicate which schemes are required for an operation. To do this,
 
@HéctorÁlvarez thank you for helping out, I'll continue working on this once I got home again, for now I have to go for a while
 
OK cheers
 
G'day!
I've recently noticed a part of our program crashes because we send a special character ('ö') via the URL, tried to fix it by running it through WebUtility.UrlEncode() but doesn't seem to have changed much. Ideas?
Would it help replacing the letter with \\ö, so that it's escaped when it reaches the url?
 
That isn't the sort of encoding that matters to URLs.
 
Nevermind, I just realised something. The UrlEncode does work, it's just not the cause of the issue
 
04:00 - 11:0011:00 - 22:00

« first day (2826 days earlier)      last day (2123 days later) »