|
public static is global. Perhaps you would be better to use delegates, or create a public static class to hold just the data you ant to share ?
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 )
|
|
|
|
|
Thank you, I have solved this problem.
|
|
|
|
|
hy everyone!
what happens in cases like this:
string myinput = "12345678910";
myinput = myinput.toString({0:10});
Does this throw an exception or does it cut off all charecters > 10 ??
Because I want the string to be insert no matter if it is too long or not. If it is too long then this should be handled by a warning but the string should be insert without cutting off anything.
So I wonder if this function tries to format it to length 10 but accepts strings which are longer as well, or if it doesn't. Because if it doesn't then i have to take care about this myself by checking, if the string is too long.
Thanks.
Stephan.
|
|
|
|
|
Why write such a long post instead of just trying it to see ?
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 )
|
|
|
|
|
stephan_007,
What language is this in?, because it doesn't compile in C#.
Regards,
Gareth.
|
|
|
|
|
it's c# but i didn't copy it from my source, i just typed it into here. maybe i misstyped it.
the reason why i posted it here is, maybe someone already did anything similar and could help me to keep it simple
because it looks like i usually solve problems in a too difficult way which could be solved by default functions. that's why.
i know i could try the two statements above in my own code, but as i already said, maybe someone knows a different way to format the string without raising an error
|
|
|
|
|
ups, i misstyped the second line!
it should be
myinput = String.Format("{0,10}", myinput}
and i already found out, it ignores the formating, if the string is longer than defined in the formatsring. so i have to check it myself, by splitting off the relevant position in the format string to compare it to.
modified on Monday, May 5, 2008 9:10 AM
|
|
|
|
|
I believe it will throw an exception..even sql server throws an exception that warns that string data is bieng truncated. your best solution would be to either limit what the user can type in, or check its length before you try to insert it, and either truncate it yourself, or tell the user that the input is invalid(best solution so the user doesnt get bad data in the db or where ever you're putting it)
|
|
|
|
|
the user wants this behaviour:
if the string is smaller or equal the length defined in the format string, then just insert it, if it is longer than the length defined, then the programm should throw a worning, but insert the data anyway.
i have to insert it into a stream. so if it is too long, then all other info is moved x characters to the right (x is the difference to the defined and the real length).
well, because it just ignores the length if it is too long, i have to write a check myself to know, if i have to throw a warning or if the length is ok.
|
|
|
|
|
you should probably try to explain to the user that just inserting the data even if its too long is a bad idea. you could just use the string.Length to find out how long it is, and use Remove to cut off any unwanted characters
|
|
|
|
|
Dear all,
I am building a c# application. I wanted to add to it the capability that i dictate a URL and then write it in a text box, so i searched and i found that i should use class "DictationGrammar". However i couldnot find an intact example or set of steps to follow to build the required utility. I would appreciate it if anyone could help...
Regards,
|
|
|
|
|
Hi All
I Wount to use the workflow project , but i dont know who i can do ...
who can hellp me ?
thank for any body hellp me
Thaer
|
|
|
|
|
Please read the forum guidelines.
|
|
|
|
|
Hi,
on My form I have about 150 controls at the same time, and most of them use docking.
some of them are childs in childs in childs of controls.
Whenever I resize my form it takes a long time for it to rearrange and ready to workwith.
I manged to speed up things in the proccess of adding all the controls by using ResumeLayout and SuspandLayout. But what should I do in the proccess of resizing?
How can I find out when the resizing event startend and when the resizing is finished?
tnx leeoz
|
|
|
|
|
Resize event doesn't quite work like that, it gets fired when the forms size has changed. So when you resize your form with your mouse, every time you see a visible change in the size of your form, then event has been fired.
Sadly you can't get the mouseDown mouseUp events for clicking on the border. The only way i know to get that information is to override WndProc and look at the messages, one of them is sent when you mouse down on the caption bar/border and other are sent when the mouse moves or the button is released.
But, i tried using SuspendLayout and ResumeLayout with docked controls, and i think after ResumeLayout the controls just stayed where they were. So you should check that.
Good news is though, if you also override the OnPaint event you can stop any drawing yourself. So if you use WndProc to work out when the form is being resized then you can set a bool to false or something, and have an if statement around base.OnPaint(e); in your OnPaint override. Of course even without drawing it will still try to reposition all of the controls every time the resize event is fired, so it may still end up going slow.
Well, good luck.
My current favourite word is: Bacon!
-SK Genius
|
|
|
|
|
Hello. I have to open an outlook item using the hyperlink like <Outlook:Sent Items>. This technique is described here http://support.microsoft.com/kb/225007. As i understand, such links are to work in the explorer address bar as well. But instead, IE just can't display the page. Could anybody explain how it should work?
Than's in advance.
|
|
|
|
|
Well i just tried it and it does work, but IE doesn't show the page. Outlook just opens on the Sent Items folder. And just in case, you don't actually type the <> signs.
My current favourite word is: Bacon!
-SK Genius
|
|
|
|
|
Very strange, because it does not work with my configuration. Could you please tell me what Outlook and IE versions you use? I have IE6 and Outlook2007 installed. Thank you.
|
|
|
|
|
IE6 and Outlook 2003. And i just checked in FireFox, it works there too.
My current favourite word is: Bacon!
-SK Genius
|
|
|
|
|
Thank you very much. I have just tested it with Outlook2003 and it works fine. The problem is in Outlook 2007.
|
|
|
|
|
Public AsynCallback pfnWorkerCallBack; //Define a global reference
public void WaitForData(System.Net.Sockets.Socket soc,int clientNumber)
{
try
{
if( pfnWorkerCallBack == null )
{pfnWorkerCallBack = new AsyncCallback (OnDataReceived);}
SocketPacket theSocPkt = new SocketPacket (soc, clientNumber);
soc.BeginReceive (theSocPkt.dataBuffer, 0,
theSocPkt.dataBuffer.Length,SocketFlags.None,pfnWorkerCallBack,
theSocPkt);
}
}
public void main()
{
WaitForData(Socket1,1);
WaitForData(Socket2,2);
}
Question:
1.When the 1st WaitForData(Socket1,1) started, pfnWorkerCallBack is definitely equal to NULL so a new AsynCallback is created and assigned to pfnWorkerCallBack. What happen to pfnWorkerCallBack when the second WaitForData(Socket2,2) started?
2.When a same method was started asynchronously for several times. Are all method's variables refer to the same variables?
|
|
|
|
|
I have created a shared folder through Windows e.g. 'D:\Testing'
I have given permissions to 3 users A, B, C
Now, I want to access the names of these three users.
I am using GetSecurityDescriptor for performing this but,
the DACL returned by this function always contains 7 users
(out of 6 are default and 1 loggedin user) irrespective of shared permissions.
DDeepali
|
|
|
|
|
This is because there are two levels of permissions in play when you share a folder:
1. The permissions on the *folder* in the file system (NTFS). Accessible via the "Security" tab in the properties dialog box for the folder. These permissions are in effect even when you access the folder locally (not only via networking). The permissions are stored in the file system, and are what you get when you query the file system (NTFS).
2. The permissions on the *share* (accessible via the "Permissions" button on the "Sharing" tab). These apply only when accessing the share via the file server component (lanmanserver - which started its life as a port of OS/2 LAN Manager, hence the name) in the system. These permissions (along with the share name and other settings) are stored in the registry (HKLM, System, CurrentControlSet, Services, lanmanserver, Shares).
In order to access a file via a file share, you need the appropriate permissions on BOTH.
Most likely you are querying the file system, so you get the file system permissions. I suspect you have to use another API (or framework namespace) to find the share permissions (never done it myself).
Before Windows Server 2003 best practice (and default) was to grant everyone full control to the share and then control permissions in the file system. Most people still do that (as those permissions will be enforced even if users use other protocols/services to get at the files). The default configuration in WS2003 is to only grant everyone read-only access to new shares, though.
Confusing? Yes, but that's unavoidable. The file server has to be able to secure stuff residing on insecure file systems (such as FAT), and therefore needs an additional layer of security. When you use NTFS, however, there's not much point in using that layer - and as noted, most people tend to use "everyone, full control" at share level and then control access with the NTFS permissions.
HTH
--
Peter
|
|
|
|
|
Thanks alot for such a knowledgeable reply.
I will try to some APIs that can help me.
thanks alot
DDeepali
|
|
|
|
|
Thanks for the appreciation!
On a second note - my experience (20+ years of working with sysadmin tasks in various OSes) is that permissions should never be granted to users or organizational groups (groups that are based on peoples role's). The one way of achieving zero maintenance for folder/share permissions is:
1. Create a group (machine or domain local depending on scope of the resource) for the resource. Name it so that the resource and appropriate access is described, such as "Product presentations (modify)". Only create groups for permissions that are actually needed - otherwise, you'll end up swamped with unnecessary groups...
2. Grant the appropriate NTFS permissions to that group (as well as full control to SYSTEM and Administrators). Grant file share permissions accordingly (except for SYSTEM - not applicable at share level).
3. From then on - manage permissions by adding/removing users and/or user role groups to/from the resource group.
Not only will you never need to fiddle with file system and/or share permissions once they have been created, but you will also be able to delegate (assuming you use domain local groups) permissions management to someone who doesn't have access to the file system/share permissions. Also, it is somewhat simpler to script/automate group membership management than permissions management. You'll also never more need to see "account unknown" in an ACL after users have been deleted (if you use machine local groups and add domain users to them, you will see them in the group memberships instead - but not if you stick to domain groups).
Later,
--
Peter
|
|
|
|