|
I'm developing a remote control software and would like to know if it's possible to compare between two images to check and see if they are the same image. For example, if i am idle while using the remote control software, the remote PC image would be the same at all times (until there are change on screen such as mouse movements, time updates (clock @ statusbar), etc).
If there's an alternative way or any suggestions, i'd be glad to hear it. The reason why i'm doing this is to prevent the server from sending the same image (screenshot) every time regardless of whether the user (on the client side) is idle or using the remote pc.
|
|
|
|
|
I would have thought the overhead in doing the comparison would be prohibitive.
This should be event based so that a new screen is only sent to the client when something happens that then need to be aware of.
If you really must do the comparison, its pretty easy to convert an image into a memorystream and then into an array where you could do a byte by byte comparison.
|
|
|
|
|
You could take a checksum of the image on both sides and compare the checksum.
|
|
|
|
|
somebody can help me , how to get all param in store procedure
ex : myStore(@param1, @pram2, @pram3,...)
and I want that
index name
1 @param1
2 @param2
3 @param3
....
thanks!!!
Nho'c ti`
|
|
|
|
|
sqlCOmmand.Parameters.Add("@param1", SqlDbType.Varchar,200);
sqlCOmmand.Parmaters["@param1"].Value = 1;
|
|
|
|
|
No, I want get name param of myStore
ex : Store Procedure myStore(@param1, @param2,...)
in this store : @param1, @param2 I don't know that name and I want get name of all param in this store
Nho'c ti`
|
|
|
|
|
You can use sp_procedure_params_rowset 'your_procedurename_here' .
It returns a rowset containing the names, types and other info on the parameters that you procedure takes.
This is the SP that is used by MS in their Data Access Application Blocks (DAAB) for .NET and in earlier versions of ADO.
|
|
|
|
|
I has use your code but it return 0 row effect althought my store have 4 params
can you show me your code??
thanks
Nho'c ti`
|
|
|
|
|
Copy this into a C# Console application:
<br />
SqlConnection cn = new SqlConnection("some_valid_connectionstring_here");<br />
SqlCommand cmd = new SqlCommand("sp_procedure_params_rowset 'your_stored_procedure_name_here'", cn);<br />
SqlDataAdapter da = new SqlDataAdapter(cmd);<br />
DataTable table = new DataTable();<br />
da.Fill(table);<br />
<br />
foreach(DataRow row in table.Rows)<br />
{<br />
Console.WriteLine("{0}", row[3]);<br />
}<br />
"It works on my machine..."
|
|
|
|
|
I dont see why becuase the name has to match the store procedure parameters but
SqlParameter sqlPar;
foreach sqlPar in mySqlCommand.Parameters
{
Debug.WriteLine(sqlPar.ParameterName);
}
|
|
|
|
|
I'd try same your code Ista, but it didn't work
thanks Einbu with your idea
|
|
|
|
|
foreach( SqlParameter p in sqlGet.Parameters)
{
Debug.WriteLine("The name is " + p.ParameterName);
}
Well obviously from the compiler kick backs it says it must be declared and have a parentheses. so if you modify my code it works just fine.
I even included another code snippet for you:
Debug.WriteLine("The name is " + sqlGet.Parameters[0].ParameterName );
Sorry about the misprint but I havent been using the foreach a whole bunch
|
|
|
|
|
Is there any way to have the font color set by a rule? For example if the value in a cell is negative I would like it to be displayed as red. (It would be cool to set this rule on the column.) Can this be done?
|
|
|
|
|
|
Thanks Mazy!
I needed to change the fore color.
I used your idea and changed it to this
protected override void Paint(Graphics g, Rectangle bounds, CurrencyManager source, int rowNum, Brush backBrush, Brush foreBrush, bool alignToRight)
{
Decimal val = (Decimal) GetColumnValueAtRow(source, rowNum);
if(val>0)
foreBrush = Brushes.Green;
else
foreBrush = Brushes.Red;
base.Paint (g, bounds, source, rowNum, backBrush, foreBrush, alignToRight);
}
Works well. Thanks again.
|
|
|
|
|
Ok, I am kinda stuck here, say I have class A which is instantiated on my main form, this class contains all a slew of properties and methods. I have a second form pop up and I want to transfer that class instance that is created on my main form over to the second form. The idea would allow me to pass the one instance all throughout the application regardless of the form it is on. My first thought was to create a property for the class, but I wasn't sure and I wanted to asking everyone else what they think is the best implementation here? Thanks in advance.
-Nick Parker
|
|
|
|
|
By class, I assume you mean control, right?
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
Nope, just a regular class, it deals with a lot of XML processing.
-Nick Parker
|
|
|
|
|
Nick Parker wrote:
The idea would allow me to pass the one instance all throughout the application regardless of the form it is on.
If you will only have that one instance through-out the entire life of the application, then you would probably benefit from using a singleton.
public sealed class A
{
private A()
{
}
private static object lockObject = new object();
private static A instance;
public A Instance
{
get
{
if( instance == null )
{
lock( lockObject )
{
if( instance == null )
{
instance = new A();
}
}
}
return instance;
}
}
} This ensures that only one instance is ever created and makes it so you don't have to be passing that instance all over the place.
James
"I despise the city and much prefer being where a traffic jam means a line-up at McDonald's"
Me when telling a friend why I wouldn't want to live with him
|
|
|
|
|
Would all that be required? Wouldn't:
private static A Instance = new A();
Be the same?
Of course, I could be having brain fade here...
Rocky Moore <><
|
|
|
|
|
It would be similar, the difference being that you delay the creation of A until you actually need it. That could be important if A were a "heavy" object. Then to ensure you don't create 2 instances of A by having two threads run the getter the first time, you need to lock on an object.
James
"I despise the city and much prefer being where a traffic jam means a line-up at McDonald's"
Me when telling a friend why I wouldn't want to live with him
|
|
|
|
|
Actually, the instance will not create until the first time you access it. I made a simple test application. I put debug information in the contructor and the property get of the class. Then in the code where I actual reference it, I put a debug statement before and after it. The order was:
Before
Constructor
Get
After
I wonder what would happen in multiple threads though, wouldn't you think .NET would take care of that since it is a static?
Just my curiousity is up
Rocky Moore <><
|
|
|
|
|
Rocky Moore wrote:
I wonder what would happen in multiple threads though
Here is a nice article on MSDN that discusses the Singleton design under the .NET Framework, including multithreading issues.
Exploring the Singleton Design Pattern[^]
-Nick Parker
|
|
|
|
|
Hey, thanks for the link. Glad to hear that the .NET framework does handle the threading issues automatically and that my VS.NET was not possessed, that the object is only created when first accessed They are really making some things a lot easier in .NET. Can hardly wait for a few more versions down the road.
Anyone know how Mono handles this situation?
Rocky Moore <><
|
|
|
|
|
James, the singleton implementation works absolutely great, that's just what I needed. Thanks again.
-Nick Parker
|
|
|
|