|
Thanks. Would you mind explaining the advantage of an INNER JOIN over an IN?
|
|
|
|
|
Sub queries are run in a temporary memory space, hence they can be slower.
However, most engines now are capable of converting sub queries into INs, so in general for new databases, you should be ok with both.
|
|
|
|
|
One thing to bear in mind: GETDATE isn't particularly accurate at the millisecond level. Although the datetime datatype is accurate to about 3 milliseconds, GETDATE does not give you that level of precision, as far as I can gather from a quick google it is somewhere around 15ms although things like machine load can affect it. If you are expecting to do repeated updates to the same row within a very short time period, this may not give you unique values for your Modified column. If your rows will not be updated that frequently, then it's not a problem.
I thought SQL Server supported the ability to automatically timestamp rows when they were updated. The timestamp is just a meaningless number but at least you can check whether a row is the version you expect it to be, and you can also tell the order in which updates were applied.
(I'm assuming SQL Server since you haven't said what database you are using.)
|
|
|
|
|
Hi all,
I have been using this code project to create custom taskbar notification windows. This worked perfectly well in Windows XP, but in Windows 7 the background goes black (instead of transparent) and the custom image gets smeared (as opposed to being clearly re-drawn as it "rises" from the taskbar). Have any of you run into this issue? If so, is there a simple workaround? If there isn't, I would not be adverse to learning how to create these on my own (without someone else's code), but I'm not entirely sure where to start. Graphics and drawing aren't exactly my strongest suits.
Thank you for your time.
-Anfai
|
|
|
|
|
If you got the code from an article, then there is a "new message" button at the bottom of that article, which causes an email to be sent to the author. They are then alerted that you wish to speak to them.
Posting this here relies on them "dropping by" and realising it is for them.
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
Ah, I understand. I wasn't intending my question to be solely for the creator of the article, as the article is now nearly nine years old. I will, however, post my inquiry there and hope for a response. Thank you for directing me to the correct location.
|
|
|
|
|
I have a service that runs as Local System. I need the service to be aware when the machine goes to sleep and when it reawakens.
Since the service has no UI, hence no windows, is there some other facility in the framework for receiving the necessary broadcast messages?
SOLUTION:
The ServiceBase class has an protected OnPowerEvent() function that I can override.
Thanks for reading my post.
The difficult we do right away...
...the impossible takes slightly longer.
modified 31-Jan-12 18:02pm.
|
|
|
|
|
Richard Andrew x64 wrote: no UI, hence no windows
Hmm. I've been using a hidden window in such occasions, not sure it would work for a service though.
Luc Pattyn [My Articles] Nil Volentibus Arduum
Fed up by FireFox memory leaks I switched to Opera and now CP doesn't perform its paste magic, so links will not be offered. Sorry.
|
|
|
|
|
Thanks Luc, you have given me the answer even though you didn't state it directly.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Did I? Sorry for that.
Luc Pattyn [My Articles] Nil Volentibus Arduum
Fed up by FireFox memory leaks I switched to Opera and now CP doesn't perform its paste magic, so links will not be offered. Sorry.
|
|
|
|
|
And then there is the SystemEvents[^] class, it doesn't need a window!
Luc Pattyn [My Articles] Nil Volentibus Arduum
Fed up by FireFox memory leaks I switched to Opera and now CP doesn't perform its paste magic, so links will not be offered. Sorry.
|
|
|
|
|
Case Scenario:
Executable:
namespace ChipTools
{
public class SplashScreen
{
public int ReadChip()
{
byte[] data = new byte[32];
Assembly a = Assembly.LoadFrom("Reader.dll");
Type mm = a.GetType("Reader");
object o = Activator.CreateInstance(mm);
object[] par = new object[] { data };
int status = (int)mm.InvokeMember("ReadChip", BindingFlags.Default | BindingFlags.InvokeMethod, null, o, par));
}
}
}
Reader.dll (.NET dll)
namespace ChipReader
{
public class Reader
{
public int ReadChip(byte[] data)
{
int status = 0;
<reads chip>
return status;
}
}
}
Question is... Did I do this right? If not, should I load the appropriate namespace in order for this late binding to work? Pls give example so I can understand. Thanks!
|
|
|
|
|
I just figured it out... it should read for the executable... The correction is at "Type mm" line in the code below.
namespace ChipTools
{
public class SplashScreen
{
public int ReadChip()
{
byte[] data = new byte[32];
Assembly a = Assembly.LoadFrom("Reader.dll");
Type mm = a.GetType("ChipReader.Reader");
object o = Activator.CreateInstance(mm);
object[] par = new object[] { data };
int status = (int)mm.InvokeMember("ReadChip", BindingFlags.Default | BindingFlags.InvokeMethod, null, o, par));
}
}
}
|
|
|
|
|
Blubbo wrote: Did I do this right?
Does it work? If not, why don't you show the outcome, the exceptions, etc., rather than turn it into a quiz?
BTW: you need less reflection code, and you'll get better performance, when your late bound object implements an early bound interface.
Luc Pattyn [My Articles] Nil Volentibus Arduum
Fed up by FireFox memory leaks I switched to Opera and now CP doesn't perform its paste magic, so links will not be offered. Sorry.
|
|
|
|
|
Luc Pattyn wrote: early bound interface
A little misleading. Although interfaces allow compilers to do compile-time contract checks, the actual method to be called is determined only at run-time.
|
|
|
|
|
The method is determined by the Framework at the time that you perform the cast to the known interface (typically immediately after calling Activator.CreateInstance). At the point you actually call the method, it's dispatched in the normal way for interface methods.
I second the recommendation to the OP to do it this way, if possible.
|
|
|
|
|
|
You don't need to load any namespace unless you want to load all types within a namespace.
E.g.
var q = from t in a.GetTypes()
where t.IsClass && t.Namespace == "ChipReader"
select t;
Reflection is a performance-intensive way to achieve late binding.
Unless you are studying reflection, you might also want to consider Interfaces as another means to achieve late binding.
As another example. an object is late bound when it is assigned to a variable declared to be of type Object .
|
|
|
|
|
I agree with Luc, you are better off doing the following:
class Executable {
public int ReadChip()
{
byte[] data = new byte[32];
Assembly a = Assembly.LoadFrom("Reader.dll");
Type mm = a.GetType("ChipReader.Reader");
IReader reader = (IReader)Activator.CreateInstance(mm);
int status = reader.ReadChip(data);
}
}
Somewhere both the reader DLL and the main app can reference*:
interface IReader {
int ReadChip(byte[] data);
}
DLL:
namespace ChipReader {
class Reader : IReader {
public int ReadChip(byte[] data){
}
}
}
This allows you to call methods on the reader directly without messing about with reflection code, apart from looking up and instantiating the original type. You can then pass the IReader instance around in the executable like any normal object.
*: If the reader DLLs are specific to this application, the interface can just be in the application, and the reader assembly would need to be compiled with a reference to the executable. This is typically a good approach for plugins, where they are plugging in to a known application. Otherwise, it needs to be in a separate interface assembly which both the app and the reader DLL should reference.
|
|
|
|
|
Ok I'll give this a shot. It does looks more simplier than what I do.
|
|
|
|
|
i have created my own media player in wpf.i want to add
repeat and shuffle button like same as VLC player, but there is problem in syncronization between them and
secondly i want to add control like media library
in widows media player how can i do it ????
|
|
|
|
|
If you can use the XNA framework (Microsoft.Xna.Framework.Media ), try with the MediaLibrary class[^].
|
|
|
|
|
hey i want just code for scaning a folder through which i can use it sub folder and i directly add this to my media player.....i m using wpf ....just feature like windows media player\ FIle \manage library and we can add song to our library
|
|
|
|
|
|
When we install the Windows application setup file then it is giving different results.
If I install in Windows XP it is copying the files in the path C\Programme Files\Application. In XP application is working without any issues in all machines.
But if I install same setup in Win7 then it is copying in the C\Programme Files\ only.All the files are placed in C:\Programe files and application is not working.
If I copy individual files and paste inside the C:\Programme Files\Application then again it started working.
Request you to help me in resolving this issue.
Thanks in advance.
|
|
|
|