|
Thank you every one for your help.
public static Bitmap BytesToBmp( byte[] b )
{
using ( MemoryStream ms = new MemoryStream(b , true) )
{
Bitmap bmp = Bitmap.FromStream( ms ) as Bitmap;
return bmp;
}
}
Works great. This is was the byte[] that I was sending the method; it was not being recognized by the Bitmap Constructor. I am storing images within an Access 2003 db, (yes, not a good idea), and the way Access had been altering the byte [] so that the Bitmap Constructor couldn't recreate it. I'm not sure n exaclty what Access was doing with the Image but I as inserting a bitmap from file to it. ???
If anyone know the answer to this, please drop me a line. Otherwise, I'm now converting the image and inserting it into the database using a FileStream in and then a FileStream out. If anyone is interested I will post the project when I've completed.
Thanks again!!
I'm listening but I only speak GEEK.
|
|
|
|
|
'Adaptive Resonance Theory'
ART network is a 'Neural network'.
the goal is design an Art with C#,
because Matlab not supprt Art netwok.
in the network is a parameter than named vigilance factor
this factor to care network in front of learned pattern
|
|
|
|
|
Interesting. Do you have a concrete question too or are you simply expecting us to write the whole thing for you?
In case you're looking for some ideas on how to implement neural networks in C#, search the articles. There are some covering the topic.
"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." - Rick Cook www.troschuetz.de
|
|
|
|
|
hello... i wanted to segment a picture into characters using histograms... i managed to do so but now the code throws exception "image already locked"...
this exception is not thrown all the time but is thrown sometime... i think it is because image although is unlocked (i did unlocking) according to statement but the area might still be captured in ram or so... plz correct me if i am wrong and also show me some way to control the exception as it occurs at times and not all the time....
please provide help
and are there any algos for character segmentation apart from histogram and connected components one... which will work better...
haseeb
|
|
|
|
|
Hi!
i have a problem!
i have a datagrid and when the focu is on it and click on enter, the focu pass to the next row. How i do to take off it! I'd like to disable it to not pass to the next row.
help me!!
Thanks
|
|
|
|
|
Hi,
You could code the following
<br />
private void dataGridView1_KeyDown(object sender, KeyEventArgs e)<br />
{<br />
if (e.KeyCode == Keys.Enter)<br />
e.Handled = true;<br />
}
Hopes this helps...
Greetings
Kaine
|
|
|
|
|
Thanks for help me!
this code was great, it helped a lot.
if (e.KeyCode == Keys.Enter)
e.Handled = true;
Thanks again!!
|
|
|
|
|
Hi, I have a question related to reporting.
Right now I'm trying it with Crystal Reports, but I'm open to other suggestions. I need to make some letters generated from a customer file in a MySQL DB.
The letters would involve some fixed text, some variable field in and under the text.
What are the best ways to generate reports for MS Word or in PDF when I have a class that looks like this f.e.:
Rappel
- customerName
- customerStreet
- customerPostal
- quantityBehindOnPayment
- comments
or little more complex
Invoice
- customerName
- customerStreet
- customerPostal
- customerCode
- InvoiceLines (list)
- total
- comments
If the answer is going to be "use Crystal Reports", can anyone direct me towards a decent tutorial, example or anything for using this kind of reports? Because I'm kind of struggling. Thanks in advance.
The output can be anything as long as its printable (.doc, .pdf, .html,...)
Visual Studio can't evaluate this, can you?
public object moo<br />
{<br />
__get { return moo; }<br />
__set { moo = value; }<br />
}
|
|
|
|
|
Good evening everyone,
I'm trying to write to an existing file using the StreamWriter and I cant replace the entire text in an existing file.. for example if I wrote xxx to file already contains oooo, the result will be xxxo
Please help
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
You don't really have a choice here. You read the file, modify the contents how you want in memory, then write it back out.
The only opther way to do it would be to treat the file as Binary, not Text and start modifying the individual bytes of the file. But then you'll also have to worry about encoding and Unicode (multi-byte characters).
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Thanks Dave, you're really a MVP, at least to me
Pleased to meet you and thank you for your true help every time.
ps. I liked the first tip and will use it, thanks again Dave
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
The StreamWriter class provides constructors that allow you to specify whether you want to overwrite or append in case the file already exists. Use one of those to create your StreamWriter .
"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." - Rick Cook www.troschuetz.de
|
|
|
|
|
PERFECT!!
StreamWriter sw = new StreamWriter("MyFile.txt", false);
Thank you Stef
BTW: My best friend is called Stefan as well
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
one thing that u can do is to read the entire file as a single string by using a stream reader and then replace the old string with whatever you want.
u will have to use a StreamWriter in that case.
string OldString = streamReader.ReadToEnd();
string NewString = OldString.Replace(OldString, "NewString");
Keshav Kamat
India
|
|
|
|
|
Thank you for your help Keshav
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
i have an web application. from here i want start a new process in local mechine. if i start the process it is shown it the task Manager doesn't comes as active window. becase it is runing under ASP.NET user.
is there any way to change the owner for the process before we start?
or
can we bring the aplication intractive with out changing the owner in ASP.NET?
help me
|
|
|
|
|
I have about 3 minutes to dinnertime, so can't look into it too deeply. But here are some links
This forum tells you to go to MSDN and read on Impersonation
http://www.thescripts.com/forum/thread576383.html
Here is the msdn link
http://msdn2.microsoft.com/en-us/library/ms998351.aspx
http://msdn2.microsoft.com/en-us/library/system.security.principal.windowsidentity.impersonate.aspx
hope this gets you going
Visual Studio can't evaluate this, can you?
public object moo<br />
{<br />
__get { return moo; }<br />
__set { moo = value; }<br />
}
|
|
|
|
|
Thank U friends
for u r help
joe
india
|
|
|
|
|
to start a process as a different user, please follow this link
http:
for general process start procedure use this...
http:
Keshav Kamat
India
|
|
|
|
|
Here's an interesting one -- Can someone riddle me this?
Given:
<br />
using System;<br />
<br />
enum Foo { Bar, None }<br />
class Program<br />
{<br />
static void PrintArg(object x) { Console.WriteLine(x.ToString()); }<br />
static void PrintArg(Foo x) { Console.WriteLine(x.ToString()); }<br />
public static void Main()<br />
{<br />
PrintArg(Foo.None);<br />
PrintArg(0);<br />
PrintArg(1);<br />
}<br />
}<br />
Results in the output of:
None
Bar
1
Note: The application of this issue is apparent in the SqlParameter constructors -- If you do SqlParameter param = new SqlParameter("Name", 0); it calls the SqlDbType override, instead of the object value override.
Any ideas why the int 0 isn't acting like the int 1? Is 0 not an int by default?
Chadwick
=============================
I'm a developer, he's a developer, she's a developer, Wouldn'tcha like to be a developer too?
|
|
|
|
|
this is hilarious :p
enum Foo { Bar, None }
static void PrintArg(object x) { Console.WriteLine(x.ToString()); }
static void PrintArg(Foo x) { Console.WriteLine(x.ToString()); }
public static void Main()
{
PrintArg(Foo.None);
PrintArg(Convert.ToInt32(0.ToString()));
PrintArg(1);
}
your problem is very strange
here's the output when you cast it to int, Int32, ...
PrintArg(0);
PrintArg((int)0);
PrintArg((Int16)0);
PrintArg((Int32)0);
PrintArg((Int64)0);
-- modified at 14:16 Wednesday 21st March, 2007
-- modified at 14:17 Wednesday 21st March, 2007
Visual Studio can't evaluate this, can you?
public object moo<br />
{<br />
__get { return moo; }<br />
__set { moo = value; }<br />
}
|
|
|
|
|
So what we're trying to say is that 0 cannot be implicitly boxed by a call to a method if it is in an Int32 valuetype, but it can be boxed if its in an Int16 or an Int64?
Any CLR specialists care to take a stab at this one?
Anyone try this targeting .NET 1.1? Mine is targeting 2.0...
Btw if you call the method as
(object)0 -- it outputs 0 as expected.
I also use Resharper, and when I do a (object)1 it tells me the cast is redundant, but when I do a (object)0, it does not!
=============================
I'm a developer, he's a developer, she's a developer, Wouldn'tcha like to be a developer too?
|
|
|
|
|
this is at least a 7 on the WTF-scale.
Visual Studio can't evaluate this, can you?
public object moo<br />
{<br />
__get { return moo; }<br />
__set { moo = value; }<br />
}
|
|
|
|
|
Code sample:
<br />
PrintArg(0);<br />
PrintArg((int)0);<br />
PrintArg((Int16)0);<br />
PrintArg((short)0);<br />
PrintArg((Int32)0);<br />
PrintArg((long)0);<br />
PrintArg((Int64)0);<br />
PrintArg(1);<br />
Corresponding IL:
<br />
.method public hidebysig static void Main() cil managed<br />
{<br />
.entrypoint<br />
.maxstack 1<br />
IL_0000: nop<br />
IL_0001: ldc.i4.0<br />
IL_0002: call void Program::PrintArg(valuetype Foo)<br />
IL_0007: nop<br />
IL_0008: ldc.i4.0<br />
IL_0009: call void Program::PrintArg(valuetype Foo)<br />
IL_000e: nop<br />
IL_000f: ldc.i4.0<br />
IL_0010: box [mscorlib]System.Int16<br />
IL_0015: call void Program::PrintArg(object)<br />
IL_001a: nop<br />
IL_001b: ldc.i4.0<br />
IL_001c: box [mscorlib]System.Int16<br />
IL_0021: call void Program::PrintArg(object)<br />
IL_0026: nop<br />
IL_0027: ldc.i4.0<br />
IL_0028: call void Program::PrintArg(valuetype Foo)<br />
IL_002d: nop<br />
IL_002e: ldc.i4.0<br />
IL_002f: conv.i8<br />
IL_0030: box [mscorlib]System.Int64<br />
IL_0035: call void Program::PrintArg(object)<br />
IL_003a: nop<br />
IL_003b: ldc.i4.0<br />
IL_003c: conv.i8<br />
IL_003d: box [mscorlib]System.Int64<br />
IL_0042: call void Program::PrintArg(object)<br />
IL_0047: nop<br />
IL_0048: ldc.i4.1<br />
IL_0049: box [mscorlib]System.Int32<br />
IL_004e: call void Program::PrintArg(object)<br />
IL_0053: nop<br />
IL_0054: ret<br />
}
Notice the lack of a box operation any time the Int32 0 value is used... consistent with the call to the wrong function void Program::PrintArg(valuetype Foo) ... but notice the correct box op for the call with 1!?!?
Quirky... I am almost convinced this is a compiler bug.
The only work around I can think of is to do the following:
<br />
using System;<br />
<br />
enum Foo { Bar, None }<br />
class Program<br />
{<br />
static void PrintArg(object x) <br />
{ <br />
if (x is Foo) <br />
{ <br />
PrintFooArg((Foo)x); <br />
return; <br />
} <br />
Console.WriteLine(x.ToString()); <br />
}<br />
<br />
static void PrintFooArg(Foo x) <br />
{ <br />
Console.WriteLine(x.ToString()); <br />
}<br />
<br />
public static void Main()<br />
{<br />
PrintArg(0);<br />
PrintArg((int)0);<br />
PrintArg((Int16)0);<br />
PrintArg((short)0);<br />
PrintArg((Int32)0);<br />
PrintArg((long)0);<br />
PrintArg((Int64)0);<br />
PrintArg(1);<br />
PrintArg(Foo.Bar);<br />
}<br />
}<br />
It prints everything as expected....
=============================
I'm a developer, he's a developer, she's a developer, Wouldn'tcha like to be a developer too?
|
|
|
|
|
try
PrintArg(-0);
and
Console.WriteLine(0.GetType() == 1.GetType());
and the resharper making it redundant is _very_ odd to say the least. I use it too. It usually looks up whether your type cast has any purpose for this specific case. f.e. casting 0 into object for the purpose of .GetType'ing makes it redundant, because it also has this option without the cast.
Visual Studio can't evaluate this, can you?
public object moo<br />
{<br />
__get { return moo; }<br />
__set { moo = value; }<br />
}
|
|
|
|