.net

How to Create Subset Fonts in .NET?

I have a Silverlight application that I need to embed some less-than-common fonts in. It's simple enough for me to just copy over the TTF/OTF and compile that with my app. However, in many cases, only like 5-10 of the characters are actually used. In other cases, some font files are incredibly large (Arial Unicode MS Regular is 22.1 MB, ...

Convert a .fntdata file into a .ttf

Is anyone familar with the .fntdata structure of an embedded font? This is used in PowerPoint 2007/2010 when embedding a font into a presentation (it is unlike .odttf that is used in Word 2007/Word 2010). Basically, I just want to convert this to a .ttf or .odttf file so it can be read by WPF/Silverlight applcations. One page of the sta...

application tune up

My next task is tune-up our C# application to minimise the memory usage, reduce threads used and improve performance. There will be a small status message received by our application every 100ms. The application will process these status message. Then a 2M data will be received by our application. That day will be processed and 4 more ...

ASP .NET MVC ViewModel object is not preserved

I am sort of new to MVC so pardon my ignorance. I am using IoC ( StructureMap ) and I have a need to pass in an instance of what I consider to be a set of Controls to each view, so I have created ViewModels in order to accomodate this. The view model is populated with an instance of the Controls and the View is then rendered. When a u...

Calculating Number of Months between 2 dates

I have the following VB.NET Code: Dim Date1 As New DateTime(2010,5,6) Dim Date2 As New DateTime(2009,10,12) Dim NumOfMonths = 0 ' This is where I am stumped What I am trying to do is find out how many months are between the 2 dates. Any help would be appreciated. ...

How .NET overrides non-virtual method in .NET Remoting?

Consider following piece of code: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace RemotingNonVirtualCall { class Program { static void Main(string[] args) { var domain = AppDomain.CreateDomain("Second Domain"); A extA = (A)domain.CreateInst...

Switching the "Files of type" pull-down in .NET OpenFileDialog clears the list of files bug.

I'm trying to use the .NET class OpenFileDialog in C++ and getting a weird bug. My basic code is below. OpenFileDialog^ openFileDialog = gcnew OpenFileDialog; openFileDialog->InitialDirectory = "c:\\"; openFileDialog->Filter = "Bitmap|*.bmp|All Files|*.*"; openFileDialog->FilterIndex = 1; openFileDialog->RestoreDirectory = true; if (ope...

allow user to download dynamic csv file asp.net

I want to allow my user to click on a button that says "download" and then will build a dynamic csv file on the fly and will prompt the user to download. I know how to build the file using a HTTPHandler, but not quite sure the mechanism for delivering the content via download. ...

interprocess communication with and without .net

I'm developing a .net WPF application, and I would like to put in a two way IPC mechanism. I realize named pipes and remoting are options, however I would like to make the mechanism not dependent on .NET for non-.NET applications to communicate with my application. What does SO recommend as a solution to this? WM_COPYDATA? ...

Manage project meta-data with JIRA?

Perhaps I'm missing this functionality out of the box, but I can't seem to find it. So I'm looking for a JIRA plugin that would allow for adding notes attached directly to the project summary page. This would be for keeping track of odds and ends about a project that are important to document, but don't fit as bugs, code comments, spec ...

WebClient, what does UploadString do?

What does WebClient.UploadString do? I thought it post so i can login with it. When i used wc.UploadString(@"http://mysite.com/login", "user=u&pass=p"); i thought i would get the html of the front page with me logged in. However all i got was no warning that my pass was incorrect and my method=post note at the bottom. What does WebClie...

Caching approaches for singular database records.

Consider the following data model: Suppose I have a table called "SuperAwesomeData" where each record maps to an instance of an object called "SuperAwesomeData" which is retrieved by using the primary key for table "SuperAwesomeData". My question is what caching strategy would best work for managing individual records? I need to still...

How to control prefixes of namespaces in XML document generated by XmlWriter - generated XAML with x:Type markup extension

I am trying to generate XAML from XElements. <Style xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"&gt; <Style.BasedOn> <StaticResource> <StaticResource.ResourceKey> <Type xmlns="http://schemas.microsoft.com/winfx/2006/xaml"&gt; <Type.TypeName>p:Window</Type.TypeName> </Type> ...

Updating config file and updating the values in application

I am currently updating a few settings in a rather large *.exe.config file via the *.exe executable by using XLinq to navigate the directories and read / write the values. The problem with updating this way is that changes only take effect after restarting the executable, but I would like the changes to take effect instantaneously. Is th...

Parse log files programmatically in .NET

We have a large number (read: 50,000) of relatively small (read under 500K, typically under 50K) log files created using log4net from our client application. A typical log looks like: Start Painless log Framework:8.1.7.0 Application:8.1.7.0 2010-05-05 19:26:07,678 [Login ] INFO Application.App.OnShowLoginMessage(194) - Validating Crede...

XmlSerializer and nullable attributes

I have a class with numerous Nullable<T> properties which I want to be serializable to XML as attributes. This is apparently a no-no as they are considered 'complex types'. So, instead I implement the *Specified pattern, where I create an addition *Value and *Specified property as follows: [XmlIgnore] public int? Age { get { return...

Why is there OrderBy and OrderByDescending but not OrderBy(SortOrder)?

Currently if we get direction of ordering as an external dependency we have to use if to apply this direction: public static IEnumerable<FileInfo> getlist(string directory, string searchPattern, string order) { var files = new DirectoryInfo(directory).EnumerateFiles(searchPattern); if (order == "A") return files.OrderBy...

Common handler for all right clicks

I would like to create one common handler of all right clicks (or possibly some other unique behavior like middle button click, etc.) happening in my application. They would invoke the same action, e.g. fire up dialog to customize control that was clicked or display help dialog for it. Is there a mechanism, which would allow me to inter...

How to Set this Kind of Perspective Transform in Matrix3D?

I have an image with and have a few values to make it a perspective in Silverlight, but can't quite figure out what I need to do mathmatically to make it happen. The most important thing is I have an angle called a "Field of View" (FOV). This is the normal picture: For example: X = 30° X = 30° X = 30° ...

After packaging with mkbundle2, the destination machine is complaining about libmono.so. Why?

I thought the purpose of mkbundle2 was to allow a machine without mono installed to run a mono application. But it does not seem to be packaging libmono.so. I am not sure if it is supposed to or not, but the destination machine is complaining that it can't find libmono.so.0 when I run the bundle. Why would it be looking for that file?...