|
MS samples are meant to show language features. They don't "do MVVM" unless the article is about MVVM. x:Bind provides some additional type checking at design time and some performance advantages versus "Binding"; with trade-offs. Nothing to do with MVVM in particular.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|
|
Thanks, Gerry. My WPF application code was fairly consistent in its application of Binding with commands and converters, and I'd like to continue that level of consistency as I refactor it to WinUI 3.
I'd like to take advantage of the x:Bind performance improvements, but also remain consistent in the way it's used. In other words, I'd prefer to continue to wholly use Binding (to DataContext) with traditional commands and converters, wholly use x:Bind (to code-behind objects) with traditional commands and converter classes, or wholly use x:Bind with functions (no commands or converters).
This may not make sense or be possible, I just haven't gotten far enough into it to tell. So far I haven't found any showstoppers, and that's why I'm curious. But I'm also only about 10% into it.
|
|
|
|
|
I'm working on a WPF app that will connect to Google and retrieve contacts. Right now, the Google key info is all hardcoded unencrypted into the app and is a security risk. I'd like to refactor this so that the key is not compiled in.
One idea we had was to make a backend call to our server to retrieve the key, then use it to connect to Google.
What's the right way to do this?
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
modified 13-Dec-22 14:24pm.
|
|
|
|
|
The server connects to / queries Google; the client makes the Google request via the server.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|
|
OK.
THe issue is that the Security Key & Secret are stored local in the client. They have to be passed. I'm asking about how to design this for security
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
But if the key is shared, shouldn't it be on the server? You route the queries through the server; the query runs from the server; the client never needs to see the key; only the results.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|
|
You pass a Key and Secret to the server. We're trying to avoid this
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
Where do I say pass the key? Put the key on the server. Why do you have a server? The client queries the server; the server queries Google and whatever else, and returns the result to the client. It acts like a proxy or a firewall. If you think "2 hops" is an issue, that's another matter, and only if you benchmark it and it says so.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|
|
Gerry Schmitz wrote: The client queries the server; the server queries Google
It's a WPF app. It's calling the Google People API directly. The Secret and Key are hardcoded as constants in the C# code. The app directly queries the Google API passing the Secret and Key.
But that's what I said in my OP. We could store the Key & Secret on our sever and add an endpoint to simply return them, therefore removing them from the WPF app's code. The client app would still call the Google API directly passing the Secret and Key, it would just first, on app start, go to OUR server to get them, instead of them being in the code.
Old
- App starts
- App calls Google API, passing hardcoded Key & Secret
New
- App starts
- App calls OUR server, which returns the Key & Secret, and stores them
- App calls Google API, passing the stored Key & Secret
Again, the ultimate goal is to get the Secret & Key out of the code.
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
Wpf <-> internet <-> server <-> internet <-> Google; UPS; USPS; VISA; etc.
I have WPF apps, running as kiosks, calling into my (ASP.NET) web server that has "no presence" other than to handle client requests), that calls multiple API's for credit card verification, postal rates, address verification, and retrieving shipping label images; all using different accounts and passwords "stored on the server" along with "back end code" and an SQL data base.
Does that help?
(Sounds like you have a simple / local "file server"; and not a remote / distributed application / database / web server).
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|
|
Seems like the other thread has a miscommunication.
Your current app has the credential information in the client code. The type of credential information is irrelevant.
The credential information is hard-coded because you stated that. (That means every actual user of the client will be using the same exact credentials.)
So the other solution is to modify the code to do the following
1. Create a server API method that expects a requests from the client code. The client code does NOT make a call to google. The client code does not have the credentials.
2. The server code API uses the credentials and makes the call to google.
3. The server code returns the result of the google code to the client.
Note in the above that I did not specify where the server code gets the credentials from. Could be it still hard-coded but in the server code. There are other possible solutions to providing the credentials to the server code.
|
|
|
|
|
I have a really strange problem with WebRequest in a ServiceStack web application (hosted by XSP on Mono). It seems that the registration of request modules works in a very strange way; I am using WebRequest to create an HTTP request, and it is failing because it was not able to find a creator for that "prefix" (HTTP).
The exception I am seeing is NotSupportedException, and I was able to track it to the fact that no creator is registered for the HTTP prefix (I am hitting https://github.com/mono/mono/blob/master/mcs/class/System/System.Net/WebRequest.cs, around line 479)
EDIT: more details: NotSupportedException is thrown by WebRequest.GetCreator, which uses the URL prefix as a key to choose which creator to return; in my case, a HttpRequestCreator. The exception is thrown because there is no creator registered for the "HTTP" prefix (actually, there are no creators at all).
So I searched around a little bit, dug into Mono sources, and found that modules are (or should be) added to the webRequestModules section of system.web in one of the various *.config files.
I looked at my machine.config file, and there it is:
System.Net.HttpRequestCreator, System, Version=4.0.0.0
Looking at WebRequest Mono sources it seems that prefixes are added from configuration(s) inside the class static constructor (not a good choice, IMHO, but still.. it should work).
To test it, I tried to add an HttpRequestCreator to system.net/webRequestModules in my web.config; this is loaded by XSP/Mono and results in a duplicate key exception (which is expected since HttpRequestCreator should be already loaded, as it is already present in machine.config).
Even stranger: if I add a mock handler for Http, like this:
bool res = System.Net.WebRequest.RegisterPrefix ("http", new MyHttpRequestCreator ());
Debug.Assert (res == false);
The assertion sometimes pass... sometimes not! (RegisterPrefix returns "false" if a creator for the same prefix is already registered; I expect it always to return false, but this is not the case! Again, it is completely random)
When the registration "fails" (i.e., returns false because an "HTTP" prefix is already registered), then the WebRequest can create requests for HTTP. It is as if calling RegisterPrefix "wakes up" the static constructor and let it run.
I am perplexed: it seems like a race condition in the execution of the static constructor of WebRequest, but this does not make sense (the runtime protects static constructors with a lock, IIRC)
What am I missing? How could I solve or work around this problem? Is it my fault (misunderstanding or missing something), or does it look like a Mono bug, so should I submit it?
modified 16-Dec-22 4:27am.
|
|
|
|
|
Isaac Tack wrote: (it is not possible to reduce the amount of data).
That statement is unqualified.
You might not be able to reduce the total amount of data but you might be able to reduce the amount of data that is returned.
Isaac Tack wrote: I have the following ideas:
What happens if they want to turn off access to a user. Or change access. So the database is updated (delete the user, set a flag or change associated attributes.)
So now what happens with either of your ideas?
|
|
|
|
|
It is possible to compare two git remote repositories ? Those two repositries were clone, and I need to see if the source repository was updated. I didn't see any example of how to do that ... and I am thinking its not possible ?!
|
|
|
|
|
Depends what tools you're using. For the command-line, there are several suggestions in this StackOverflow thread[^].
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Ok, I see, but I don't have access to the source repository ...
|
|
|
|
|
If you don't have access to it, then there's no way to know what's in it. You can't even perform a manual comparison.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Right click the branch you are targeting and select Compare with Current Branch. Alternatively, you can utilize the branch list on the Git Repository window to access the same command.
|
|
|
|
|
1) Why are you replying to me, and not the OP?
2) How do you think that's going to work when the OP has said they don't have access to one of the branches they want to compare?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
First you must have access to both of them. At least to download. You do not need permission to modify.
Then if it was me I would download both to different directories on my local computer.
Then I would get a tool that does file comparisons. Myself I use both WinMerge (free) and BeyondCompare (need to buy.)
|
|
|
|
|
Hi!
I want to upgrade my programming skills but don't know where to go.
Programming is an important hobby for me and I also made some tools for my company and for me to facilitate my work and my other hobbies.
For decades I used Visual Basic in MS Visual Studio. The last years a also tried HTML, CSS, JS, PHP, Python, SQL. And a view months ago I changed from Visual Basic to C#. And I ask myself if I should leave MS.
What I need and want:
- Nice graphical user interfaces.
- At the moment preferred Windows desktop apps. Web apps only if they also can handle local data.
- Maybe Linux and/or mobiles in the farer future, never ever Apple.
- Local and server databases. (XML, SQLite; MySQL, ...)
- Graphics (photos, charts, simple games, ...).
What I think of different tools and languages:
- Visual Studio WinForms: Old, outdated but still not bad.
- Visual Studio WPF and UWP: Nice but also outdated, MS stopped them.
- Visual Studio ASP.NET: I never tried it.
- JS: Great but not for local data(bases) und code is readable for everyone.
- Python: Great but no nice GUIs and I don't know if the compiler is good.
- Java: I never tried it but I think it can do everything. What about GUIs? How difficult to learn?
So what do you think? What are your experiences? What can you recommend?
Thanks
|
|
|
|
|
If you want to stick with MS, their latest offering is MAUI:
.NET Multi-platform App UI documentation - .NET MAUI | Microsoft Learn[^]
That will let you create apps that work on Android, iOS, macOS, Windows, and Tizen.
However, I haven't tried it yet, so I don't know how good or bad it is. I'm still using WPF, which still works and is still supported.
There's also Avalonia UI, which is an open-source cross-platform system "considered a spiritual successor to WPF":
Avalonia UI - Home[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
While WPF and UWP are "deprecated", they are not abandoned; and make it easier to transition to WinUI3 due to the similarities. UWP is the equivalent of WinUI2, and I still haven't found anything in WinUI3 to make me take notice.
While an EV may be the future, a lot of people are still buying ICE in the meantime in order to get somewhere.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|
|
... and what about Electron?
|
|
|
|
|
hi i will recomended Visual Studio it's best note code software.
|
|
|
|
|