|
thanks for the reply.
what is switch?
sorry, im a newbie.
|
|
|
|
|
google it, or go to msdn.com search keywork switch .
|
|
|
|
|
|
Just put them in the same panel or group box and it will be automated
Natza Mitzi
|
|
|
|
|
|
Hello guys,
I needed to create a proxy by adding a web reference into my C# class library project, but there's been some issues configuring the thrid party product and the webservice they expose....so I have manually downloaded the WSDL file (its not asmx, its actually java/ibm web service).
Anyways, since i can't use the add web reference wizard from Visual studio anymore, I'd like to know how to I create a porxy (Reference.cs) file in my project using the WSDL file located on my C drive.
Can anyone point me to the right direction, I treid looking into Wsdl.exe but looks like it only support a URL and not a local path, if it does can someone point me to the right command syntax?
I'd appreciate your help.
Thanks
Tina
|
|
|
|
|
I use svcutil.exe [^] to manually generate WCF proxies.
/ravi
|
|
|
|
|
Hello Ravi, thanks for the response...but I should have mentioned, I'm using VS 2005 framework 2.0.
Can you tell me how do i do that in this environment?
Thanks
|
|
|
|
|
Run the svcutil.exe command line app located in your VS2005 installation folder hierarchy. See the online docs for the app's command line args. svcutil.exe is what runs when you do Add | Service Reference from the VS200x GUI.
/ravi
|
|
|
|
|
Hi,
I'm trying to figuring out how to add an object (insert a new row), when the object is related to another entity.
Eg.: I have a user entity, each user can have a title ("Mr.", "Ms.", "Dr.", etc.) or no Title assigned at all.
Entity Model
So you see, the user entity is mapped to the the title entity. Navigation properties exist also (directly generated from the wizard).
In the database, the tables look like this:
DB diagram
The user table has a column "title_id" which is the foreign key for the primary key of the table "titles".
My question is now, how do I add a new user object and directly associate it with an existing title.
I tried various ways, but I get different exceptions when attaching the user entity to the Context. Eg.:
{System.InvalidOperationException: The object cannot be added to the ObjectStateManager because it already has an EntityKey.}
or
"An object with the same key already exists in the ObjectStateManager. The existing object is in the Unchanged state. An object can only be added to the ObjectStateManager again if it is in the added state."
My create user method looks like this:
public int CreateUser(User user)
{
this.context.AddToUsers(user);
this.context.SaveChanges();
return user.UserId;
}
... where I've previously assigned the desired "Title"-Entity to the passed User-Entity, eg:
user.Title = dataAccess.GetTitleByTitleId(titleId);
So, I guess the problem is in this part.. as this given Title-Entity modifies the User-Entity in a undesired way. I've also tried to get rid of the "Title"-navigation property and add the "TitleId" property direclty to the "User" entity, so I could simple assigne the desired "TitleId" to the user (user.TitleId = titleId; ), but this gives me various validation errors in the entity model designer.
Does anybody know how to do this (simple task?) in a correct way?
Thanks, Shi
|
|
|
|
|
Am I just crazy or is it kind of hard to find a sample on using WIA with a digital camera.. I also read something that you might not be able to do this with Vista?
I got my camera to take a picture...
Item pic;
ImageFile myImg;
pic = _Device.ExecuteCommand(CommandID.wiaCommandTakePicture);
myImg = (ImageFile)_Device.Items[0].Transfer(FormatID.wiaFormatJPEG);
PictureBox picBox = new PictureBox();
picBox.Dock = DockStyle.Fill;
picBox.Image = (Image)myImg.FileData;
this.Controls.Add(picBox);
But on trying to Transfer I get:
Exception from HRESULT: 0x8021006B
|
|
|
|
|
Sorry I meant I'm getting a NullReferenceException.
|
|
|
|
|
Whatever I do it always returned null!
|
|
|
|
|
I realize this is a little old, but maybe this will help others. My code is in VB but does not take much to convert to C#.
In XP this code takes and saves a picture:
item = dev.ExecuteCommand(CommandID.wiaCommandTakePicture)
Dim myImage As WIA.ImageFile = CType(item.Transfer(format), WIA.ImageFile)
myImage.SaveFile("c:\somewhere\mypicture.jpg")
But in Vista "item" is ALWAYS NULL but it does take the picture on the camera.
here is my fix:
' get current image count
Dim cnt As Int32 = dev.Items.Count
'take picture
item = dev.ExecuteCommand(CommandID.wiaCommandTakePicture)
' insert this single if block
If IsNothing(item) Then
' Vista drops the ball here (and a lot of other places!)
' Loop for up to 10 seconds waiting for the image to appear on camera device
While dev.Items.Count = cnt And x < 10
System.Threading.Thread.Sleep(1000)
x+= 1
End While
If cnt = dev.Items.Count Then
'throw your exception here - no image arrived
Else
' we found the new image on the camera
' pull it into the "item" variable since Vista didnt
item = dev.GetItem(dev.Items(cnt - 1).ItemID)
End If
End If
' and the rest of the code is unchanged.
Hope that helps.
|
|
|
|
|
You know I got it to work with WIA1 but never the version WIA2.
Thats because I used WIA1 on XP and WIA2 on Vista.
I see what you are saying. I was always able to get the camera to take a picture, but it never assigned the picture to the item.
I see what you did. You just take the amount of pictures on the camera, make it snap a picture, then if item is null (which is always will be) loop for 10 seconds OR until the count changes on the camera. Then get the last picture.
Genius! I'll give it a try
|
|
|
|
|
I write new application server/client. I use TcpClient. When my server is listening and allow many computers connect. Example : My server have 50 computers client connected. I have problem when I want to send 1 message to all clients, I must use FOR/NEXT therefore It cost 5 seconds or more to send 1 message to 50 Computers client. Now I want to improve speed of send message, Please give me advice.
Please see code below
//Send Admin Message
public static void sendAdminMessage(string sMessage)
{
//ArrayList LIST_CLIENT contain all connections of client
if (LIST_CLIENT.Count > 0)
{
Object []arr = LIST_CLIENT.ToArray();
for (int i = 0; i < arr.Length; i++)
{
try
{
MyClient client = (MyClient)arr[i];
send(client.TcpClient, sMessage);
}
catch(Exception e) {
Console.WriteLine(e.Message);
}
}
}
}
|
|
|
|
|
If you have the bandwidth, you could send each message on a seperate thread.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
you should use 2 threads for each client + 1 thread for entire network.
thread1)its priority should be low till they get a message from application in their line(collection for messages, you should build a class for that).
when message(s) got finished the priority should be set to low
thread2)should always read streams and add them to the line class associated with it.
net thread) should read lines of messages gotten by second set of threads and execute them.
i have did it and it worked very well.
i had a project i named it remotecompiler the project sends codes objects events procedures gets services from clients or server such as NetService FileService... (i used IServiceProvider class) and can execute orders with its services (it had about 50 classes)
i think tis may get you a good idea.
please tell me when you done it
|
|
|
|
|
How can I intercept the audio output as it goes to the sound card? is there an audio stream that I can access using .net or third party library?
I'm trying to write a program for correcting lip sync problems when playing back blu-ray discs. I'm hoping to be able to intercept the audio output from the computer and then add an adjustable time delay before sending it back to the audio output again.
Is this possible?
Cheers
|
|
|
|
|
I would imagine you're going to play with DirectX to intercept the audio stream and introduce a delay. I don't know exactly how you'd do that, tho
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Google this name, "Total Recorder".
They sell a library that lets you intercept the audio stream.
However, it doesn't work with Vista because Vista has a protected audio stream.
|
|
|
|
|
Richard Andrew x64 wrote: Google this name, "Total Recorder".
They sell a library that lets you intercept the audio stream.
However, it doesn't work with Vista because Vista has a protected audio stream.
Thanks, I've had a look at Total Recorder, the latest version does work with vista athough it seems that all I can do with it is duplicate the audio stream as it is output rather than being able to actually reroute it. I might be wrong of course.
What I would really like to be able to do is capture the audio stream before it gets to the sound output device and then add my delay before sending it on again.
|
|
|
|
|
I have come accros another issue whist trying to use directx to acheive my goal. I thought I would start by attempting to identify what the sound output device was identified as so I wrote the following to hopefuly display all my sound devices.
DevicesCollection devList = new DevicesCollection();
foreach (DeviceInformation device in devList)
{
Console.WriteLine(device.ToString());
}
Unfortunately running this code reulted in the following error.
LoaderLock was Detected
DLL 'C:\Windows\assembly\GAC\Microsoft.DirectX\1.0.2902.0__31bf3856ad364e35\Microsoft.DirectX.dll'
is attempting managed execution inside OS Loader lock. Do not attempt to run managed code inside a
DllMain or image initialization function since doing so can cause the application to hang.
I've never come accross this before and have absolutely no idea how to resolve it. I'm a bit of a beginner having completed only 1 year of a computer science degree course so far and errors like this just tend to floor me.
|
|
|
|
|
|
hi,
i need to convert an ascii byte array to string.
in the byte [] could be 0 value that marks the end of the string.
i tried to do it like that :
byte[] test = { 0x41, 0x42, 0 };
string mystr = ASCIIEncoding.ASCII.GetString(test);
but the result is - "AB\0"
can i do it otherway to get just "AB" ?
thanks,
Samy
|
|
|
|