|
I want to program a web spider to search the resource from web by a URL?
How to judge the resource, such as JPG, mp3?
|
|
|
|
|
Fired.Fish.Gmail wrote: I want to program a web spider
Do a little basic research and you will find an article here on CP that may help you clickety[^]
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I downlaod the aspseek, but I find it is too big and donot know where is the rearch function. I only want to know how to search the resource from a url
|
|
|
|
|
I am using AT Command "AT+CNMI=2,3,2,1,0" to
There is a event handler named 'DataReceived' of SerialPort object. But I don't know what will be the parameter and how to handle the parameter to receive the message.
Could you please send a sample 'DataReceived' function?
|
|
|
|
|
You want to recieve an SMS message from where ? How is your phone connected to a mobile phone number, is it attached to a phone ?
Christian Graus
Driven to the arms of OSX by Vista.
Please read this[ ^] if you don't like the answer I gave to your question.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
|
|
|
|
|
My mobile is connected to my PC by a data cable. I want to get mobile incoming message to my PC.I just want an example of DataReceived event handler of SerialPort object.
|
|
|
|
|
Are you sure this will fire when you get an SMS message ?
Christian Graus
Driven to the arms of OSX by Vista.
Please read this[ ^] if you don't like the answer I gave to your question.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
|
|
|
|
|
|
i have a black and white image, i need to quickly scan the entire image for white (255,255,255 RGB) pixels and add then to an array. I have a for loop in a for loop to do this as follows:
<pre
private void trackLane()
{
Bitmap leftLane = new Bitmap(detectLeft.Image);
Bitmap rightLane = new Bitmap(detectRight.Image);
for (int i = 0; i <= detectLeft.Width; i++)
{
for (int j = 0; j <= detectLeft.Height; j++)
{
leftLane.GetPixel(i, j);
rightLane.GetPixel(i, j);
}
}
}
></pre>
Where j is the y axis and i is the x axis, i think there is a more efficient way of doing this, any suggestions?
|
|
|
|
|
Hi,
here are some ideas:
1. j <= detectLeft.Height gets executed for every pixel, you'd better store detectLeft.Height in a local int variable
2. executing a lot of GetPixel() calls tends to be slow since each time the coordinates are checked against the image boundaries, and translated into a linear index, something that can be done more easily once one knows they all get handled sequentially
3. the most practical approach to (2) is by using pointers
4. why do you use 4 bytes per pixel if all it can be is black and white; an array (bools, bytes, ints, ...) or a BitArray would be more economical in space, and hence in speed (assuming your image is say 512*512, it takes 1MB which is about the size of the level 2 cache); less data would run faster.
Maybe you should swith to one byte per pixel (optimum between density and simplicity)
5. there are special code snippets to find the lowest bit set in an integer, this could be much faster assuming a binary image (yours is), and a majority of zeroes.
x & -x results in zero if x is zero, and in an int with exactly one bit set which is also set in x otherwise.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Thanks, I'll keep working on it. : )
|
|
|
|
|
|
I'm hoping that someone could give me some advice on how to code a data-grid so that the first row added appears at the bottom, and each additional row fills in above the previous!
In the program I am building, the data-grid starts out empty, and then the user adds information over the course of the session - the first piece of information he adds needs to be on the bottom, and then the second on top of the first, etc.
Any advice appreciated !
Dave
|
|
|
|
|
I've got one of those fancy rotating screens, so all I do is rotate it 180 deg, mind you it's tough on the neck
Sorry, could not resist.
There are a number of solutions, depending on your data source. If you are manually creating the rows then there should be a DGV.Row.Insert(index) obviously 0
If your data is set based (datatable or list) then you need to insert it into the appropriate postion in the supporting datasource.
Either way you are going to have to manage the DGV manually rahter than changing a setting or two!.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hmmm. I tried the command you recommended, and Visual Studio rejected the syntax. Any idea what I could be doing wrong?
I created a DataGridView object on the form and called it DG1.
I created a button. For the onclick event in the button, I went to type the command DG1.Row.Insert(0) and it rejected the syntax.
Dave
|
|
|
|
|
So I was typing from memory, did you take a look around to get the correct syntax. I will feed you ideas, you have to do the work. I have no interest in providing code, thats what articles are for.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I did scroll through all of the possible commands for the object, and none of them seemed relevant.
|
|
|
|
|
I am a novice of C#,Could you please tell me the advantage and disadvantage of using interface and not using interface in the proggram? I'm gragteful if you give a litte code for contrast. Thanks!
|
|
|
|
|
Well, a program without an interface can't really do much, can it ? Or do you mean interfaces as a coding construct, not a user interface ? I would suggest you buy a book on C# and read it, rather than hope to get a deep understanding from random forum replies.
An interface is useful mostly as a means to get around the lack of multiple inheritance.
Christian Graus
Driven to the arms of OSX by Vista.
Please read this[ ^] if you don't like the answer I gave to your question.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
|
|
|
|
|
I'm assuming like Christian that your question is about using interfaces in your own classes. Interfaces do not offer any significant performance benefit. However, they are very useful in situations where classes do inherit from the same base type. Here's a quick example of using interfaces:
public class SecretService : ISecurityCleared
....
public class CIA : ISecurityCleared
...
public class President : ISecurityCleared
...
//ISecurityCleared interface...
public interface ISecurityCleared
{
void ViewTopSecretMessage(string message);
}
//sample code...
private void TopSecretMessage(string topsecretmessage)
{
List<ISecurityCleared> securityCleared = new List<ISecurityCleared>();
securityCleared.Add(new SecretService());
securityCleared.Add(new CIA());
securityCleared.Add(new President());
for (int i = 0; i < securityCleared.Count; i++)
securityCleared.ViewTopSecretMessage(topsecretmessage);
}
Again, no performance increase, just cleaner code without having to worry about inheritance issues.
Cheers,
Richard
There cannot be a crisis today; my schedule is already full.
|
|
|
|
|
Richard Blythe wrote: securityCleared.Add(new President());
I wish...
|
|
|
|
|
No comment
There cannot be a crisis today; my schedule is already full.
|
|
|
|
|
Another advantage of interfaces (again assuming you are talking about code constructs and not the UI) is that they provide a well defined contract to program against. In other words, if you know that a certain type supports a certain interface, then you know that it implements the methods on that interface. An example:
public interface IMyInterface
{
void DoSomething();
}
public class MyInterfaceClass : IMyInterface
{
public void DoSomething()
{
Console.WriteLine("IMyInterface called");
}
} Then, you could do something like the following:
public class MyGenericClass<T> where T : IMyInterface, new()
{
public void CallAMethod()
{
T value = new T();
value.DoSomething();
}
} The generic class is constrained to using classes that support the IMyInterface interface, which means you could write code like this:
new MyGenericClass<MyInterfaceClass>().CallAMethod();
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Another benefit of interfaces is that they help with code reuse.
If a method parameter is an interface type, you can call it by passing an object of ANY class that implements that interface.
|
|
|
|
|
thanks all for your help!
|
|
|
|