|
sorry sir Thomas
but i want to send an Email to this person so he could help me with my code
and i don't know how to send it to him
|
|
|
|
|
youshy wrote: i want to send an Email to this person so he could help me with my code
That's generally frowned upon by the recipients. It's unwanted requests like this that led to me removing the option to email me.
|
|
|
|
|
thank you
|
|
|
|
|
It is not my account. I certainly wouldn't welcome people e-mailing me directly for help. e-Mailing like this also goes against the purpose of Code Project, as the idea is to share problems so that other can see them and hopefully use any answers given.
“Education is not the piling on of learning, information, data, facts, skills, or abilities - that's training or instruction - but is rather making visible what is hidden as a seed” “One of the greatest problems of our time is that many are schooled but few are educated”
Sir Thomas More (1478 – 1535)
|
|
|
|
|
thank you
|
|
|
|
|
Hi all,
This is more of a WMI question than C#, but for lack of a more appropriate forum I am hoping someone here will know the answer.
I have a USB printer connected to my computer, and I am trying to retrieve the USB port ID for it in a C# application (i.e VID/PID).
I pulled the printer details from the WMI Win32_Printer class. The problem is the port field shows USB001 (which from what I understand is just a virtual allocation).
I discovered the actual USB port was a parent device called 'USB Printing Support', and the printer USB device was a child of that.
I pulled the WMI class Win32_USBControllerDevice and thought I found the relationship I need:
Antecedent: \\MARK-PC-MKII\root\cimv2:Win32_USBController.DeviceID="PCI\\VEN_8086&DEV_1E2D&SUBSYS_84CA1043&REV_04\\3&11583659&0&D0"
Dependent: \\MARK-PC-MKII\root\cimv2:Win32_PnPEntity.DeviceID="USB\\VID_04A9&PID_271A\\0000A1A6Q2NI"
Antecedent: \\MARK-PC-MKII\root\cimv2:Win32_USBController.DeviceID="PCI\\VEN_8086&DEV_1E2D&SUBSYS_84CA1043&REV_04\\3&11583659&0&D0"
Dependent: \\MARK-PC-MKII\root\cimv2:Win32_PnPEntity.DeviceID="USBPRINT\\CANONLBP6000/LBP6018\\7&2509A3F3&0&USB001"
Unfortunately the PCI bus that both devices are related with is also related with a bunch of other devices, so I am not sure this approach will work.
Does anybody know a way I could programically relate my printer device with its parent USB device (Preferably one which I could pull the USB device info once it has been related to the printer)
Note:
If I open the properties->details window for the 'USB Printing Support' device, there is a property called 'Children' which would be perfect... I just don't know how to get to it... ;-(.
Thank you.
Mark Brock
I'm pretty sure there's a lot more to life than being really, really, ridiculously good looking
|
|
|
|
|
I cant say I remember the code exactly, but I think you can get all the device id by the use of some dll. Sorry for the vague answer but I think youll find the related code in the book USB complete by Jan Axelson.
|
|
|
|
|
How to Import a doc file in sql server in windows application...??
|
|
|
|
|
What do you mean by 'import' here; do you want to use the contents of the doc file to populate some tables in your database, or are you just interested in storing the file as a data item?
Use the best guess
|
|
|
|
|
I've inherited a project that includes unit tests written in this framework. I know little about c# and nothing about nunit. I'm told that I can't just run the test project (as it builds to an assembly, not an exe) but need to use a third party tool to run the tests. I tried resharper but uninstalled it as it changed my VS 2012 shortcuts without asking me. Then I tried NUnit itself but for some reason unknown to anyone here it is not possible to debug the tests using NUnit.
I'm just stunned at how bad this appears. Surely tests lose most of their value when they are hard to execute?
Is it possible to add a Main() to my test project and just run the tests?
|
|
|
|
|
There's a Visual Studio addin for NUnit that would allow you to debug the tests. Source[^].
A left field idea, if you don't want to pay for this, is to create a Console project that simply spawns NUnit.exe. If you pass in your projct as a command line argument to that, then you should be able to set breakpoints.
An alternative to this - open your project in NUnit and, before running the tests, attach the debugger to NUnit.exe. You should be able to debug your code this way.
|
|
|
|
|
I'm just used to a c++ system where test projects are runable. Ease of running tests is important I think.
In the end I wrote something with the nunit api that given an assembly path will load it, run the tests and write output to the console.
|
|
|
|
|
It is definitely possible to debug Nunit.
Just attach the NUnit UI to your program when you run it from Visual Studio.
If you are very unhappy with Nunit, you can consider using Visual Studio's Unit Testing Framework[^].
|
|
|
|
|
|
Debugging when running nunit.exe is a bit of a fiddle, you have to attach the debugger to the process. I believe there's a VS plugin these days though that allows you to execute NUnit tests with debugging enabled.
|
|
|
|
|
_Josh_ wrote: I tried resharper but uninstalled it as it changed my VS 2012 shortcuts without asking me.
Yes it does do that. I've even lost shortcuts when I've told it to use the Visual Studio Scheme.
_Josh_ wrote: Then I tried NUnit itself but for some reason unknown to anyone here it is not possible to debug the tests using NUnit.
As others have said, it is possible tp dp this.
An alternative is to use MS's unit testing framework for .net[^] the main drawbacks are you need VS Pro or above and any nunit tests you have are the wrong way round(actual/expected vs expected/actual) (though you'd have to refactor anyway). Other that the integration is pretty seamless.
“Education is not the piling on of learning, information, data, facts, skills, or abilities - that's training or instruction - but is rather making visible what is hidden as a seed” “One of the greatest problems of our time is that many are schooled but few are educated”
Sir Thomas More (1478 – 1535)
|
|
|
|
|
_Josh_ wrote: I'm just stunned at how bad this appears. Surely tests lose most of their value
when they are hard to execute?
You probably should read up on the philosophy of unit tests. The point isn't to allow you to debug it - not even close to that.
But the following process works if you can't get the IDE to work.
1. Determine something is failing.
2. Open the VS IDE and the project.
3. Add the following at a point that it relevant to the failure, perhaps at the top of the unit test.
System.Diagnostics.Debug.Assert(false);
4. Build in Debug mode.
5. Run the unit test with the GUI version of Nunit.
6. When it hits the above line it will pop a dialog asking if you want to debug the application and present you with your choice of debuggers. Pick the IDE from 2.
7. It will resolve itself to a break point marked in your IDE at the above line.
8. After that you can step through and do anything thing else the debugger allows.
Might note that I prefer the above process versus running unit tests in the IDE.
_Josh_ wrote: Is it possible to add a Main() to my test project and just run the tests?
Of course - after all that is exactly what the Nunit command line and GUI tools do.
|
|
|
|
|
hi everybody
am trying to understand interfaces .and i created a Console App with Two Classes( Somme and Tunnel) and an Interface called IAdd.
IAdd interface:
interface IAdd
{
int calc(int a,int b);
}
Somme Class that implement the IAdd interface:
class Somme : IAdd
{
public int calc(int a, int b)
{
return a + b;
}
}
Tunnel Class :
class Tunnel
{
IAdd som = new Somme();
som.calc(3,4);
}
but the MAin Console can use this writing.why i can't calculate the Somme and then send the result to the main Console.
Console Main:
static void Main(string[] args)
{
IAdd som = new Somme();
int x = som.calc(3, 4);
Console.WriteLine( x);
Console.ReadKey();
}
what's the point am missing here?
forget my english,am doing my best to learn many things .
|
|
|
|
|
i got it..i must do that in the constructor or in a method..
lke this
void Tunnel()
{
IAdd som = new Somme();
so
}
Silly Right ? Ooh Beginners...
|
|
|
|
|
how to write into text box from database query row values?
|
|
|
|
|
You can try this code:
SqlConnection conn = new SqlConnection(connectionStringArg);
SqlCommand command = new SqlCommand("select field from table");
command.Connection = conn;
conn.Open();
textbox.text = (string)command.ExecuteScalar();
conn.Close();
If you need more than the first column from the first row returned, you'll need to use ExecuteReader().
|
|
|
|
|
|
You do this by
1) Setting up a connection to the database using a connection string.
2) Using ADO.Net to write a parameterized query and then execute this query to fetch this data.
3) Displaying this in the text box.
|
|
|
|
|
I'm using google api 2.0 for .net. I use this code to create a new calendar:
CalendarEntry calendar = new CalendarEntry();
calendar.Title.Text = "Little League Schedule";
calendar.Summary.Text = "This calendar contains the practice schedule and game times.";
calendar.TimeZone = "America/Los_Angeles";
calendar.Hidden = false;
calendar.Color = "#2952A3";
calendar.Location = new Where("", "", "Oakland");
Uri postUri = new Uri("https://www.google.com/calendar/feeds/default/owncalendars/full");
CalendarEntry createdCalendar = (CalendarEntry) service.Insert(postUri, calendar);
but, on execution, return the error:
Execution of request failed
at the line
CalendarEntry createdCalendar = (CalendarEntry) service.Insert(postUri, calendar);
However, if I connect to google calendar with the browser, the new calendar is created.
Also, I use this code to retriving all calendars and it's works
CalendarQuery query = new CalendarQuery();
query.Uri = new Uri("https://www.google.com/calendar/feeds/default/allcalendars/full");
CalendarFeed resultFeed = (CalendarFeed) service.Query(query);
Any suggestions?? Thanks
|
|
|
|
|
Looks almost identical to the example from the manual. Did you call the authenticate-method of the service object?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|