Click here to Skip to main content
       

C#

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page  Show 
QuestionConverting semi-structured htm data to xmlmemberRichardInToronto12 Oct '06 - 7:06 
Hi everyone,
 
Posting for the first time here - this looks to be a very active forum.
I have some data in an htm file, enclosed in "pre" tags (well at least the beginning tag is there). It looks like this:
 
<small>----- --------- ----- --------- ---- ------------------------------------- ---------------- ---------- -------- ---------------- ----------------------
      Official  Pace  Chip                                                                  Gender     Category                   Split   Split  Split
Place Gun Time   km   Time        #  Name                                  City             Plce/Tot   Plce/Tot Category          @10km   @15km  @20km
----- --------- ----- --------- ---- ------------------------------------- ---------------- ---------- -------- ---------------- ----------------------
    1 1:37:58.2  3:16 1:37:58.2    3 BETCHIM, NOURDDINE                    Montreal            1/2297    1/277  Men 30 - 34        32:37   49:24 1:05:25 
    2 1:37:59.9  3:16 1:37:59.2    2 NSENGIYUMVA, JOSEPH                   Ottawa              2/2297    1/140  Men 25 - 29        32:37   49:23 1:05:26 
    3 1:38:50.0  3:18 1:38:50.0    5 DEHBI, AMOR                           Montreal            3/2297    2/277  Men 30 - 34        32:37   49:23 1:05:46 
    4 1:40:15.4  3:21 1:40:15.4    7 KASSAP, DANNY                         Toronto             4/2297    1/52   Men 20 - 24        32:38   49:23 1:05:35 
    5 1:42:04.6  3:25 1:42:04.6   19 PAULING, RYAN                         Rochester           5/2297    2/140  Men 25 - 29        33:34   50:50 1:07:50 
    6 1:42:25.0  3:25 1:42:25.0 1817 VOLLMER, MARK                         Guelph              6/2297    3/140  Men 25 - 29        33:33   50:49 1:07:49 
    7 1:43:10.6  3:27 1:43:10.6   12 GRAF, ERIC                            Meadville           7/2297    4/140  Men 25 - 29        33:48   51:22 1:08:27 
    8 1:43:14.8  3:27 1:43:13.8   16 PRINCIC, DANIEL                       Meadville           8/2297    5/140  Men 25 - 29        34:46   52:03 1:08:42 
    9 1:43:19.5  3:27 1:43:18.8 4462 KEMP, PAUL                            Toronto             9/2297    1/354  Men 35 - 39        34:12   51:33 1:08:25 
   10 1:43:44.5  3:28 1:43:42.9 1256 MACDONALD, JAY                        Hamilton           10/2297    6/140  Men 25 - 29        33:33   50:50 1:07:49 </small>
I'd like to convert this to XML, I think it's best to do this programmatically. I'm considering using C# or Perl to do this, but I'm open to other ideas. I have the following questions:
 
- With Perl, setting up my regex will be elegant, but I don't know if Active Perl has any way of producing an XML file.
- With C#, it might be faster, but I don't know what class I would use to produce the XML and serialize it to disk.
 
All information and advice is welcome!
 
Thanks a lot,
 
Richard
AnswerRe: Converting semi-structured htm data to xmlmemberled mike12 Oct '06 - 7:39 
RichardInToronto wrote:
I don't know what class I would use to produce the XML and serialize it to disk.


Look in the System.Xml namespace. Also look for articles on CodeProject and msdn.microsoft.com that might be tutorial type articles.
 
YOu can use a DOM object System.Xml.XmlDocument or perhaps a XmlWriter would work better for your solution.
 
led mike

GeneralRe: Converting semi-structured htm data to xmlmemberRichardInToronto12 Oct '06 - 16:57 
Thanks for the help Mike.
AnswerRe: Converting semi-structured htm data to xmlmemberSreenath Madyastha12 Oct '06 - 7:46 
use regular expression object in C#
 
1. Use Regex
2. Do Grouping in Regex
3. Use MatchEvaluator if needed
4. Add the grouping result values to the dataset.
5. Save Datset to Xml.
 
You are done!
 
Sreenath
 

GeneralRe: Converting semi-structured htm data to xmlmemberRichardInToronto12 Oct '06 - 16:59 
Thanks for your help Sreenath.
QuestionRun EXE from Windows servicememberkalyan.n@dsolusys.com12 Oct '06 - 6:54 
Hi All,
 
I Have created a windows service in C# and I want to run an exe which was created by me earlier from this service when the service starts.
 
I can see the exe running in the task manager but I am unable to see the UI of the exe
 
Please help me as this is urgent.
 
Thanks.
Kalyan
AnswerRe: Run EXE from Windows servicememberperlmunger12 Oct '06 - 7:33 
If you go into the services control panel and double click your service, you will see a tab in the ensuing dialog labelled "Log On". Click on that and then select the checkbox under the "Local System account" radio button marked "Allow service to interact with the desktop". I'm not sure if this will work for you, but give it a try.
 
The preferrable way to manage your own services is to create a service with no UI and then build a second Windows Forms application (possibly even one that runs in the tray) that can connect to the service and control it. You can also use remoting if you want to communicate with your service in some other way than just telling it to start, stop, and restart.
 
Hope that helps.
 
-Matt
 
------------------------------------------
 
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall

QuestionWhere does my Console output go?membersnorkie12 Oct '06 - 6:48 
I am working on an application that has hundreds of try/catch blocks that output to Console.Writeline() on error. This is great for debug mode as it gets picked up in Visual Studio. I am curious where the output goes when I am in release mode. Is there an app that can pick this up? Are there serious performance implications for leaving them in for Release mode?
 
Thanks!
 
Hogan
AnswerRe: Where does my Console output go?memberGreeeg12 Oct '06 - 6:57 
If there is no Window open that catches stdout (like a Console or the VS output window), then imho it goes nowhere. Use Trace.WriteLine to print debug output.
You can capture it with DebugView in Debug and Release mode
 
regards
GeneralRe: Where does my Console output go?membersnorkie12 Oct '06 - 10:56 
Didn't work. Put my app in release mode. Launched it in Visual Studio .NET and stand alone and nothing got logged. Guess I'll have to do something else.
 
Thanks
 
Hogan
GeneralRe: Where does my Console output go?memberGreeeg12 Oct '06 - 13:27 
Works fine for me, DebugView captures my Trace.WriteLine.
You might also try this:
 
DefaultTraceListener listener = new DefaultTraceListener();
listener.WriteLine("TEST");
 
regards
GeneralRe: Where does my Console output go?membersnorkie13 Oct '06 - 11:29 
Greeg,
 
Sorry about my quick response. I missed using the Trace part. I was just using my Console.Writeline... I think I am going to convert them all to using NLog in Release mode so I can turn them off if I don't need them. Thanks for your help!
 
Hogan
QuestionHidden FilesmemberSyed Shahid Hussain12 Oct '06 - 6:29 
I want to access only hidden files from a specific folder. Is there any property that fullfills my need....
 
Thanks
 
Syed Shahid Hussain

AnswerRe: Hidden FilesmemberLuc Pattyn12 Oct '06 - 8:05 
see FileInfo.Attributes Smile | :)
Questionrdlc dynamic formatting?memberCryoK12 Oct '06 - 6:28 
Hi there.
 
Apologies in advance if i'm posting this question in the wrong section.
 
i'm wondering if it's possible to change the layout of the rdlc report at runtime (preferably without having to generate the .rdlc file from code). For instance, i want the user to be able to select which columns to display in a matrix. Based on those choices, the matrix must adjust to hide those non-selected columns.
 
Using the "expression to determine visiblity" feature hides the data, but there's a blank gap left in its place (makes the report look really... dodgy Dead | X| ). I was thinking of putting in a function that said if the parameter passed through was false, set the matrix column width to 0 - except that it won't let me do that.
 
So, is there another way? Short of programmatically creating the report, or having awful-looking gaps.
 
Thanks Smile | :)
AnswerRe: rdlc dynamic formatting?memberPrivate_Void12 Oct '06 - 6:48 
The way I have done things like this in the past is have a dynamic XML generator. The XML will be used as the Code behind the report.
QuestionHow to Play Stream Videos in CSharp 2005 ?memberhdv21212 Oct '06 - 6:19 
hi
i want to play stream video from my hdd, How to do ??
thanks .
QuestionListView GroupsmemberBoneSoft12 Oct '06 - 4:46 
I have a ListView and a custom IComparer for sorting. Which was working fine. I added a couple groups to the ListView, and now the sorting does nothing. The IComparer is processing each ListViewItem, the ListView just seems to ignore it.
 
Has anybody dealt with this? What am I missing?
 


Try code model generation tools at BoneSoft.com.

QuestionParameter not valid??memberhristo197712 Oct '06 - 4:40 
Hi!
 
Moved my project from school to my home PC using a USB. Done that many times and it have worked.
 
Now I get this message:
Parameter is not valid. C:\Documents and Settings\Peter\Mina dokument\Visual Studio 2005\Projects\Bamse\Bamse\Form2.Designer.cs 111 0
And it points to this line:
this.picBoxPase.BackgroundImage = global::Bamse.Properties.Resources.påse;
 
The resource "påse" is in my project folder.
 
Any ideas?
 
Newbie untill I die! Smile | :)

AnswerRe: Parameter not valid??staffChristian Graus12 Oct '06 - 4:46 
It won't compile ? This line is in your auto generated code, so delete it and set the property again in the IDE and see how you go.
 
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog

AnswerRe: Parameter not valid??memberCoolASL12 Oct '06 - 4:47 
Hi hristo1977,
Well it happened with me once too.
When you specify a resource in your project, VS does not copy that resource to your project. It just takes a reference of that resource which is actually present on your hard drive.
If you have chose the option to embed that resource in your build, then that resource is embedded during compile time. Meaning, at no time, it is actually included into your project.
 
So, you need to check if the resource it points to is actually present on your drive. Click the resource and check out its path in the properties window and make sure it points to the right thing.
 
Hopefully it was helpful. Smile | :)
 

*** Who said nothing is impossible? I have been doing it for a long time ***

GeneralRe: Parameter not valid??memberhristo197712 Oct '06 - 10:35 
Hi!
 
The resource is there! Frown | :-( But I still get that damn message.
 
Newbie untill I die! Smile | :)

GeneralRe: Parameter not valid??memberCoolASL13 Oct '06 - 0:02 
Try deleting that reference from the project and include it afresh.
That might work. Unsure | :~
 

*** Who said nothing is impossible? I have been doing it for a long time ***

QuestionWeb Control in C#memberCoolASL12 Oct '06 - 4:33 
Hi all,
Today i went crazy WTF | :WTF: looking out for a web control for C# in Visual Studio 2003.
I read somewhere that one can drab-drop a IE control in one's form. But i am not able to locate Confused | :confused: this control. Dead | X|
 
My requirement is to display display an HTML page in the control and if possible able to display using html string. Meaning, the control should be able to render the html code i pass to it.
Is there a better control available here on CP. I could not find any.
 
Please help me.
 
Thanks in advance.
 

*** Who said nothing is impossible? I have been doing it for a long time ***

AnswerRe: Web Control in C#staffChristian Graus12 Oct '06 - 4:49 
It's the webbrowsercontrol. It's built in to the IDE. If you can't see it, right click on the contols list and you can list all the ones that can be added. It should be there by default tho.
 
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   


Advertise | Privacy | Mobile
Web03 | 2.6.130523.1 | Last Updated 25 May 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid