Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

270 Neutral

About Thevenin

  • Rank
  1. Thevenin

    Learning resources for electronics design

    I recommend Fundamentals of Electric Circuits. I also recommend Microchip brand microcontrollers, particularly the PICkit2 (not only can you code this Microcontroller using the C programming language, but there's also a plugin for Electronics Workbench that will let you simulate the controller hooked up to a circuit). Lastly, since you're so concerned about expenses, I recommend Andrew L. Hodges Funeral Home Price Guide in determining the best prices for funeral services (for when your house burns down with your loved ones inside).
  2. Thevenin

    Multilingual Addresses

    So I just read on Google News that ICANN said it "would declare an end to the exclusive use of Latin characters for website addresses" 1, but it doesn't really educate the readers on the significance of this change. It's my understanding that when you permit Unicode strings, you lose the ability to rely on the visual representation of the string to uniquely identify it. For instance: A = 0x53 (ASCII, Latin 'A') A = 0xB3E653AF (UTF-8, Arabic Greek 'A') ICANN is aware of this... Quote:"ICANN is concerned about the potential exacerbation of homograph domain name spoofing as IDNs become more widespread, and is equally concerned about the implementation of countermeasures that may unnecessarily restrict the use and availability of IDNs." ICANN Statement on IDN Homograph Attacks... but I'm not sure whether the change is just on Internet top-level domains or all levels. It's my understanding that we were already at the point where domain names like "蔡依林.cn" are valid, but domains names such as "蔡依林.公司" are not. Any experts here mind filling in the gaps? [dead]
  3. Ok, that works. Thanks. [grin]!
  4. I have a class that takes in a variable of type 'Type'. It later casts the instance of this type to its respective type. /* set during setup of the class */ public Type abstractpotatotype; /* {much later in the code} */ AbstractPotato[] potato = new AbstractPotato[some_constant]; for(int x=0;x<some_constant;x++) potato[x] = (AbstractPotato)Activator.CreateInstance(abstractpotatotype); The problem is, at compile time, I can set 'abstractpotatotype' to whatever I want. abstractpotatotype= typeof(Bitmap); causing an exception to be thrown at runtime. Unfortuntly, the class must be passed only the typeof(), because it's designed to instantiate its own quantity of this type (aka, it's not known outside the class). What I want to be able to do is write.. Type:AbstractPotato potatotype; .. so that when I'm passing the type, the compiler knows that I'm passing it a type of Potato and not an image (even if it's an image of a potato). Is there a way I can enforce (at compile time) the type of the object that is passed without first instantiating it? [Edited by - jpetrie on October 15, 2009 2:06:43 PM]
  5. I'm considering storing a large file as an embedded resource for sake of easier distribution. However, I'm worried that this will cause the RAM requirements of the application to double, as the embedded resource might be stored in RAM when the application is ran. I'm not having much luck Googling the answer, this particular answer seems to suggest that it's stored in RAM: Anyone have any insight on this?
  6. Thevenin

    Why does web development make so little sense?

    Quote:Why does web development make so little sense?Because it started as a framework for documents, then documents with styles, then documents with the ability to mimic applications, then applications inside documents, then applications with documents inside them, then applications with documents with browsers in applications ...
  7. Thevenin

    Why is remote desktop like molasses on a LAN?

    Quote:Original post by Sirisian hmm I tested RDP with windows 7 from my computer to my brother's a few days ago. We're both using windows 7 and using the wireless router in the house. Runs perfectly. Maybe older versions of RDP act differently. I'm using RDP in Windows 7 between two computers on a wired LAN, and it runs lousy (despite the bandwidth settings set to highest). The CPU usage hovers at around 3%, and there's more than half the RAM available, on both computers.
  8. Quote:Original post by Codeka There's a mistake there: you want to return the type of the class, not the type of the interface it implements (i.e. return TheTypes[TheLoop] instead). Yup, that and, for some reason ([rolleyes]) my BaseType wasn't showing up on the GetInterfaces. So I changed it to if (TheTypes[TheLoop].BaseType.Equals(typeof(T))) and subsequently removed the second loop. Quote:Original post by CodekaIf a simple Activator.CreateInstance isn't enough, you can create a new type (say, cFrostDirectXFactor which does have a simple constructor, and implements a special IRendererFactory interface, you can then call IRendererFactory.CreateInstance() on that type instead. An IRendererFactory would just make it less of a hassle to invoke constructors that have a known set of parameters.. for constructors with an unknown set of... wait where am I going with this... .... I think the problem is solved. Thanks! Quote:Original post by CodekaQuote:Original post by Thevenin Also, how to fix this.... (cFrostForm.eRenderer)Enum.Parse(typeof(cFrostForm.eRenderer), TheRendererString)You won't be able to fix that and still be able obfuscate the enumeration. You could have a simple dictionary that maps the names to the enumeration values, but there's two problems: k
  9. Quote:Original post by Codeka If construction of your type is more complicated than a simple constructor, you can create a factory type, which you can construct via Activator.CreateInstance and then use that factory to create an instance of the type. How? lol Edit: Also, how to fix this.... (cFrostForm.eRenderer)Enum.Parse(typeof(cFrostForm.eRenderer), TheRendererString) "a,aa,a1" won't match the strings "DirectX, OpenGL, GDI", lol... [Edited by - Thevenin on August 3, 2009 7:23:15 PM]
  10. Yah, I wrote this just now... using System; using System.Reflection; namespace FrostCommon { public static class cAssemblyLoader <T> { public static Type sTypeFromDLL(string TheURL) { Assembly TheAssembly = Assembly.LoadFile(TheURL); Type[] TheTypes = TheAssembly.GetTypes(); for(int TheLoop=0;TheLoop<TheTypes.Length;TheLoop++) { Type[] TheInterfaces = TheTypes[TheLoop].GetInterfaces(); for(int TheInterface=0;TheInterface<TheInterfaces.Length;TheInterface++) if(TheInterfaces[TheInterface] == typeof(T)) return TheInterfaces[TheInterface]; } throw new Exception("The specified base type was not found in the DLL " + TheURL + "."); } public static T sInstanceFromDLL(string TheURL) { return (T)Activator.CreateInstance(sTypeFromDLL(TheURL)); } } } This code allows me to simply write... cRendererControl TheReturn; TheReturn = cAssemblyLoader<cFrostForm.cRendererControl>.sInstanceFromDLL( AppDomain.CurrentDomain.BaseDirectory + "FrostDirectX.dll"); and since it relies on a type comparison instead of a string match, the obfuscation tool should be able to detect that the two types should match after obfuscation. However, some of my DLLs have complicated constructors though, and the code above is only going to handle classes with no parameters. I've written (in the past) code to activate classes with parameters in their constructors, but it's not compatible with obfuscation; it assumes the order of types. [Edited by - Thevenin on August 3, 2009 7:16:49 PM]
  11. It's obfuscating public methods, public variables, public class names. It even renamed my public Enums so that if I have an Enum like this.. public enum eRenderers { OpenGL, DirectX, GDI }; and later in my code I have something like this... public eRenderers MyRenderingMode = eRenderers.DirectX; MyTextRasterer.sRenderString(MyRenderingMode .ToString)); .. the output to the screen will be "a". Also, for reasons I'm not going to get into, omitting the renaming of certain types is out of the question. It's either all or none. The obfuscation tool is just the DotNet Obfuscator Community Editino. It looks like this line of code: if(TheTypes[TheLoop]. == typeof(cFrostForm.cRendererControl) won't be able to match "cFrostDirectX:cRendererControl" with "cRendererControl" I might need to use the Type.GetInterfaces() and loop through the type array it returns:
  12. Because I'm running some obfuscation tools, I cannot assume the name or order of types in the assembly I'm loading. The simplest example of this is my rendering code, I have an abstract class "cRendererControl" that both cFrostDirectX and cFrostOpenGL interface in their respective dll files. When I load cFrostDirectX, I call a cRendererControl TheReturn; TheReturn = (cRendererControl)Assembly.LoadFile(AppDomain.CurrentDomain.BaseDirectory + "FrostDirectX.dll").CreateInstance("cFrostDirectX"); which obviously fails due to assumption that the class is called cFrostDirectX. I'm currently considering a solution where as, I get the types from the loaded assembly, and check to see if they are of the type cRendererControl. Type[] TheTypes = TheAssembly.GetTypes(); for(int TheLoop=0;TheLoop<TheTypes.Length;TheLoop++) if(TheTypes[TheLoop] == typeof(cFrostForm.cRendererControl) Once I've found one of that type, I'll invoke a function similar to this, from the abstract class: public abstract static cRendererControl sGetInstance() Unfortunently, static methods cannot be marked abstract, so I'm stuck. [Edited by - Thevenin on August 3, 2009 8:30:21 PM]
  13. Unfortuently SQL Server CE doesn't run on Linux or Mac OS X. Although I use SQL Server on the server end for various segments of the project, this particular code runs on both ends (server & client). I'm currently pursuing my backup solution (because I doubt I'll find a library that does what was described), and it's leading to some mind boggling data-structures. Just initializing some of this stuff is confusing... Dictionary<int, List<cMapPacket.cTileEntry>>[] TheDict;"It's an array, of hashes, containing lists.."
  14. Sounds like what I should be using then. Only problem left is.. does anyone know a C# library for one that'll stream to and from a file.
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!