|
hi, can anyone explain to me:
Public Overrides Function GetHashCode() As Integer
Dim hash As Int32
hash = pk1 And pk2
Return hash
End Function
is "And" basically an "bitwise AND" operator? On the contrary, what's "bitwise OR" operator? And why are we using bitwise AND in GetHashCode? Guess been out of school for awhile, don't see how "And" can give you a unique ID/Hashcode...
Did some testing, doesn't work.
1 AND 581 = 1
1 AND 57 = 1
1 OR 580 = 581
1 OR 581 = 581
So... AND/OR operator won't work. Should I use XOR... It seems to work... What's the logic behind this... I don't see why XOR would produce unique hashcode as some suggested.
REF 1: GetHashCode and XOR
http://mathworld.wolfram.com/XOR.html
REF 2: XOR - Mathematics
Why XOR would work in producing unique hashcode? What's the math behind this...
|
|
|
|
|
(I'm not sure if this belongs better in the ASP.NET forum, but since it's a Windows forms app calling it, and the problem is in the caller, I thought it goes here.)
Hello,
I have a Windows Forms application that uses web services on a remote server (hosted somewhere else, no access to it). It works perfectly when run with a local server or in that remote/production server.
But when the main window appears, a secondary thread is started to call another method in a web service in the same server to get the newest version, and if newer than the current version, a form is displayed to the user telling him to go to the website to download.
This works perfectly on both my development machines with a local server. And this works perfectly with the client running on both my development machines against the remote server.
But that's it. When I run the app in any other machine, the call to the web service to get the latest version throws a System.Net.WebException with a message The underlying connection was closed: Unable to connect to the remote server. I found this with a development copy full of Console.WriteLine s on another machine on my same network. The only difference I can think of between that machine and mine is that mine have IIS installed while that one does not. But still, it puzzles me that everything from the main thread works fine, and not from the secondary thread.
So, any ideas?
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
|
|
|
|
|
Is there a collection object in the C# .NET framework. I need an object that contains a list of objects indexed by another object?
E.g. A list of type Employee indexed on string name where name = Employee.name
|
|
|
|
|
|
Hi dudes. how are you everybody ????
When you Open Start ---> run -----> and type any command like (cmd , regedit) it will execute the command.
So how can i make a command line string of my own to do some operations when the user type it in run dialog of the windows operating system. ? if anybody can help me with this
Miss With The Best And Die Like The Rest
|
|
|
|
|
You need to handel Command Line Arguments in Your program So use public static void Main(string Args[]) Or static int Main(string[] Args) instead of parametersless Main method
look at Command-Line Arguments[^]
you need to parse this arguments to handle more complex parameters an example for this can be found at C#/.NET Command Line Arguments Parser
[^]
MCAD
-- modified at 20:59 Thursday 6th October, 2005
|
|
|
|
|
Take a look at the registry key SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths
|
|
|
|
|
Okay, I give - been all over the net and nothing comes close. You'd think this was the first time somebody cam across this in C#:
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Ansi)]
public struct AGENT_DATA
{
//[MarshalAs(UnmanagedType.LPArray, SizeConst=3000, ArraySubType=UnmanagedType.LPStr)]
//[MarshalAs(UnmanagedType.SafeArray, SafeArraySubType=System.Runtime.InteropServices.VarEnum.VT_LPSTR)]
//[MarshalAs(UnmanagedType.ByValTStr, SizeConst=15)]
//[MarshalAs(UnmanagedType.ByValArray, SizeConst=3000, ArraySubType=UnmanagedType.ByValTStr)]
public string[] m_AgentNames;
}
As you can see, I've tried several attributes - all runtime error. "Cannot obtain size of struct" when I attempt to:
int nSize = Marshal.SizeOf(agentData);
There will be no more than 3000 names, about 15 characters long.
Eventually, I'm going to: IntPtr lParam = Marshal.AllocHGlobal(nSize);
and then: Marshal.StructureToPtr(agentData, lParam, false);
finally:
Win32APIWrapper.PostMessage(
m_hMessageHandlerWindowHandle,
WM_MESSAGE,
(uint)(wParam.ToInt32()),
lParam.ToInt32());
This structure will then be consumed in a C++ module.
So... How do I Marshal a string array of "n" elements that are "l" characters?
Thanks. If you know - Go tell MSFT, so they can post it somewhere.
Note: the names are 15 ascii alphabetical characters. I'd rather avoid using BSTRs but am open to suggestions.
Jay McCormick
|
|
|
|
|
I wrote a simple Windows Forms app (just has one form) which runs fine on XP.
But when I try it on a Windows 98 PC, all the controls in the form are enlarged (I turned off AutoSize for my textboxes), and the font of my text labels doesn't look like what I specified in the property editor. The size of the form appears to be correct though.
Has anyone seen this before, or have any hints about making sure a form displays the same across different windows OS. I'm wondering if turning off AutoScale form property will help...
|
|
|
|
|
Are the fonts you use in your app installed on both platforms?
|
|
|
|
|
My form/controls are all using the default font that shows up in the VS.NET 2003 property editor. I think Microsoft Sans Serif 8.25pt. The Windows 98 PC is at a remote site, so I can't check it at the moment, but I thought the default font would be available across PCs.
|
|
|
|
|
Hi all, I have two tables one is Machine the other is SitePosition.
The SitePosition table have primary keys (SiteNo, PositionNo). In the Machine table, there are SiteNo and PositionNo as the foreign key reference to the siteposition table. When updating the machine table, I need to change the value of (SiteNo, PositionNo) in machine table. But because the foreign key constraint, once I change the SiteNo's value, it will give me an error say that it violate the foreign key constraint since there is no record existed in the SitePosition table. The same error happens if I update the PositionNo first. The problem seems that the foreign keys as a bunch are not updated simultaneously. Does anybody know a solution to this problem please???
Thanks in advance!!!
|
|
|
|
|
hi there,
here is just my suggestion: should check the constraint between these tables in business logic, not throw this task for DB server.
<< >>
|
|
|
|
|
hi
I didn't put this into DB server, the exception occurs in the dataset. It prevents me from carrying on my tasks
Asura
|
|
|
|
|
just dont set any relationship between these tables in ur dataset
<< >>
|
|
|
|
|
Try setting the EnforceConstraints property to false before and back to true after editing.
|
|
|
|
|
How can I auto-adjust the column width using Excel Automation?
I am extract a large dataset from a DataSet object to the Excep workbook.
|
|
|
|
|
We are beginning the development of applications in Visual Studio.Net and have a number of libraries written in C++. For a number of reasons we don't want to convert these to C#. Any recommendations/references as to how best to access the C++ code from C#?
Think globally act locally.....integrate by parts
|
|
|
|
|
Go to MSDN and do a search for "P/Invoke". I don't want to frighten you off but P/Invoke isn't exactly a beginner level topic and marshalling data types across can get hairy. You need to be sure you have your .Net and C# fundementals down first before you try to bridge to other language runtimes.
-- modified at 14:57 Thursday 6th October, 2005
|
|
|
|
|
How can I insert a table into rich text box please
Nana
|
|
|
|
|
AFIK There are no out of the box method you need to deal with RTF syntax to do this look at RTF [^]
MCAD
|
|
|
|
|
how can i read data from excell file?
|
|
|
|
|
If you would just search for Excel you would already have the answer...
|
|
|
|
|
read through a datafile store the information in primary memory and sort it in ascending order using selection sort According to course code
the data file contains a sequence of records
each record consists of several data fields stored sequentially in the order given
DATA FIELD DATA TYPE
Code String
Title String
Semester Integer
Credits Integer
Level Character
Short Description String
Previous Pass Rate Double
Must write a function char *read_string(File *fp)
to read a string from a file
|
|
|
|
|
School asignment?
---
b { font-weight: normal; }
|
|
|
|