|
Thanks Senthil,
1.
S. Senthil Kumar wrote: No other thread can add or remove or access the list, while you are manipulating a totally unrelated object.
In my scenario, I have no such requirement. But are there any samples, which we need to lock the whole List even we removed the instance?
2.
S. Senthil Kumar wrote: Would you want that? No, so that's the answer - you don't need to call SafeUseItem from within the lock, as long as you don't reference the list from that method.
So, you mean if I removed the reference from the list (List.RemoveAt), there is no need to lock the reference any more?
regards,
George
|
|
|
|
|
AFAIK, your code is not thread safe. The object you used for locking is not a static member. So each thread will have it's own ListLock instance which should not happen.
George_George wrote: // no lock here? safe?
SafeUseItem(LastItem);
As senthil said, until you are not using Buffer in SafeUseItem() method, you don't need lock.
|
|
|
|
|
Sorry, N a v a n e e t h!
It is my coding bad. I should use static member since there is only one instance of class.
regards,
George
|
|
|
|
|
N a v a n e e t h wrote: The object you used for locking is not a static member. So each thread will have it's own ListLock instance which should not happen.
How did you come to that conclusion? After all, he could be sharing a single instance of the object across multiple threads.
|
|
|
|
|
S. Senthil Kumar wrote: he could be sharing a single instance of the object across multiple threads.
Yes, possible. But he hasn't mentioned that. So I thought so.
|
|
|
|
|
hi all experts,
as i'm new to this, can someone plz advice me?
my project requirements:
1. images upload with adding texts/descriptions attached to it (save it in notepad/html??) using microformats (not too sure also as need details from lecturer)
2. search images via information in the notepad/html saved to the images
3. display searched results images
should i use C#, VB, C++ for this project? as i want to start on the right path... can someone plz refer to any guide?
i've found this:
http://www.codeproject.com/KB/aspnet/netimageupload.aspx
is this the right on to start on? so i can add on later...
please help thanks a million.. waiting on your reply!!
my email/MSN : narmon@gmail.com
plz help
|
|
|
|
|
Thomas Toh wrote: should i use C#, VB, C++ for this project?
C# or VB.NET, you can't do ASP.NET in C++
I think you almost certainly want a simple ASP.NET site which has a database on the back end to store the text, perhaps store the images ( or store local paths to them ) and support searching of that text to find images.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
thanks for the input, appreciate it.
however between C# and VB.Net.. which is a better choice? (as in which language is easier)
also, is there a need for usage of SQL server? cos i remember my lecturer told me there's no need to.
and.. how about microformats -- XFN? lol
waiting for reply again :P
|
|
|
|
|
Thomas Toh wrote: (as in which language is easier)
If you have no idea about programming, you may prefer VB.NET for it's more English like syntax. I find C# easier, but I did C++ first
Thomas Toh wrote: also, is there a need for usage of SQL server?
No, I guess I am thinking of ways to do it properly. You could for example store cat.txt next to cat.jpg to store the text you want to show, if you like. I think it's messier, but it would get you out of learning SQL.
Thomas Toh wrote: and.. how about microformats -- XFN? lol
I have no idea what that means. Just googled it, it looks stupid, unless I missed something. It's just an attribute put on links and stuff, which I guess helps searching for those aware of it.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi Christian,
What is the HTML you use to quote like you have above?
Cheers,
|
|
|
|
|
If you right click and choose 'view source' you can see the html. I highlighted text and used the 'quote selected text' button.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
sorry guys if i sound rude but im really desperately in need of help as im not good in programming and my due date is within weeks.....
i've downloaded http://www.codeproject.com/KB/aspnet/netimageupload.aspx and tried the source codes on Visual Studio 2005. it works.. (solved access denied directory)
now i need to do an addition function which allows me to add descriptions/text/information attached to that image and saved it on either HTML/notepad.. i'm lost.. please help.............
|
|
|
|
|
Thomas Toh wrote: im not good in programming and my due date is within weeks.....
I don't want to be rude here, but the assignment you're given, is a representation of your teachers expectations, and should be in line with what you've been taught and the source material you've been given. If you're totally lost, perhaps you deserve to fail, and try harder when you repeat the subject ? We're happy to help, but we don't want to short circuit a system that's designed to weed out people who are 'not good at programing' before we find ourselves having to work with them.
The task is pretty straightforward, talk to your fellow students, if you're all lost, then it's a problem with the teacher and you should take it to the people running the school. Otherwise, you should look at your notes, take the info you've been given, and try to do the work. If you show signs of having tried something and ask specific questions, we'd love to help further.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
lol sorry... well guess what i've found the code... http://forums.asp.net/p/1121501/2331341.aspx#2331341 ... it works great for me... however is there a way to display the saved images together with the descriptions
|
|
|
|
|
Thomas Toh wrote: well guess what i've found the code
Not the way to do homework, but fair enough.
Thomas Toh wrote: however is there a way to display the saved images together with the descriptions
Well, putting the path to the image in an img tag seems the obvious way.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
the error provider icon is always visible on the program run,even if there is no error! please,help...
csetopper_bhanu
|
|
|
|
|
Hello,
It seems that the condition for errorprovider is not set properly. Let me give you a very simple
example where we will display an errorprovider for a Textbox when alphanumeric values are entered.
<br />
Private Sub TextBox1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged<br />
<br />
Dim num As Integer = 0<br />
<br />
If Not TextBox1.Text.Equals("") Then<br />
<br />
If Not IsNumeric(TextBox1.Text) Then<br />
<br />
ErrorProvider1.SetError(TextBox1, "Please enter numeric value")<br />
<br />
Else<br />
<br />
ErrorProvider1.Dispose()<br />
<br />
End If<br />
<br />
End If<br />
<br />
End Sub<br />
I hope this helps. In case the issue persists, just provide the code where you have implmented the
errorprovider.
Regards,
Allen
Allen Smith
Software Engineer
ComponentOne LLC
www.componentone.com
|
|
|
|
|
hy everyone!
does anyone of you know how to get the correct encoding of a textfile?
because i do read the file via a streamreader and write a new one with streamwriter. but sometimes i do have problems with some signs.
i know the file was created on a unix machine (line seperators just \n instead of \r\n in windows etc.).
streamreader and streamwriter allow encoding to be used as a second/additional parameter when reading or writing of/to the file.
so my two questions:
1) which encoding do i have to use for unix textfiles so the characters are read and written correctly? (because here in europe we have characters like "ö" or "ä" but they are not displayed correctly during writing the file. in the original file they are displayed correctly. so i want to provide the encoding in the parameter, but there are so many. and i am not sure, if i choose one which seems to be working on one file, does this mean it works for every unix textfile?
2) is there a chance to get the encoding of the file, when reading it without knowing it from the beginning? meaning, i want to find out the encoding when i access the file and set it when reading it, some kind of "dynamic encoding setting".
thanks.
stephan.
|
|
|
|
|
|
and which encoding type do i have to use? because i read the msdn but it confused me more than it helped. tons of different encoding specifications and descriptions
|
|
|
|
|
Sorry, I really don't know. Something unicode based is what you're looking for though I think. Personally I would say stop using *nix, but then i'm sure you have a good reason not too (otherwise i'll bash your head in with a really big book ).
|
|
|
|
|
Hi,
try new Encoding(codepage) where codepage probably is 1252.
There is no general way of detecting the encoding; if it is Unicode/UTF8 you
will find two special leading bytes; if it is an 8-bit ASCII extension (as I
expect it is for you), you won't get a clue: every codepage is another way
to map the top 128 byte values to a immense collection of possible characters.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Hello everyone,
When we call Environment.Exit to terminates a console application or a Windows service,
1.
All the expected finally blocks are ensured to be executed, so resource leak?
2.
No exception occured (i.e. when invoking Environment.Exit, no exception thrown, like invoking Thread.Abort will throw ThreadAbortException?)
thanks in advance,
George
|
|
|
|
|
George_George wrote: All the expected finally blocks are ensured to be executed, so resource leak?
No, managed threads will be suspended and then terminated, so the CLR does not make any explicit attempt to execute finally blocks. It does execute finalizers though. And your process is going down, so the OS is going to cleanup all process local resources anyway.
George_George wrote: No exception occured (i.e. when invoking Environment.Exit, no exception thrown, like invoking Thread.Abort will throw ThreadAbortException?)
No again - it doesn't throw any exception as part of normal execution.
|
|
|
|
|
Cool, Senthil!
Question answered.
regards,
George
|
|
|
|