|
Hi,
I don´t know that i think, but do you know about Asynchronous connections? If not read about it!
Maybe because you are not using that your sockets blocks.
Check out the way you managed your threads maybe because you are invoking a wrong thread!
Sorry i can´t help you more!
|
|
|
|
|
Well - Thanks for your input anyways
You can only be young once. But you can always be immature.
- Dave Barry
|
|
|
|
|
Hello,
I'm having difficulty signing a string using the RSA cryptography algorithm.
I've search here in this forum for sample code, but I guess, signing is not that popular.
Anyway, any help would be greatly appreciated.
here is my code.
public static string SignMyData(string data2Sign)
{
AssignPr();
byte[] byte2Sign = System.Text.Encoding.UTF8.GetBytes(data2Sign);
StreamReader reader = new StreamReader(@"C:\MyPrivateKey.xml");
string pubPriKeyXML = reader.ReadToEnd();
rsa.FromXmlString(pubPriKeyXML);
reader.Close();
byte[] byteSig = rsa.SignData(byte2Sign, "SHA1");
return System.Text.Encoding.UTF8.GetString(ByteSig);
}
If anyone knows of a simple tutorial or can guide me through this, that would be great
Thanks
JC
|
|
|
|
|
nyjcr wrote: rsa.FromXmlString(pubPriKeyXML);
'rsa' seems to be a non-static member variable. You cannot use non-static member variables in static methods. Try changing your method to a non-static one.
|
|
|
|
|
|
|
Hi,
Can anyone help me here to translate this? It´s from a help file that is only coded in vb.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
CType(objForm, Form1).Label2.Text = TextBox1.Text
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim MyForm As New Form2()
MyForm.objForm = Me
MyForm.SetBounds(400, 400, 300, 300)
MyForm.Show()
End Sub
Public Property Form2Value() As String
Get
Return MyVal
End Get
Set(ByVal Value As String)
MyVal = Value
End Set
End Property
Thanks
|
|
|
|
|
Don't cross-post. It's considered rude and isn't going to help you get an answer to your question any faster. The original post is here[^].
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
[ Blog][ Articles][ Forum Guidelines] Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
|
|
|
|
|
The weirdness continues unabated.
I've written an app that downs files via the WebClient object, using the DownloadFileAsync method.
Immediately after processing the call to DownloadFileAsync, the application terminates. I've verified that both the uri and the target filename I'm passing are valid. This does not happen on anyone else's machine.
I've got event handlers setup, but they're not hit at all. Also, the call to DownloadFileAsync is contained within a try/catch block and I'm not getting any indication of an exception.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
John Simmons / outlaw programmer wrote: Immediately after processing the call to DownloadFileAsync, the application terminates
Without any error message ? Have you looked at the event viewer for any error report.
John Simmons / outlaw programmer wrote: Also, the call to DownloadFileAsync is contained within a try/catch block and I'm not getting any indication of an exception.
Since it's an asynchronous operation, your catch block can't handle exceptions as the file download will be happening on a separate thread.
|
|
|
|
|
N a v a n e e t h wrote: Without any error message ? Have you looked at the event viewer for any error report.
Yeah, checked that - nothing there.
Another weird aspect of this is that I wrote a very simple app that downloads a file (from the same server, no less) using WebClient.DownloadFileAsync, and it works fine. I even used the code from the app that doesn't work. How bizarre is that?
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Hello Guys..
I am currently working on a project where I am suppose to read High R3es MultiPage Tiff images.
I am able to display the First page But I dont know hot to Loop tru the multiple pages in perticuler Image file.
If Anyone can explain.. tat will be gr8!!
Environment : .net 3.5
Thanks,
Niks
|
|
|
|
|
I was also looking for something like this, where I could handle individual pages of a multipage tiff and re order them (move first page to the back or remove it - cover sheets, etc).
This may allow you to iterate through the pages, but for me it was blowing up badly when I tried using the Bitmap.SaveAdd method to save the pages (GDI+ Exception). You may have better luck if you don't need to save these.
frameDimension = System.Drawing.Imaging.FrameDimension.Page
pageCount = inputFile.GetFrameCount(frameDimension)
For x As Integer = 0 To pageCount - 1
'set page x as the active frame
inputFile.SelectActiveFrame(frameDimension, x)
nextPage = New System.Drawing.Bitmap(inputFile) 'may need overload for size
'outputBitmap.SaveAdd(nextPage, encParams) <--blows up on me... you may not need to worry about it.
Next 'x
The best thing I could come up with to SAVE images was to use iTextSharp and do something like this... (copy and paste - I am doing many other things in between these lines ). You may not need this, but here it is anyway.
bmpImage = New System.Drawing.Bitmap(InputTIFFFile)
intTIFFPages = iTextSharp.text.pdf.codec.TiffImage.GetNumberOfPages(objRA)
For c As Integer = 0 To intTIFFPages - 1
objImage = iTextSharp.text.pdf.codec.TiffImage.GetTiffImage(objRA, c + 1)
'Do stuff with your images here.
Next 'c
These are all from 1.1 framework.
modified on Friday, July 18, 2008 7:22 AM
|
|
|
|
|
Hello Astanton,
thanks for reply.
I am able to iterate tru the diff pages of Tiff, but the problem I am facing is I want to dispay each frame as I go along..
Like Next and Back bottons will allow me to move with the frams. I was not able to get the file reference.
Say, I have the below code,
string tifimgFileNM = "c:\\images\\test.tif";
Bitmap tifImg = new Bitmap(tifimgFileNM);
int pageCount = tifImg.GetFrameCount(FrameDimension.Page);
if (pageCount > 1)
{
for (int i = 0; i < pageCount; i++)
{
tifImg.SelectActiveFrame(FrameDimension.Page, 0);
Bitmap img = (Bitmap)tifImg.Clone();
}
}
Now @ //XXXXXXXXXXXXXXXX, i want to assign selected Frame image to Picture Box. HOw I am suppose to do tat.. normally we can write
PictBox.Load("c:\\images\test.tif");
how Can i refer it here..??
THanks,
Niks
|
|
|
|
|
Dig this....
http://www.bobpowell.net/addframes.htm[^]
Basically he explains that you can do something like this....
int pageCount;
int curPage;
List<bitmap> tifPages;
private void Form1_Load(object sender, EventArgs e)
{
string tifimgFileNM = ".\\multipage.tif";
Bitmap tifImg = new Bitmap(tifimgFileNM);
pageCount = tifImg.GetFrameCount(FrameDimension.Page);
tifPages = new List<bitmap>(pageCount);
if (pageCount > 1)
{
for (int i = 0; i < pageCount; i++)
{
tifImg.SelectActiveFrame(FrameDimension.Page, i);
Bitmap tmp = new Bitmap(tifImg.Width, tifImg.Height);
Graphics g = Graphics.FromImage(tmp);
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
g.DrawImageUnscaled(tifImg, 0, 0);
g.Dispose();
tifPages.Add(tmp);
}
}
curPage = 0;
PictBox.Image = tifPages[curPage];
PictBox.Refresh();
lblPageNo.Text = "Page " + Convert.ToString(curPage + 1) + " of " + Convert.ToString(pageCount);
}
private void btnNext_Click(object sender, EventArgs e)
{
curPage++;
if (curPage + 1 > pageCount)
{
btnNext.Enabled = false;
}
else
{
btnNext.Enabled = true;
}
PictBox.Image = tifPages[curPage];
PictBox.Refresh();
lblPageNo.Text = "Page " + Convert.ToString(curPage + 1) + " of " + Convert.ToString(pageCount);
}
private void btnPrev_Click(object sender, EventArgs e)
{
curPage--;
if (curPage - 1 < 0)
{
btnPrev.Enabled = false;
}
else
{
btnPrev.Enabled = true;
}
PictBox.Image = tifPages[curPage];
PictBox.Refresh();
lblPageNo.Text = "Page " + Convert.ToString(curPage + 1) + " of " + Convert.ToString(pageCount);
}
}
</bitmap></bitmap>
|
|
|
|
|
I am senting data in a flat file to a client who is parsing the data using Cobol and he is
asking me to format money with an implied decimal point padded to 6 charaters in length.
For example given $15 dollars he wants me to send either
001500 or 1500 I am not sure which yet but the problem is the same either way.
I have a generic tool that allows me to pick a field to send and also to provide the
formating to apply.
Here is the method I call each time a number needs to be formatted:
static public string ProcessNumber(string amount, string format)
{
decimal temp;
bool results = decimal.TryParse(amount, out temp);
if(results)
{
string localFormat = string.IsNullOrEmpty(format) ? "0.00" : format;
string convertedValue = temp.ToString(localFormat);
return convertedValue;
}
return amount;
}
Normally, for money I would use the "0.00" or "000.00" format specifier when
yields 15.00 or 015.00 respectively.
I don't want to have to treat this request as a one off and write special code if I don't have to.
I can't assume in any given case that the decimal will or won't be implied.
Is there a way to apply a format to yield a textual representation of a number with an implied decimal place?
|
|
|
|
|
Multiply by one hundred?
amount.Replace ( "." , "" ) ?
|
|
|
|
|
Yes, that works but not under the contraints I layed out in my question.
The code doesn't know where the decimal is implied or not. If I used your
solution it would be right if for this client as he wants an implied decimal
but wrong for everyone who doesn't want an emplied decimal point.
I am looking for a workaround to not have to pass in either the decimal is implied
or not hense my question about how to solve this via applying a format.
|
|
|
|
|
You aren't likely to get too much help when you keep 1 voting people. BTW - there is a solution to your problem, and it relies on you using a pattern called Inversion of Control. (There are other solutions, but this one is a good one).
|
|
|
|
|
I didn't vote a one. I was given the choice of Yes or No was this answer helpful. I selected no.
I didn't even realize I was voting I was just answering a yes or no question.
Thanks I will look at your suggestion.
BTW Your answer didn't have the Yes or No question.
|
|
|
|
|
smesser wrote: BTW Your answer didn't have the Yes or No question.
That's because mine was a General message and not an Answer. Take a look at the Message Type for this.
|
|
|
|
|
smesser wrote: not under the contraints I layed out
Which are fairly silly. Why take a decimal, convert to string, convert back to decimal, and then convert back to string again?
Why wouldn't the caller simply use (val * 100.0M).ToString ( "000000" ) and be done with it? What benefit would your method provide?
|
|
|
|
|
The contrains aren't silly they are provided by the client.
My problem comes in trying to make a tool generic enough to provide
all clients with their needs.
Again this method would work if all clients wanted to use an assumed decimal point.
In the end I ended up using the format string "000000%" which multiplies by one hundred thus
given me the assumed decimal place. Then in my ProcessNumber method I remove the "%" if it exists.
The "%" will only exist if I am using the assumed decimal approach and I can still
use standard formatting for all clients.
Problem solved.
|
|
|
|
|
As long as you have the "000000%" format, why not just use it and not bother with this method?
I still see no point for this method. What benefit does it provide? What's the point?
I suspect you're doing something upstream that you shouldn't be.
|
|
|
|
|
The point is that the format specifier "000000%" multiplies by 100 and adds the percent sign.
So, given 15.00 the result of applying the above format string yields 001500%.
The percent sign is undesirable and needs to be striped out.
So the method I mention always strips out the % if it exists as I will never need to send a
percentage. So, I have accomplished my needs by still allowing standard formatting to be
used.
I could have created a custom format specifier "000000i", and then in my number processing
method look for i and then use implied decimal formatting.
|
|
|
|