|
Hi,
I found many ways to get the host from url but i need the domain only.
for example - if the url is http://www.abc.com
uri.host = www.abc.com but the domain is abc.com (www is one example)
so, how do i get the domain and not the host?
Thanks,
dana Tov
|
|
|
|
|
.NET has a Uri class, right. Use it.
|
|
|
|
|
as i said in the question the Uri returns the host which is not
identical to domain.
dana Tov
|
|
|
|
|
if (!Url.Contains("://"))
Url = "http://" + Url;
string LstrDomain = Uri(Url).Host;
this should help
|
|
|
|
|
Hi, pros. How to detect a mouse hit on image on the form.
Image have transparent color.
with respect.
What doesn't kill us makes us stronger
modified on Monday, August 4, 2008 11:35 AM
|
|
|
|
|
If the image is in a picture box - just implement the Click() method of the picture box.
dana Tov
|
|
|
|
|
No, It's stand alone image. I know what you mean, but if I will do so there would be another problems, such as how to make PictureBox with transparent color.
What doesn't kill us makes us stronger
|
|
|
|
|
...and i would have many images in pictureBox which would complicate on what of the one I just clicked...
What doesn't kill us makes us stronger
|
|
|
|
|
|
what do u mean by a stand alone image ?
Vikas Amin
UNITED STATES STEEL CORPORATION
My First Article on CP" Virtual Serial Port "[^]
modified on Thursday, July 24, 2008 5:33 PM
|
|
|
|
|
mean that it alone in picture box by itself.
What doesn't kill us makes us stronger
|
|
|
|
|
|
Hi guys,
Some time ago I've found a very nice (there are probobly more of them) tutorial about developing application for Windows Vista. The article was talking about Vista security model and why it is important to specify application security level using mt.exe tool. Can anybody point me to a similar article?
thanks a lot!
zilo
|
|
|
|
|
Hi Zilo,
Please refer to the below mentioned links for information on creating applications for Windows Vista:
Link 1[^]
Link 2[^]
Link 3[^]
Link 4[^]
I hope this would be helpful.
John Adams
ComponentOne LLC.
www.componentone.com
|
|
|
|
|
Thanks John,
You have partly answered my needs, however I was more searching for an article saying why it is important to do it than the actual procedure.
although this is helpful as well, thanks a lot !
zilo
|
|
|
|
|
Hi,
I have a generally question that bother me.
Let me explain it with an example, so that you understand the question.
Let's say we have simple TcpSerer-class which a ConnectionList and looks like this
public class TcpServer {
public List<tcpclient> ConnectionList { get; }
public void start () { }
public void stop () { }
private void client_Connected ( TcpClient client ) {
ConnectionList.Add( client );
}
private void client_Disconnected ( TcpClient client ) {
ConnectionList.Remove( client );
}
}</tcpclient> So, as you can see, this class is not thread-safe.
Because an exception will thrown when i enumerate the ConnectionList
while some Client connect or disconnect.
Thats why i need an object to provide a possibility to lock the ConnectionList
while i enumerate it. OK so far so good.
Now i thought just take the SyncRoot-Property from the ICollection Interface implementation.
But someone told me, i should not use that Object for synchronization with the list.
Because the SyncRoot-Property was a mistake from Microsoft and decoy the developers
to use it without thinking about synchronization.
But the same one told me, that there is no differenc between the object from the SyncRoot-Property
and the object i could provide with a derivation of the List<T>.
Thats why my questions:
Q#1 - Is it true that the SyncRoot-Property was a mistake from Microsoft and shoundnt be used for synchronization. ?
Q#2 - If Q#1 is true then - Why ?
Q#3 - What its the recommended pattern to lock / synchronize any collection.
Thanks in advance.
P.S.: I asked this question already in the msdn-forum but it doesn't satisfy me.
Link: http://forums.msdn.microsoft.com/en-US/netfxbcl/thread/3d760576-7cd2-44d5-936e-969ff5213648/[^]
|
|
|
|
|
A#1) Yes, SyncRoot was a bit of a balls up from someone at MS.
A#2) http://msdn.microsoft.com/en-us/magazine/cc188793.aspx[^]. Basically, IIRC it all boils down to the fact that your lock object should really be private.
A#3) Create a private object and use that.
private Object _lockObject = new Object();
.
.
.
lock(_lockObject)
{
...
}
In theory, if your writing a class to wrap a ICollection object, and if that object is contained privately within your class, and you never expose it directly, then your probably OK to use the SyncRoot object, as it will be private. I'm not totally sure on this though.
Simon
|
|
|
|
|
thank you for the good answer =)
But in the case of the TcpServerClass....I have two possiblilities
P#1 - I provide a lock-object with a collection to synchronize with it ( SyncRoot - )
or
P#2 - I provide a lock-object from the class which wrap the collection ( TcpServer.SyncLock).
But for P#2 i would have to do this everytime i use a collection whereat for the P#1 the lock-object would just come with the collection.
I understand you when you say... lock object should really be private ...but in a development, you should know what you are doing.
So, thats why it is not really necessary, i think
|
|
|
|
|
The private lock object should be private to the TcpServer class. Like this:
public class TcpServer {
private Object _lockObject = new Object() <-- HERE
private List ConnectionList { get; }
public void start () { }
public void stop () { }
private void client_Connected ( TcpClient client ) {
lock(_lockObject) <-- HERE
{
ConnectionList.Add( client );
}
}
private void client_Disconnected ( TcpClient client ) {
lock(_lockObject) <-- HERE
{
ConnectionList.Remove( client );
}
}
}
MarkPhB wrote: I understand you when you say... lock object should really be private ...but in a development, you should know what you are doing.
So, thats why it is not really necessary, i think [Smile]
It's not because of what you might do, it's because of what other people might do. If you make the lock object public, nasty horrible programmers who don't like you might write a program that reflects on your assembly, and takes a lock on your public lock object. This will cause your program to hang, or worse. Public lock objects are bad practice.
Simon
|
|
|
|
|
Simon Stevens wrote: nasty horrible programmers who don't like you might write a program that reflects on your assembly, and takes a lock on your public lock object
Well in that case you have no chance. If someone uses reflection then there is no way to protect it.
With Reflection someone can do everything, unimportant whether the lockObject is private or public.
Simon Stevens wrote: Public lock objects are bad practice
OK, but how shall i lock the ConnectionList for an external enumeration ?
...or shall i copy the entire ConnectionList befor i enumerate it ?
|
|
|
|
|
MarkPhB wrote: Well in that case you have no chance. If someone uses reflection then there is no way to protect it.
With Reflection someone can do everything, unimportant whether the lockObject is private or public. [Wink]
Really. Dam it, how stupid. How can anything ever be secure if someone can just fully reflect all your private stuff and change anything they want. Have I missed the point here?
[It seems your right: You have to pass the BindingFlags.NonPublic value! This seems rather dumb]
MarkPhB wrote: OK, but how shall i lock the ConnectionList for an external enumeration ?
...or shall i copy the entire ConnectionList befor i enumerate it ? [Sniff]
Yes, copying the collectionlist before returning it would be the standard way. We have several classes that wrap collections, and do copies before returning them to maintain integrity.
Simon
|
|
|
|
|
HI,
Ranges newRange =Excelobj.ActiveCell.SpecialCells(XlCellType.xlCellTypeAllFormatConditions, Type.Missing);
here Excelobj is my excel Object.i want to read all the ranges in which conditional formatting are applied.
for example if the conditionalformatting are used in below two ranges:
A1:c3 and d11:f12
with the above code, i get all the cells combination of both ranges.
but i want two separate range
like range1=A1 and range2=d11
now how do i get two different range from a range object.
I have searched alot but nothing found, please help meeee..........
|
|
|
|
|
having excessive amounts of .....................................
....................................................................................................................................................................................
........................................
.............................................................................................................................................................................................................
..............................................................
....................................................
is not necessary in thread titles or in the subject of a message for that matter. (Unless the person is proving a point, in this case)
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios
Discounted or Free Software for Students:
DreamSpark - downloads.channel8.msdn.com
MSDN Academic Alliance - www.msdnaa.com
|
|
|
|
|
I want to open PDF File in my application
I want to open Doc File in my application
How can I do it
Hello Friends
|
|
|
|
|
Use System.Diagnostics.Process.Start to open the file. This will open the default application associated with the file type.
|
|
|
|