|
What happens if you enable viewstate? let's start there.
|
|
|
|
|
I don't see any difference between the EnableViewState being set to "true" or "false". From reading the MSDN site, I think this needs to be "false" to update the view dynamically.
|
|
|
|
|
I finally figured this out. I wasn't approaching the problem correctly.
I had to change my ASP code to be an ASP:Placeholder:
<asp:placeholder id="tblBrowserOSTable" runat="server" xmlns:asp="#unknown" />
Then at the end of my code, instead of assigning the new table to the existing table (which is now gone), I replaced the placeholder control with the new table:
tblBrowserOSTable.Controls.Clear();
tblBrowserOSTable.Controls.Add(newTable);
|
|
|
|
|
Hi, Ive been trying to figure out how to go about doing this for a few hours, Was wondering if someone could offer some advice.
What i have is "List<string> Files = new .." containing a number of file paths in order of last opened. The list is LIMITED to only holding 10 items.
When a new file is opened, i want to shift all of the items in the list by +1 place.
So Files[1] goes to Files[2] ... and Files[2] goes to Files[3]
and so on.
So then i can keep adding new files, they will go to Files[1] and all of the others move up a position.
Anyone any advice? If what i said even makes the slightest of sense?
Thanks for reading my confusing stuff
|
|
|
|
|
Do a list.Insert to put the item in at the first place, and a list.Remove to remove the last item from the list.
|
|
|
|
|
I recently implemented something similar. The way I did it was to have a class that contained the 'friendly' filename, filepath and date. I used IComparable to sort them by date descending and used a generic list and it's Sort method. Then I just displayed the number of entries I was interested in by getting those just that many from the beginning of the List.
Doing it that way, you can automatically 'reverse fill' the list if you give the user the option to remove an entry - similar to the way visual studio does.
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)
|
|
|
|
|
What happens if you open a file that's already part of the collection? If it should only work for new files being opened, then a Queue[^] will do the job, otherwise could use a LinkedList[^].
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi,
for every potentially new file, you can remove it (which will fail silently if not present),
then insert it at the most-recently-used side.
When the remove failed (see return value), you may want to remove the one at the least-recently-used side instead.
|
|
|
|
|
This is what a Stack or Queue is used for...
Either that or just use List.Add, and then display them in reverse order
|
|
|
|
|
I have a form that gets a list of files for processing I am storing the path in an sting array then passing the array to a class that does the work on the files. the single thread approach takes about 30 mins to process 100 files and update an access DB (will be ported to SQL soon). Currently the single thread makes the form not responsive. I want to at a minimum move the processing to another thread, possibly setup a thread pool. from what I can tell the time consuming part is updating the DB. I have a few questions before I jump to conclusion of adding 1 thread or a thread pool.
1. will the thread pool solution run into locked file problems when writing to the DB from multiple threads? currently using Jet OLEDB to connect to the DB
2. What is the best way to handle passing the files to the class with threads?
Currently I am reading the directory and storing the files in a string array in the form
creating the object for the class
passing the array to the StoreArray method
call the Process method
the process method calls another method that handles the interaction with the array
I think the answer to my 2nd question with the least amount of rewriting code is to create the object of the class as a form variable, but I'm not sure that that is really the best solution.
I'm new to threads and not sure how I can get the data from the Form to the class.
below is two of the methods that should show how i am currently doing this (could have errors I didn't cut and paste)
## form1 ###
private void btnStart_Click(object sender, EventArgs e)
{
int count = 0;
string dirpath = this.txtxmldir.Text.ToString();
if (dirpath != "")
{
//new Dir Info object
DirectoryInfo di = new DirectoryInfo(dirpath);
//load files into array
FileInfo[] rgFiles = di.GetFiles("*.xml");
foreach (FileInfo fi in rgFiles)
{
file[count] = dirpath + "\\" + fi.Name;
count++;
}
}
RRRxml ProcessXml = new RRRxml();
ProcessXml.SetFiles(file, count);
ProcessXml.Process();
}
## RRRxml Class ###
public void Process()
{
while(Arraycounter > 0)
{
string FiletoProcess = ReadFiles(); //Read files is in charge of controlling the array counter and returns the file to load
xml.Load(FiletoProcess);
//Do work....
}
}
|
|
|
|
|
Hi Planker,
i will try to answer your question.
1. I don't know it exactly but it seems that there is only one connection to the db at one time (I think because it is file based). This issue will be solved if you move to a database supporting multiple connections at once. To use multiple threads with the access database you can think about using the producer-consumer pattern. The threads processing your files will produce data. This data will be stored in a single datastructure (attention: must be thread-safe!). If data is passed into this structure the thread containing the db connection will "consume" this data and store it within the db. (search for the producer-consumer-pattern to get an idea of it).
2. Here I would nearly do the same using the producer-consumer-pattern. Store the files in a thread-safe datastructure (single static instance, so that it can be accessed from everywhere in your application), the threads working with the files will "consume" the filenames stored within the datastructure.
The perfect datastructure for this is a Queue. For using the producer-consumer-pattern take a look here:
http://msdn.microsoft.com/en-us/library/yy12yx1f(VS.80).aspx[^][^].
Let me know if this helps you.
Regards
Sebastian
|
|
|
|
|
I think, writing docu on SW with MS-Word and so on is obsolete - too inflexible.
XML, XSLT and ... are todays standard.
But, what I don't know: How are these tools applied by "normal users" (non-xslt-experts)? What is the professional way to write documentation? I also mean more than just what is generated by MsVisualStudio.
Best regards
|
|
|
|
|
|
Frygreen wrote: writing docu on SW with MS-Word and so on is obsolete
Really?
Frygreen wrote: XML, XSLT and ... are todays standard.
As used by obsolete software like Microsoft Word!
Frygreen wrote: How are these tools applied by "normal users" (non-xslt-experts)?
With Microsoft Word.
Frygreen wrote: What is the professional way to write documentation?
With a word processor... Like Microsoft Word.
Seriously, take a Word 2007 document replace the .docx extension with .zip and take a peek inside. Lots of luvvvelee XML!
And, also serious, I will guarantee most professional documentation is written in Microsof Word that it converted to a PDF when ready for "publication".
|
|
|
|
|
|
..hmmmm...
thank you for your answers.
I'm puzzled. I know about MS-Word, Sandcastle, Ndoc - I use all of them.
Integrating (this is transforming it via xslt to html/pdf) Sandcastle, Ndoc in an automatic build-environment is just "plain easy", because it is based on XML.
On the other hand, MS-Word makes also sense, because it's so easy to use for "non-programmers" and e.g. attaching images and the like is no problem.
But unfortunately in my environment (many users/machines/humans updating asynchronously docu) MS-Word is not to maintain in practice; and how to maintan automatically generated docu (let's say generated by NDoc) with MS-Word?
What I really liked in the past (and still today) was/is latex, because there is really no maintenance-cost (independent of the number of users). But LateX is not so well upto date concerning newest technology
|
|
|
|
|
Function read bytes from file and save in new file, but after this operation size of the new file is different
source file: Size 26,6 KB (B: 27300)
after
Size: 26,8KB (B: 27468)
bufferSize= 252
enter= 27300
enter / bufferSize = 108,(3) so 109 blocks
109* bufferSize = 27468
How can I do this correct?
Please for Your help
C# code
private void button1_Click(object sender, EventArgs e)
{
readMyStream("D:\\files\\myFile.txt");
}
Stream inputStream;
Stream outStream;
int bufferSize = 252;
byte[] buffer;
private void readMyStream(string fileName)
{
buffer = new byte[bufferSize];
inputStream = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read, bufferSize, true);
outStream = new FileStream("D:\\plikiTxt\\az.txt", FileMode.Create, FileAccess.Write, FileShare.Write, bufferSize, false);
inputStream.BeginRead(buffer, 0, buffer.Length, new AsyncCallback(OnCompletedRead), null);
}
private void OnCompletedRead(IAsyncResult asyncResult)
{
int bytesRead = inputStream.EndRead(asyncResult);
if (bytesRead > 0)
{
outStream.Write(buffer, 0, buffer.Length);
inputStream.BeginRead(buffer, 0, buffer.Length, new AsyncCallback(OnCompletedRead), null);
}
else
{
inputStream.Close();
outStream.Close();
}
}
|
|
|
|
|
In this snippet
if (bytesRead > 0)
{
outStream.Write(buffer, 0, buffer.Length);
inputStream.BeginRead(buffer, 0, buffer.Length, new AsyncCallback(OnCompletedRead), null);
}
what if bytesRead is less than buffer.Length ? Wouldn't you be writing more bytes to the file than you read?
P.S. use PRE tags around code to preserve formatting
|
|
|
|
|
Yes , I know now
That is ok.
Do You know better solution?
FileStream fstFile;
FileStream fstWrite;
private void sendData()
{
string fileName = "d:\\az.txt";
// The file stream will read bytes from the file that the user has chosen
fstFile = new FileStream(fileName, FileMode.Open, FileAccess.Read);
fstWrite = new FileStream("d:\\zapis.txt", FileMode.Create, FileAccess.Write);
int bytesSize = 0;
byte[] downBuffer = new byte[252];
string tekscik;
while ((bytesSize = fstFile.Read(downBuffer, 0, downBuffer.Length)) > 0)
{
fstWrite.Write(downBuffer, 0, bytesSize);
}
fstFile.Close();
fstWrite.Close();
}
|
|
|
|
|
|
I want get byte[] from file, manipulate them(add detection code), send by UDP ...
|
|
|
|
|
|
in C # I designed a program including WebBrowser, 1 combobox called cbo1.I want to control a checkbox combobox's Web site on a WebBrowser cbo1 by the user control.I programming will be like?
|
|
|
|
|
Stop spamming over and over, this is the third time you asked. Do you think that the people who regularly post here won't recognize it? You got all the help you're going to get..
|
|
|
|
|
...
"Well, we're getting "F"'d at work. WPF, WCF, and WWF... WTF?" --John Simmons
|
|
|
|
|