|
Thanks,
I will investigate.
CI/CD = Continuous Impediment/Continuous Despair
|
|
|
|
|
Not languages (yet), but for changing colors I've used "dynamic" resources.
Dynamic Localization In WPF
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
Hello! I am just curious if it would be good practice to have all of my layers in the same project, or should I create a separate project(Web API) as my data layer, for example, and call it from my MVC application.
I feel I can still create the separate layers in the same project but just use a controller as the middle layer to call a Web API that would handle the database inquiries, then report back to the controller for the View the user is interacting with. Does this sound like good practices for sticking with n-tier architecture?
Thank you!
|
|
|
|
|
I think you mean multiple projects in one solution. A project is (usually) an exe or dll (or both). The data layer is usually a dll. Easier (for one person) to work with multiple projects under development when they're in one solution.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
using Microsoft.ML;
using Microsoft.ML.Data;
using System;
using System.Linq;
using System.IO;
using System.Collections.Generic;
namespace MLModelx_ConsoleApp1
{
public partial class MLModelx
{
#region model input class
public class ModelInput
{
[ColumnName(@"Label")]
public string Label { get; set; }
[ColumnName(@"ImageSource")]
public string ImageSource { get; set; }
}
#endregion
#region model output class
public class ModelOutput
{
[ColumnName("PredictedLabel")]
public string Prediction { get; set; }
public float[] Score { get; set; }
}
#endregion
private static string MLNetModelPath = Path.GetFullPath("MLModelx.zip");
bool disposed = false;
public static ModelOutput Predict(ModelInput input)
{
MLContext mlContext = new MLContext();
ITransformer mlModel = mlContext.Model.Load(MLNetModelPath, out var modelInputSchema);
var predEngine = mlContext.Model.CreatePredictionEngine<ModelInput, ModelOutput>(mlModel);
ModelOutput result = predEngine.Predict(input);
return result;
}
public void Dispose()
{
Dispose1(true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose1(bool disposing)
{
if (disposed)
return;
if (disposing)
{
}
disposed = true;
}
~MLModelx()
{
Dispose1(false);
}
}
}
|
|
|
|
|
First, what makes you think you have a memory leak?
GC.Collect does not do anything about memory leaks. Calling it useless.
|
|
|
|
|
I see a constant Increase in the Memory Usage of the Server. Even I did try to run the Performance Profiler in VS 2019, and the memory usage patterns where very much similar to the system memory and it kept on increasing, and the system crashes after few minutes.
Any suggestions, where I went wrong.
|
|
|
|
|
The code you posted doesn't show anything that would leak, so no.
|
|
|
|
|
rahulgorai wrote: and the system crashes after few minutes.
That isn't a very clear statement.
In C# AppDomains exit when a OutOfMemory exception (OOM) occurs. So the 'system' in this case would mean you have one AppDomain and you are actually seeing an OOM and not guessing about what the exit is.
There are two general causes for this sort of error.
1. Your general, and complex, processing is very slowly leaking somewhere.
2. You have some very specific code, and when it runs it causes the problem.
3. You are not leaking anything. Your processing is just using more memory than what is available.
4. You have a problem with Large Objects.
For 2 the stack trace of the OOM will often reveal this. However the nature of the cause of the OOM might mean that you need to collect more than a couple of these to see the problem.
Problem 3 occurs because the VM has been limited. This can specifically happen when running in IIS. But can also occur for other reasons including the way the OS is set up.
For 1 you just need to dig in and start looking for incorrect things such as collections that keep adding the same object (duplicates) rather than removing/replacing anything. Note that with a 64 bit system and without limits from other sources this should be a rare occurrance.
For 4 you are going to have a different problem. The Large Object Heap is a problem due to the way that that is specifically implemented. It is impacted in the same way as others by limits placed on the application but can occur sooner. There is no quick, and easy way to explain it but if you are doing work anywhere in your application that uses memory streams and/or large allocations then those are going to be the problem areas. Basically anything over 80k freezes memory and puts large unmovable holes in the heap, which by themselves can lead to OOMs. Fixing it means to stop doing memory streams and/or large memory allocations.
|
|
|
|
|
hi all
i need a source code for reading .tag (DataFlex) file and show its content on datagridview ( File Extension )
Thanks
modified 15-Jul-21 10:11am.
|
|
|
|
|
fat61 wrote: I Used this code, but it is wrong:
Why do you use the "wrong" code rather than to fix it?
|
|
|
|
|
the Message "the code is wrong" isn't a useful information ...
Perhaps, if you still want help, you tell us what happens and what should happen.
But basicly : have you tried to look what really happens with the Debugger ? This would be the best way to get a Solution ...
|
|
|
|
|
Start with the basics: where did you get your information on .TAG file format from?
Go back there, and read it again, carefully - your existing code assumes there are 10,000 bytes in the file before before any actual information you are interested in and that's pretty much unlikely.
You then assume that "what's left" is line based strings, and that's probably not the case either.
So read the file format documentation, and code against that - the code you have looks like it was thrown together without any actual consideration of the file content!
"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!
|
|
|
|
|
fat61 wrote: I Used this code, but it is wrong: Yes.
Bastard Programmer from Hell
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Yes, that code is clearly wrong. I can tell without knowing how TAG files work. I've seen some hints that TAG files are text files, but I could not find out the exact format, at least not with the amount of effort that I feel like putting into this question. IDK if this question really deserves it, but I feel like some slightly more helpful comments could be made about it..
Reading 10000 bytes and then ignoring them is probably a bad thing. It looks like a relic from some code that you copied that reads a file in 10000-byte blocks (a weird block size, not a round number). The while (count != 0) part in particular makes me think that. That style is reasonable if and only if you update count by doing another read in the loop. As it is, it makes no sense: that loop either does not start, or continues until it runs headlong into an exception, there is no normal way for it to terminate. Block-based reading and text files are an awkward match anyway.
BinaryReader.ReadString is the counterpart to BinaryWriter.Write(String) . It uses a particular format of length-preceded string, with the length encoded in 7 bit chunks with a continuation bit. You won't find that kind of string in a text file. What you actually need here depends on format of TAG files, which I don't know and don't feel like getting into. Presumably you have a file that you're reading, putting you in a better position to figure this out than any of us. Possibly some combination of TextReader.ReadLine and splitting strings (not the most efficient approach, but probably fine). You could go for File.ReadAllLines too. If TAG files have no line-breaks then do something else.
modified 15-Jul-21 15:01pm.
|
|
|
|
|
The only code you're going to get is the YOU write.
|
|
|
|
|
what code should be use to access all drives in following code instead of c:\ drive only for e.g c:\ d:\ e:\ thx.
code is :
public static void Encode()
{
string startDirectory = @"C:\";
ProcessDirectory(startDirectory, 1, "");
}
public static void Decode(string decryption_password)
{
string startDirectory = @"C:\";
ProcessDirectory(startDirectory, 0, decryption_password);
}
modified 11-Jul-21 6:46am.
|
|
|
|
|
|
i am not coder i have seen this but dont know how to apply in mentioned code
could u plz apply the method change the code as required thx
|
|
|
|
|
While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.
So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.
Just going "write the code for me" is not going to get you far on this (or any other) site. Or in the real world either, come to that.
Follow the link, look at the example code and try to work out what is going on.
If you are having problems getting started at all, then this may help: How to Write Code to Solve a Problem, A Beginner's Guide[^]
"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!
modified 11-Jul-21 7:47am.
|
|
|
|
|
THX for your lenghty reply this forum is not for amateur like me i just need little help not asked you to code big app for me i just want this function to be done its not a big deal BYE..!
|
|
|
|
|
Member 15284301 wrote: i just need little help not asked you to code big app for me
Quote: could u plz apply the method change the code as required thx
That sounds like "write the code for me" to me.
You will not get anywhere trying to do complicated stuff unless you understand the basics: and clearly you don't. I'd strongly suggest you sit down with a book (or take a course) and learn how to do things rather than trying to dive into projects you aren't skilled enough to do yet...
"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!
|
|
|
|
|
Thank You i just need to use this tool for personnel use i told you i am not coder anyway thx Good Day
|
|
|
|
|
You are trying to play with encryption: that's a bad idea for the unskilled.
It's very, very easy to make a trivial mistake and c**k it up completely - which means that your data will end up lost forever, or about as secure as an open window!
Really and truly, if you want to encrypt stuff, get an app that can do it for you: try WinZip which can move your data into a encrypted ZIP file for example.
Writing encryption code is not a job for a beginner.
"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!
|
|
|
|
|
If this is a homework assignment ...
|
|
|
|