|
Hi guys !
would be very thankful if somebody suggested what is happening here and how i can resolve
this issue. the problem is that iam encrypting and sending messages over the LAN with
tcpclient stream class. on the receiving end i am trying to decrypt the message but a get a
whole set of different characters
no where near the source message
iam using
client.GetStream().EndRead(ar);
followed by
Encoding.ASCII.GetString(readBuffer, 0, BytesRead - 1);
thanks in advance
manishjadhav
|
|
|
|
|
|
hi colin thanks very much for the quick response.
i am using ASCII encoding right now on the server side but i have tried unicode as well but the characters still get tampered. please guide
thanks
|
|
|
|
|
Hi
When i open a .tif file in picture box, i should be able to see or open all the pages. A .tif file can have any number of pages. I should be able to display all the pages in the picture box one by one. How can i do this?
I also need to zoom in and zoom out the image. Also scrolling of the image.
Can anyone help me? If possible please send me the code to open multiples pages of .tif files, zoom in and zoom out of image and scrolling of image.
|
|
|
|
|
you need to iterate through the tif file to get each individual image -
<br />
System.Drawing.Image i = System.Drawing.Image.FromStream(mem);<br />
int count = i.GetFrameCount(System.Drawing.Imaging.FrameDimension.Page);<br />
for (int x = 0 ; x < count ; x++)<br />
{<br />
i.SelectActiveFrame(System.Drawing.Imaging.FrameDimension.Page,x);<br />
Bitmap bmp = new Bitmap(i, i.Width / 2 * 140 / 100, i.Height * 140 / 100);<br />
}<br />
Then if you want to zoom the easiest way is probably just to change the width and height of your image.
|
|
|
|
|
Thanks a lot for this help.
can you tell me how can i display the corresponding frames in the picturebox?
right now the first page gets displayed. when i press the "next" button, i need the second page to be displayed in the picture box.
|
|
|
|
|
<br />
System.Drawing.Image i = null;<br />
int imageIndex = 0;<br />
<br />
public myForm()<br />
{<br />
System.Drawing.Image i = System.Drawing.Image.FromStream(mem);<br />
i.SelectActiveFrame(System.Drawing.Imaging.FrameDimension.Page,imageIndex);<br />
myPictureBox.Image = i;<br />
}<br />
<br />
private void button_Click(object sender, System.EventArgs e)<br />
{<br />
if(imageIndex >= i.GetFrameCount(System.Drawing.Imaging.FrameDimension.Page))<br />
{<br />
MessageBox.show("Reached end of images in tif");<br />
return;<br />
}<br />
imageIndex++;<br />
i.SelectActiveFrame(System.Drawing.Imaging.FrameDimension.Page,imageIndex);<br />
myPictureBox.Image = i;<br />
}<br />
You may have to update or refresh the pictureBox (but i dont think so)
|
|
|
|
|
Hi
Thanks a lot. I have got the solution. I used a static variable and did it.
Can i have your personal id? This is incase of future help?
|
|
|
|
|
I dont know how helpful I could be (I can try but I think there are many more bright people here on cp!) but you are welcome to contact me via email if you need help with something - gavirj2002 at yahoo.co.uk
|
|
|
|
|
hi!
How could i implement delay in c#? that will logicallylook like this:
while<br />
{<br />
process1();<br />
delay(5);<br />
}
thanks!!!
|
|
|
|
|
Use the Thread.Sleep() method.
Regards
Senthil
|
|
|
|
|
Thanks Senthil!!!
|
|
|
|
|
wanna explore this
any sample code for this topic.....
thanx in advance
|
|
|
|
|
Hi ronin,
You can access the database from the webservice in the same way you access from the other applications. The following lines of code connect to the database and return the results in the form of a dataset.
[WebMethod]
public DataSet GetData()
{
SqlConnection conn = new SqlConnection();
string connstring = "Persist Security Info=false; Integrated Security =false; database=DATABASENAME; server=DATABASESERVERNAME; User ID=USERID; Password=PASSWORD";
conn.ConnectionString = connstring;
DataSet ds = new DataSet("Employee Data Set");
SqlDataAdapter adptr = new SqlDataAdapter("select * from TABLE NAME", connstring);
adptr.Fill(ds);
return ds;
}
Hope this will help you.
Regards
SGS
|
|
|
|
|
The above reply seems to be fine I would like to add some details. Please do take care connection string settings and securtiy
Padvit
|
|
|
|
|
i have created a server and client application.
i have ran the server but after a few days of running, it seems to utilize almost 100% of the processor, is this a problem of memory allocation (memory leaks)? if so, what should i do to address this problem? what are the tools which can be used to check if there exists any memory leaks?
|
|
|
|
|
100% utilitization of the processor probably means that there are a lot of threads running around. If you're looking to measure memory consumption, look for Memory Usage and related columns in Task Manager.
Regards
Senthil
|
|
|
|
|
threads seems like a valid reason for 100% cpu
@topic
maybe it's not even the memory itself that's leaking but the thread-resources...
make sure every thread is properly killed (thread.Abort()) after it's done (on WinAPI it really is necessary to do this every time, not sure if the GC collects finished threads so just make sure it's cleaned up)
since you have a client-server-model I guess you're using threads and "sessions" for each user. make sure every session has an inactivity-timeout and it's properly cleaned up (all the threads, all the resources)
so long.
|
|
|
|
|
My application allows user to authenticate to a remote share using domain loggon by invoking mpr.dll
[DllImport("mpr", CharSet=CharSet.Auto)]<br />
public static extern int WNetAddConnection2(<br />
ref NETRESOURCE lpNetResource,<br />
[MarshalAs(UnmanagedType.LPTStr)]<br />
string lpPassword,<br />
[MarshalAs(UnmanagedType.LPTStr)]<br />
string lpUserName,<br />
int dwFlags<br />
);
For example I logged on using following user name: "DOMAIN_1/USERNAME_1".
I would like to find out the user groups (Administrators/Users/etc. ) of user USERNAME_1 within DOMAIN_1.
Could anyone please suggest how to do that?
I have tried using NetUserGetLocalGroups() (netapi32.dll) function but it only retrieved the user groups of USERNAME_1 in the local machine, not in the domain DOMAIN_1. I've tried NetUserGetGroups() too but don't know how to set the parameters to get it right. Please help.
[DllImport("netapi32", CharSet=CharSet.Auto)]<br />
public static extern int NetApiBufferFree(<br />
out IntPtr bufptr <br />
);<br />
<br />
[DllImport("netapi32", CharSet=CharSet.Auto)]<br />
public static extern int NetUserGetLocalGroups(<br />
[MarshalAs(UnmanagedType.LPWStr)]<br />
string servername,<br />
[MarshalAs(UnmanagedType.LPWStr)]<br />
string username,<br />
int level,<br />
int flags,<br />
out IntPtr bufptr,<br />
int prefmaxlen,<br />
out int entriesread,<br />
out int totalentries<br />
);<br />
<br />
<br />
public static ArrayList GetUserGroups(string serverAddress, string userName)
{<br />
<br />
ArrayList groupNames = new ArrayList();<br />
int entriesRead = 0;<br />
int totalEntries = 0;<br />
<br />
IntPtr bufPtr;<br />
<br />
int errorInfo = NetUserGetLocalGroups(serverAddress,userName,0,LG_INCLUDE_INDIRECT,<br />
out bufPtr,MAX_PREFERRED_LENGTH,out entriesRead,out totalEntries);<br />
<br />
<br />
<br />
if(entriesRead> 0)<br />
{<br />
LOCALGROUP_USERS_INFO_0[] RetGroups = new LOCALGROUP_USERS_INFO_0[entriesRead];<br />
IntPtr iter = bufPtr;<br />
for(int i=0; i < entriesRead; i++)<br />
{<br />
RetGroups[i] = (LOCALGROUP_USERS_INFO_0)Marshal.PtrToStructure(iter, typeof(LOCALGROUP_USERS_INFO_0)); <br />
iter = (IntPtr)((int)iter + Marshal.SizeOf(typeof(LOCALGROUP_USERS_INFO_0)));<br />
groupNames.Add(RetGroups[i].groupname);<br />
}<br />
int error = NetApiBufferFree(out bufPtr);<br />
}<br />
<br />
if (errorInfo != NERR_Success)<br />
{ <br />
int error = NetApiBufferFree(out bufPtr); <br />
}<br />
<br />
return groupNames;<br />
}
|
|
|
|
|
|
Look at the System.Management namespace. ManagementObjectSearcher will allow you to query active directory for the info on the domain account. I don't have any code on this computer to offer. You can probably find the query you need by googling on 'wmi user groups' or something.
|
|
|
|
|
Hi Friends,
I have a datagrid (in C#) where in all the rows in a particular cell has hyperlink attribute.
But on ItemDataBound event I want to remove Hypelink attribute from some of the Rows in that particular cell (Conditionally).
My following logic does not seem 2 work
Private dg_ItemDataBound.....
{
e.Item.Cells[1].Attributes.Remove("href");
}
How do I remove hyperlink in some rows in Datagrid??
Regards,
Vipul Mehta
Regards,
Vipul Mehta
Software Engineer
Chenoa Information & Software Services Pvt Ltd
|
|
|
|
|
Hi Friends,
I have a datagrid (in C#) where in all the rows in a particular cell has hyperlink attribute.
But on ItemDataBound event I want to remove Hypelink attribute from some of the Rows in that particular cell (Conditionally).
My following logic does not seem 2 work
Private dg_ItemDataBound.....
{
e.Item.Cells[1].Attributes.Remove("href");
}
How do I remove hyperlink in some rows in Datagrid??
Regards,
Vipul Mehta
Software Engineer
Chenoa Information & Software Services Pvt Ltd
|
|
|
|
|
I coded some kind of electronical Post-it notes and I want to stick them on the Windows Desktop, but how?
The Show Desktop Icon (or Winkey+D) always minimizes my form and i couldn't find any way to prevent that.
Another Idea would be to directly draw my stuff on the Desktop but I don't know how to register to the OnPaint event of the desktop to redraw my stuff.
Thanks a lot in advance.
|
|
|
|
|
>The Show Desktop Icon (or Winkey+D) always minimizes my form and i couldn't find any way to prevent that.
I discoverd that when I click "Show Desktop" that I get the Mesage WM_ACTIVATEAPP which tells me that my app gets deactivated and a thread from the explorer.exe Process gets activated.
So far so good, but how do I prevent now that my app gets minimized?
|
|
|
|