|
I Found a lot of articles explained how to store and retrieve a image into /from DB.They are helpful.But I got a problem when i used the same way to deal with a MPG picture.
First,I upload a mpg picture ,convert it into byte[],and store it into my DB,until now ,it's working well.
Then,I just need to convert the byte[] back to a MPG picture,as follows:
byte[] b = (byte[])cmd.ExecuteScalar();
if(b.Length >0)
{
System.IO.MemoryStream stream = new System.IO.MemoryStream(b, true);
stream.Write(b, 0, b.Length);
Bitmap bmp = new Bitmap(stream)//Exception is threw here
//using Image img = Image.FromStream(stream )is the same;
}
I have found out mpg was not included in ImageFormat.So,what type is mpg,and how can get it from byte[]?
modified on Sunday, November 8, 2009 12:58 AM
|
|
|
|
|
|
Thank you very much ,and ,the link is helpful.
|
|
|
|
|
In CR XI it is possible to adjust the x position conditionally. But is it also possible to adjust the y position conditionally?
For my report i need to adjust the position of a field based on it's value.
I have needed to conditionally adjust the x and y position of fields. Is this possible? If Yes How? Please reply me.
|
|
|
|
|
I tried to test a simple BHO but it doesn't seem to work very well.
I compiled the .dll and registered using regasm, the BHO appears in the IE Addons (or complements, i have it in spanish) page, and it says "Enabled" but when visiting any site I am not getting the message box I should get (it's a simple message for testing if the bho works), could someone take a look at it?
I uploaded my visual project here.
http://sites.google.com/site/oscodes/ClassLibraryTest.rar?attredirects=0&d=1[^]
It doesn't have much code just the necessary for a simple test, I can't find why it's not working.
Any help will be appreciated.
Regards.
|
|
|
|
|
This may be a stupid question for some of you, but I really am unsure how to start learning the information I want to learn.
I really want to know how to access webcams and other USB devices without the use of frameworks in C#. For example, you have aforge that makes it easy to access your webcam, and you have directshow that does that same. But how do those frameworks gain the ability to access these devices? I know this is getting into COM development most likely, but I would like any direction someone could give as to how I can start learning how to do this in C#.
Thanks!
|
|
|
|
|
It is physically impossible to access a camera without DirectX or WIA. Why ? Because web cams did not exist when Windows was created, these are things that have been added to Windows to add the ability to access these peripherals.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Ohh.. so even major applications like aim, skype, communicator even use DirectX or another library to help access webcams? I've been reading the books I have purchased but none of them really got into Dllimports or any unmanaged coding with C#. I'm just tryin to learn as much as I can. I'm in school but they seem to not teach that advanced as I've already taken all of the classes lol.
|
|
|
|
|
Jacob Dixon wrote: Ohh.. so even major applications like aim, skype, communicator even use DirectX or another library to help access webcams?
Absolutely.
Jacob Dixon wrote: I've been reading the books I have purchased but none of them really got into Dllimports or any unmanaged coding with C#.
www.pinvoke.net[^] is a great resource for dll stuff. Also, there's a couple of full libraries that import all of DirectX into C# about, I've used those before, and they work well.
Jacob Dixon wrote: I'm in school but they seem to not teach that advanced as I've already taken all of the classes lol.
*grin* well, perhaps that means you're the one who is likely to actually become a programmer. It's generally good to pull things apart and work out how they work, not just use code people give you or that you find, but you won't gain much from trying to go more low level than just finding an article on CP on C# and webcams, and using whatever method they use to get access to Direct X, I believe the DirectX library I was talking about gets used a lot, and that it also has a CP article.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Thanks!
I will check out the pinvoke.net!
Well I can tell you everything I have learned is from books and just trying to get it to work. I know I have posted a lot in the past here on CP and you guys have helped me out with my problems. I love to code. Its not part of my job right now but I do as much of it as I can at work and home to help out. My fear is not being able to find a job as a programmer since I personally feel my experience is not good enough even though I will have "paper" that says I can.
One day I am hoping to be able to assist in writing applications that are widely used.
I have checked out some of the DirectX articles and found that the ones I did try had issues with accessing some webcams (like iSight on iMac in windows mode). I had good luck with AForge in that area. I was just hoping to learn more how the library worked in doing what it did.
Anyways thanks again!
See you around!
|
|
|
|
|
Jacob Dixon wrote: My fear is not being able to find a job as a programmer since I personally feel my experience is not good enough even though I will have "paper" that says I can.
I have no formal training at all. You'd be surprised how much a passion to learn, a willingness to admit that you don't know something, and a proven ability to teach yourself, can count for more than a degree.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
I am hoping so!
I noticed your signature "Driven to the arms of OSX by Vista".
LOL
Funny thing is I bought a iMac after I bought a HP laptop with Vista
I just can't develop anything that good on anything other than Windows (yet)
|
|
|
|
|
Jacob Dixon wrote: I just can't develop anything that good on anything other than Windows (yet)
The tools and languages for Mac development are no-where near as advanced as under Windows, although I do think Core Animation is well put together, overall, Windows is definitely easier to work with, programming wise.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Majority of people use Windows anyways.
Well looks like I'm going to purchase another book. The site you suggested recommends: ".NET and COM: The Complete Interoperability Guide".
Thanks
|
|
|
|
|
The System.Array class implements several interfaces such as IList , IEnumberable , and so on. However, when defining an array of specific types such as string[] or Foo[] I have noticed those implement the generic versions of IList<T> and IEnumerable<T> .
I am at a loss where this is defined. For instance, I know that arrays are reference type object derived from System.Array , however looking at the IL I see no formal implementation of this.
It would be really nice if the SDK documentation would fill me in on these details, particularly the interfaces that are implemented. I have not seen where IList<T> and IEnumerable<T> are tagged on to System.Array and there is no System.Array<T> .
How am I supposed to know that string[] implements IList<string> and IEnumerable<string> if it isn't documented?
|
|
|
|
|
see Important Note[^].
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
CaptainSeeSharp wrote: IEnumberable
Brilliant.
CaptainSeeSharp wrote: How am I supposed to know that string[] implements IList<string> and IEnumerable<string> if it isn't documented?
I guess you'll have to wait for the youtube video to explain it in a format you're used to.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
CaptainSeeSharp wrote: How am I supposed to know that string[] implements IList<string> and IEnumerable<string> if it isn't documented?
It is documented. You actually have to READ the documentation in order for it to be explained to you, as Luc has already pointed out where it is.
|
|
|
|
|
Dave Kreskowiak wrote: You actually have to READ the documentation in order for it to be explained to you
Oh...interesting. What a novel concept.
I don't have time to read through moutains of documentation looking for a needle in a haystack. I was looking where I expect to find what interfaces a type implements. I shouldn't have to look at it through a microscope to find it.
|
|
|
|
|
The docs on System.Array isn't exactly a needle in a haystack.
CaptainSeeSharp wrote: I don't have time to read through moutains of documentation
Then you don't have time to write code either.
|
|
|
|
|
the link I provided was the first result for "MSDN online" when I entered "array class" in Visual's search page. I never saw a haystack, it took me all of 10 seconds to get it.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
I have been searching all over for an answer, but I have fallen back to asking the programming geniuses that frequent this site.
I am looking into a way to call different methods within a class. The problems are, in the class there are lots of methods and many of the methods are similar in function. So I am looking for a way to put the methods in a hierarchy within the class, but namespace can't be called within a class.
Hopeing for the class to resemble something like:
namespace IEWindow
{
public class Main
{
public void Method()
{
}
public ... NavigationBar
{
public void Method()
{
}
public ... Forward
{
public bool Method()
{
}
}
public ... Back
{
}
public ... AddressBar
{
}
}
}
}
*Note, in reality this will contain as many as a few hundred methods;
and to be used like
IEWindow.Main IEWin = new IEWindow.Main();
IEWin.Method();
IEWin.NavigationBar.Method();
bool g = IEWin.NavigationBar.Forward.Method()
Any help, even a statement like 'This is impossible, but thanks for humoring me', would be greatly appreciated.
|
|
|
|
|
I'm not sure what you're describing.
In C# you can declare classes within classes, but you can't declare methods within methods.
|
|
|
|
|
not really a method within a method, just a way to create a hierarchy that contains methods within a class. With namespace i know you can create exactly what I am looking for, but it doesn't work within a class. I can do without this ability, but that would mean 100's of methods would be sitting in my class without any organization, meaning the method names would end up being unnecessarily complicated and hard to distinguish one group of methods from another.
I would just rather be calling:
bool g = IEWin.NavigationBar.Forward.Method()
instead of:
bool g = IEWin.NavigationBar_Forward_Method()
|
|
|
|
|
Then you may want to declare classes within classes, but agregation may be a better technique. You may also want to use partial classes to help manage the code.
|
|
|
|