|
It was created by XmlWriter. Those 3 letters are only poiting that this file was saved with Encoding UTF-8.
Even if i removed them manualy, error still persist
|
|
|
|
|
It looks suspiciously like a unicode BOM but viewed with a non-western charset
And that's allowed
|
|
|
|
|
Dunno, but why use a StringReader?
I prefer to use an XmlDocument for reading (loading) XML.
|
|
|
|
|
XmlDocumont loads entire xml file into memory. However i expect that file woud exed memory limitation with its size
Edit:
Found the problem
XmlReaderSettings xrs = new XmlReaderSettings();
xrs.IgnoreWhitespace = true;
xrs.IgnoreComments = true;
XmlReader reader = XmlReader.Create(SettingFile, xrs);
while (reader.Read())
{
}
As you can see i feed XmlReader its file. I don't know what URI is. But on one forum i sow they put in with the StreamReader. As it turns out, that class didn't read the file at all, but the string. So Reader only got the path to that file instead actual xml file
modified on Tuesday, August 11, 2009 1:59 AM
|
|
|
|
|
Hi All!
I want to use this code to copy a changed file to backup folder, i am using
Filesystemwatcher to listen for the change to a file in a test folder in documents, and when a file is changed a copy should end up in backup.
Now when i use File.Copy it copies the file but then gives me an exception saying it allready exists! How can this be when the backup folder was empty?! i checked this out, and if i use File.Move it still complains when it moves the folder to backup, and the says "file does not exist in test!" so copy would be better as it leaves the original where it is, but why the hell does it say it allready exists in backup when it copies it over?? any ideas? im doin the 70-536 course and the "suggested practices" at the end of the chapters just chuck you in the deep end! lol.
//set the FileSystemWatcher properties
fsd.IncludeSubdirectories = true;
fsd.Path = @"C:\Users\Luke\Documents\test";
fsd.NotifyFilter = NotifyFilters.FileName | NotifyFilters.LastWrite;
//add the changed event handler
fsd.Changed += new FileSystemEventHandler(fsd_Changed);
fsd.EnableRaisingEvents = true;
static void fsd_Changed(object sender, FileSystemEventArgs e)
{
//allready exists on first copy!!??
File.Copy(@"C:\Users\Luke\Documents\test\" + e.Name,
@"C:\Users\Luke\Documents\test\Backup\" + "bak" + e.Name);
//moves file and then says "could not find file in test!
File.Move(@"C:\Users\Luke\Documents\test\" + e.Name,
@"C:\Users\Luke\Documents\test\Backup\" + "bak" + e.Name);
}
|
|
|
|
|
Why all the white space?
Anyway... have you set a breakpoint at (or just after) the offending line? It is possible for FileSystemWatcher to fire the same event multiple events in a very short space of time. My guess is it may be suceeding the first time, but the event may be immediately being reraised.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Hello every body .......... I was developing a C# application and one of ma friend was also developing an application that is dependent with my C# application using VB.NET ........ He is good @ VB.NET ..... so how do our applications can work together??
THANK YOU
|
|
|
|
|
Your colleague just need to reference your application (DLL). He will be able to use any public members of your library like a C# application would. After compiling an application, doesn't matter if it was written in C# or VB.NET, you use it the same way.
Regards,
Leonardo Muzzi
|
|
|
|
|
Leonardo Muzzi wrote: He will be able to use any public members of your library
How do he references to it ...... i.e just using the form name?? or how ??
Thank you
|
|
|
|
|
First you build an assembly with your C# library. Then send this assembly (DLL) to him, and he can reference this assembly in his own application. If he is using VS, just right click the project and "Add Reference". After adding the reference, his application will be able to see all your Namespaces and all public classes within it.
If you are making a windows form app, you should separate the Executable from the Business library that you want to share. Let's say you have a method called "ListClients" in a "Clients" class and wants to share it. You should build a separate project, a Class Library project, called "ClientsAccess" for instance, and put this class in this new project. Then, you reference this project from your windows form app. This new Class Library project will generate a DLL, called "ClientsAccess.dll", that you can send to your colleague so he can reference the DLL just like you did and use the Clients class inside.
Regards,
Leonardo Muzzi
|
|
|
|
|
OK DUDE.... I will try it the rest by my self... thnks for the help
|
|
|
|
|
Hey dude....we have all tried to help you here....however, it is clear that you would benefit from reading a couple of books....or taking some .net and development classes before asking more. The questions you are asking are very basic....and....would be covered in these resources....If you continue to rely on others you will never learn or succeed in this profession.
only two letters away from being an asset
|
|
|
|
|
ya you are right ....... i will follow your advice ..... by the way are there any free books on .Net & c# windows form applications online??
thank you
|
|
|
|
|
Hi,
Someone can point me to an article that explain how to read traffic/data from cisco router device.
Thanks
|
|
|
|
|
Hey dude .... I am not here to answer you question but to ask you something similar to urs .....
What things must should I have to know inorder to work on socket programming .... I just wanted to work on VOIP....
Thank you...
|
|
|
|
|
|
|
Hello,
i have a application, where parallel running threads have access to my database. In most cases, that's no problem, but if a thread has a open DataReader and another Thread wants to access the DB too i get a problem, because there's only one open DataReader allowed.
Now, i wanted to make a Method (lets call it "dbRead()" ) which asks the DB and returns the Data to the specific Thread or Method, which executes dbRead(). My problem is now, that this could become a bottleneck if i have a lot of Reader-Transactions.
There's the possibility to make a list of classes (lets call it "dbOperations") which contains public the dbRead(), put maybe 5 of them in a List<dboperations> and if i want to make a transaction i use randomly one of the classes and start "dbOperationsList[randomNr].dbRead()".
This would work, but isn't there maybe a tutorial or has somebody such an piece of code? Because i don't think, that i'm the first with this problem
Many thanks for your help
Patrick
|
|
|
|
|
My applications always seem to allow multiple readers to a database without issue.
|
|
|
|
|
Provided they each have their own connection?
|
|
|
|
|
Create more connections; one for each concurrent request.
|
|
|
|
|
OK,
that was my first problem and so that i need more Connections to the database, i'll need such an "RequestManager". I've made a simple piece of code and i'll test it if it works. It's very simple. A class, which a standardized Method which gives me a List<object[]> back (it's not a Object[][], because i don't now how much entries i'll get back i get only the amount of columns back), this method makes the request and reads the data and closes the DataReader. This class has a own connection to the database. So... i put n-instances in a List at the start of my application and make a simple integer-value, which gives me the index of the next RequestManager-Class back.
So the first request goes to List<requestmanager>[0], the second to List<requestmanager>[1] and so on... a simple and effective LoadBalancing and Transaction-Management for my Database. And if i see, that i need more connections, i could realize this if i only make more instances of the RequestManager Class.
Many thanks for your ideas.
|
|
|
|
|
Doesn't sounds like a good idea to me. I'd suggest you to use separate connection and command instances for each threads. ADO.NET has inbuilt connection pooling and you don't need to pool it manually.
|
|
|
|
|
N a v a n e e t h wrote: Doesn't sounds like a good idea to me.
Indeed.
N a v a n e e t h wrote: separate connection and command instances for each threads
Yes, but a thread may still need more than one connection to the same database.
N a v a n e e t h wrote: ADO.NET has inbuilt connection pooling
But I don't think it will detect when you need an additional connection to a database and create it. The pooling only pools the connections that have been created by the application. And of course, only if the connection has been closed. So the developer still has to do that.
N a v a n e e t h wrote: you don't need to pool it manually
Not pool, but create.
|
|
|
|
|
PIEBALDconsult wrote: The pooling only pools the connections that have been created by the application
My understanding is: each pool will have a minimum connection object limit and when a pool is initiated, these objects will be created and ready to use. When SqlConnection object is requested, it will be served from the pool if available.
PIEBALDconsult wrote: So the developer still has to do that.
Caching the connection objects? I still believe developer shouldn't cache the connection objects. All they can do is to wrap the connection in a using statement, so it gets disposed properly and return back to the pool. Let framework's pooling do it's job.
|
|
|
|