I need to do it programmatically.
Werdna
Posts
-
install windows fonts -
install windows fontsDoes anyone know any API to install fonts to windows folder? On XP I used to just copy those to windows/fonts folder, but it does not work on vista. There is windows API AddFontResource, but it only installs font until user reboots computer. Thanks.
-
Monitor SOAP body for webservicesNone of the above answers will work for me. I found out that I can use SoapExtension to get the data I need. Just in case someone ever has the same question.
-
Monitor SOAP body for webservicesI'm connecting to a webservice over https and I need to see the xml that is being sent and returned. VS generated all the code to connect thru wsdl, and I'm not sure how to see what is transmitted. Is it somehow possible? Lookat at http traffic won't work, as data is sent on https port. Thanks.
-
StructLayoutAttribute and type safetyI see this as possible problem. Imagine having [StructLayout(LayoutKind.Explicit)] struct MyStruct { [FieldOffset(0)] public int i; [FieldOffset(0)] public byte[] o; } now if you set: x.i = 0x4899; then you'd be able to access data from any address. I don't know if peverify can check those.
-
font scriptYou can use FontDialog FontDialog dlg = new FontDialog(); if (dlg.ShowDialog()==DialogResult.OK) { selectedFont = dlg.Font; }
-
Can I get the original string from a HashCode?It's totally not possible. The hashing function is always one way. Since int can only have about 2.2B possible values, there is way more than 2.2B possible string combinations.
-
handling Stack overflow ExceptionUnfortunatelly as of .net 2 you cannot catch this exception. Here is the info from .net docs: In prior versions of the .NET Framework, your application could catch a StackOverflowException object (for example, to recover from unbounded recursion). However, that practice is currently discouraged because significant additional code is required to reliably catch a stack overflow exception and continue program execution. Starting with the .NET Framework version 2.0, a StackOverflowException object cannot be caught by a try-catch block and the corresponding process is terminated by default. Consequently, users are advised to write their code to detect and prevent a stack overflow. For example, if your application depends on recursion use a counter or a state condition to terminate the recursive loop.
-
Compact paths?If you're drawing your text using GDI+, you can use StringFormat class and set Trimming to EllipsisCharacter. If you need it in a control, you can easily create custom control that does all the drawing and uses appropriate Trimming flag.
-
Rotating image in C#An easy way to draw rotated image is to use transformations: Graphics g = ...; g.RotateTransform(angle); g.DrawImage(...) if you want to rotate around any point, you can use matrix. Matrix m = new Matrix(); m.RotateAt(angle, new PointF(x, y)); g.Transform = m; g.DrawImage(...);
-
Need Help for a parserYou might be better off using parser generator tool http://www.antlr.org is a good one. You can look at couple of my examples: http://www.codeproject.com/csharp/stringtokenizer.asp[^] or have a look at http://www.adersoftware.com/index.cfm?page=templateEngine2[^] (library with easy to use hand coded lexer/parser) or http://www.adersoftware.com/index.cfm?page=compilers[^]
-
Graphics.MeasureString - string with space at the end problem.Make sure you pass StringFormat with MeasureTrainingSpaces: StringFormat format = new StringFormat(StringFormatFlags.MeasureTrailingSpaces); g.MeasureString(..., format);
-
Read large text files with c#I have created a simple program that does something similar. It will read a file in chunks using a reader and provides forward only navigation. If you send me an email I can send you the source code (C# vs2005) andrew at pmall dot com
-
DB Server RecommendationI need to upgrade our db server and was wondering if anyone had any experience with opteron based processors. I want to use HP ProLiant DL385 with 2 AMD Opteron 280 processors (Raid 5 and 8GB Ram) I want to use 64bit version of windows and sql server 2005. (System price around $15,000) How would this compare to comparable Xeon processor based configuration?
-
Server recommendationI need to upgrade our db server and was wondering if anyone had any experience with opteron based processors. I want to use HP ProLiant DL385 with 2 AMD Opteron 280 processors (Raid 5 and 8GB Ram) I want to use 64bit version of windows and sql server 2005. (System price around $15,000) How would this compare to comparable Xeon processor based configuration?
-
ListView ControlYou can use BeforeLabelEdit event private void ListView1_BeforeLabelEdit(object sender, System.Windows.Forms.LabelEditEventArgs e) { if (e.Item == 7) { e.CancelEdit = true; } }
-
Error handling - which is preferrable?Or in case of IO operation it would be better to do: catch (IOException ex) { .. io error occured. PathTooLongException and all other IO related inherit from IOException } catch (Exception ex) { .. all other unexpected errors }
-
to trigger some actions after form load.Or if you're using .net 2 myForm.Shown += formStartup; void formStartup(object sender, EventArgs e) { }
-
Libraries of functionsYou can't do that in C# In latest java (1.5) you can do static import and in C# 2.0 you can have static class that will force you to have only static members and can't instentiate that class. One possible (but not recommended) solution would be to have class rog { ... static methods here... } class myclass : rog { ... now you can call methods of rog without rog. }
-
how do I read a files' or assemblys' metadata (date modified, assembly version, etc.)I'm not sure if it will give you all the info you need, but you can do: Assembly asm = Assembly.Load(filename); then use properties/methods of asm: asm.GetName().Version You can also get attributes of an assembly by using GetCustomAttributes(typeof(AssemblyTitleAttribute), true)