|
anishkannan wrote: How can we achieve that
Dongles are hardware keys - best thing would be to buy them, mostly you'll get a free booklet explaining how to interface with it. I'd suggest the USB-key dongles since you can stack those more easily than the parallel ones.
anishkannan wrote: please give the solution of these...
There you are[^]
I are Troll
|
|
|
|
|
Hi,
I am wondering if it is ok to use the following snippet ? I am suspecting that, as the object license will be disposed after this block, the caller of GetLicense method will get null object all the time, right ?
public virtual EncryptedLicense GetLicense(LicenseContext context, Assembly assembly, Type type)
{
..........
using (EncryptedLicense license = LoadLicense(context, null, licenseKey))
{
return license;
}
}
As my class EncryptedLicense is Disposable, my refactor tool (CodeRush and ReSharper) is asking me to place the statement EncryptedLicense license = LoadLicense(context, null, licenseKey) within using. But, I am getting worried if it is a correct practice or not. Would you please suggest!.
|
|
|
|
|
IMO, since you want to use your license code elsewhere, why do you want to put it in a using statement?
You are not going to call dispose() on it anyway.
|
|
|
|
|
Hi Abhinav,
Thanks for ur reply. So, that means, I should not use 'using' here, right ? I got the answer.
|
|
|
|
|
AFAIK, there is no point in you using using here.
Me, I'm dishonest. And a dishonest man you can always trust to be dishonest. Honestly. It's the honest ones you want to watch out for...
|
|
|
|
|
|
When using a "using" construct, when execution leaves the "using" block for ANY reason, the object specified in the "using" block is Disposed and destroyed. You cannot return an object created in the "using" statement to any caller since it won't exist any more.
|
|
|
|
|
Thank you Dave, thats the answer I was looking for. I was confused about it, now I am clear.
|
|
|
|
|
I agree, however that also tells me the compiler should reject the code as it cannot possibly make sense.
|
|
|
|
|
Another one for MS to consider.
|
|
|
|
|
It can't figure it out because if license is declared before the using but not necessarily instantiated, it can still be used to instantiate another object after the using block.
|
|
|
|
|
Emran Hussain wrote: will get null object
No, not null, but it should be unusable -- however that depends on what the Dispose method actually does.
I write Dispose methods for a lot of things, not all of them leave the instance unusable.
|
|
|
|
|
Hi,
Thanks for your reply. I just started learning to use Dispose method and I am highly confused about one thing. WHY Microsoft created this new pattern when the Class Designer can put all memory cleaning logic in the Destructor of the class ? Because it is very easy to miss calling Dispose method for a new programmer and I have seen hundreds to source code where programmers are not calling dispose method or using 'using contruct' for Stream operations. Even in the popular open source library 'HtmlAgilityPack', I dont see the programmers are Calling Dispose method in Stream operations.
==> Also, I am wondering, even the Windows Form generated Code in Main method in Prgram.cs file in any Windows Application, the Entry Point Form is invoked without using 'using construct'. So, can you please give me any light about it please !
Regards.
|
|
|
|
|
To clean things up before the destructor gets called?
|
|
|
|
|
Dear Sirs,
I have a program that takes command-line arguments. The ordinary method of ingestion is drag-n-drop. So, you drag a (DICOM|*.dcm) file (or more) onto my program, it reads them and processes them without showing a form. No problem. A coworker pointed out today that the program doesn't work with "twelve or so" files. I tried it and can get 23 items to work, but adding the 24th screws it up. The error message is a simple msgbox saying:
"Windows cannot access the specified device, path, or file. You may not have the appropriate permissions to access the item." With the full path to the application in the title-bar.
My guess is that he was using rather deeply-nested or long-named files. I'm thinking what's happenning is that the shell is somehow not getting the program path correct with lots of parameters?? the parameters somehow obstructing the filename?? I checked it out and when I get the twenty-three items to work, the command-line length (with full program path) is 2,075 characters. Raymond[^] has lots to say about it, but my length isn't close to what he talks about: Nowhere near 32767, over 2048, and not near 8192, and well over the dos limit of 127.
I could do something creative if my program would just run, but it never gets to sub Main().
If anyone has had this problem before, please give me sympathy. Even better, if someone knows how to work around or fix this problem, please let me know!! I've searched the web for a while and nothing came up. I was sure to check this forum to avoid double-posting. Thanks!
Aaron
In Christ,
Aaron Laws
http://ProCure.com
|
|
|
|
|
Raymond wrote: If you are using the ShellExecute/Ex function, then you become subject to the INTERNET_MAX_URL_LENGTH (around 2048) command line length limit imposed by the ShellExecute/Ex functions.
Think about it, dragging files from Explorer and dropping them onto your application requires something to start the application. I would venture to suggest that Explorer uses ShellExecute/Ex to do just that, hence the 2048 character limit.
It's time for a new signature.
|
|
|
|
|
Dear Mr. MacCutchan,
Good catch. This doesn't exactly explain the fact that I was able to get 2,075 characters into the command line. Well, either way, I still have a limit, even if it's not the 2048 limit, that I'm hitting. Thanks for your comment.
In Christ,
Aaron Laws
http://ProCure.com
|
|
|
|
|
you should not take 20 or more RX'es for a single patient, medical costs are skyrocketing as it is, nor mix pictures from different patients in a single run of some app, to avoid mix-ups.
|
|
|
|
|
Dear Mr. Pattyn,
Thanks! I'm anonymizing.
In Christ,
Aaron Laws
http://ProCure.com
|
|
|
|
|
Not sure if there is a way around that limitation. That is, I'm not sure there is a way to drag-drop a virtually unlimited number of files and have them processed via command line. Instead, however, you could modify the context menu that pops up when you select mutliple files and right click them. You could add an extra item that say something like "Process With MyApp". That command would then add all those paths to a text file and then you'd pass that text file (as a command-line argument) to MyApp.exe (it would then read all the paths from that text file). Never tried that myself though, so I'm not sure if there would be any problems with doing it that way.
|
|
|
|
|
Dear Mr. aspdotnetdev,
Thanks for your suggestion. I'd hate to have to modify that menu.... I was hoping for a stand-alone app that didn't require a setup of any sort. Maybe I can make an alternate version... oh well.
In Christ,
Aaron Laws
http://ProCure.com
|
|
|
|
|
Hi everybody!
Need a little help here...
http://yfrog.com/jx63488581j[^]
At the image u see a dialog window from ms access before and after u click "Objects" button.
I want to make something similar to this in a C# application, but dunno if there is actual control for that purpose, or I have to make it myself.
The idea is to have a number of buttons and when you click ONE of them you reveal a group of other "things".. buttons or other controls.. dunno, hope u got the idea
Thank you for the attention,
best regards Peter.
modified on Thursday, April 1, 2010 3:18 PM
|
|
|
|
|
First, no one is going to follow this link to look at your image.
Myzrael wrote: The idea is to have a number of buttons and when you click ONE of them you reveal a group of other "things".
Very easily accomplished, handle the button click event and show/hide the controls necessary.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Mark Nischalke wrote: First, no one is going to follow this link to look at your image.
Because it doesn't work in the first place?
|
|
|
|
|
Now it works i hope.. sry
|
|
|
|
|
Mark Nischalke wrote: no one is going to follow this link to look at your image.
you're absolutely correct, the link does not work. 404
|
|
|
|