|
So I'm a programmer who's been programming for 20 years. I have written Windows services numerous times and need to do it again. There are things that my service code doesn't do (like run in console mode) that I'd like it to do.
So does anybody have any code that I can steal that is the basis for a Windows service? I know I can create a new project as a Windows Service through VS2010 but was wondering if anybody has a basis I can use.
Also - the premise I used was in the OnStart command, start a timer that would run a routine that would poll for things to do. The routine would never end and check, based on time, if something needs to be done. Is this still an appropriate method for doing a service or is there a better way?
TIA - Jeff.
|
|
|
|
|
Jeff - when I create a service, I tend to use a form of background thread to run the processing. If I have something that I need to run periodically, I use a Monitor because I use the Wait method for the period of time that I want the thread to sleep. This way, if I need to stop processing, I just Pulse the Monitor and shut it down.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
I tend to write Services using a System.Timers.Timer -- so all I really need to do each time is write an Elapsed handler.
|
|
|
|
|
Hi all,
Please suggest me how to convert a word document to xsl/xslt (.doc file to xsl file). Please provide me some sample code or URL from where I can do this using C# 2.0 without using any third party tools.
Thanks in advance
Know is Drop, Unknown is Ocean
modified on Tuesday, July 20, 2010 9:16 AM
|
|
|
|
|
|
No, actually our requirement is to generate XSL file based on the word document (word document is an template with mail merge, later we merge data with this template document retrieved from database). We have different kind of document, for each selected document we have to create XSL file dynamically using C#.
Know is Drop, Unknown is Ocean
|
|
|
|
|
The I have no idea, but perhaps you could post a small example of what sort of structure is in the document and what XSL you want to produce.
|
|
|
|
|
Hi,
Thanks for you response.
Below is sample template document, in this Date, Name, Age, Address are merge field. I have to convert this template document to XLS.
<Date>
<Name>, <Age>
<Address>
Dear <Dr./Mr./Ms. Last Name>:
Below is the sample XLS for above template. (We created this manually)
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:ibex="http://www.xmlpdf.com/2003/ibex/Format">
<xsl:template match="InvitationContemplateInfo">
<fo:block margin-left="0.785in" margin-top="0.7in" margin-right="0.88in" color="gray" font-family="'Times New Roman'" font-size="11.5pt" letter-spacing="0.15pt"><xsl:value-of select="//Date"/>
<xsl:if test="//Name[. != '']"> <xsl:value-of select="//Name"/></xsl:if>
<xsl:if test="//Age[. != '']"> <xsl:value-of select="//Age"/></xsl:if>
</fo:block>
</xsl:template>
</xsl:stylesheet>
Like this we have to create for all different kind of template documents dynamically.
Thank you once again.
Know is Drop, Unknown is Ocean
|
|
|
|
|
Have you tried the XML/XSL forum, you may have more luck there.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi People,
Let me be straight, I want to interact with a webserver from a DotNet Client. The web server is a Postgre Server and the server-side scripting language is PHP. The DotNet client is built in C#. I am actually new to this type of a concept but I was wondering whether it is actually possible or not. Its almost 5days now that I am not able to come up with any solid solution. I will be very much thankful if anyone can guide me out of this problem.
Thanks in advance
|
|
|
|
|
Assuming the server uses standard HTML to communicate then you should be able to access it through a client written in any language you like.
arj_agt wrote: Its almost 5days now that I am not able to come up with any solid solution.
A solution to what? Perhaps if you describe your problem someone may be able to offer some words of advice.
It's time for a new signature.
|
|
|
|
|
Thanks to all of you for your tips and advice. I have figured it out.
|
|
|
|
|
It's fairly simple. Server to Server communication is a Solved problem. I believe they came up with a human readable data interchange format to facilitate this sort of task in the late 90's. It's called XML and you can deliver it using either Restful calls or webservices and both languages can make and receive requests from each other across the Internet as well as share data in an interoperable format.
|
|
|
|
|
As mentioned, it would help if you described what the problem is.
Since your client and server are on 2 separate machines, if one sends information in a format the other can handle, it really doesn't matter what languages or operating systems are used on either end.
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
HI ALL,
I am trying to use a dll made in C#.net(using framework 2.0) in to vb.net proj in framework 1.1 visual studio 2003
WHen I am trying to do add reference i am getting below error
"ADd reference to dll could not be added.This is not a valid assembly or COM component.ONly assemblies with extension 'dll' and COM components can be referenced.Please make sure that file is accessible,and that is valid assembly or COM component.
BUt when trying to add reference it in vs2005 proj in C#.net its successfully added.
ANy help will be greatly appreciated.
Ankit Aneja
"Nothing is impossible. The word itself says - I M possible"
modified on Tuesday, July 20, 2010 9:34 AM
|
|
|
|
|
You cannot use a 2.0 compiled .DLL in a 1.1 project. With those versions of the .NET Framework, you cannot load two different versions of the .NET CLR in the same process at the same time, like you're trying to do.
If you cannot recompile the 2.0 .DLL under 1.1 because you used stuff that isn't available in 1.1, you have no choice but to upgrade your 2003 project to Visual Studio 2005, or higher, and write in under .NET 2.0, or higher.
|
|
|
|
|
hello all,
I want to deserialize an xml file.This xml has one attribute as xsi:type="value". When i do deserialization xml without this xsi:type thn it works, but when I include this an exception occures.
Please help is there any idea behind it.
Thanks in advance...
|
|
|
|
|
Can you elaborate more by posting here your
xml file or with some sample data, to understand
the scenario?
I think your xml file is not pure, contain
some invalid data that's why it is failing
during serialization.
HTH
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|
|
<?xml version="1.0" encoding="utf-8"?>
<PARAMS>
<PARAM xsi:type="VALUE" SEMANTIC="DATA">
<SHORTNAME>PARAM_0</SHORT-NAME>
<DOP-REF IDREF="DOP_MDiffAccelMap02RowAxis"/>
</PARAM>
</PARAMS>
this is the xml file generated..
|
|
|
|
|
Ok, I have dig our more and I found this[^] link.
According to this this is (content xsi is generated serialized xml.
So can you give me the exception or error you are receiving during deserialization?
HTH
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|
|
It is not giving a specific exception.When I run code of deserialization it halts and give a general exception like deserialization fail and indiacte at the line whcih contains xsi:type.
|
|
|
|
|
Refer this[^] link, it will resolve your problem.
HTH
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|
|
I have same problem as in the linke given by you. Bt I am not getting how it will solve...
plz help..
|
|
|
|
|
Just go through whole article, the resolution is below related questions links.
HTH
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|
|
sorry to disturb u again....
I am not able to find related questions links.
|
|
|
|