|
Hello Everybody, this is my first time posting to the forums, so... "Hi, My name is John, and I'm a code-aholic..."
I have a question about COM performance in .Net applications. I am trying to write a program interface's with Apple's COM library for the iTunes app on windows in order to get access to the library of tracks and I am having some serious performance issues.
I am basically trying to load the library into a typed Dataset for easier manipulation in C# as the COM interface is pretty limited, and it is taking about 10 minutes to load the entire library. I am using a foreach loop over the library's Tracks collection to add them into the dataset.
I was just wondering if anyone else out there has done anything with the iTunes interfaces and if so if you have any tips on how to improve performance???
|
|
|
|
|
Can you specify the sort order of a hashtable? I’m using a string as the key and a home made class as the value.
Ronald Hahn, CNT - Computer Engineering Technologist
New Technologies Analyst
HahnTech Affiliated With Code Constructors
Edmonton, Alberta, Canada
Email: rhahn82@telus.net
|
|
|
|
|
System.Collections.Hashtable does not support sort order. It stores the data as Key, value pair.
Though I just found an article dealing with what you want.
Hashlist - Hashtable meets ArrayList
[^]
Hope this helps you.
|
|
|
|
|
Thanks!
Ronald Hahn, CNT - Computer Engineering Technologist
New Technologies Analyst
HahnTech Affiliated With Code Constructors
Edmonton, Alberta, Canada
Email: rhahn82@telus.net
|
|
|
|
|
Hi,
I want to export some data from an Excel file to a Database.
How can I connect programmatically to Excel?
How can I export from Excel to Databse?
|
|
|
|
|
I suggest you do a search for excel on codeproject. I found lots of useful articles on CP about this. I cannot remember the name of the article, but there is a good one on connecting to Excel using ODBC which I think will help you a lot, as you could load this information into a dataset, then connect to sql, etc.
|
|
|
|
|
Thanks.
But I couldn't find so in CP.
|
|
|
|
|
I dont know, I did a search and came up with a lot to do with Excel. But here is the address anyway: www.codeproject.com/csharp/Excel_using_OLEDB.asp
|
|
|
|
|
I have been using VC++6 IDE for a while. I just aquired Visual Studion.net.
I would like to start using the VS.NET IDE. What is the best way to open VC++6 projects in VS.NET?
|
|
|
|
|
try the VC, Managed C++, MFC messege boards
there are no facts, only interpretations
|
|
|
|
|
I think you can simply open the project with VS.NET which then offers you to convert it.
www.troschuetz.de
|
|
|
|
|
Dear sir,
i have created an array list called LiveClients.and i have a object(C1) which consists of attributes like (Thread Mythread,Endpoint Myendpoint,string Name,Socket MySocket).those properties are in a Class called client.
When i 'm going to add above C1 object into my ArrayList it raise exception
called nullpoint....,how do u solve this prob.
also can anyone tell me how can i find yahoo or msn imotion icons.i just
want those smiley's seperately in ico format.
AMAL@SLIIT
|
|
|
|
|
Do you mean NullReferenceException? This happens if you have only declared, but not initalized the ArrayList.
Have you forgotten the line liveClients = new ArrayList(); ?
_________________________________
nur Idioten brauchen einen Führer
|
|
|
|
|
//c# code:
public class Win32 {......
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)]
public struct SP_DEVICE_INTERFACE_DETAIL_DATA
{
public uint cbSize;
public char* DevicePath;
}
[DllImport("setupapi.dll", CharSet=CharSet.Auto)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool SetupDiGetDeviceInterfaceDetail(
[In]IntPtr DeviceInfoSet,
[In] SP_DEVICE_INTERFACE_DATA *DeviceInterfaceData,
[Out]SP_DEVICE_INTERFACE_DETAIL_DATA *DeviceInterfaceDetailData,
[In]int DeviceInterfaceDetailDataSize,
[Out]int *RequiredSize,
[Out]SP_DEVINFO_DATA *DeviceInfoData
);
......
}
public class usbdevice {......
ptrDeviceInterfaceDetailData = (Win32.SP_DEVICE_INTERFACE_DETAIL_DATA*)Win32.GlobalAlloc(Win32.GPTR,nBytesRequired);
ptrDeviceInterfaceDetailData->cbSize = (uint)sizeof(Win32.SP_DEVICE_INTERFACE_DETAIL_DATA);
ptrDeviceInfoData->cbSize = Marshal.SizeOf( new Win32.SP_DEVINFO_DATA().GetType() );
bResult =Win32.SetupDiGetDeviceInterfaceDetail(hDevInfo,
ptrDeviceInterfaceData,
ptrDeviceInterfaceDetailData, //[out] pointer to a buffer to store the interface detail data
nBytesRequired, // the buffer size
null,
ptrDeviceInfoData);
lasterror = Win32.GetLastError();// Error number:1784. How to settle this problem????
|
|
|
|
|
I'm a delphi programmer. I have the same problem when programming, but I find a way to correct it. Take a look at following code which in bold. I hope it can help you.
const
GUID_CLASS_COMPORT: TGUID = (
D1:$86e0d1e0; D2:$8089; D3:$11d0; D4:($9c, $e4, $08, $00, $3e, $30, $1f, $73));
procedure EnumPortsWdm(AList: TStrings);
var
LGuid: TGUID;
LDeviceInfo: HDEVINFO;
LDevice: TSPDevInfoData;
LDeviceInterfaceData: TSPDeviceInterfaceData;
LDeviceInterfaceDetailData: PSPDeviceInterfaceDetailData;
LSuccess, LIsUsbDevice: Boolean;
LDeviceInterfaceDetailDataSize,
LRequiredSize: DWORD;
LIndex: DWORD;
LFriendlyName: array[0..255] of Char;
LDesc: array[0..255] of Char;
LLocInfo: array[0..255] of Char;
LComPortInfo: TComPortInfo;
begin
ClearPortsList(AList);
LGuid := GUID_CLASS_COMPORT;
LDeviceInfo := SetupDiGetClassDevs(@GUID_CLASS_COMPORT,
nil, 0, DIGCF_PRESENT or DIGCF_DEVICEINTERFACE);
if (Cardinal(LDeviceInfo) = INVALID_HANDLE_VALUE) then
begin
Exit;
end;
SetupDiGetDeviceInterfaceDetail(LDeviceInfo,
@LDeviceInterfaceData, nil, 0, @LRequiredSize, @LDevice);
LDeviceInterfaceDetailDataSize := LRequiredSize;
GetMem(LDeviceInterfaceDetailData, LRequiredSize);
try
LDeviceInterfaceData.cbSize := sizeof(TSPDeviceInterfaceData);
LDeviceInterfaceDetailData.cbSize := sizeof(TSPDeviceInterfaceDetailData);
LIndex := 0;
while True do
begin
if not SetupDiEnumDeviceInterfaces(LDeviceInfo,
nil, LGuid, LIndex, LDeviceInterfaceData) then
begin
Break;
end;
LDevice.cbSize := sizeof(TSPDevInfoData);
LDevice.ClassGuid := GUID_CLASS_COMPORT;
if not SetupDiGetDeviceInterfaceDetail(LDeviceInfo,
@LDeviceInterfaceData,
LDeviceInterfaceDetailData,
LDeviceInterfaceDetailDataSize,
@LRequiredSize, @LDevice) then
begin
Break;
end;
LSuccess := SetupDiGetDeviceRegistryProperty(LDeviceInfo,
LDevice, SPDRP_FRIENDLYNAME, nil,
PByte(@LFriendlyName[0]), sizeof(LFriendlyName), nil);
LSuccess := LSuccess and SetupDiGetDeviceRegistryProperty(
LDeviceInfo, LDevice, SPDRP_DEVICEDESC, nil,
PByte(@LDesc[0]), sizeof(LDesc), nil);
LIsUsbDevice := FALSE;
if SetupDiGetDeviceRegistryProperty(
LDeviceInfo, LDevice, SPDRP_LOCATION_INFORMATION, nil,
PByte(@LLocInfo[0]), sizeof(LLocInfo), nil) then
begin
LIsUsbDevice := (Pos('USB', LLocInfo) = 1);
end;
if LSuccess then
begin
LComPortInfo := TComPortInfo.Create;
LComPortInfo.DevPath := PChar(@LDeviceInterfaceDetailData.DevicePath[0]);
LComPortInfo.FriendlyName := LFriendlyName;
LComPortInfo.PortDesc := LDesc;
LComPortInfo.IsUsbDevice := LIsUsbDevice;
AList.AddObject(LFriendlyName, LComPortInfo);
end;
LIndex := LIndex + 1;
end;
finally
FreeMem(LDeviceInterfaceDetailData);
SetupDiDestroyDeviceInfoList(LDeviceInfo);
end;
end;
|
|
|
|
|
I'm writing a Client/Server app that uses RSA encryption. I'm triing to serialize an entire class to send across the socket. The class contains 6 byte arrays which hold encryption data.
I can serialize and send just fine, but when I receive the data and try to deserialise it I get the following error:
Decrypt: Cannot find the assembly RSASend, Version=1.0.1774.26988, Culture=neutral, PublicKeyToken=null.
Well this is of course due to the fact that the two Assemblies I'm using are different.
Is there any way to avoid this problem ?
Perhaps a better way to send this class over the socket ?
Here is my de/serialization code:
public byte [] Serialize(CipherMessage Data)
{
try
{
MemoryStream sms = new MemoryStream();
BinaryFormatter format = new BinaryFormatter();
byte [] Buff=null;
format.Serialize(sms,Data);
Buff = new byte[(int)sms.Length];
sms.Seek(0,SeekOrigin.Begin);
sms.Read(Buff,0,(int)sms.Length);
return Buff;
}
catch (Exception Err)
{
CryptoError="Serialize Error: "+Err.Message;
return null;
}
}
public CipherMessage Deserialize(byte [] Data)
{
BinaryFormatter format = new BinaryFormatter();
MemoryStream ms = new MemoryStream(Data);
ms.Seek(0,SeekOrigin.Begin);
CipherMessage message = (CipherMessage)format.Deserialize(ms);
ms.Close();
return message;
}
|
|
|
|
|
How would I traverse an array testing each individual array member for equality to a char. Below is what I have so far but it says I can't use == with char and sting:
for(int x = 0; x <= input.Length; x++)
if(input[x] == " ") word_count++;
Thanks all
kha0s
"There are 10 types of people in this world; Those that know binary and those that do not."
|
|
|
|
|
If you change the " " to a single quote, ' ', then that should help with that. You should also change your <= to just < for the Length check. Arrays start with 0 and go to Length-1.
Steve Maier, MCSD MCAD
|
|
|
|
|
Ahh PERFECT it works, thanks a lot!!
kha0s
"There are 10 types of people in this world; Those that know binary and those that do not."
|
|
|
|
|
how exactly does the algorithm for finding all the permutations of a string work in C. For example, if you have a specified length, and you have an initial string, how would one calculate all the possible permutations of that string. Any examples would be greatly appreciated
|
|
|
|
|
do you simply want a total of all permutations, or do you want to display them too?
I think I remember doing a permutation problem when I was in college...use the factorial maybe? I'm not sure if that's correct or not, but if all you need is the number, that might be a place to start.
If you need to display all of the permutations, you'll probably have to use a stack.
This not only sounds like a homework problem, but it was also posted in the wrong forum, so I'm guessing you'll get more rude remarks than help in here...
|
|
|
|
|
Programs like SMS get the video from
a remote machine and allow you to interact
as if you were on that machine
I was wondering what I would need to look into
so I could write a program using C# that allowed
a user to do the same. I am guessing that the answer
to this question is not an easy one.
Any help would be great
thanks
Will
|
|
|
|
|
I use a simple ftp client code (that I've found on the internet) in my application.
The problem is that I can't receive the WHOLE response message from some ftp servers.
I've noticed that if the server response is short (one or two lines) it works fine (Socket receive(...) method is able to catch the whole response), but when the server response is a little bit longer (i.e. GuildFTP - three lines) - only first two lines are received.
Has someone noticed the same problem?
Many thanks for help in advance.
Socket client = new Socket(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.Tcp);<br />
IPEndPoint ipep = new IPEndPoint(Dns.Resolve(remoteHost).AddressList[0], remotePort);<br />
<br />
client.Connect(ipep);<br />
<br />
Byte[] buffer = new Byte[1024];<br />
<br />
client.Receive(buffer);<br />
<br />
MessageBox.Show(ASCII.GetString(buffer));<br />
|
|
|
|
|
Newbie question(still getting used to C#):
HTTP/1.1 500 Internal Server Error
Server: Sun-ONE-Application-Server/7.0
Date: Tue, 09 Nov 2004 16:58:28 GMT
Content-length: 8802
Content-type: text/xml; charset=UTF-8
Optimizable: true
Connection: close
[newline]
Message Here
....
....
I want to parse the message above so that I get the 'message' part of HTTP response, I am used to java, and I would normally use a 'split' function, does this exist in C#, a split, the result is stored as a String
Berlin Brown
GIS Developer
http://www.retroevolution.com
|
|
|
|
|
Don't know if that's what you're looking for, but i'll give it a try
Take a look at the String class which offers many methods for string manipulation, e.g. the Split method.
www.troschuetz.de
|
|
|
|
|