|
that's not my problem. I just want to read the value from a Xml file and to convert it to time, in a string without date.
|
|
|
|
|
You can't have a time without a date. You keep using TimeSpan. That shows the difference between two times / dates - unless I am mistaken. Anybody?
You have two options - convert all times to 'today' + your time. You can then sort them.
or
Or convert your timestrnig to an integer, throw all the ints into a collection and sort them.
string myString = "07:30"
int myTime = int.Parse( myString.Substring(0,2) ) * 60;
myTime += int.Parse( myString.Substring(3,2) ) ;
This will give you the time in minutes, as aninterger. (from memory, so could be typo's etc);
Regards
Angel
*********************************************
|
|
|
|
|
Use TimeSpan.Parse(string s)
Hope this helps...
|
|
|
|
|
Guys,
Last week I asked here on CP for some aid in converting something like "aabb" to "aAbB". You had to read a textfile, convert it and show it in a textbox.
We participated with about 10 or 15 people and the result was that my application wasn't the fastest (and definitely not the slowest), but I did got a compliment for having the shortest code. Most participants used a lot of delegates and events with different threads etc.
Thanks to all those that helped me .
V.
I found a living worth working for, but haven't found work worth living for.
|
|
|
|
|
V. wrote: converting something like "aabb" to "aAbB". You had to read a textfile, convert it and show it in a textbox.
V. wrote: Most participants used a lot of delegates and events
I don't remember your post last week, but from the description you gave just now, I don't see where delegates and events could come into a solution like that.
|
|
|
|
|
lol, he could convert a file of 8MB in 2,9 seconds. (including reading in and putting into the textbox), he used several different classes and he added different conversion methods for ASCII, UTF etc...)
My conversion, including reading in and putting into textbox was not even 20 lines .
|
|
|
|
|
1) Know what do you want
2) Be sure that what you want is meaningful and understandable
3) What does "convert it and show it in a textbox" means? Convert to what? Any rule, regular expression, upper-lower case, flower, tree, insect...what?
If you want to convert every occurance of a string to a reqular expression then use a predefined regular expression and trace the file with a buffer of whatever size your computer can handle. If the file size in not very big, you can read it completely into the memory at once and then process.
Hope this helps...
|
|
|
|
|
Actually i have data like in this format:
1aDOCSTART_3
DOCTYPE BILL
GENEVAVERSION 5.0
BILLSTYLE 2
BILLTYPE 1
BILLTEMPLATE 3
BILLSEQ 1
BILLVERSION 1
ACCCURRENCYCODE GBP
BILLLANGID 1
BILLLANGNAME English (UK)
BILLLANGLOCALE en_GB
Our requirement is to parse this file into attribute value pairs. like:
GENEVAVERSION : 5.0
BILLSTYLE : 2
BILLTYPE : 1
BILLTEMPLATE : 3
BILLSEQ : 1
BILLVERSION : 1
ACCCURRENCYCODE : GBP
BILLLANGID : 1
BILLLANGNAME : English
BILLLANGLOCALE : en_GB
we have to seperate the field and values and generate the xml.
pls anybody help me in this problem.
Thanks&Regards
RENU
Thanks&Regards
RENU
|
|
|
|
|
Looks to me like each line only has a space between the key and the value, so use the Split method on the string class to turn them into an array of key and value, line by line.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi Graus
Thank you for ur valuable suggession.but im new learner in .net.
pls can u send me some sample code for this .
Thanks&Regards
RENU
|
|
|
|
|
DON345 wrote: but im new learner in .net.
pls can u send me some sample code for this
I don't understand, you're obviously writing code professionally, but you're new to .net ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
store everything in a string
for eg: string str=data;
string[] temp = new string[1000];
temp = str.Split('\n'); //now wat this will do is,each line is stored in each array
for eg: temp[0] will have "GENEVAVERSION 5.0"
temp[1] will have "BILLSTYLE 2" and so on
and wat u have to do is that, take a for loop and parse til the end of the temp array and use one more split function and finally store that in XML
did this help.......
|
|
|
|
|
Hi Rahul,
yes you are given correct approach but i shown you before it is sample code.
if i have bulk amount of data,is this string is able to store that whole data.
Thanks&Regards
RENU
|
|
|
|
|
If it has got lots of data then u can go for StringBuilder.
|
|
|
|
|
Hi rahul
actually iam new at .net,i dont know how to parse field value text data into xml.could you help me in this scenario.
Thanks&Regards
RENU
|
|
|
|
|
I have a client-server application. When I try to connect to the server application using the loopback address, it runs fine, but if I give the actual IP or if I try to connect a server that run on another machine, it throws,
System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it
excpetion. Has it got something to do with .net security settings that we have in Adminstrative tools in the control panel? I've just set the local intranet security to "full trust". Any help?
Press: 1500 to 2,200 messages in just 6 days? How's that possible sir?
Dr.Brad :Well,I just replied to everything Graus did and then argued with Negus for a bit.
|
|
|
|
|
do u have any kind of firewall installed in your system or in the other system. If there is, then disable it and try.
If this doesnt help , then come back with the code
|
|
|
|
|
I guess it's not something related to the firewall, Because I just tested it with my C++ C/S application with the same port. It works fine. Btw, I just reached home. Dont have the code with me now. But it's quite simple.
It's quite primitive one, A simple TCP listener waiting to accept a TCP client. with 127.0.0.1, everything works cool.
Press: 1500 to 2,200 messages in just 6 days? How's that possible sir?
Dr.Brad :Well,I just replied to everything Graus did and then argued with Negus for a bit.
|
|
|
|
|
That is true for 127.0.0.1, what port number do you use, in .NET you must use a port number that is greater than 5001 (As I remember).
|
|
|
|
|
I gues it's not for .net in particular, but in general it's safe not to clash with the reserved zones.I'm in the safest of zone. Above 20000!. I'm using 20555. And no other application uses this port in my pc.
Press: 1500 to 2,200 messages in just 6 days? How's that possible sir?
Dr.Brad :Well,I just replied to everything Graus did and then argued with Negus for a bit.
|
|
|
|
|
That's what came to my mind, though I'm not experienced with network programming.
|
|
|
|
|
Actually i have data like in this format:
1aDOCSTART_3
DOCTYPE BILL
GENEVAVERSION 5.0
BILLSTYLE 2
BILLTYPE 1
BILLTEMPLATE 3
BILLSEQ 1
BILLVERSION 1
ACCCURRENCYCODE GBP
BILLLANGID 1
BILLLANGNAME English (UK)
BILLLANGLOCALE en_GB
Our requirement is to parse this file into xml format like attribute value pairs. like:
<1aDOCSTART_3>
<genevaversion>"5.0"
<billstyle>"2"
<billtype>"1"
<billtemplate>"3"
<billseq>"1"
<billversion>"1"
<acccurrencycode>"GBP"
<billlangid>"1"
<billlangname>"English (UK)"
<billlanglocale>"en_GB"
we have to seperate the field and values and generate the xml.
pls anybody help me in this problem.
Thanks&Regards
RENU
|
|
|
|
|
hi all,
i worked in ASP.Net and there i have default 6validators,
and i am happy to work with those,
and now when i wanna Restrict my controls, i didn't found any default validator property
please suggest me the approch, to validate textbox(for now)
thnx in advance
Prashanth
|
|
|
|
|
Hi all!
I need help ragarding the k-mean clustering algo. Any one have a
source code in C#.. or a dll file that could be used in the
project.... I cannot seem to identify the objects that could be used
in the algo..
I have to group the hospitals, and plot them in
graph, and then identify the number of patients in the region.
Urgently need help!
|
|
|
|
|
You think that u r brilliant but that’s not truth
|
|
|
|