Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
S

Schokoolero

@Schokoolero
About
Posts
10
Topics
6
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • NumericUpDown in hexadecimal mode bug
    S Schokoolero

    Thanks for the reply! I tried Validating, but that is only thrown, when the NumericUpDown gets the focus or looses it and in similar situations. It doesn't seem to be thrown right before the value is changed wrongly. I also tried KeyDown, but wasn't able to intercept the value the NumericUpDown should take after the Key was pressed if there was no maximum and exchange it for the real value. I solved my problem by enhancing a TextBox to take only hexadecimal numbers, adding a minimum and maximum etc. to it.

    C# help question

  • NumericUpDown in hexadecimal mode bug
    S Schokoolero

    When I use a NumericUpDown with Hexadecimal=false and a number that is too large or to small is entered, it is set to the corresponding limit. With Hexadecimal=true however, the value is reset to the previous, correct, value, when a value too large or too small is entered. I have tried to intercept the ValueChanged and various other events to get the same effect as with Hexadecimal=false, but there seems to be no situation in which I can read the entered value instead of the already reset value and adjust it manually. Does anybody know a solution to this problem? Thanks

    C# help question

  • Problem serializing large datastructure
    S Schokoolero

    I am using a datastructure that represents a triangle mesh. It contains a list of 3D-vertices, a list of triangles (indices of the vertices used for the triangle), a list of edges (also indices) and some additional data. Each triangle has a 3D-vertex attached to it (the normal vector), so does each vertex. The angles and the area are also stored with every triangle. And every vertex stores the principal curvatures and their directions (as 3D-vertices). Every vertex stores a list of adjacent triangles and a list of neighboring vertices (also as indices). All of that is not a problem for serialization. But I also need to store the distances from every vertex to every other vertex (to calculate the curvatures). I do this by storing the distance from one vertex to every vertex preceding it in the list of vertices with that vertex, so there is no redundance. (I tried a single array for all the distances, but it was too much and I got an OutOfMemoryException.) My sample mesh contains 11703 vertices, 23402 triangles and 35103 edges, but the program should be capable of handling meshes a lot larger. I originally used doubles, as most of the "Math" methods return doubles. But I switched to float to save memory. Now the program uses about 500MB of my 2GB of memory. The distances are still too much for the serialization. (I tried storing just the distances using a StreamWriter and WriteLine and got a txt-file larger than 1GB, which is way too large.) Serialization always throws an OutOfMemoryException. (I used binary serialization and GZip-Compression.) Does anyone know a way of serializing such large datastructures?

    C# graphics data-structures json performance help

  • Is there a good free numerical library for C#/Visual Studio? [modified]
    S Schokoolero

    I'm currently looking for a numerical library for C#. I need to find eigenvalues and eigenvectors and do "least squares fitting" etc. I found several, rather expensive, commercial libraries, like IMSL (recommended by Microsoft). I also found a few free libraries: ILNumerics.Net: http://ilnumerics.net/siteref\_Home Math.net Iridium: http://mathnet.opensourcedotnet.info/ Mapack: http://www.aisto.com/roeder/dotnet/ dnAnalytics: http://www.codeplex.com/dnAnalytics Does anyone have any experience with those libraries (are they any good?) or know other good free numerical libraries?

    modified on Friday, January 25, 2008 5:34:40 AM

    C# csharp visual-studio com question

  • Encrypting a stream
    S Schokoolero

    I found that article too. But the problems I described are not solved by this method. 1. The method encrypts a string and decrypts to a string. I don't have a string! (Or I would first have to encrypt all the strings before serializing! :( ) 2. The key for Rijndael has to be of a fixed length (128, 192, or 256 bits), so I can't use a password of my choice.

    C# security announcement learning workspace

  • Encrypting a stream
    S Schokoolero

    I'm currently writing a little password-manager to store my passwords and the associated data my way. Of course I would prefer the stored data not to be plainly readable to anyone, so I thought of encrypting it. However, I couldn't really find any way of doing it elegantly. 1. I want to enter a password of my choice to encrypt it. Rijndael and others always need a key of a specific length, so the choice of passwords is limited to the accepted length :( . 2. Some methods I found need an input file and an output file. This is not particularly elegant, since one has to erase the input file (encryption) or the output file (decryption) afterwards, in order not to have a plainly readable version. Other methods encrypt a string, while I am serializing objects in a stream. Here is what I have so far (without encryption): Saving: private void SaveFile(string path) { Stream stream = null; try { stream = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.None); MemoryStream memoryStream = new MemoryStream(); GZipStream compressedStream = new GZipStream(stream, CompressionMode.Compress); IFormatter formatter = new BinaryFormatter(); formatter.Serialize(memoryStream, ((PasswordList)ActiveMdiChild).List); memoryStream.WriteTo(compressedStream); compressedStream.Flush(); compressedStream.Close(); } catch (Exception r) { throw new ApplicationException("File could not be created " + r); } finally { if (null != stream) stream.Close(); } } Opening: private void openToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog openFile = new OpenFileDialog(); openFile.Title = "Open"; openFile.InitialDirectory = Environment.CurrentDirectory; if (openFile.ShowDialog() == DialogResult.OK) { Stream stream = null; try { IFormatter formatter = new BinaryFormatter(); stream = new FileStream(openFile.FileName, FileMode.Open, FileAccess.Read, FileShare.Read); GZipStream compressedStream = new GZipStream(stream, CompressionMode.Decompress); PasswordList newList = new PasswordList(this, (List)formatter.Deserialize(compressedStream)); compressedStream.Close(); newList.MdiParent = this; newList.filename = openFile.FileName; InitializeNewList(newList); } catch (Exception r) { throw new ApplicationExcepti

    C# security announcement learning workspace

  • Accessing network drives
    S Schokoolero

    The common OpenFileDialog can't be modified (At least not without some rather complicated hacking.). I just thought it would be a lot nicer to have one dialog instead of using the common dialog and opening a custom dialog upon closing the common one, to ask the user for all the remaining settings. With my custom OpenDialog filtering is a lot more flexible. I can not only filter files by their ending, but also display them in the listView without it.

    C# question sysadmin

  • Accessing network drives
    S Schokoolero

    I'm currently trying to create an OpenDialog that is similar to the Windows Explorer in appearance. (TreeView on the left, ListView on the right) To get the logical drives is pretty simple. I just use the Directory.GetLogicalDrives() method. However, I didn't find anything similar to access network drives, like in the Network-node in the Windows Explorer TreeView. I found a few solutions, that take hundreds of lines of code to get the result, that this one method achieves for the logical drives. Is there no shorter way? If there is one, what is it?

    C# question sysadmin

  • Generic parameter to string
    S Schokoolero

    I found a solution, but I'm not quite happy with it. I simply pass the string I need to the constructor, when I create an instance of the class. Thanks for the help I'll check it out, it might be the cleaner way of accessing the string I need.

    C# regex help tutorial question

  • Generic parameter to string
    S Schokoolero

    1 private void AddPlugin(Assembly pluginAssembly) { 2 3 //Loop through all the Types found in the assembly 4 foreach (Type pluginType in pluginAssembly.GetTypes()) { 5 //Only look at public and non-abstract types 6 if (pluginType.IsPublic && !pluginType.IsAbstract) { 7 Type typeInterface = null; 8 try { 9 //Gets a type object of the interface we need the plugins to match 10 typeInterface = pluginType.GetInterface("IPlugin", true); 11 } 12 catch (Exception) { } 13 14 //Make sure the interface we want to use actually exists 15 if (typeInterface1 != null) { 16 //Create a new available plugin instance 17 T newPlugin = 18 (T)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 19 20 availablePlugins.Add(newPlugin); 21 } 22 } 23 } 24 } Here's a method I've got in a generic PluginManager class with parameter T. It adds a plugin of the right type to a list of available plugins. The problem I've got is in line 10. Instead of "IPlugin" (The parent interface of the different interfaces for plugins (IParser, ISolution, etc.), something like "T" should be used. Unfortunatly I couldn't find out how to get the name of the parameter T as a string. ToString and casting doesn't work on the generic parameter. Is there any way of getting the right string ("IParser", "ISolution", etc.) depending on the chosen parameter T?

    C# regex help tutorial question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups