|
Put break-points at strategic places in the code, then single-step (F11 in Visual Studio) through the code at run-time observing what happens, what the values of variables are.
When you reach an understanding of where the code is not in a state that you expect, then:
1. ask the author of the article a specific question
2. or, ask a question here
Whereever you ask, post only the code that is relevant to what you do not understand, or what creates an error, etc.
«I want to stay as close to the edge as I can without going over. Out on the edge you see all kinds of things you can't see from the center» Kurt Vonnegut.
|
|
|
|
|
Hello,
when i use chart control to refresh data, i use RecalculateAxesScale() command to refresh axis value.
But ,one status and other status Axis label is not at the same position when refresh, it offset.
I set ChartArea position and innerplot postion,but i don't know why axisA label can be up and down offset.
|
|
|
|
|
|
VirtualQueryEx(processHandle, proc_min_address, out mem_basic_info, 28);
|
|
|
|
|
Is the number #28 what you calculate as the memory footprint of the Struct ? If so, I guess that's not the right size.
«I want to stay as close to the edge as I can without going over. Out on the edge you see all kinds of things you can't see from the center» Kurt Vonnegut.
|
|
|
|
|
how do I get the correct size?
|
|
|
|
|
You get the right size by:
1. studying the MS documentation for memory allocation by Type + the overhead for a Struct object
2. and/or you do a some research on inter-op with NotePad; there's content here on CP.
3. you take a working example of inter-op with NotePad and study its code.
4. you look up the Win API calls you are making and study them carefully
You can do this: with some effort
«I want to stay as close to the edge as I can without going over. Out on the edge you see all kinds of things you can't see from the center» Kurt Vonnegut.
|
|
|
|
|
what would be the right size for a notepad for example?
|
|
|
|
|
how do I get the correct size?
|
|
|
|
|
The last parameter (the one you use 28 in place) should look like this:
(uint)Marshal.SizeOf(typeof(MEMORY_BASIC_INFORMATION))
|
|
|
|
|
changed evil is still return 0 !!in basic_info !!when I moved 28 to 100 come some values but not complete!!
|
|
|
|
|
Take a look at the code here[^]
|
|
|
|
|
I work!! compile for Win32 and worked do not know 'cause for win64 was giving erro
|
|
|
|
|
what might be going wrong?
|
|
|
|
|
Hi everyone,
First of all apologise for any english mistake as english is not my natural language.
Problem to Solve:
I need to import data from 3 flat files. It might be a 4 one. The files will be very similar in structure. I mean the data contained in the files are very similar in structure. In these files each line represents a record to imported into an object object. The way to process the file is the same for all files. Each line represents a new record and each file has a related file that tells you which bit in the line to extract and the length of that bit. These fetched bit represent properties in C# objects.I'm thinking in reading the files line by line returning a String and per string will use the related file to extract the necessary/right info and export the data into an object.
I would like help with the following:
1) Which structure should I use store the static (maybe constant) information in the related files used to fetch the right bits of info from the returned strings.
2) How should I design the class library responsible for all this process in terms of classes, interfaces...maybe a "factory"
Many thanks.
|
|
|
|
|
A key question here (to me) is whether you created this format, and have the "rights" to select/implement another strategy, or whether you have to use this format.
I say this because I hypothesize that whatever you are doing here could be done with standard serialization/deserialization techniques using .NET WCF (DataContract, DataMember), and result in more maintainable, less elaborate, code ... without any major penalty in terms of memory consumption, file-size, etc.
Having a set of files where each file has an associated "schema" file to be used for parsing the data in the file, is an okay choice ... depending.
Your mention of "records" suggests this is a database app, but your speaking of "imported into an object" and "These fetched bit represent properties in C# objects" suggest this is more a problem involving deserialization.
Please clarify your question further.
«I want to stay as close to the edge as I can without going over. Out on the edge you see all kinds of things you can't see from the center» Kurt Vonnegut.
|
|
|
|
|
Hi BillWoodruff,
Thanks for answering.
I do not have the right to implement another strategy. I have to use the formats provided. if they will change in the future I do not know. The format of the files, the files containing data and their associated schemas, will be sent from a "third party" system. The files Will have a fixed structure. Base on the associated schemas I need to parse each line.
When I say "records" I mean an entity. Each line of the file represents and entity. Let say that each line represents the entity Person. And based on the associated schema files I will parse the line to get the age, name, gender, etc.... Then I will create an instance of the object Person with this fetched data. Later everything will be stored in a database.
Hope this helps to clarify.
Any doubt please just let me know.
Many thanks for help.
|
|
|
|
|
I have to deploy my project from local to the server,in local it works fine but the problem when I try to drop the database "sma" and recreate it,I get this error:
"Message":"An error has occurred.","ExceptionMessage":"String was not recognized as a valid DateTime.","ExceptionType":"System.FormatException","StackTrace":" at System.DateTime.Parse(String s)\r\n at SMA.Entities.Models.SMADBInitializer.Seed(SMAContext context)\r\n at System.Data.Entity.DropCreateDatabaseAlways`1.InitializeDatabase(TContext context)\r\n at System.Data.Entity.Internal.InternalContext.PerformInitializationAction(Action action)\r\n
I work on rest API service with asp.net MVC5,it works fine and the database was created with the tables in local(xampp),but I get this error in the server (Windows Server 2012),many tables are created but others not !! I don't know why did I miss any thing
thanks a lot for help
|
|
|
|
|
Sounds like the date-format (a culture-setting) is different from your local development machine. Make sure that what you are passing into DateTime.Parse is a valid date in the correct format.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
i need help
i search a solution for my problem
this is the Json
{
"files": [
{
"date": 1445521605,
"gcodeAnalysis": {
"estimatedPrintTime": 530.8143991643507,
"filament": {
"tool0": {
"length": 74.55374000000013,
"volume": 0.0
}
}
},
"hash": "713a103e403781e9edf4b7dafc5ecd75e9f24ad0",
"links": [],
"name": "19_Space_Shuttle_Discovery_Main_Engine_Connection_(Design_Share_Make).STL.gcode",
"origin": "local",
"refs": {
"download": "http://192.168.1.182/downloads/files/local/19_Space_Shuttle_Discovery_Main_Engine_Connection_(Design_Share_Make).STL.gcode",
"resource": "http://192.168.1.182/api/files/local/19_Space_Shuttle_Discovery_Main_Engine_Connection_%28Design_Share_Make%29.STL.gcode"
},
"size": 57850,
"type": "machinecode"
},
{
"date": 1445521610,
"gcodeAnalysis": {
"estimatedPrintTime": 1872.1848191080057,
"filament": {
"tool0": {
"length": 481.17632000000054,
"volume": 0.0
}
}
},
"hash": "54f64a3081d6f70a217b94f8b62364c7c59f70d8",
"links": [],
"name": "20_Space_Shuttle_Discovery_Manoeuvring_Engine_Left_(Design_Share_Make).STL.gcode",
"origin": "local",
"refs": {
"download": "http://192.168.1.182/downloads/files/local/20_Space_Shuttle_Discovery_Manoeuvring_Engine_Left_(Design_Share_Make).STL.gcode",
"resource": "http://192.168.1.182/api/files/local/20_Space_Shuttle_Discovery_Manoeuvring_Engine_Left_%28Design_Share_Make%29.STL.gcode"
},
"size": 928161,
"type": "machinecode"
},
{
"date": 1445521575,
"gcodeAnalysis": {
"estimatedPrintTime": 20294.513776836233,
"filament": {
"tool0": {
"length": 14730.938639999962,
"volume": 0.0
}
}
},
"hash": "31d84126f9c206bb2d5161c63d09ee0af693672f",
"links": [],
"name": "11_Space_Shuttle_Discovery_Base_(Design_Share_Make).STL_104524.gcode",
"origin": "local",
"refs": {
"download": "http://192.168.1.182/downloads/files/local/11_Space_Shuttle_Discovery_Base_(Design_Share_Make).STL_104524.gcode",
"resource": "http://192.168.1.182/api/files/local/11_Space_Shuttle_Discovery_Base_%28Design_Share_Make%29.STL_104524.gcode"
},
"size": 5072778,
"type": "machinecode"
}
]
}
i will listing all name, length, size etc. in a Gridview
Who can help me?
I thank you in advance
Martin
|
|
|
|
|
What's the problem?
What have you tried?
Where are you stuck?
What help do you need?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
How to display from this json file, all the name in a GridView
|
|
|
|
|
And?
I repeat:
What have you tried?
Where are you stuck?
What help do you need?
We can't see your screen, access your HDD, or read your mind - we only get exactly what you tell us!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
this i tried
files.cs
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DataGridJsonTest
{
class DataFiles
{
public file[] files { get; set; }
}
public class file
{
public string name { get; set; }
}
}
Form1.cs
using MetroFramework.Forms;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace DataGridJsonTest
{
public partial class Form1 : MetroForm
{
public Form1()
{
InitializeComponent();
WebClient client = new WebClient();
var json = client.DownloadString("http://192.168.1.182/api/files/local?apikey=A6C6603BB2F743D6B084D7F52E568011");
List<DataFiles> DataFiles = JsonConvert.DeserializeObject<List<DataFiles>>(json);
gvData.DataSource = DataFiles;
}
}
}
i will all names in a GridView
|
|
|
|
|
And?
What did it do that you didn't expect, or not do that you did?
What happened? What was displayed, what wasn't?
What was in json after the download? What did the debugger show?
What went in the List?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|