|
Hello there guys.
Firstly Im sorry if I this is the wrong place to post this.
I have a problem with IIS.Each time I try to browse my webpages(its from my home machine), I get the error "An unhandled win32 exception occured in mmc.exe[4760].
Then it asks me to debugg the site.I have tried to google the solution to this and Im not getting anything.
Can someone please help me.
Thanx in advance.
kagiso
|
|
|
|
|
how to zoom and pan an image using asp.net 2.0 with c#?? Or using AJAX in it.
|
|
|
|
|
I copied the form files (Form1.h, Form1.resX, Form1.cpp) from one project to another. When I opened the new project, the desinger view is lost from the Form1.h and the link between Form1.resX and Form1.h is lost as well. How to fix problem?
|
|
|
|
|
|
Hi All,
I am making a generic custom collection class as following:
Snippet:
public class MyCollection<specifictype> : IEnumerable
{
...
}
Internally how should I store the items so the class can be used for any type. For example, I can not use List<> as then my internal code will break if the type is not the same as the one declared in the List<>. If I use ArrayList then I am thinking it will hinder performance as it has to box and unbox. Does this mean the only option I have is to use simple array?
Thanks,
CodingYoshi
|
|
|
|
|
Rather than reinventing the wheel, take a look at Collection<T> available in .NET 2.0.
It will behave as a collection for serialization and deserialization purposes, allows strong typing, allows all the interfaces and data binding of a collection, and best of all, doesn't require you to write your own custom collection.
It has become appallingly obvious that our technology has exceeded our humanity. - Albert Einstein
|
|
|
|
|
Hi Patrick,
I am not reinventing the wheel but I need to add some methods of my own along with the other methods already there, i.e. Add, Remover etc. Furthermore, it would be nice to know how to write one anyways. I am well familiar with Generics in .NET 2.0.
Any other advice?
Thanks,
CodingYoshi
|
|
|
|
|
You can inherit collectionbase, and add your own add/remove/indexer, etc.
|
|
|
|
|
CodingYoshi wrote: Any other advice?
You could do as darkelv says, and inherit from CollectionBase, or you could inherit from Collection<T>.
One common approach is to inherit from Collection<T> but not expose the collection as a generic collection - in other words you'd inherit from Collection<string> for example and call your object StringCollection. This would be if you don't want to expose the collection type in your external API.
It has become appallingly obvious that our technology has exceeded our humanity. - Albert Einstein
|
|
|
|
|
Hi.
I am using MOSS 2007 and trying to change the title border of the web - parts.
I have managed to use 3 pictures - left, middle and right - to appear as border on the web - part title, but I have problems with alignment even though all the picture are same size. The problem is that the left and right pictures get 1 px under the middle picture.
I use this code wich I found on this site, but it doesn't work out for me.
.ms-WPHeader td { background: url('webpartBg.gif') top left repeat-x; padding-right: 0 !important; }
.ms-WPHeader h3.ms-WPTitle { background: url('webpartCornerLeft.gif') top left no-repeat; color: #BD8C2A; }
.ms-WPHeader .ms-HoverCellInActive, .ms-WPHeader .ms-HoverCellActiveDark { background: url('webpartCornerRight.gif') top right no-repeat; padding: 7px 5px 5px 5px; }
.ms-WPBody { padding: 0 5px 5px 5px; }
.ms-WPBorder { border-color: #FFECC5; }
.ms-partline { background: #FFECC5; }
.ms-WPTitle { padding: 7px 0 5px 10px; }
.ms-WPTitle a { color: #BD8C2A; }
http://www.thesug.org/blogs/kyles/Lists/Posts/Post.aspx?ID=9
Any suggestions ?
|
|
|
|
|
Hello everybody,
I was playing around with the new .net 3.5 ECDsaCng elliptic curve class of the System.Security.Cryptography namespace and have encountered a problem with importing a previously exported private key. The strange thing is that importing a public key works fine, but importing a private key always fails with a cryptographic exception, although I am calling the import function properly, as far as I can tell.
Before this drives me nuts, I thought I should post the code here - maybe someone can have a look at it and check whether I am missing something, or whether this is a bug within the ECDsaCng class itself.
Here's the VB2008 code - the section where the error occurs is marked (bottom of function)
<br />
<br />
Imports System.Security.Cryptography<br />
<br />
Public Function CreateSignature(ByVal strString As String) As Boolean<br />
<br />
'The exception occurs in the 'objCngKey = CngKey.Import' line on the bottom<br />
<br />
Dim data() As Byte<br />
Dim bSignature() As Byte<br />
Dim sSignature As String<br />
Dim objCngKey As CngKey<br />
Dim keyName As String = "ECDSA Key"<br />
Dim publicKeyBytes(), privateKeyBytes() As Byte<br />
<br />
'Check if CngKey exists - if so, delete it, if not create a new pair of keys<br />
If (CngKey.Exists(keyName)) Then<br />
objCngKey = CngKey.Open(keyName)<br />
objCngKey.Delete()<br />
Else<br />
Dim creationParameters = New CngKeyCreationParameters()<br />
creationParameters.ExportPolicy = CngExportPolicies.AllowPlaintextExport<br />
objCngKey = CngKey.Create(CngAlgorithm.ECDsaP256, keyName, creationParameters)<br />
End If<br />
<br />
'Export the public and the private key to byte arrays<br />
publicKeyBytes = objCngKey.Export(CngKeyBlobFormat.EccPublicBlob)<br />
privateKeyBytes = objCngKey.Export(CngKeyBlobFormat.EccPrivateBlob)<br />
<br />
'Convert String to be signed to a byte array<br />
data = System.Text.Encoding.Default.GetBytes(strString)<br />
<br />
'Create a ECDsaCng Object<br />
Dim ecdsa As ECDsaCng = New ECDsaCng(objCngKey)<br />
<br />
'Sign the string<br />
bSignature = ecdsa.SignData(data)<br />
<br />
'Convert Signature to Base64 string for better reading<br />
sSignature = Convert.ToBase64String(bSignature)<br />
<br />
'Destroy Keypair<br />
objCngKey.Delete()<br />
objCngKey.Dispose()<br />
ecdsa = Nothing<br />
<br />
'Re-Import the keys created above<br />
'Actually the code below was part of another function, to which I pass the private key which was created by the code above<br />
'The purpose of this was to sign another string with the same private key<br />
<br />
'Re-Import the previously exported public key - that works fine.<br />
objCngKey = CngKey.Import(publicKeyBytes, CngKeyBlobFormat.EccPublicBlob) 'That works fine<br />
'NOW, here's where the trouble starts:<br />
'>>>>>>>>>><br />
objCngKey = CngKey.Import(privateKeyBytes, CngKeyBlobFormat.EccPrivateBlob)<br />
<br />
'Here a cryptographic exception occurs<br />
'>>>>>>>>>><br />
'Although I am re-importing the key exactly as exported above, a cryptographic exception occurs.<br />
'What am I doing wrong? Importing the public key works fine, importing the private key fails...<br />
'I also tried to only import the private key, without importing the public key, but that does not help either ...<br />
'Is this a bug in the ECDsaCng function, or am I doing anything wrong?<br />
<br />
<br />
End Function<br />
<br />
Thanks for any help and for pointing me into the right direction.
TIA,
Steve
|
|
|
|
|
Hi,
Does anyone know if it is possible to generically add a new language to highlight, in VS 2005?
I couldn't find such option. If none like such exists, I would be happy to be referenced to an add-in that imitates that action.
Thanks
|
|
|
|
|
Take a look at the Visual Studio eXtensions (VSX) stuff - under the Visual Studio Integration Program (VSIP).
|
|
|
|
|
In 2006, I wrote a C# app (using .NET 2.0 in VS 2005 Express) which was designed to add some PHP code to several HTML files. The HTML files are encoded as ISO 8859-1.
This application worked fine until around Nov 2007 when some unknown change occurred in my Windows XP installation which resulted in hex A0 (  in html) being converted to hex EF BF BD.
I have since found info which states that an illegal character will be recoded as EF BF BD. However, A0 is a LEGAL character in ISO 8859-1 encoding.
In trying to resolve this problem I have tried all of the StreamWriter class Encoding options and have also completely uninstalled VS 2005 and all .NET SDK's and runtime and then subsequently installed .NET 3.5 SDK's (which includes the latest 2.0 SDK) and runtimes and also C# VS 2008. None of these actions resolved the problem.
Any ideas on how to prevent this conversion from occurring?
The code sequence which makes use of StreamWriter.WriteLine is as follows:
<code> private void Process_Files()
{
const bool OVERWRITE = true;
const bool APPEND = true;
ArrayList file_array = new ArrayList();
string newString;
bool found = false;
foreach (string fileName in fileList)
{
Console.WriteLine("Processing: " + fileName + ".htm");
// Add PHP authentication info to top of file
FileInfo srcFile = new FileInfo("PHP-Auth.txt");
srcFile.CopyTo(HTM_FILE_PATH + "temp.php", OVERWRITE);
StreamReader htmFile = new StreamReader(HTM_FILE_PATH + fileName + ".htm");
StreamWriter tmpFile = new StreamWriter(HTM_FILE_PATH + "temp.php", APPEND);
// Read the entire .htm file into memory.
while (!htmFile.EndOfStream)
{
file_array.Add(htmFile.ReadLine());
}
htmFile.Close();
// Append a blank line to the end of the temp.php file.
tmpFile.WriteLine();
tmpFile.WriteLine();
// Process each line of the .htm file.
foreach (string line in file_array)
{
// Compare each name in the fileList to each line of this particular
// .htm file.
foreach (string name in fileList)
{
// If this line of the file contains one of the filenames in "fileList"
// with an extension of .htm, replace it with an extension of .php, with
// the exception of a line that contains "family.htm".
if (line.Contains(name + ".htm") && !line.Contains("family.htm"))
{
found = true;
break;
}
}
if (found)
{
newString = line;
newString = newString.Replace(".htm", ".php");
tmpFile.WriteLine(newString);
found = false;
}
else
// Use the existing line.
tmpFile.WriteLine(line);
}
tmpFile.Close();
file_array.Clear();
// Rename the temp file to it's final .php name.
File.Move(HTM_FILE_PATH + "temp.php", HTM_FILE_PATH + fileName + ".php");
// Delete the old .htm filename.
File.Delete(HTM_FILE_PATH + fileName + ".htm");
}
}</code>
|
|
|
|
|
Have you tried to simply specify the encoding when you open the reader and writer?
Encoding isoWesternEuropean = Encoding.GetEncoding(28591);
StreamReader htmFile = new StreamReader(HTM_FILE_PATH + fileName + ".htm", isoWesternEuropean);
StreamWriter tmpFile = new StreamWriter(HTM_FILE_PATH + "temp.php", APPEND, isoWesternEuropean);
If that doesn't work, the file that you are reading contains a byte order mark (BOM) that overrides the encoding. You can check this by adding the .bin extension to the file and open it in Visual Studio to examine the actual binary data in the file.
If it contains a BOM, the file is broken, as it contains information about decoding it that doesn't match how it was encoded. To fix this you would either have to use/write a program that removes the BOM, or open the file as a binary stream so that you can read past the BOM before starting to read the stream with the StreamReader.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
That did the trick. Thanks very much.
I had tried all of the obvious encodings, but there is no obvious encoding for ISO Western.
1. How did you know that ISO 8859-1 was represented by 28591 (in .NET) (i.e., where would I have looked to find such information)?
2. The fact that you were able to respond with an answer to this type of question conveys to me that you know a fair amount about programming. What kinds of things did you do to get to the understanding of programming that you have today?
Thanks again and have a great day!!!
|
|
|
|
|
Mike Bluett wrote: 1. How did you know that ISO 8859-1 was represented by 28591 (in .NET) (i.e., where would I have looked to find such information)?
In the documentation on the page about the Encoding class, there is a list of encodings:
MSDN Library: Encoding class[^]
Mike Bluett wrote: 2. The fact that you were able to respond with an answer to this type of question conveys to me that you know a fair amount about programming. What kinds of things did you do to get to the understanding of programming that you have today?
Well, I did a lot of programming. I have used many different programming languages on several different platforms. It helps to have done a bit of machine level programming, so that you know what really happens below the surface.
Also, the last years I have been hanging out a lot in forums like this, helping people. You learn a lot from that.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hi everybody!!
I've migrated a .Net 2003 VB project to .Net 2005, everything works fine, but I need to replace the use old DataGrid class with the DataGridView, as it's more functional; but I'm having the following problem: I need an equivalent of the DataGridTableStyle for the DataGridView, I know that as is it doesn't exist, but maybe there's another class that holds a similar functionality...?
So, what I need is someone to give me a hint on that, maybe there's some kind of library already developed by a third-party that encapsulates the functionality of DataGridTableStyle and it'a appliable to DataGridView. Any help will be appreciated, as I have no idea of how I'm going to achieve the same for the new version of the program.
Thanks in advance,
Kenia
|
|
|
|
|
|
Oh yes led, I know they do, that's why I see no other solution than implementing the class myself, but as the idea freaks me out a bit, I want to hear opinions from other programmers.
Thanks anyway for your quick reply
Best Regards,
Kenia
|
|
|
|
|
keniagm wrote: that's why I see no other solution than implementing the class myself,
Sorry, I am not following you, you said:
keniagm wrote: I need an equivalent of the DataGridTableStyle for the DataGridView, I know that as is it doesn't exist, but maybe there's another class that holds a similar functionality...?
The documentation contains the new classes that work with DataGridView to accomplish similar ( but likely greater ) functionality, you don't have to "implement the class yourself".
led mike
|
|
|
|
|
They provide classes to work with the table elements such as cells, columns and so on, but I need to work with the table as a whole, do you get it now? And that's what I don't see in the documentation, classes to work with the entire table, if you know of any, please tell me.
I hope I made myself clear enough this time.
Thanks again,
Kenia
|
|
|
|
|
|
Good point the Rolling Stones song!!
It's not that I want to do it that way, it's just that there are lots of lines of code that work with the table, so if I start working with cells and columns then I'll have to change pretty much of the code, and it's not a good idea, as there are other functionalities to be added to the project and the DataGrid replacement is just one of a long long list. That's why I needed a similar table class for the DataGridView.
Thanks anyway for your concern,
Kenia
|
|
|
|
|
Any one know this answer for the question ,kindly help me too face same issue.
|
|
|
|
|