|
It can be failing silently in your code and thus wouldn't log the errors to your DB. You need to add logging to a file (for debugging I mean, not for your real production code) or something more "bullet proof" then a DB. Just off the top of my head, I'd guess its a permissions issue coming from the service.
|
|
|
|
|
Hi Sledge,
I have "try/catch" and the beginning and end of each eventlogwatcher segment as well as console.writelines. No errors are caught by "try/catch" but also there is no printout from the console.writeline.
Its not permissions because all the code surrounding the eventlog watcher runs and reports perfectly.
Its just this one segment that seems to do nothing while everything around performs as expected.
|
|
|
|
|
hello guys.. I have a struct in class A. In one of its function, I returned this struct. I tried something like this (all the getters and setters are there properly)
class A
{
struct MyStruct
{};
public MyStruct func()
{
MyStruct struc = new MyStruct();
return struc;
}
}
class B
{
struct MyStruct
{};
A = new A();
MyStruct result = new MyStruct();
result = A.func();
}
But I get the error
Cannot implicitly convert type 'A.MyStruct' to 'B.MyStruct'. Whats wrong with it? thnx
|
|
|
|
|
You have defined MyStruct in both class A and class B. That means that the compiler will see them as different even if their internal structure is the same.
Define MyStruct outside of the class boundaries only once and your issue will go away.
I wasn't, now I am, then I won't be anymore.
|
|
|
|
|
thnx..it solved my problem. But let me tell you that I did following
A.MyStruct result = new A.MyStruct();
Is it OK to do so?
|
|
|
|
|
Absolutely, it can be done that way as well.
My personal thought on the matter is that unless A.MyStruct is required to be tightly coupled to class A, it should stand on it's own outside of the class, but like I said earlier, what you have done is perfectly valid.
I wasn't, now I am, then I won't be anymore.
|
|
|
|
|
class A and class B both have nested structs named MyStruct defined. In class B you have MyStruct result = new MyStruct(); If you intend to use A.MyStruct objects in class B then you need to be explicit:
A.MyStruct result = new A.MyStruct();
Mark Salsbery
|
|
|
|
|
thnx...just after I found it out, I read your suggestion.
|
|
|
|
|
overloaded Name wrote: A = new A();
MyStruct result = new MyStruct();
result = A.func();
You don't need to new up the MyStruct here because it is just getting overwritten by the return. If you were passing in a reference, that would be different, but in the case, you are not.
|
|
|
|
|
Hi all!
At first sorry for my poor write english!
I'm creating a web service for connect a future mobile application and at this moment of the development found a problem. The web service recibe at first a username and password, verify if exists in de DB and return one encripted token, the idea is use this token in the next calls to the diferent functions of the webservice, and in a second function verify if the token send by the client is the same that the web service generate.
Whats is the best way of save this tokens in the service? in a DB? in Sessions? the service can recibe direfent calls by diferent users and generate many diferent tokens in a little space of time.
Hope I explain correctly and can undesrtand my question.
Thanks all!
|
|
|
|
|
Sounds like a session key to me, or something that should be stored in the session along with a key. If your web service infrastructure already has the concept of a session (I can't remember if WCF does or not), put it in there, for sure.
|
|
|
|
|
I put it in the database. One benefit is that if the user logs in from another station later, the new token overrides the old one so the previous login becomes invalid -- avoiding having the user logged in twice.
|
|
|
|
|
Thanks all.
Finally I'm trying to implement the session method but have a problem. I create a little form in ASP.NET to test de WS, 2 textbox to insert the user and password and 2 buttons, one to verify the user and password and a second one to call a WS function that check the if the token sended by the user is the same than the saved in Session but in this function the session value is null.
When I call the second function this call again all web service and this empty all the data?
If you need for understant better my queston I can post the WS code.
|
|
|
|
|
Just wondering if anyone else has experienced this before. I have a check box with style Appearance:Button (actually it is wrapped in a user control but that isn't relevant here). Two instances of this check box on different panels within the same application are displaying differently: one has the normal 1px control border like real buttons, and on another panel the same control is displaying with a double thickness border. It also seems to be offset by 1px when I try to read its location, or alternatively its painting region is offset by 1px (I'm aligning another control on it and it is not quite lining up).
|
|
|
|
|
How do I put my window at the top of your desktop (by analogy - the task bar)?
|
|
|
|
|
What do you mean exactly? TopMost or on a certain Location?
Are we talking WinForms or WPF?
V.
|
|
|
|
|
You are not going to put any of your windows on my desktop, you hear!
It is strictly forbidden!
"With sufficient thrust, pigs fly just fine."
Ross Callon, The Twelve Networking Truths, RFC1925
|
|
|
|
|
|
|
Fetch[^] handle of the desktop-window, set it as your parent[^], make your form the "bottom most[^]" and you're there. Should look like an IFrame in your desktop, should work and behave in the same way.
Good luck
Bastard Programmer from Hell
|
|
|
|
|
wave file can be add to project as resources but mp3 i cant played it as resources ....what the problem with mp3 can anyone help me with that please
|
|
|
|
|
1. One exclamation sign suffices if not separated from last word.
2. What have you tried to play the mp3 in question? What error messages (if any) did you see?
After getting the Play part to work, you can deal with attaching the file to your project's resources pretty easily.
Ciao,
luker
|
|
|
|
|
i try to add mp3 file to resources without open dialog its not work ..
after i add wav file to resources i played it with :
SoundPlayer sndplayr = new SoundPlayer(resource.Properties.Resources.xp);
sndplayr.Play();
and i try :
System.Reflection.Assembly a = System.Reflection.Assembly.GetExecutingAssembly();
System.IO.Stream s = a.GetManifestResourceStream("xp.wav");
SoundPlayer player = new SoundPlayer(s);
player.Play();
wave file played but mp3 i can't .. is that any method to do it ..
|
|
|
|
|
You can embed anything (well, any file or finite stream which can be saved as a file) as a resource. I don't think there is native MP3 playing in the Framework, though.
|
|
|
|
|
AFAIK (and MSDN[^] is pretty categorical about it) SoundPlayer can't handle MP3's - you would need to use a MediaPlayer embed to play them. The problem with that is that MediaPlayer only works with files: it has no facility to work with streams. So, you would need to export the MP3 from your resources into a temporary file, play it, then clean up after yourself when you are finished. Which defeats the purpose of having the file as a resource in the first place!
There is an alternative solution here: http://stackoverflow.com/questions/184683/play-audio-from-a-stream-using-c-sharp[^] but I haven't tried it and can't vouch for it's effectiveness!
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|