|
From my known, the format of doc is not public, otherwise many other Office products would be compliant with MS Office documents well and then rob its market.
I'm amumu, and you?
|
|
|
|
|
Hi there,
I don't think that MS is making money from the file format. I have seen applications that convert .doc and .xls to XML. The problem is that I don't want an application, I need a component to integrate it with my ASP.NET application. I want to write the component myselfe but I have no idea where to start from...
I tried to read a .doc file with the StreamReader object but I get a lot of wierd stuf. I need some information on how to do this...
Thanx for your reply though!
|---------------|
| theJazzyBrain |
|---------------|
|
|
|
|
|
Hi,
I guess the application you mentioned is using MSOffice Automation Object, it means the doc format analysis is done by MS. That's just my personal point. On the other hand, maybe you could also use this way.
I'm amumu, and you?
|
|
|
|
|
In commenting on my C# Design By Contract article someone wrote:
Hi,<br />
<br />
Have you tried to implement this using attributes and MessageSinks? I think something like the following would be a lot easier. <br />
<br />
class Example<br />
{<br />
public Example(){}<br />
<br />
[Precondition(y != 0)]<br />
public int Divide(int x, int y)<br />
{<br />
return x / y;<br />
}<br />
}
Any idea how to implement this? can it be done? the idea is that Precondition(y != 0) should translate to Assert(y != 0).
All the custom attribute examples I ever see seem to be to do with annotating classes or methods in some way, e.g., [CodeReview("Eric", "01-12-2000", Comment="Bitchin' Code")]
Kevin
|
|
|
|
|
Like this[^]?
Hawaian shirts and shorts work too in Summer.
People assume you're either a complete nut (in which case not a worthy target) or so damn good you don't need to worry about camouflage...
-Anna-Jayne Metcalfe on Paintballing
|
|
|
|
|
Interesting. Although I want to know how to write such attributes myself.
Kevin
|
|
|
|
|
The source is included with the XC# download. All you have to do is look in $InstallDir$\Source\XCSharp.Attributes\
Hawaian shirts and shorts work too in Summer.
People assume you're either a complete nut (in which case not a worthy target) or so damn good you don't need to worry about camouflage...
-Anna-Jayne Metcalfe on Paintballing
|
|
|
|
|
Hello,
I have an XmlNodeList with attributes and and text values. I am looking for a way to create a function that can return a value from reading a nodelist by specifiying the attribute name. For example, string a = FieldByName("acct") would result in 12345 being returned.
<fields>
<field name="acct">12345
<field name="company">ACME Inc
<field name="city">Dallas
<field name="state">TX
Any help would be greatly appreciated.
Thank you.
|
|
|
|
|
<br />
private string GetAttributeByName( XmlNode node, string name )<br />
{<br />
if( node != null && node.Attributes != null )<br />
{<br />
XmlAttribute attr = ( XmlAttribute )node.Attributes.GetNamedItem( name );<br />
<br />
if( attr != null ) return attr.Value;<br />
}<br />
<br />
return string.Empty;<br />
}<br />
Solutions:
1. Create method which make cycle and check each item in XmlNodeList (value can be taken by method written upper)
2. use XPath, like: //*[@*[local-name()='select123']] - such xpath return to you node(s) with contains attribute select123. After that use method written upper to get atribute value
Good Luck
Alex Kucherenko
|
|
|
|
|
Alex,
I am new to XML and not that familiar with the nodes and attributes. I have started with this by using xmlDocument.
Would you have an example of loading an XML doc similar to below and cycling thru the nodes and using your function of GetAttributeByName to return the value of the company from the below nodelist? I am having difficulties in getting the nodes setup from the nodelist.
<fields>
<field name="acct">12345</field>
<field name="company">ACME Inc</field>
<field name="city">Dallas</field>
<field name="state">TX</field>
</fields>
|
|
|
|
|
First of all, I am new to C# and .NET programming, however initial impression is very favourable, despite my brain complaining that it is already full up.
Anyway, I am trying to get a client system running a web browser, to exchange text with an application, running on a remote server. I have looked at .NET Remoting and it looks like overkill for what I want to do
So does the panel think the following will work ?
Client
- Web browser running the DHTML Webservice Behaviour
Server
- C# WebService talking to
- C# Windows Forms Application
Seems a simple solution to me however I can't work out the best way to get a C# WebService to talk to a C# application.
Appreciation for any help given will be shown with virtual beers (I am sure someone around here uses a beer icon, but I can't see it in the list of smilies)
Cheers
Steve
|
|
|
|
|
For your WebService to talk to your C# application you would again need something like .NET remoting, which brings you back to the first scenario anyways. You are crossing app domains, so communication has to be dealt with anyways.
My suggestion would be use .NET remoting. It's really not an overkill at all. The server (which would be you C# application) simply needs add a couple of lines of code. And your client app can add a couple of lines of code and voila!!! You're done!!!
The good thing here is that with .NET remoting you have all the flexibilty you want and it's very extensible. You can communicate TCP/IP or Http (through IIS or not) etc...
If you need some samples respond back.
Steve
|
|
|
|
|
Many thanks for that, if remoting only needs a few lines of code, then as you say it is not overkill !
I guess the answer then is to connect from the Webservice to the App via TCP/IP. If you have any samples of 'simple' remoting on the same system then that would be great.
Cheers
Steve M
|
|
|
|
|
This example exists within the examples of on your computer.
<frameworksdk>\Samples\Technologies\Remoting\Basic\RemotingHello
Take 15-30 minutes to look at it. It's worth it.
|
|
|
|
|
Hmmm...
Took a little while to make the stuff work. My system has 2 network connections. One for the cable set top box for broadband and one for my local network. Add in ZoneAlarm as the firewall and mix until thoroughly confused.
IIS on this machine is bound to the local network, BUT it is not resolved to LOCALHOST (i may need to switch network connections over). So I had to edit the .config files to use the actual IP address. The web client implementation wants me to log in as I am not authorized to view the page even though IIS is configured for anonymous acess and so refuses my administrator password
However, running the service using DirectHost service works when using the consoleclient. I have loads of questions but I will carry on playing for while...
Cheers
Steve
|
|
|
|
|
hey guys and girls,
im trying to get the ability to embed a hastable value of the password im going to encrypt a file with, in the file its self (but not embedding the password its self though just the hastable it generates). After encrypting it like above, i want the decryptor to beable to compare the incoming password to the hashtable on the encrypted file, if the 2 match, then continue, my problem is i need the incoming stream, to seek passed the hashtable and start there (SeekOrigin.Begin), so the original data is intact,the problem is when i use the FileStream.Seek = Seek(hashtablelength,SeekOrigin.Begin) when it gets to the actualy decryption part, it freezes and doesnt do anything, Ill include the code below, Am i just not doing it right ? If i was unable to make my question clear enough please let me know,
Jesse M
(i clipped the code so it will not be 100% correct, but the bulk of it is there)
///
///Decryption Method
///
<br />
FileStream fin = new FileStream(inName, FileMode.Open, FileAccess.Read);<br />
FileStream fout = new FileStream(outName, FileMode.OpenOrCreate, FileAccess.Write);<br />
fout.SetLength(0);<br />
byte[] bin = new byte[buffersize];
long rdlen = 0;
long totlen = fin.Length;
int len;
RC2CryptoServiceProvider RC2 = new RC2CryptoServiceProvider(); <br />
PasswordDeriveBytes db = new PasswordDeriveBytes(KeySecretString,SaltByte);<br />
byte[] f= db.GetBytes(RC2.LegalKeySizes[0].MaxSize /16);<br />
RC2.IV = f; <br />
RC2.Key =f;<br />
CryptoStream encStream = new CryptoStream(fout, RC2.CreateDecryptor(RC2.Key, RC2.IV), CryptoStreamMode.Write); <br />
Console.WriteLine("Encrypting...");<br />
while(rdlen < totlen)<br />
{<br />
len = fin.Read(bin, 0, buffersize);<br />
encStream.Write(bin, 0, len);<br />
rdlen = rdlen + len;<br />
PD.PerformStep();<br />
Console.WriteLine("{0} bytes processed", rdlen);<br />
} <br />
The Code Project Is Your Friend...
|
|
|
|
|
Code example :
ClassA oClassA = new ClassA();
Thread oWorker = new Thread(new ThreadStart(oClassA.read)); //How??, this is only partially done
My ClassA has a method "read(out ArrayList Something)" which expect a reference to ArrayList as input paratemer. How could I do so in C# with the code above?
Thank You
|
|
|
|
|
Anthony_Yio wrote:
read(out ArrayList Something)"
i guess the delegate ThreadStart encapsulates any methods without any parameters.
Cheers,
Venkatraman Kalyanam
Chennai - India
"Being Excellent is not a skill, it is an attitude"
|
|
|
|
|
Thank you but your help doesn't seem helping.
|
|
|
|
|
Anthony_Yio wrote:
your help doesn't seem helping
Ok. One solution could be use module level variable for storing the parameter and manipulate it from with in the function.
Cheers,
Venkatraman Kalyanam
Chennai - India
"Being Excellent is not a skill, it is an attitude"
|
|
|
|
|
Ok, thank you for this time although I had found some solutions in the web already.
I thought you were just one of those irresponsible people where they like to post and run. Apparently, I am glad you are not because you are trying
Some of the solutions I found was
Thread local storage
or
Save it into the object state.
|
|
|
|
|
Thanks, i forgot to point to this article.
Cheers,
Venkatraman Kalyanam
Chennai - India
"Being Excellent is not a skill, it is an attitude"
|
|
|
|
|
Why can't you pass the reference to ArrayList in the constructor for ClassA()?
Gaulles
|
|
|
|
|
Reason is that I will need to process the reference parameter in the contructor itself unless I would to store the refence to a pointer but it would make my program to be unsafe.
I guess this is not an old C++ style programming anymore.
|
|
|
|
|
You could also and is probably better than spawning a new thread is to use the BeginInvoke(string str, AsyncCallback asc, object stateobject). You then call the EndInvoke(IAsyncResult result) to retrieve the answer from the function. You pass a reference to the Arraylist in the stateobject and your AsyncCallback method handles and the parameter within it's function.
The good thing here is that you don't have to create a new thread, but rather the delagate function is executing on a thread from the thread pool - no creation is necessary.
I understand that this is probably hard to understand if you've never seen it before but you can look up BeginInvoke. .NET supports asynchronous method calls wonderfully with delagate.BeginInvoke.
|
|
|
|