|
First of course be aware of your user base. You are collecting information about them by doing that and there might be customer relation problems with that. And legal ones as well.
Other than that all your are doing is collecting data remotely from an application. There are many ways to do that.
geomeo123 wrote: if there's a way to do that possibly on Github
As in that there is a library for that? Or that you want the data stored on Github? For the first I am certain there is. As for the second that wouldn't be my choice.
geomeo123 wrote: thinking about logging some try/catch handler errors
You should create a code API that logs the following
- location. File/method.
- Text that describes what it is
- Additional information. This would be where you put exceptions, including stack traces.
Then you call that where ever you want.
There are specific libraries that provide 'logging'. In C# I have used log4net and Nlog.
That provides the API that I mentioned ready to go. It does not however provide the 'destination'. I know you can find addins to log to databases. I suspect others.
Another problem you will have is that since your application is remoting pushing data then someone might do something malicious to abuse your system. Basically you need to figure they will attempt this. So at a minimum you need to provide credentials. Although that probably is not enough. You might want to throttle as well so if they hack your app they can't just start blasting away.
There are services that provide APIs that collect data also.
|
|
|
|
|
jschell wrote: There are many ways to do that If I may, but you didn't mention what any of them are. I too have been asking myself this question and I'm very interested to know what other people think.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
I don't think he knows. Think we might have to go to a university and earn a degree to figure it out.
|
|
|
|
|
Richard Andrew x64 wrote: but you didn't mention what any of them are.
Some of them:
To a SQL Database
To a no-SQL Database
To an event hub
To flat files
To a service that collects metrics.
To a custom server API.
To Syslog
To Azure OpenAPI
To AWS OpenSearch
|
|
|
|
|
|
Ah, Log4Net. From the glory days of .NET, as I moved from (work) place to place everyone used it. Seems to have lost favour in the Core world, and been replaced by something more standardised and flexible, but not as to-the-point
Two line logging, whoever thought that was a good idea?
Regards,
Rob Philpott.
|
|
|
|
|
Rob Philpott wrote: and been replaced by something more standardised and flexible,
What exactly?
|
|
|
|
|
I use Winform and I use Entity Framework to communicate with the database and I use the MSSQL database and when I want to connect the SQL database to the Visual Studio program, the table Those that exist in my database are not present as classes in the Visual Studio program
|
|
|
|
|
If you're talking about using the Data Sources tab in Visual Studio to connect to the database, and you're using Entity Framework, you're doing it wrong. The Visual Studio designers will not create classes for Entity Framework. You have to write the classes yourself.
|
|
|
|
|
If I connect the data base to Visual Studio and create my own classes, will Visual Studio connect my classes to the tables in the data base?
|
|
|
|
|
It appears you have no idea what Entity Framework is or how it works, correct?
Visual Studio isn't going to do anything for you when using Entity Framework, nor should you rely on it. Using the designers in Visual Studio hides a bunch of details from you that makes learning how to interact with databases more difficult to learn. You don't need anything from Visual Studio to work with databases.
|
|
|
|
|
Downloads: Generic Database Access[^]
This a HUGE Codeproject article which, from the looks of things (quick scroll through the .zip content), is likely to give out many C# programming secrets wrt SQL Server (even) with no further sacrifice of time searching on your part.
Generic Database Access[^]
|
|
|
|
|
I have a strange issue I am experiencing with a web app. Typically, the user right clicks on the web page and click Print. He views the document in preview and then decides how to print it.
On Chrome, everything works fine
On Microsoft Edge, It only works if you right click the web page at the top of the page. If you scroll down to the bottom of the page before you right click and select print, the printed document is not formatted properly. The print preview is also not formatted properly. See screen shots below:
On Chrome - (User right click from bottom of page)
You can see the title of the app, title of the report, report run date etc
Report Issue - Chrome.PNG - Google Drive[^]
On MS Edge - (User right click from bottom of page)
The preview starts at some random data as shown below. Title of the app, title of report etc are not shown in the preview and printed version.
Report Issue - MS Edge.PNG - Google Drive[^]
As you can see from the above screen shots, Chrome is displayed properly. MS Edge only displays like that if I right click on the web page from the top of the page without scrolling down
Below is my code sample:
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Physician Activity Report</title>
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
<link href="~/lib/font-awesome/css/all.css" rel="stylesheet" />
<link href="~/css/mycss.css" rel="stylesheet" media="print" />
</head>
Below is the content of mycss.css
@media print {
.col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6,
.col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12 {
float: left;
}
.col-md-12 {
width: 100%;
}
.col-md-11 {
width: 91.66666666666666%;
}
.col-md-10 {
width: 83.33333333333334%;
}
.col-md-9 {
width: 75%;
}
.col-md-8 {
width: 66.66666666666666%;
}
.col-md-7 {
width: 58.333333333333336%;
}
.col-md-6 {
width: 50%;
}
.col-md-5 {
width: 41.66666666666667%;
}
.col-md-4 {
width: 33.33333333333333%;
}
.col-md-3 {
width: 25%;
}
.col-md-2 {
width: 16.666666666666664%;
}
.col-md-1 {
width: 8.333333333333332%;
}
}
h5 {
color: darkblue;
}
What can I do to get this to work properly on MS Edge ? Is it a CSS issue ?
|
|
|
|
|
No idea what the answer is but I did upvote the question because someone down voted it and without explanation. Seems like a reasonable question to me.
Perhaps they wanted you to post in a different forum but didn't feel like explaining that.
|
|
|
|
|
Yeah. It is a strange issue that our users recently brought up. Most users use MS Edge. I don't know what angle to analyze from. It is a .NET Core web app.
|
|
|
|
|
I use Edge as a secondary browser when Firefox fails to display a dark background with light foreground because it (Edge) and it's settings remain at default. Nothing there in a contextual right-click and print (apparently CTrl+P also) fails when the target format is .PDF; so I suggest ... printing from the saved .pdf document instead of printing to .png.
|
|
|
|
|
Hi @RedDK, thanks for your input. Yeah CTrl+P also fails. Like I said in the question even the generated PDF is not formatted properly for MS Edge. Why is it that it works if I right click and click print from the top of the web page but as soon as I scroll down and do the same action it doesn't work in MS Edge ? What can I do to fix it ? What code do I need to add? Why don't I experience same issue in Chrome?
|
|
|
|
|
Perhaps your reticense to post actual code instead of showing images through links is what's keeping me from seeing what could possibly be wrong here. I can right-click and Print this as-is ... with no difficulties.
|
|
|
|
|
I found the answer:
It's a known issue in Edge version 126. The fix has been included in Stable 126.0.2592.81, which had been released on June 27, 2024. Please install the latest Edge Stable version 126.0.2592.81 (Official build) and test again.
|
|
|
|
|
Hello everyone,
I try to connect a pc to some esp32 arudino boards using tcp sockets
the idea is that on the each esp board I open a server that accapt the pc( client ) request and also a client that is used to do all data traffic between the pc and esp
the pc and the board use the some router as AP i wrote some thing like that using Jyhton
Now i want to do the some for other project but on the PC I run a VS2022 C# program that connect to the esp boards but i don't know how to do it .
Can someone show me the road ( an example will be great )
Regards Doron
|
|
|
|
|
You are going to have to give us a lot more detail than that - we have no idea what you have tired, where you are stuck, or what help you might need - if you have a working example, most developers should be able to alter it to fit the new circumstances, so we are at a loss to know what you expect from us that will help you get there.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Hi
May be is was not clear , I don't have code written yet.
i want to get the idea how to create and manage many client sockets on my pc so i can select the socket i will send the data to by using the ip or other index
Doron
|
|
|
|
|
Doesn't matter how you 'think' about the design the following is true.
For TCP sockets there is always a 'server' and a 'client'.
The 'server' creates a listener port and waits for a connection.
The 'client' opens a socket to the server. So the client is the one that initiates the connection.
After a connection is created either side can send and receive requests. Although often the client is the one that sends most requests.
The above also means that the server must have an addressable IP address. Probably in your situation that will not matter but it does mean you will need to figure out what the servers IP address is.
-----------------------------
Now for your actual code whether your want the pc or arudino to be the server is up to you. (I know very little about the second but I expect it can act as both a server and client.)
However I suggest that you start your learning experience using the PC only. So you will have two programs that run on your PC. One is the server. One is the client.
You can google for examples of writing code exactly like that in C#.
After you have tested that a bit then I suggest again only on the PC that you simulate what you want to actually do using the sample code. So for example if you want to send a specific command to the arudino then add code to do that in the PC code (client probably) and then respond in a pseudo way on the other side of the PC code.
You might also want to figure out how to analyze problems while you are developing this.
So for example you might do the following
- PC server code to simulate arudino
- Command received: Health check. Returns 'ok'
- PC client code to send command
- Command send: Health check
- Use Console.WriteLine() to write the command to send (all information)
- Use socket code to send it
- Use socket code to recieve response
- Use Console.WriteLine to write the response (all information.)
You should also experiment with what happens when the IP address is wrong and what happens if the server is not running.
-----------------------------------------------------------------------
As additional suggest for quite a bit in the future for a full application relying on Console.WriteLine() is not workable. So investigate 'logging'. You should not do this until you are comfortable with sockets.
|
|
|
|
|
|
Hello,
I have list checked box has items like "C:\" , "D:\" etc... and each item user can check or not. I need to test if current loop string value (drive) is checked or not in the list box
In addition I want to test "if not" condition for ex like this:
if (drive not in chklist_drives.CheckedItems) continue;
|
|
|
|