|
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
|
|
|
|
|
The problem with that approach is that it only works for the local machine. I believe the OP is looking to scan ports on remote machines.
|
|
|
|
|
Ahh! Reading the question right is generally a good start
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|
|
You asked this question already, less than a day ago.
|
|
|
|
|
Univote countered
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
What you are trying to achieve here is a port scanner. This[^] article should give you a decent head start - but there are a couple of things to be aware of.
1. If you are scanning all ports, you should consider running the checks via multiple threads. The reason for this is because checking a port is a time consuming process.
2. Just because the list identifies that a port is free, it doesn't mean that the port will be free when you come to request it. Another application could have taken that port before you get to it, so don't consider that the list is definitive.
|
|
|
|
|
If you are attempting to create a port scanner then I STRONGLY suggest that you consider the following....
Do not do this unless YOU own the network or you have PERMISSION from the owner of the network in WRITING to do this.
People have been expelled from school, lost their network connectivity, been fired from jobs, have had civil judgments rendered against them and even criminally prosecuted because they did this. Even when they thought they had a legitimate need for the functionality.
|
|
|
|
|
Current working code in a public static class: a List<Type> used internally:
using System;
using System.Windows.Forms;
using System.Collections.Generic;
private static List<Type> OkToModify = new List<Type>
{
typeof(CheckBox),
typeof(TextBox),
typeof(Button),
typeof(Panel),
typeof(Label)
}; By "working:" I mean that I can use the List<Type> to test if a given Control passed into the public static class is okay for the uses I make of it. Through, simply:
if (OkToModify.Contains(cntrl.GetType())) { processControl(cntrl) }; I keep thinking that somewhere in my reading (Skeet ? StackOverFlow ?), or here on CP, I have seen a "niftier" way to do this.
Appreciate any alternatives.
thanks, Bill
[1] edit: 'references changed to 'directives in response to feedback from PIEBALDconsult. However, they are, indeed, "required."
"Everything we call real is made of things that cannot be regarded as real." Niels Bohr
modified 7-Aug-12 23:56pm.
|
|
|
|
|
HashSet
But as you may have read in one of my articles (you've them all by now, right?) that may not handle derived types and Interfaces as well as you might like.
BillWoodruff wrote:
They're neither required, nor references.
|
|
|
|