|
Well if you are not a genius you are very close.
Thanks Mike i think this experiece has meant a lot to me because it taught me which things i need to know better before posting!
Thanks for the link i am going to look at it now!
Luis E Tineo S
|
|
|
|
|
use cases are an English Language description of the work flow from the user perspective, along with error and fail paths.
UC1 Start the Computer and ...
1 Push the power button. - the PC turns on and boots to the windows logon screen.
fail states:
BIOS error: goto UC2 Contact Tech Support
Windows boot error: goto UC2 Contact Tech Support
2 At the windows login screen enter your username and password
fail states:
Login rejected. Repeat UC1 step 2.
Multiple failed logins lock computer: goto UC2 Contact Tech Support
...
--
If you view money as inherently evil, I view it as my duty to assist in making you more virtuous.
|
|
|
|
|
Thanks Dan,
Now i know for future references how to post "use cases".
thank you so much
Luis E Tineo S
|
|
|
|
|
Why would you want to kill processes? Wouldn't you just want to prevent users from starting new ones?
It is quite easy to prevent the task manager (via registry) and Alt-TAB and the Windows keys with a global keyboard hook.
xacc.ide
The rule of three: "The first time you notice something that might repeat, don't generalize it. The second time the situation occurs, develop in a similar fashion -- possibly even copy/paste -- but don't generalize yet. On the third time, look to generalize the approach."
|
|
|
|
|
I do need it because my application will be consuming a lot cpu resources and there will be a lot of Network traffic from the clients to the server.
I think you are right about preventing via the registry but i don't know how to use the registry from C# to be honest, would you mind pointing where to start?
Thanks!
Luis
|
|
|
|
|
you don't need to kill any process. make two applications. one that creates a new desktop and then starts the second application (the kiosk one) within that newly created desktop. THAT's what you need right there. there are examples of this all over codeproject. it's easy to do, too. or you could just email me if you need help
|
|
|
|
|
dears,
I have a text file of about 800 MB 17,000,000 Lines and i have to process it line by line ..
i need a way to start more than one thread to read that file ...
the problem here is that i'm using the streamReader Class ...
the only available method for reading line is StreamReader.ReadLine().. "Sequential Access"
I need away to read a specific line directly... "Random Access"
this will give each thread the ability to read a part of that file
Any Idea .. Any Help ... is really appreciated ...
|
|
|
|
|
|
You could set up two stream readers and seek one of them to the middle of the file and have the second thread start from there. (It would have to move to the start of the next line to ensure it is in a good place). It might have the problem of thrashing the disk as it seeks between the two file locations.
You could have one thread tasked with just reading the file. And worker threads that process bits of the file. The worker threads each contain a queue which the first thread populates in a round robin. The worker threads pull data off their queues until the data processing is complete. (You would need to add a null to the queue to indicate that the end of the file has been reached)
|
|
|
|
|
Colin Angus Mackay wrote: You could set up two stream readers and seek one of them to the middle of the file and have the second thread start from there. (It would have to move to the start of the next line to ensure it is in a good place). It might have the problem of thrashing the disk as it seeks between the two file locations.
The only way I could see this not murdering performance was on a raid where each read thread was always targeting data from a different drive. Unless the data file is a fixed length format that aligns with the raids block size though I can't see any way to implement it.
--
If you view money as inherently evil, I view it as my duty to assist in making you more virtuous.
|
|
|
|
|
dan neely wrote: The only way I could see this not murdering performance was on a raid where each read thread was always targeting data from a different drive
That is why I said it would have the problem of thrashing the disk.
|
|
|
|
|
Hi,
you can use the Position property of streams to skip some of the data, so you could
start a few threads and give them different initial positions; I do have some remarks:
1. each thread will have to open the file in such a way that the others can also read it,
hence readonly and "shared reading"
2. if Position is not zero, the first line read will likely be a partial line, so you may
want to ignore the first line.
3. you will need a way to make each thread stop reading when it reaches the first valid
line another thread has already dealth with.
4. don't expect to gain much from large numbers of threads; two will probably help, and
four or more may well have a negative effect since overhead costs will increase
while the threads in the end may well compete for the same resources (unless processing
includes a lot of waiting on communications, or some other round-trip delays).
An alternative approach would be to have one thread that reads the entire file,
and dispatches the lines to a couple of threads for processing. This would be simpler
to organize, and maybe even better for performance, assuming your processing threads
don't need consecutive lines from the file.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
thanks all for your co-operation ...
but any code sample for the stream position Idea ... ??
Luc Pattyn wrote: you can use the Position property of streams to skip some of the data,
|
|
|
|
|
Sorry I don't have code available, I suggest you look at StreamReader.BaseStream and
Stream.Position
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
They have a library on MS Research to deal with big files and partial access.
xacc.ide
The rule of three: "The first time you notice something that might repeat, don't generalize it. The second time the situation occurs, develop in a similar fashion -- possibly even copy/paste -- but don't generalize yet. On the third time, look to generalize the approach."
|
|
|
|
|
FileStream allows random access. I used it to parse the national do not call database combined with binary search to access elements without parsing the entire file.
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|
|
hello, hello
i've encourted here some problem how to extract a table array.
one of the important things when u code an app is the daynamic Aspect.
well i'm trying to do this:
at the moment the app loads it self it load a dataBase without knowing what kind of tables are in the MDB file.
Well, i've been cracking my head using the GetSchema() Method
but it returns only one table, but nothing.
i've tried sql query Like "SELECT Name FROM MSysObjects"
But MSysObjects permisstion = false & still have not a way how to allow the
permisstion (maybe ADOX????) and nothing.
well any suggestion????
Have Fun
Never forget it
|
|
|
|
|
Try this one !!!
SELECT Name
FROM MSysObjects
WHERE Type In (1) AND Left([Name],4)<>"MSYS";
Happy Programming
-----
Abhijit
|
|
|
|
|
YEH
i've found that code from an SQL forum, and it's Version like :
"SELECT Name, Type FROM MSysObjectsWHERE Name Not Like 'MSys*' AND Type IN (1,6);"
but i'm still tring figure out how to solve the
NO Read Permission on 'MSysObjects' Odbc Exception!!!!
Have Fun
Never forget it
|
|
|
|
|
|
Changing your name and asking the same questions doesn't mean you are going to get a different answer!
The GetSchema method returns a DataTable where each row represents the information about each element in the database. You would use this information to create queries for each of the tables - if that is the purpose.
The fact is that there is no "magic" way of getting all of the information from a database because generally this is an AWFUL idea! I have no idea why you want to do this, but i suggest you rethink why you want to do this in the first place.
|
|
|
|
|
You can Change your Name But Your Problem will remain same !!!!!
Happy Programming
-----
Abhijit
|
|
|
|
|
I created a thread to which I passed two ThreadStart delegates to execute for me in the following manner.
ThreadStart myWorkerThread = (ThreadStart)Delegate.Combine(new ThreadStart(addListItemsToDisplay), new ThreadStart(checkProblematicValves));
Thread listThread = new Thread(myWorkerThread);
listThread.Start();
the delegate are:
public delegate void addListItemsHandler();
public delegate void checkProblematicValvesHendler();
the problem I encounter is that when executing the second function, it runs into an endless loop, only
of a reason related to the fact a different thread is running it, because if I run it from the main
thread, this doesn't occure, it simply leaves the function.
the function is:
private void checkProblematicValves()
{
foreach (long key in messageArr.Keys)
{
if (messageArr[key] != null)
{
for (int j = 0; j < messageArr[key].Count - 1; j++ )
{
if (messageArr[key][j] is Clusters.CSensorStatus)
{
if ((messageArr[key][j] as Clusters.CSensorStatus).valveAngDeg > 0)
{
string myKey = LongToHex(key);
int index = valveCheckedListBox.Items.IndexOf(myKey);
if (valveCheckedListBox.InvokeRequired)
{
checkProblematicValvesHendler d = new checkProblematicValvesHendler(checkProblematicValves);
valveCheckedListBox.Invoke(d);
}
valveCheckedListBox.SetItemChecked(index, true);
}
}
}
Thread.Sleep(50);
}
}
} //From here it returns to the start of the function for NO apparent reason.
Please help me!!!
thanks in advanced.
|
|
|
|
|
Hi,
First a comment: the line valveCheckedListBox.SetItemChecked(index, true);
should read else valveCheckedListBox.SetItemChecked(index, true);
since the SetItemChecked is not allowed by another thread.
AFAIK your thread will execute both methods once, one after the other.
The second method (checkProblematicValves) does contain an InvokeRequired/Invoke construct
which is intended to make it execute again on the thread that created valveCheckedListBox,
so yes this method may execute twice.
This construct is necessary because Controls are not thread-safe, so they should be
accessed only by the thread that created them.
Now the way you organized things is not optimal: you have several loops, and
it could happen that the InvokeRequired/Invoke construct fires multiple times,
each time causing the ENTIRE method to run again. I don't think that is what anyone would
intend.
The normal approach would be to organize the InvokeRequired/Invoke stuff outside
the first loop, hence put all the looping in the else part that I mentioned in
my first comment.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Hi Luc,
The second method (checkProblematicValves) does contain an InvokeRequired/Invoke construct<br />
which is intended to make it execute again on the thread that created valveCheckedListBox,<br />
so yes this method may execute twice.
I don't understand how exactly, Invoke() works, you got me confused.
Can you please explain to me how exactly it works, what do you mean by:
<br />
causing the ENTIRE method to run again
Is the following code what you meant???
private void checkProblematicValves()
{
if (valveCheckedListBox.InvokeRequired)
{
checkProblematicValvesHendler d = new checkProblematicValvesHendler(checkProblematicValves);
valveCheckedListBox.Invoke(d);
}
else
{
foreach (long key in messageArr.Keys)
{
if (messageArr[key] != null)
{
foreach (object message in messageArr[key])
{
if (message is Clusters.CSensorStatus)
{
if ((message as Clusters.CSensorStatus).valveAngDeg > 0 )
{
string myKey = LongToHex(key);
int index = valveCheckedListBox.Items.IndexOf(myKey);
valveCheckedListBox.SetItemChecked(index, true);
}
}
}
}
}
}
}
|
|
|
|