|
What do you mean by "file system crash", and how do you think the app could recognise it?
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
for example, a designated folder got changed, not able to write into it, the system shall pop up error message, right? so I have to make specific error exception/message for this kind of case, otherwise the system just gave general error message, am I right?
|
|
|
|
|
You would need to implement FileSystemWatcher, take a look at these links[^].
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
As the inability to save to a certain location is a predictable exception (e.g. the user attempts to save into the Windows folder on Windows 7 when running with normal permissions), it's always a good idea to protect against this type of exception.
|
|
|
|
|
alexyxj wrote: can anyone help explain what might happen to a .NET application if file system
crash?
In general - no.
alexyxj wrote: How does your apps deal with file system crash?
Whatever the business requirements suggest and reasonable extrapolation from that.
For example I don't try to do anything at all about the file system filling up for a server. Can it happen? Yes. If it does what can I do? Nothing. I do however expect that any reasonable operations setup would take into account file system monitoring.
As another example if I can't read a configuration file that the server requires on start up then besides logging an error I can do one of the following
- Start with default values.
- Exit the server.
The choice depends on what was supposed to be in the configuration file that I was reading.
(Note that a logging solution MUST be implemented such that a logging failure does not stop the application from running.)
A stand alone user application should probably do something different. If it cannot read/write to the fle system then it should report that to the user.
|
|
|
|
|
Thanks Richard/Pete/jschell, you guys provided very helpful knowledge, appreciate!
|
|
|
|
|
|
I do I get description from Public Enum?
Public Enum API
'''
''' Using Google API
'''
<description("google api")=""> Google
'''
''' Using Yahoo API
'''
<description("yahoo api")=""> Yahoo
End Enum
API.Yahoo.Description not working
|
|
|
|
|
what programming language your are using and how you are trying to access the description?
Jibesh V P
|
|
|
|
|
You need Reflection . With that, you can retrieve the DescriptionAttribute .
Look at some articles on Enum Description Converters, e.g. Description Enum TypeConverter[^].
|
|
|
|
|
Those are XML-comments, and comments aren't compiled into the code. You could use a DescriptionAttribute as already mentioned, or you'd manually parse the generated XML.
|
|
|
|
|
Hopefully somebody can tell me what I’m doing wrong … I’ve never used an XML file before, so I’m obviously misunderstanding something ...
This XML file :
="1.0"="utf-8"
<Folders>
<TemplatesFolder>E:\Newsletter Templates (Email)\</TemplatesFolder>
<NewsLetterFolder>E:\Newsletters\</NewsLetterFolder>
</Folders>
Read by this code :
Do While (myXml.Read())
If myXml.IsStartElement() Then
If myXml.Name = "TemplatesFolder" Then
myXml.Read()
myTempFolder = myXml.Value
End If
If myXml.Name = "NewsLetterFolder" Then
myXml.Read()
myNlFolder = myXml.Value
End If
End If
Loop
Gives this error:
There are multiple root elements. Line 3, position 2.
|
|
|
|
|
Just a guess: The backslash/left-angle-bracket combination may be confusing the parser. The backslash character is sometimes used to "escape" the following character. If this is happening, it may not be recognizing the left-angle bracket or the end tag.
Maybe put the folder names in double quotes.
|
|
|
|
|
There is nothing wrong with the XML (presuming that your ascii looking text really is ascii text.)
You posted code that shows how you are attempting to parse the xml tree.
But how are you creating the tree in the first place?
|
|
|
|
|
Google XPath and SelectSingleNode... the code you have is about the worst possible way to deal with XML.
|
|
|
|
|
Hi
Use this script to initialize a dos program:
Dim myprocess As New Process
Dim StartInfo As New System.Diagnostics.ProcessStartInfo
Public Sub Audio128(ByVal MyPathandFilename As String, ByVal MyFileName As String)
StartInfo.FileName = MyProgram.exe
StartInfo.RedirectStandardInput = True
StartInfo.RedirectStandardOutput = True
StartInfo.UseShellExecute = False
myprocess.StartInfo = StartInfo
myprocess.Start()
The script works fine but the prompt is displayed while the program EXE works.
Is possible to hide it?
Thanks in advance
|
|
|
|
|
Hi,
Try
StartInfo.WindowStyle = ProcessWindowStyle.Hidden
Hope this helps.
In some cases, my signature will be longer than my message...
<em style="color:red"> <b>ProgramFOX</b></em> ProgramFOX
|
|
|
|
|
Thank ProgramFox
I tested and does not work
It seems to have no effect
|
|
|
|
|
It won't work unless UseShellExecute is set to True, but then you lose the redirect abilities because those have to be set to False in order for the process to even launch.
You can't hide the window if you're going to redirect the streams.
|
|
|
|
|
Try setting the ProcessStartInfo.CreateNoWindow property. I'm suprised you didn't see this when you were browsing the documentation!
|
|
|
|
|
In my asp.net dynamic data project I want to read an excel file using suitable Microsoft technology (Not Excel). Someone said their was a server side tool for this? I want to read the first few columns of data from a table?
Any suggestions or directions on where to go?
|
|
|
|
|
Yes, Excel files are encoded in XML.
So to get started you can include following namespaces in the codebehind of your page:
System.Xml (work with XML objects)
System.IO (read/write to files)
The Internet is full of code example that show you how to use them.
http://support.microsoft.com/kb/301228[^]
.
|
|
|
|
|
It depends on the version of Excel format the file is saved in. If it's in 2003 and below, it's a multiple stream binary file that will be just about impossible to decipher. If it's 2007 and above, it'll be a .ZIP format file with multiple XML files inside of it. Again, a royal pain to decipher without the SDK. Seriously, save yourself MONTHS of work and use the Visual Studio Tools for Office to do this.
|
|
|
|
|
string stmp = "\n<rs:data ItemCount=\"6\" xmlns:rs=\"urn:schemas-microsoft-com:rowset\">\n <z:row _x041a__x043b__x0438__x0435__x043d__x0442___x043a__x043e__x0434_=\"16440042770нÑ\" _x0424__x0438__x043b__x0438__x0430__x043b___x041a__x043e__x0434_=\"20706\" _x041a__x043e__x0434_=\"3049\" _x041d__x0430__x0437__x0432__x0430__x043d__x0438__x0435_=\"Татнефть УÐ*С\" BdcIdentity=\"__bg01003300030043009300\" xmlns:z=\"#RowsetSchema\" />\n <z:row _x041a__x043b__x0438__x0435__x043d__x0442___x043a__x043e__x0434_=\"16440042770нÑ\" _x0424__x0438__x043b__x0438__x0430__x043b___x041a__x043e__x0434_=\"20706\" _x041a__x043e__x0434_=\"5328\" _x041d__x0430__x0437__x0432__x0430__x043d__x0438__x0435_=\"Ð*озница\" BdcIdentity=\"__bg01005300330023008300\" xmlns:z=\"#RowsetSchema\" />\n <z:row _x041a__x043b__x0438__x0435__x043d__x0442___x043a__x043e__x0434_=\"16440042770нÑ\" _x0424__x0438__x043b__x0438__x0430__x043b___x041a__x043e__x0434_=\"20706\" _x041a__x043e__x0434_=\"5353\" _x041d__x0430__x0437__x0432__x0430__x043d__x0438__x0435_=\"Медуница\" BdcIdentity=\"__bg01005300330053003300\" xmlns:z=\"#RowsetSchema\" />\n <z:row _x041a__x043b__x0438__x0435__x043d__x0442___x043a__x043e__x0434_=\"16440042770нÑ\" _x0424__x0438__x043b__x0438__x0430__x043b___x041a__x043e__x0434_=\"20706\" _x041a__x043e__x0434_=\"5357\" _x041d__x0430__x0437__x0432__x0430__x043d__x0438__x0435_=\"Оптовик\" BdcIdentity=\"__bg01005300330053007300\" xmlns:z=\"#RowsetSchema\" />\n <z:row _x041a__x043b__x0438__x0435__x043d__x0442___x043a__x043e__x0434_=\"16440042770нÑ\" _x0424__x0438__x043b__x0438__x0430__x043b___x041a__x043e__x0434_=\"20706\" _x041a__x043e__x0434_=\"8372\" _x041d__x0430__x0437__x0432__x0430__x043d__x0438__x0435_=\"Ðртемьев ИП\" BdcIdentity=\"__bg01008300330073002300\" xmlns:z=\"#RowsetSchema\" />\n <z:row _x041a__x043b__x0438__x0435__x043d__x0442___x043a__x043e__x0434_=\"16440042770нÑ\" _x0424__x0438__x043b__x0438__x0430__x043b___x041a__x043e__x0434_=\"20706\" _x041a__x043e__x0434_=\"8620\" _x041d__x0430__x0437__x0432__x0430__x043d__x0438__x0435_=\"Шифа\" BdcIdentity=\"__bg01008300630023000300\" xmlns:z=\"#RowsetSchema\" />\n</rs:data>\n";
XmlDocument xd = new XmlDocument();
xd.LoadXml(stmp);
DataSet dsQuery = new DataSet();
var node = xd.DocumentElement as XmlNode;
XmlReader reader1 = new XmlNodeReader(node);
dsQuery.ReadXml(reader1);
var v1 = dsQuery.Tables["row"].Rows[4]["_x041a__x043e__x0434_"];
var v2 = dsQuery.Tables["row"].Rows[4][dsQuery.Tables["row"].Columns[2].ColumnName];
The line with v1 throws an exception:
Column '_x041a__x043e__x0434_' does not belong to table row.
The line with v2 throws no exception, however it returns an empty value instead of expected integer value. I wonder why it happens and how to force dataset to work with my XML correctly?
|
|
|
|
|
I neglected to include my DB creation script in my Git repo to bring it home for some weekend get-ahead work. Now I thought the lauded 'Generate Database from Model' feature would be my saviour here, but it's useless. It uses the entity set names to generate table names, so where all my original table names were singular, the generated ones are plural.
Some wag at StackOverflow suggested making all the entity set names singular but all I can think of is somehow extracting all original table names, generating the script, then doing a marathon search and replace. Any suggestions on how I could do this? Any other suggestions?
Disclaimer: This is a duplicate of my StackOverflow question here.
|
|
|
|