« first day (3319 days earlier)      last day (1612 days later) » 

8:02 AM
Good morning.
 
8:45 AM
@Vlad Searching for "public SOAP service" finds you quite a few possibilities, but for a demo, relying on an unsupported 3rd party service is risky for no reason - you can create a minimal SOAP service that runs in-process in your WPF app.
Twitter, AFAIK, only exposes a REST service, as do most modern public web APIs. SOAP exists mostly in legacy or enterprise apps.
 
8:56 AM
Moonan
 
V.7
9:15 AM
Hey there o/
 
yes hello how is life
 
life is life
 
 
1 hour later…
10:48 AM
I like that ode to a shipping label
unfortunately, I have a similar situation
at work, we use a reporting engine, and you pass that engine an xml document which should contain all the data that the reporting engine should use
however... it cannot process escaped characters
if you have <stuff>3 &lt; 5</stuff>, it will display 3 &lt; 5
luckily for us, we havent had to use less-than or greater-than symbols yet
 
11:22 AM
Have you considered unencoding them
 
<stuff>3 < 5</stuff> ?
then it gives an xml parsing error
 
No don't decode the entire thing
 
decode?
 
Decode the values when you're out of the XML context
 
oh, no, we cant
 
11:24 AM
Like after you've deserialised to some class, decode your values
Why not
 
that is internal stuff of the report engine
its not just a library or something
its an application that you feed xml
 
Oh
Then a better plan
 
we dont have the source code or any injection stuff
 
Don't feed it shit it can't deal with
 
ditch it?
oh...
 
11:25 AM
Alternatively, dfitch it
 
I thought my plan was better
 
If it can't parse xml properly then it needs to sort its shit out
Especially if its primary way of getting data is XML
 
11:37 AM
Should I stick with .net framework if i don't care about cross platform?
 
It's strange, one year you're XML, XML, XMLing everywhere, and then suddenly *poof*, XML is a legacy mechanism you don't care about.
@Blue No. .NET Framework is being phased out. .NET Core is the way to go, certainly for new projects, regardless of your platform.
 
@AvnerShahar-Kashtan you mean me specifically or just in general?
 
@Wietlol Specifically me.
 
hmm
 
But if I switch to .NET Core there are compatibility issues with class libraries and packages
 
11:39 AM
I used to do a lot of XML stuff. It was everywhere.
 
we use a rule engine that can only work with XML, we use a reporting engine that can only work with XML
 
@Blue For a new project? Maybe for very specific libraries you may be using. I haven't run into any compatibility problems yet, with hte libs we use.
 
XML is something we cant just ditch
even if we really wanted to
but I dont really see the benefit of it
at least, assuming we would switch to any other text based document format
 
@Wietlol XML used to be the de-facto standard for data serialization and interop. Then, relatively overnight, JSON replaced it for a big chunk of its usages (common serialization, APIs).
 
@AvnerShahar-Kashtan thanks... they still use cobol where I work... I fear this will be an uphill battle
 
11:41 AM
we did replace our web services from xml to json tho
but that is to be expected of todays standards
 
@Blue You can either switch to .NET Core now, or wait for ".NET 5" and switch then, since it will be the official "next gen" for .NET Framework (even though it will be, effectively, .NET Core)
@Wietlol XML remained popular for many legacy apps and many enterprise apps, either because they're got a lot of traction and little use for switching formats (a good reason) or simply because that's the standard for their line of business, which is also fine.
 
btw, I am trying to make an application that would set up projects for me
create a multi-module project, setting all stuff correctly, adding gitignore, serverless.yml, etc
but, what is the easiest way to create a local git repository, attach to a remote, add all files (respecting gitignore) and doing an initial commit?
 
@Wietlol Visual Studio has its project templates, but I'm not sure what other IDEs use for project scaffolding.
 
but does that project template allow setting up a git repo, connecting to a remote and doing a commit?
(not that it matters tho, since its not dotnet, so no VS templates for me)
at work, we use those project templates (I think from nuget)
 
@Wietlol Yeah, you can add a bit of code that will run as part of creating the project from the template.
 
11:45 AM
but as far as we know, they are really limited
as in, they do a text replace from ProjectTemplate to WhateverProjectNameYouChoose
 
Here' an example that finds a powershell script that's part of the template and executes it: stackoverflow.com/questions/14178312/…
 
but, back to the question, how do I easily do the git stuff?
should I use the cli, assuming the user has the cli installed?
and from my application run a process that executes those relevant commands
 
git init & git remote add origin <remote url> & git add . & git commit -m "initial commit" & git push?
If you're setting up a dev environment, it's fair to require that the git cli is available.
You can add a couple of git checkout or wget calls to public repositories to get the default .gitignore/serverless.yml/whatever files.
 
the url could be the same as the clone url?
I have my own templates for the gitignore and other files
 
Ah, if you're cloning you don't need init and remote add, just git clone
That will both set up a repo and initialize the upstream
 
11:51 AM
no, I am not cloning, that is just something in the response of my "createRepository" function
I am creating the repository using the AWS CodeCommit SDK
in the response, the only url thing I can find is "cloneUrl"
I suppose I could create the repo, then clone, and then generate the project
but I think this is better
 
I don't know the SDK, but it makes sense to me to create the remote repository on AWS, fully featured, then simply clone it locally.
Instead of splitting your creation logic between the remote and the local repos.
 
12:17 PM
hmm... perhaps
> fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use

git push --set-upstream origin master
I used the commands as you mentioned
is this expected behavior?
(I never use the git cli, so I am totally clueless)
 
I was working from memory, so might have skipped some steps. You might need to set an upstream branch before pushing (git branch -u origin <branch name>)
Though I think you can it inline as part of the push command itself.
Ah, yes. Just add -u origin <branch name> to the git push.
(-u is the short form of --set-upstream. If you're writing scripts that should be easier to read but only written once, I'd use the longer form)
 
hmm... I guess I will instead set up the repository with all the stuff and let the dev clone it
less chance of failure
 
V.7
12:45 PM
Although, an issue TextBlock with property MouseBehaviour.MouseUpCommand="{Binding MouseUpCommand}"></TextBlock> should invoke a method inside Dependency_1.cs
pastecode.xyz/view/3ea03a16
in the result - it doesn't
What I'm doing wrong?
Just in case, a simple sample project showing a test case sendspace.com/file/esps73
 
Did you try debugging? Did attaching the property work as expected? Are you getting the MouseUp events in the behavior?
 
1:07 PM
46 mins ago, by Avner Shahar-Kashtan
I was working from memory, so might have skipped some steps. You might need to set an upstream branch before pushing (git branch -u origin <branch name>)
Avner truly is a god
@V.7 are you actually using a mouse?
MouseUp doesn't work in WPF on touchscreens
For example
 
There's a set of "Manipulation_XXX" events for touchscreens, right?
 
Simply Touch_xxx
 
Haven't used WPF in a couple of years, and haven't written any touchscreen stuff with it.
 
Realistically you shouldnt be hooking up mouse click type events to a textbox
 
V.7
@CaptainObvious A usual mouse
@AvnerShahar-Kashtan Says Cannot retrieve value using the binding and no valid fallback value exists; using default instead. BindingExpression:Path=MouseUpCommand; DataItem='Dialog_1ViewModel' (HashCode=64636290); target element is 'TextBlock' (Name=''); target property is 'MouseUpCommand' (type 'ICommand')
Seems it can find a binded command for some reason
 
1:16 PM
@V.7 It looks like the problem is the binding, not the behavior.
 
V.7
Sure
 
What the fuck is this folder structyure
 
V.7
What would be the right way to bind a command for custom ViewModel and Window?
 
@V.7 I don't know what your datacontext is for that snippet (and I'm not going to download a full project locally). If MouseUpCommand is part of your window's datacontext (though it seems like a strange name for a command on a VM - it should be something logical), it should bind fine.
 
V.7
MouseUpCommand is in XAML like xmlns:t1="clr-namespace:WPF_5.Resources.Dependencies" where namespace WPF_5.Resources.Dependencies is where MouseUpCommand located
 
1:21 PM
I have no idea what you just put there.
 
Basically it's horrendous
 
Your view (the Window, I assume) has a ViewModel as its DataContext. You're binding to a property called MouseUpCommand on that viewmodel.
 
V.7
@AvnerShahar-Kashtan No a Window, but Dialog_1.xaml which is created on the go
 
The binding won't work ebcause there's no context set
 
V.7
1:31 PM
It has a Dialog_1ViewModel.cs as a DataContext, but MouseUpCommand is inside Dependency_1.cs which is connected in Dialog_1.xaml
@CaptainObvious Currious why then Button's dependencies works using such logic?
As you might see Button has Command="{Binding c_No}"
 
Yes
There is a property for that in the model
There isn't a property for the mouseupcommand
 
V.7
Uh, I see
1 minute
 
Maybe if I didn't have to open 6 different files to work out wtf is going on it wouldn't have been a problem
 
V.7
I've tried to set a command like for a Button, but getting System.Windows.Markup.XamlParseException: 'A 'Binding' cannot be set on the 'AddMouseUpHandler' property of type 'TextBlock'. A 'Binding' can only be set on a DependencyProperty of a DependencyObject.'
@CaptainObvious Sorry, that's how lectures and articles told(such structure)
 
That structure is insane
The fact that VS doesn't know what's going on itself means its bad
 
1:37 PM
@V.7 That's because you're mixing MVVM command bindings and event handlers.
 
If I F12 on a binding path it should go somewhere. If it just throws up this error it's gone tits up
Yeah if I add the binding to c_No it works fine
 
V.7
@AvnerShahar-Kashtan What would be the right way to handle MouseDrag or MouseUp/MouseDown events of control to trigger ViewModel's method?
 
It's just because there is no property on the model that your command is trying to bind to
Put a breakpoint on line 46 in Dependency_1.cs and that'll trigger when the binding evaluates
 
V.7
46 is empty
You mean FrameworkElement element = (FrameworkElement)sender; ?
 
You'll notice it doesn't trigger at all when binding to MouseUpCommand but when you bind to c_No it triggers when the dialog loads
 
1:42 PM
@V.7 To trigger a viewmodel command on MouseUp/MouseDown, do exactly what you were doing - but make sure your viewmodel is actually set as the datacontext.
 
Sorry line 42
@AvnerShahar-Kashtan his model was set, he was jus ttrying to bind to a property that didn't exist in the model
 
To handle dragging, you probably don't need to get the viewmodel involved at all, since it's a purely view-only operation. (Unless you have some logic to perform on drag). I've written a drag behavior a couple of times.
What are you trying to drag? Simply drag the window/dialog around? (no viewmodel needed), or handle drag/drop of items in your view?
Because the second one is a bit more of a headache, but still certainly doable.
 
I've only ever done drag and drop once, it was a pain in the ass but works admirably
 
V.7
@AvnerShahar-Kashtan First one, and you're right. ViewModel is unecessary for that.
 
Rearranging controls by dragging them around
 
V.7
1:45 PM
Although, as @CaptainObvious says ... can't get figure how would be the right way to connect this DO to ViewModel(Context) at this moment ...
 
The way you did it works
 
@CaptainObvious Yeah, it was a pain. I've done a designer-style thing, where you drag controls from a toolbox onto a canvas and have them automatically snap to the placeholders. Was a lot ofwork.
 
You just need to add the command to the model
I'm absolutely not saying it's the right way, but it is functional
 
V.7
What would be the right?
Because, tried to create a command in the ViewModel and got above error.
As @AvnerShahar-Kashtan says, this is collision between MVVM commands and events
 
@V.7 That's because you were trying to bind a command to an event handler.
 
1:49 PM
On clicking "Click me"
 
Ugh, what the hell is that naming convention?
 
Did you not see his folder structure
clicky and fuck are me
For testing stuff tends to get meaningless names
 
this.c_Yes is bad enough.
 
Oh christ yeah
 
Also, Bases.RelayCommand as some sort of factory method... for some reason?
 
1:52 PM
 
V.7
@AvnerShahar-Kashtan To disalbe controls if CanExecute is false
@AvnerShahar-Kashtan Why?
 
@V.7 Because it's different than the common code style conventions.
 
V.7
@CaptainObvious Why are they red?
 
And non-descriptive
 
V.7
@AvnerShahar-Kashtan Oh, you mean the name?
 
1:58 PM
Oh yeah I was checking the resourceDictionary was working
The easiest way to do taht being change something and see if it changes at runtime, and it did
 
V.7
Roger that.
Sorry, just learning.
 
Whatever genius told you to WPF like this obviously wants you to give up learning WPF
 
V.7
Any ideas how would it be the right way to connect this Command to context?
 
@V.7 WPF controls will automatically be disabled if bound to a command with CanExecute=false, it doesn't explain why that factory method exists.
 
V.7
@AvnerShahar-Kashtan Roger that
@CaptainObvious Clicking works, but how would you trigger MouseDown in such situation?
 
2:02 PM
Same way you did mouse up
Your mouseup command connector thing works fine
 
Generally speaking, it really seems like most of this is missing the point of MVVM and its separation of concerns.
 
V.7
Sorry, Sir, but currently a didn't make it to work
 
As soon as I added this code
13 mins ago, by Captain Obvious
user image
It all works
(and bind to Clicky instead)
Basically
You cant bind to something that doesn't exist
 
V.7
Got System.Windows.Markup.XamlParseException: 'A 'Binding' cannot be set on the 'AddMouseUpHandler' property of type 'TextBlock'. A 'Binding' can only be set on a DependencyProperty of a DependencyObject.'
This is when MouseUp="{Binding c_MouseUp}"
Or MouseUp="{Binding clicky}" for above
 
The point of MVVM is to take a view-specific event (say, a button's Command, or, using a behavior, a MouseUp event) and bind it to the viewmodel's logical command. So, for instance, if you have a btnSave button, you bind it to your vm's SaveCommand. The command on the VM doesn't know or care that it was triggered by a MouseUp or anything - VMs don't know about mouse events, they're a logical layer. The same VM command can be bound to a click event, a keyboard shortcut or whatever.
@V.7 That's because a MouseUp is an event handler, not an MVVM command.
If you want to bind to a MouseUp/MouseDown event (why?), you need to use a behavior, like the one you had earlier, that lives at the View layer of abstraction, listens to the events, and binds to an command.
 
2:06 PM
Did you add the property to the model?
 
V.7
@CaptainObvious Yes, but how this property would be related to Event?
Which exists in Dependency_1.cs
I mean, for example, we have a property in the ViewModel, but how this property should be conneced to event?
 
@V.7 First step - stop thinking in terms of events. Events aren't interesting, MVVM-wise. Events are view-specific behaviors of controls, and have nothing to do with the MVVM architecture.
 
V.7
Roger that
 
MVVM has commands. VMs expose commands (logical operations), and the views bind controls to those commands.
 
There's nothing in Dependency1 for the command
All it does execute whatever is bound in the xaml
 
2:10 PM
A Button, for instance, has a Command property that binds the VM's command to the button. When the button is executed (by clicking, by keyboard navigation, whatever), the command is executed. This is the logical binding between the layers.
 
V.7
By the way, this is where from this DO was got codeproject.com/Tips/478643/Mouse-Event-Commands-for-MVVM
@AvnerShahar-Kashtan Oh, you mean, it's possible to set a Command for MouseUp?
 
How does the Button class know that the Command has been triggered? It probably listens to events, such as MouseClick, or KeyPressed, and then triggers teh command. But that's part of the control's implementation, and you probably don't need to mess with it, most of the time.
 
V.7
... the same as for OnClick of Button
 
@V.7 It's possible to set a command for a button. Most controls will have some ICommand property for their binding - for buttons it will be when they're clicked, for other controls it might be something else. But that's their MVVM interface outwards.
Sometimes, you find yourself needing to bind a command to something else. Say, I need a command triggered when I hover over a control, something that doesn't have a built-in Command property to bind to.
 
He literally uses the Command property of buttons for the Yes and No buttons
 
V.7
2:13 PM
Sure, so Command is only for one type of event?
 
And they execute fine
I don't understand how he's not understand it
 
In those cases, we can use Behaviors (like the MouseBehavior you had earlier) to create a bridge between an event and a command - same as the internal code that listens to MouseClick or KeyPress and calls the command.
 
@v.7 How much of that project is copied from somewhere else, and how much did you write yourself
 
V.7
@CaptainObvious the command part is understandable, but only for Buttons ... unfortunately at this moment
 
So a behavior (a helper class for the view) might add an event handler for the MouseEnter event, and when it's raised, execute the Command that's bound to it.
 
V.7
2:14 PM
@CaptainObvious Everything by myself. Except RelayCommand.cs
And except this DO for MouseUpCommand
 
But you just said MouseBehaviour was from Codeproject
oh ignore that
Basically
 
V.7
@AvnerShahar-Kashtan So, how would be possible to craete such bridge?
 
That mousebehaviour shit effectively adds the ability to bind a "click" type command to a textblock (or any element really)
 
V.7
I'll try to google that, but what would be the right request?
 
So then you add a command in exactly the same way you did with the actual buttons
 
2:17 PM
@V.7 You have the MouseBehavior class, which is exactly that bridge.
 
V.7
Oh, you mean, something like Command=MouseBehavior?
 
No
Oh my god
 
V.7
Sorry
 
Make a command like you did with the Yes and No buttons
Add that to your viewmodel
 
V.7
Already, @CaptainObvious, Sir
That's for Click
 
2:18 PM
And bind the t1:MouseBehaviour.MouseUpCommand to the property which is the comamnd in your model
And then when you click the textblock, the bound command will execute
That's it
 
V.7
Hm
 
Great
Why didn't you do that half an hour ago
Protip for future though
If you want to make something clickable like a button, use a button
 
Especially because WPF controls are easily skinnable - you can take a <Button> (which gives you the set of behaviors you'd expect from a button, like being clickable) - and make it look like anything you want.
 
Including like a textblock
 
V.7
Made same for Drag. Of course, this doesn't need ViewModel because it's a View's job, but just for learning purpose.
 
2:30 PM
But it's really unintuitive from a UX POV to have buttons look like something which isn't a button or link
 
What are you trying to drag?
 
V.7
@CaptainObvious The window of dialog
 
Why, what's wrong with the default window chrome?
 
V.7
Of course, it's a View's job so ViewModel is unecessary for dragging a Window as @AvnerShahar-Kashtan said above
 
2:31 PM
(see conversationg we were having last night with Taylor about why you should use default window chrome)
 
V.7
@CaptainObvious Dialog's Window has property WindowStyle=None
 
Tldr custom window chrome looks like trash 99% of the time
 
V.7
For Transparency and rounded corners
Thank you very much @AvnerShahar-Kashtan and @CaptainObvious ... Really.
I'll keep learning.
The main mistake is that I've tried to set a Behaviour to Behaviour's executer or something like that
 
Pls no
Sounds like what you want is Windows 7
 
V.7
What do you mean WinForms?
 
2:35 PM
Bear in mind Windows 10 doesn't have the aero blur that Vista, 7 and 8 had, so if you make a translucent window whatever is behind it will be clear
No I mean. Windows 7's window borders were rounded and transparent
Also, if you insist on creating your own window chrome, you will have to use actual events
It's not something commands will be able to do
But I would seriously recommend against trying to customise the window borders until you actually know what you're doing
There's an issue with Windows 10's window borders as it is
 
V.7
@CaptainObvious actually, it has already implemeted in example you've downloaded
As you might notice, dialog's border are rounded
 
Yes, and it looks terrible
It doesnt even look like a window
 
V.7
THe only one way I found it to implement such is to make a Window's style = None
 
I thought it was just unfinished
 
V.7
@CaptainObvious I'm sorry to hear that, Sir
Although, I hope you both will have a nice weekend out there, really! :)
 
2:49 PM
The long and short of it is
DWM knows what it's doing, and you probably don't
I say you probably don't because Microsoft themselves have had issues with trying to draw windows themselves
And trying to draw window frames without DWM is going to give you a bad time, and an unfortunate understanding of USER32
 
3:43 PM
> Probably because the Windows Console is a hot mess of legacy spaghetti code
To the surprise of no-one
 
4:02 PM
EntityFramework nooby question: I have an upsert method that does a query, and if a matching row isn't found it does an Add(). I do a SaveChanges() at the very end of the program. Unfortunately my query appears to not be returning any of my newly Add() rows. I would like the entire thing to run in a DB transaction and my query to return inserted but not committed results. Is there a way to do this? or am I using EF wrong?
 
4:29 PM
I think you're doing it wrong? Why would you want to insert but not really?
 
4:45 PM
I suppose we need an mcve of that
 
I am doing a bulk data load, I want a giant transaction, not the overhead of lots of little commits. But I still want to be able to read what's been done while the transaction is ongoing.
 
Yeah I don't think you can select back from the transaction, only committed data
Could be wrohng, but either way its home time
 
5:41 PM
I think I got the right behavior out of creating a transaction explicitly with BeginTransaction, creating that txn with isolation level Serializable, and aggressively calling SaveChanges after upserting and Add as soon as any records are ready (was running into issues with the autoincrementing primary key... nooby Entity Framework probems). So not sure what along that journey got it working but I'm seeing fatal exceptions unwind the database transaction correctly.
 
6:16 PM
you could also distinct your input
 

« first day (3319 days earlier)      last day (1612 days later) »