|
I am about to do a Project in C#.
The project was already developed with Two different form in same EXE (say Verification.EXE)
I nee to split these two forms into two different EXE.
Both these forms shares a lot including References and datasets.
If I split these forms into two different EXE will there be delay in time than the previous one without splitting
KALYANA KUMAR P
|
|
|
|
|
What "time" are you talking about? Be specific.
If you are saying that time to execute the application will be longer after splitting, then when you create two exe's your application will be two, and will be launched separately ? isn't it?
And time will hardly matter in this case.
Thanks
Do not forget to comment and rate the article if it helped you by any means.
|
|
|
|
|
KUMAR619 wrote: Both these forms shares a lot including References and datasets. Put the shared code into libraries (in Visual Studio: projects) which will be shared by your two executables (in Visual Studio: solutions).
|
|
|
|
|
I have got to ask, why do the 2 forms need to be in different projects (exe)?
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
You are right. I asked my seniors they asked me to do so. Then what can I do.
|
|
|
|
|
Are your 'seniors' developers or managers. If they are developers then ask them to explain the business reason why they need to be in 2 exe's. If they are managers then you need to explain the design is invalid and they should leave the design to the architect or the developer.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
My direct senior is a senior developer.
Actually our project deals with hospital patients and their orders.
In first form patient will be displayed according to their category.
When a particular patient is clicked His/Her order form should be displayed.
Its already developed.
The clients abroad asked to separate Exe's to make Main EXE free from Order EXE else if any errors happens the main EXE should not be corrupted.
KALYANA KUMAR P
|
|
|
|
|
Nope - can't help, your client has been sold a really dumb idea and is trying to get you to conform to it. All I can offer is good luck!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
KUMAR619 wrote: if any errors happens the main EXE should not be corrupted
When running, an exe is a read only file so it won't get corrupted.
Also separating applications purely due to the probability of errors points towards needing a decent QC and sign off process.
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
modified 7-Aug-14 13:39pm.
|
|
|
|
|
That's an X-Y-Problem. As usual. There is a problem, someone has an idea of how to tackle it, and experiences a problem on that way - now the question is how to continue that way.
Instead of the correct question: what does the customer really need, and - next (nto same!) question - how can that be accomplished. A totally common problem in requirements engineering....
|
|
|
|
|
|
Hello everybody.
I'm not familiar with ABAP at all and I'm trying to automate a SAP report for my job.
At the momment I gotta open SAP (manually of course), login, call the transaction, add some parameters to it, execute it and download the first report. After that I have to work it around (thing that I already automate, so it's not a problem) but then I have to get some other parameters from it and call another transaction to execute with the new parameters that I got from the first report... And so on 2 more times.
My problem is that, after automating all the excel related stuff with C#, I can't find a way to interact with SAP R/3 to login, call the transaction, execute with the parameters and get the report.
Can somebody give me a hint about this?
I googled for a couple of hours and all I found out is that I may have to work with RFC's and BAPI's but I still can't figure out how to do it nor how to use these properly (if I'm right that I have to)
Thanks in advance,
Goliadkin.
|
|
|
|
|
Anyone, something?
|
|
|
|
|
Hi,
first time poster.
I have been programming for quite a while (and used code project quite a lot) but have so far avoided to use XML files.
Now I have to and while I can parse the data, and read values, it still escapes me how XML is the new, so easy way to store ans retrieve data.
I have a XML structure that basically contains a list of files on a hard drive and while I can imagine all kinds of complicated loops to list all paths and files in a list box, I cannot find an easy way to accomplish that.
(I which I could upload an image of the structure
so here it is a code.
The length of the path (Contained folder) is totally arbitrary of course:
Thanks a lot for any input!!!
<pre>
<pre>
-<Drive>
<Name>C:</Name>
-<ContainedFolders>
-<Folder>
<Name>Program Files</Name>
-<ContainedFolders>
-<Folder>
<Name>VirtualBox</Name>
-<ContainedFolders>
<pre><Name>TEST</Name >
-<ContainedFiles>
-<File>
<Name>qtaccessiblewidgets4.dll</Name>
|
|
|
|
|
XML really wasn't designed to be a database if that's what you mean by "store and retrieve data". It's more intended for the formatting, serialization, transmission and transformation of data. It just so happens that XML is a text format that happens to be very easily stored on any storage medium.
In any case, I think your schema could be laid out a bit better. Such as:
<drives>
<drive identifier="C">
<folders>
<folder name="Program Files">
<folders>
<folder name="Some Folder">
<folders />
<files>
<file name="MyApplication.exe" size="1064322" />
<file name="MyLibrary.dll" size="103223" />
</files>
</folder>
<files />
</folders>
</folder>
</folders>
<files>
<file name="Some Junk.txt" size="2310" />
</files>
</drive>
</drives>
A better option would be to skip trying to worry about the details of the XML file and worry more about your class definitions that can be serialized into an XML file. That way you can just build an object graph with the data you're tracking and then just send it to the XmlSerializer and it'll create the XML file for you.
The same serializer can be used to reconstitute the graph from the XML data it wrote.
modified 7-Aug-14 1:33am.
|
|
|
|
|
Do you have a schema definition (*.xsd file) for that type of XML files? If so, you can easily generate classes for handling the data with the xsd tool, e.g.
xsd.exe D:\Temp\gpx.xsd /classes /out:D:\Temp /language:CS
|
|
|
|
|
Assuming you're just looking to get a list of the full paths of all the <File> elements, then LINQ makes this reasonably simple:
static string GetFullPath(XElement fileElement)
{
var names = new HashSet<XName> { "Drive", "Folder", "File" };
IEnumerable<string> pathParts = fileElements.AncestorsAndSelf()
.Where(el => names.Contains(el.Name))
.Select(el => (string)el.Element("Name"))
.Reverse();
return string.Join("\\", pathParts);
}
...
const string xml = @"<Drive>
<Name>C:</Name>
<ContainedFolders>
<Folder>
<Name>Program Files</Name>
<ContainedFolders>
<Folder>
<Name>VirtualBox</Name>
<ContainedFolders>
<Folder>
<Name>Test</Name>
<ContainedFiles>
<File>
<Name>qtaccessiblewidgets4.dll</Name>
</File>
</ContainedFiles>
</Folder>
</ContainedFolders>
</Folder>
</ContainedFolders>
</Folder>
</ContainedFolders>
</Drive>";
XDocument document = XDocument.Parse(xml);
IList<string> filePaths = document.Descendants("File").Select(GetFullPath).ToList();
LINQ[^]
LINQ to XML[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi
This is driving me nuts.
Besides my first structure containing "drive" information, I also have a registry content XML file.
I thought I'd just apply some analogy and it sort of works but for some reason I do not seem to be able to dig deeper into the structure than <value> but I would like to get the value of <action>, <type> and <content> (inside if <value> too.
So here is the structure:
<Registry>
<RootKey>
<Name>HKEY_LOCAL_MACHINE</Name>
<Action>None</Action>
<ContainedKeys>
<Key>
<Name>SOFTWARE</Name>
<Action>None</Action>
<ContainedKeys>
<Key>
<Name>Classes</Name>
<Action>None</Action>
<ContainedKeys>
<Key>
<Name>Installer</Name>
<Action>None</Action>
<ContainedKeys>
<Key>
<Name>Features</Name>
<Action>None</Action>
<ContainedKeys>
<Key>
<Name>8CD5D2FB0DBCDD64A8D2AB1D09CAF271</Name>
<Action>Created</Action>
<ContainedValues>
<Value>
<Name>ClientPrograms</Name>
<Action>Created</Action>
<After>
<Data>
<Type>REG_SZ</Type>
<Contents></Contents>
</Data>
</After>
</Value>
<Value>
<Name>DataFiles</Name>
<Action>Created</Action>
<After>
<Data>
<Type>REG_SZ</Type>
<Contents>Server</Contents>
</Data>
</After>
</Value>
Using the example that Richard gave, my code is:
<pre
IList<string> Regs = document.Descendants("Value").Select(GetFullPathtoKey).ToList();
static string GetFullPathtoKey(XElement fileElement)
{
var names = new HashSet<XName> { "RootKey", "Key", "Value","Type", "Name", "Data", "Contents" };
IEnumerable<string> pathParts = fileElement.AncestorsAndSelf()
.Where(el => names.Contains(el.Name))
.Select(el => (string)el.Element("Name"))
.Reverse();
return string.Join("\\", pathParts);
}
<pre lang="text">
That works fine and a list entry is for instance:
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Features\8CD5D2FB0DBCDD64A8D2AB1D09CAF271\ClientPrograms
But if I extend the Path to include , it will just not work:
Like:
<pre
IList<string> Regs = document.Descendants("Data").Select(GetFullPathtoKey).ToList();
static string GetFullPathtoKey(XElement fileElement)
{
var names = new HashSet<XName> { "RootKey", "Key", "Value","Type", "Name", "Data", "Contents" };
IEnumerable<string> pathParts = fileElement.AncestorsAndSelf()
.Where(el => names.Contains(el.Name))
.Select(el => (string)el.Element("Contents"))
.Reverse();
return string.Join("\\", pathParts);
}
<pre lang="text">
will give \\\\\\\\ for the first entry and
\\\\\\\Server for the second.
No I can create three lists for the path with Value, the Action and the Content, but that seems to be overkill.
After extracting the Path: "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Features\8CD5D2FB0DBCDD64A8D2AB1D09CAF271\ClientPrograms"
how can I derive easily the Action, Type and the Content???
I have been piddling with this for the whole weekend without success. I guess I do not understand what the difference is
between the path to <value> and the path to .
Thanks a lot for any help!!!!
|
|
|
|
|
The problem with your second method is that your <Value> , <Key> and <RootKey> elements don't contain an element called "Contents". That means that you'll get the value from the <Contents> element under the <Data> element, and an empty string for each ancestor element.
If you just want to append the value from the <Contents> element to the path, then use:
static string GetFullPathToKey(XElement dataElement)
{
var names = new HashSet<XName> { "RootKey", "Key", "Value", "Data" };
IEnumerable<string> pathParts = dataElement.AncestorsAndSelf()
.Where(el => names.Contains(el.Name))
.Select(el => (string)el.Element("Name") ?? (string)el.Element("Contents"))
.Reverse();
return string.Join("\\", pathParts);
}
IList<string> Regs = document.Descendants("Data").Select(GetFullPathToKey).ToList();
If you want to include the <Action> , <Type> and <Content> in a different format, then try something like this:
static string GetFullPathToKey(XElement dataElement)
{
var names = new HashSet<XName> { "RootKey", "Key", "Value" };
IEnumerable<string> pathParts = dataElement.AncestorsAndSelf()
.Where(el => names.Contains(el.Name))
.Select(el => (string)el.Element("Name"))
.Reverse();
string fullPath = string.Join("\\", pathParts);
string details = string.Format(" {{ Action: '{0}', Type: '{1}', Contents: '{2}' }}",
(string)dataElement.Element("Action"),
(string)dataElement.Elements("After").Elements("Data").Elements("Type").FirstOrDefault(),
(string)dataElement.Elements("After").Elements("Data").Elements("Contents").FirstOrDefault());
return fullPath + details;
}
IList<string> Regs = document.Descendants("Value").Select(GetFullPathToKey).ToList();
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thank you Richard!!!
I really appreciate your help.
|
|
|
|
|
You must be a true XML Linq wiz!
|
|
|
|
|
Thank you everybody
Sorry, I did not get the formatting right ...
Richard, the "Descendants" look very promising.
Bernhard, thanks for the xsd tip, I'll have to check this out - again, first time XML user.
Dave, thanks for the reformatting. No I do not want to use XML as a database,
but this is the output of a disk analysis tool, that I need a human (management ) readable report of.
Thanks again
|
|
|
|
|
eblaschka wrote: this is the output of a disk analysis tool, that I need a human (management ) readable report of.
That would have helped if you put that in your original post. I wouldn't have suggested you start with the classes then.
I would agree with Bernhards use of the XSD tool to generate the classes for you. You could still use link over that object graph to your report data.
|
|
|
|
|
Thank you Dave for cleaning up my XML code, I really screwed up the format.
I definitely do not want to use XML as a database, but I do have an output file that I have to make human (rather: Management ) readable for reports.
Thanks Bernhard, I will have to look into the xsd stuff.
Thanks Richard, your "Descendant" method. It works great, BUT only if I cut the file between <drives> part. (The Structur is bigger).
That is not a big issue, but is there something like "get everything from <file> and <drive> " ???
(How does "GetFullPath" know where to stop?)
Thanks a lot to all.
|
|
|
|
|
If you reply to someone's message, then they get notified that you've replied. If you reply to yourself, then nobody else will be notified.
There's almost certainly a way to make it work, but without knowing the full structure of your XML file, we can only guess:
static string GetFullPath(XElement fileElement)
{
var names = new HashSet<XName> { "Drive", "Folder", "File" };
IEnumerable<string> pathParts = fileElements.AncestorsAndSelf()
.TakeWhile(el => el.Name != "Drives")
.Where(el => names.Contains(el.Name))
.Select(el => (string)el.Element("Name"))
.Reverse();
return string.Join("\\", pathParts);
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|