|
thanks for your discussion. you said two things very briefly which is not very clear to me.
you said
"Alternatively, you could do a binary diff, comparing the raw data. An image is an array of bytes after all, and comparing those might be faster."
can you drive me to few sample code or article from where i can know how to do binary diff on image and get the difference.
you said
"That's the reason why most screen-sharing applications do not "send images" back and forth."
if any screen sharing apps do not send image then how they send change to other end. please tell me in details whatever you know about how screen sharing apps send change to other end again and again.
i would expect good discussion on the above 2 points. thanks a lot.
tbhattacharjee
|
|
|
|
|
Tridip Bhattacharjee wrote: can you drive me to few sample code or article from where i can know how to do binary diff on image and get the difference.
Binary diff is simple to explain; you calculate the difference between two arrays of byte.
Tridip Bhattacharjee wrote: please tell me in details whatever you know about how screen sharing apps send change to other end again and again.
http://en.wikipedia.org/wiki/Remote_Desktop_Protocol[^]
Tridip Bhattacharjee wrote: i would expect good discussion on the above 2 points.
Why?
|
|
|
|
|
What i am trying to achieve is to select multiple folders and files simultaneously from the OpenFileDialog.
The suggested solution of setting :
OpenFileDialog.Multiselect = true;
OpenFileDialog.ValidateNames = false;
OpenFileDialog.CheckFileExists = false;
OpenFileDialog.CheckPathExists = true;
OpenFileDialog.FileName = "Dummy";
OpenFileDialog.Filter = string.Empty;
fails for the use case when user selects a folder and a file simultaneously.
I am looking for a solution via which i can close the dialog when user presses the open button and get the path for the selected file(s) and folder(s).
|
|
|
|
|
OpenFileDialog is used to get file names, not folders. If the user clicks a folder then it will open that folder and display the files held therein.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
I know that, that's why i am asking if anyone has extended its functionality to multiple selection of folder and files simultaneously
|
|
|
|
|
It'd be easier and faster to create your own form, fill a listbox, and return the selection.
|
|
|
|
|
You could have tried searching the CodeProject articles: I found Example for FolderBrowserDialog in C#[^] in a couple of seconds.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
can anyone tell me how to bring picturebox in motion like marquee in html i,m new in omage processing/
|
|
|
|
|
You just use a timer and display a sequence of images at regular intervals. For a simple marquee you just need to repaint the text at a different position on the screen each time, starting from one side.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
PictureBox[^] offers a lot of functionality that is totally useless for your purpose. Its purpose is to show a picture, or series of pictures, with minimal effort from your side.
If you want to draw anything programatically, use a Panel[^] or derive a class from System.Windows.Forms.Control[^].
Ciao,
luker
|
|
|
|
|
Hi,
I have crl file and it has some information, such as Valid form 02.11.2012, Next update 02.01.2013, and ect. I need to get this two datetime, and compare with real time (DateTime.Now) and when it will be 31.12.2012 (2 days before) send email to admins.
How to get this data from crl file. I find WinCrypt32
public static class WinCrypt32
{
#region APIs
[DllImport("CRYPT32.DLL", EntryPoint = "CryptQueryObject", CharSet = CharSet.Auto, SetLastError = true)]
public static extern Boolean CryptQueryObject(
Int32 dwObjectType,
IntPtr pvObject,
Int32 dwExpectedContentTypeFlags,
Int32 dwExpectedFormatTypeFlags,
Int32 dwFlags,
IntPtr pdwMsgAndCertEncodingType,
IntPtr pdwContentType,
IntPtr pdwFormatType,
ref IntPtr phCertStore,
IntPtr phMsg,
ref IntPtr ppvContext
);
[DllImport("CRYPT32.DLL", EntryPoint = "CertFreeCRLContext", SetLastError = true)]
public static extern Boolean CertFreeCRLContext(
IntPtr pCrlContext
);
[DllImport("CRYPT32.DLL", EntryPoint = "CertNameToStr", CharSet = CharSet.Auto, SetLastError = true)]
public static extern Int32 CertNameToStr(
Int32 dwCertEncodingType,
ref CRYPTOAPI_BLOB pName,
Int32 dwStrType,
StringBuilder psz,
Int32 csz
);
[DllImport("CRYPT32.DLL", EntryPoint = "CertFindExtension", CharSet = CharSet.Auto, SetLastError = true)]
public static extern IntPtr CertFindExtension(
[MarshalAs(UnmanagedType.LPStr)]String pszObjId,
Int32 cExtensions,
IntPtr rgExtensions
);
[DllImport("CRYPT32.DLL", EntryPoint = "CryptFormatObject", CharSet = CharSet.Auto, SetLastError = true)]
public static extern Boolean CryptFormatObject(
Int32 dwCertEncodingType,
Int32 dwFormatType,
Int32 dwFormatStrType,
IntPtr pFormatStruct,
[MarshalAs(UnmanagedType.LPStr)]String lpszStructType,
IntPtr pbEncoded,
Int32 cbEncoded,
StringBuilder pbFormat,
ref Int32 pcbFormat
);
#endregion APIs
#region Structs
[StructLayout(LayoutKind.Sequential)]
public struct CRYPT_OBJID_BLOB
{
public uint cbData;
[MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)]
public byte[] pbData;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct CERT_PUBLIC_KEY_INFO
{
public CRYPT_ALGORITHM_IDENTIFIER Algorithm;
public CRYPTOAPI_BLOB PublicKey;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CERT_EXTENSION
{
[MarshalAs(UnmanagedType.LPStr)]
public string pszObjId;
public bool fCritical;
public CRYPTOAPI_BLOB Value;
}
[StructLayout(LayoutKind.Sequential)]
public struct CERT_CONTEXT
{
public uint dwCertEncodingType;
public IntPtr pbCertEncoded;
public uint cbCertEncoded;
public IntPtr pCertInfo;
public IntPtr hCertStore;
}
public struct CERT_INFO
{
public int dwVersion;
public CRYPTOAPI_BLOB SerialNumber;
public CRYPT_ALGORITHM_IDENTIFIER SignatureAlgorithm;
public CRYPTOAPI_BLOB Issuer;
public FILETIME NotBefore;
public FILETIME NotAfter;
public CRYPTOAPI_BLOB Subject;
public CERT_PUBLIC_KEY_INFO SubjectPublicKeyInfo;
public CRYPTOAPI_BLOB IssuerUniqueId;
public CRYPTOAPI_BLOB SubjectUniqueId;
public int cExtension;
public CERT_EXTENSION rgExtension;
}
[StructLayout(LayoutKind.Sequential)]
public struct CRL_CONTEXT
{
public Int32 dwCertEncodingType;
public IntPtr pbCrlEncoded;
public Int32 cbCrlEncoded;
public IntPtr pCrlInfo;
public IntPtr hCertStore;
}
[StructLayout(LayoutKind.Sequential)]
public struct CRL_INFO
{
public Int32 dwVersion;
public CRYPT_ALGORITHM_IDENTIFIER SignatureAlgorithm;
public CRYPTOAPI_BLOB Issuer;
public FILETIME ThisUpdate;
public FILETIME NextUpdate;
public Int32 cCRLEntry;
public IntPtr rgCRLEntry;
public Int32 cExtension;
public IntPtr rgExtension;
}
[StructLayout(LayoutKind.Sequential)]
public struct CRYPT_ALGORITHM_IDENTIFIER
{
[MarshalAs(UnmanagedType.LPStr)]
public String pszObjId;
public CRYPTOAPI_BLOB Parameters;
}
[StructLayout(LayoutKind.Sequential)]
public struct CRYPTOAPI_BLOB
{
public Int32 cbData;
public IntPtr pbData;
}
[StructLayout(LayoutKind.Sequential)]
public struct FILETIME
{
public Int32 dwLowDateTime;
public Int32 dwHighDateTime;
}
[StructLayout(LayoutKind.Sequential)]
public struct CRL_ENTRY
{
public CRYPTOAPI_BLOB SerialNumber;
public FILETIME RevocationDate;
public Int32 cExtension;
public IntPtr rgExtension;
}
#endregion Structs
#region Consts
public const Int32 CERT_QUERY_OBJECT_FILE = 0x00000001;
public const Int32 CERT_QUERY_OBJECT_BLOB = 0x00000002;
public const Int32 CERT_QUERY_CONTENT_CRL = 3;
public const Int32 CERT_QUERY_CONTENT_FLAG_CRL = 1 << CERT_QUERY_CONTENT_CRL;
public const Int32 CERT_QUERY_FORMAT_BINARY = 1;
public const Int32 CERT_QUERY_FORMAT_BASE64_ENCODED = 2;
public const Int32 CERT_QUERY_FORMAT_ASN_ASCII_HEX_ENCODED = 3;
public const Int32 CERT_QUERY_FORMAT_FLAG_BINARY = 1 << CERT_QUERY_FORMAT_BINARY;
public const Int32 CERT_QUERY_FORMAT_FLAG_BASE64_ENCODED = 1 << CERT_QUERY_FORMAT_BASE64_ENCODED;
public const Int32 CERT_QUERY_FORMAT_FLAG_ASN_ASCII_HEX_ENCODED = 1 << CERT_QUERY_FORMAT_ASN_ASCII_HEX_ENCODED;
public const Int32 CERT_QUERY_FORMAT_FLAG_ALL = CERT_QUERY_FORMAT_FLAG_BINARY | CERT_QUERY_FORMAT_FLAG_BASE64_ENCODED | CERT_QUERY_FORMAT_FLAG_ASN_ASCII_HEX_ENCODED;
public const Int32 X509_ASN_ENCODING = 0x00000001;
public const Int32 PKCS_7_ASN_ENCODING = 0x00010000;
public const Int32 X509_NAME = 7;
public const Int32 CERT_SIMPLE_NAME_STR = 1;
public const Int32 CERT_OID_NAME_STR = 2;
public const Int32 CERT_X500_NAME_STR = 3;
public const String szOID_CRL_REASON_CODE = "2.5.29.21";
public enum Disposition : uint
{
CERT_STORE_ADD_NEW = 1,
CERT_STORE_ADD_USE_EXISTING = 2,
CERT_STORE_ADD_REPLACE_EXISTING = 3,
CERT_STORE_ADD_ALWAYS = 4,
CERT_STORE_ADD_REPLACE_EXISTING_INHERIT_PROPERTIES = 5,
CERT_STORE_ADD_NEWER = 6,
CERT_STORE_ADD_NEWER_INHERIT_PROPERTIES = 7,
}
[Flags]
public enum FindFlags : int
{
CRL_FIND_ISSUED_BY_AKI_FLAG = 0x1,
CRL_FIND_ISSUED_BY_SIGNATURE_FLAG = 0x2,
CRL_FIND_ISSUED_BY_DELTA_FLAG = 0x4,
CRL_FIND_ISSUED_BY_BASE_FLAG = 0x8,
}
public enum FindType : int
{
CRL_FIND_ANY = 0,
CRL_FIND_ISSUED_BY = 1,
CRL_FIND_EXISTING = 2,
CRL_FIND_ISSUED_FOR = 3
}
#endregion
}
How to use it and get the necessary information?
|
|
|
|
|
You can use the DateTime.TryParse() [^] method to convert your strings, and then use the other methods of the DateTime class to perform your calculations.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
A "Certificate Revocation List"?
It seems that you already have an answer on your question in Q&A. Was it not satisfactory?
|
|
|
|
|
I am finishing up my program, and I built just like an typical amateur does, only one process works at a time. I need to start multi-threading, but because of the considerable amount of repeditive type of calculations non graphic I was wondering how I might proceed.
I need to run 8000 sets of data through the same algorithms which may be up to 1000 every few minutes. Furthermore how does this fit in with using a multiple processors with multicore cores and will it speed it up, if it will do I need to set the threading up accordingly.
Right now I have an older machine with a dual core and it processes about 10 data sets a second, will I be able to set up the program where I can use dual processors with multi-cores and speed up this process (other than the processor speed).
Or do I need to use a blade server and split up the program to process more data, if so do I thread it differently also.
Any help would be greatly appreciated.
Thanks in advance.
Michael
|
|
|
|
|
The benefit you get depends on your datasets and how they need to be processed. You have a couple of options for dividing the work up:
1) Each thread will handle its own dataset, processing each, by itself, from start to finish. The benefit you get is if you have more than one dataset being worked on at a time.
2) If your dataset can be worked on if you partition a dataset into smaller chunks, each thread can work on a small chunk of the data. Say your dataset has 100 items in it and each can be processed individually with no dependancies on the other items in the set. Partitioning the dataset means breaking the 100 items into groups of, say, 25 each. Then 4 threads could work on the same dataset, each processing 25 items seperate from the others.
In both cases, you're best benefit is usually obtained when the number of worker threads you create matches the number of cores in the CPU. So, if you have an Intel proc with 4 cores and 4 hyperthreads, you'll see 8 logical cores, so you can get away with 8 threads.
You can also look into the Task Parallel Library (pre .NET 4.0) to simplify this process greatly. If using .NET 4.0 or 4.5, the TPL is integrated into the .NET Framework. You don't have to install a seperate library to use it.
See the System.Threading.Tasks namespace documentation.
|
|
|
|
|
I would difinely go with option 1 below because all data sets will not be processed to completion.
You said for every core you would have a separate thread, does this mean whether I use a single server with 2 processors and multiple cores or blade server with multiple computers it is only the number of cores that is important.
modified 6-Dec-12 0:46am.
|
|
|
|
|
You cannot start a thread on a seperate computer. If you want to use blade servers, each will have to run a seperate copy of your app and you'll have to come up with some way to spread the number of datasets over the set of servers and communicate with each.
|
|
|
|
|
i want to develop 4*6,6*10 inches photo format in my application plz help
|
|
|
|
|
You're going to have to go into quite a bit more detail than that if you want any real help.
|
|
|
|
|
I want to develop:
A telepathic application that can read a users mind and instantly respond.
A time travel application that can get information from the future.
A direct mind - computer link
Ok so its a quiet afternoon and I'm a little bored! Give us something to work with here, your question makes about as much sense as my answer!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Through me on that mailing list for when those are done but you should add one more app to the list: A telepathic application that can read a clients mind and translate that into coherent specification documents.
Oh yea and a Do Work button would be fantastic addition as well.
Don't comment your code - it was hard to write, it should be hard to read!
|
|
|
|
|
The Do Work button is a done deal - takes up 98% of the screen, is lurid red and has the text Press Me , I didn't want to scare the client with the thought of actually working. It was the last time that particular idiot ask for I want just one button, not all the complex sh*t.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I have a question about converting a C# 2010 application that is currently run as an executable to be run as a DLL instead. I do not know what parts of the entire solution file should be part of the dll file and what parts (if any) should remain as an executable.
I was briefly advised by a contract shop that when the current application calls a web service, that portion should become the dll. I was also told by the contract shop that the chelper.cs code (that calls the web service) should be part of the dll.
This same contract shop also said I could write separate dlls for each 'type' of method that is called. If I did that, I would use portions of code from each project file.
So basically I have part of one project file out of 4 project files that should be included in the dll file?
Here is a description of the current project files:
1. one project file has various routines that are tied with the web service.
2. Another project file is a handshaker to verify security.
3. There is the 'driver' project file.
4. There is a 'sample' code project file that was written by the contract shop that supports the web service.
Can you tell me how you would decide to setup the application I listed above as dll file(s)? How would you
change the code that I just listed above? How would you setup the code tio convert it (use it) as a dll file?
|
|
|
|
|
Based on your requirements, you will not convert your entire project into a dll.
Try to group out all the business / data layer components and moved them into the service layer.
The executable file will still need to call the service.
|
|
|
|
|
I wouldn't make any changes just because someone else says I should. And I'm not impressed with what you've said they said.
Does the system work?
There's nothing magical about DLLs and they can't do anything an executable can't do.
At the extreme, only the main method needs to be in an EXE and everything else can be in a DLL -- but would it make sense for you to do it that way just to satisfy someone who won't have to live with the code?
As mentioned, think in terms of layers; put a minimum of code in the top-most layer -- that could be the EXE and everything else can be in one or more DLLs if that makes sense to you.
Also: how likely are you to need to refer to the DLL from another app? If not, then why bother?
|
|
|
|
|