|
Even though your question has absolutely nothing to do with C#, I'll try to offer you some advice here. First of all, have you tried this in more than one browser? Secondly, I'm going to guess that you probably have Google toolbar installed. Disable it and see what happens.
|
|
|
|
|
Thanks for instant support. i have checked in explorer, Google toolbar is not installed.i am using asp.net, while i am runing the page the error will throwing.
|
|
|
|
|
Okay, so it sounds like you are getting an exception in there which is causing a redirect to the error page, and this Advanced System Optimiser thinks that you are trying to navigate to a phishing page, so it's cancelling the navigation.
To get around this, try switching this Optimiser off while you are running the ASP.NET application; make sure that it really is gone from memory - this could mean stopping the service that it's running under.
|
|
|
|
|
Hi all, I am trying to convert a word doc to type byte so I can send it to the database. I am also trying to send the data to the database without having to first save the converted data on a disk by using a memorystream object. The following is the code snippet I've found online for doing that but I don't quite understand the last line to make use of it:
MemoryStream ms = new MemoryStream();
byte[] bytes = File.ReadAllBytes("fileOnDisk.doc");
ms.Write(bytes, 0, bytes.Length);
Below is my insert function without the connection, command, and parameter objects listed. The last few lines are what I plan to use to insert the file into the database. What I would like to know is how do I pass a memorystream object to the insert function. Thank you in advance for your help.
public void InsertDoc(string Path, byte myFile)
{
param = new OleDbParameter("@File", myFile);
oCommand.Parameters.Add(param);
oCommand.CommandText = "AddDoc";
oCommand.CommandType = CommandType.StoredProcedure;
oCommand.ExecuteNonQuery();
sqlConn.Close();
}
|
|
|
|
|
In the method declaration for InsertDoc , change byte to byte[] so that you are passing in the byte array.
|
|
|
|
|
Hi Pete, thanks for pointing that out but that is what I already have but forgot to type it i when I created this post. The question now is how do I send the memorystream object to the database.
modified 9-Aug-12 4:33am.
|
|
|
|
|
Fair enough, but in future, please try to give us the real code, rather than having us waste your time correcting a problem that doesn't exist.
If all you are trying to do is pass the MemoryStream instead of the byte[] , then just change the parameter, and work with that. But, as you are reading from disk into a byte array, this is a pretty useless conversion step. If, however, you are trying to avoid the creation of the file, and you already have a populated MemoryStream , then you need to create a byte array and populate it from the MemoryStream like this:
byte[] data = new byte[ms.Length];
ms.Read(data, 0, ms.Length);
|
|
|
|
|
Thanks, it seems to be working but I had to modify your code to
byte[] data = new byte[ms.Length];
ms.Read(data, 0, data.Length)
|
|
|
|
|
Good catch. That's what happens when I type directly into the Code Project editor; silly mistakes slip through.
I'm glad it's working now.
|
|
|
|
|
It is a common misunderstanding that the Stream.Read method will read the number of bytes you specify in the count argument. But the count parameter specify the maximum number of bytes the stream is allowed to read. An implementation of a stream is free to return fewer bytes, even if it has not reached the end of the stream. It must return at least one byte unless the end of stream has been reached.
The MemoryStream implementation happens to read all at once - and it is probably unlikely to change any time soon but I would not recommend to get used to this behavior - because then you start using it with other stream types you will get errors.
The easy solution here is to use MemoryStream.ToArray(). In other cases where you need to read a fixed number of bytes from a stream you will either have to make a loop calling Read again if it did not return all bytes or you can for example create a BinaryReader for the stream.
|
|
|
|
|
A very good point, especially as a lot of people don't know that Read returns the count of bytes that it has read.
|
|
|
|
|
Greetings i have been looking for something that can help me put images on google image search, just after taking a picture through webcam, like google goggle, i have tried SBI sharp but it gives var result and its hard to get the image, can anyone guide me what is this called or how can i get this thing working
Thanks !
|
|
|
|
|
If you're talking about similar image search, go to images.google.com and click the camera icon in the searchbox.
|
|
|
|
|
i would like to take picture from camera and upload it to google image search and get result of similar images !
|
|
|
|
|
That's exactly what it does.
You can also try TinEye[^]
|
|
|
|
|
you dont get my point i want to take a picture from my webcam and search it online instantly ! is there any open source prog. for this or what things can help me i need some guide .
Thanks
|
|
|
|
|
Hello
I created more than 20 games on windows phone7 .I want to convert that all games for windows 8 ultrabook but touches are not working properly in ultrabook that means gesture..anyone know how to handle or enable gesture in windows 8 ultrabook
my code is for touches:
In constuctor()
{
EnabledGestures = GestureType.Tap;
}
public override void HandleInput(InputState input)
{
foreach (GestureSample gesture in input.Gestures)
{
if (gesture.GestureType == GestureType.Tap)
{
}
}
}
whenever i am touching windows 8 ultrabook.Its always showing gesture count is 0.
and its not coming inside.
foreach (GestureSample gesture in input.Gestures)
{
}
so how we enable gesture in windows 8 ultrabook.
whenever i am touching windows 8 ultrabook.gesture count comes 0.
its not coming inside.
foreach (GestureSample gesture in input.Gestures)
{
}
so how we enable gesture in windows 8 ultrabook.
please reply me ASAP.
waiting for ur reply
Thank U
Best Regards,
Ashish Gupta
|
|
|
|
|
See this MSDN page[^].
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Perhaps keep your eye on what this company, LeapMotion, is developing: high-precision gestural control without touching the screen:[^].
best, Bill
"Everything we call real is made of things that cannot be regarded as real." Niels Bohr
|
|
|
|
|
Hi,
I need to improve oops advancd concepts and learn advanced in c# dot net.
any one can help to me .
|
|
|
|
|
A good place to start with taking your OO ability to the next level is to understand something called SOLID. Now, a guy called Bob Martin popularised these principles, and you can find details here[^].
In a nutshell, it's how to approach writing complex systems using easy to understand principles. Now, although these principles are easy to understand, it doesn't stand to reason that they are easy to apply. Applying SOLID is hard - primarily because there's always a temptation to cut corners.
Please note that these aren't the only principles you can use - Bob goes on to list other principles that can be applied in the article, but these are a good place to start.
Can I suggest that you change your user name? If you want to be spammed, your user name here is a good way to go about it.
|
|
|
|
|
After you've learned the basics of OOP, read Design Patterns (Gamma et al) for the advanced concepts.
Design patterns are how you use OOP to solve problems.
"Microsoft -- Adding unnecessary complexity to your work since 1987!"
|
|
|
|
|
|
Hi all,
I want list out all the open ports for a particular IP Address in c# windows application.
How can i do it ?
Thanks in advance.
|
|
|
|
|
Have a look at this tip Find an open port on a machine using C#[^].
HTH.
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|