Mono on Shared Hosting at DreamHost through FastCGI

Mono @ DreamHostIt is technically possible to run a website on Mono (the open-source .NET development framework) using the Shared Hosting servers at DreamHost. The technique makes use of the pre-installed FastCGI module that is available on DreamHost’s Apache web servers, which is then configured to dynamically start the Mono FastCGI Backend. Just like for any other dynamic FastCGI server (such as for PHP FastCGI), the FastCGI module of Apache would monitor and manage the Mono FastCGI persistent processes and start/stop them as needed, in line with DreamHost’s configured FastCGI policy. The Mono FastCGI Backend is distributed as part of Mono’s XSP package, which needs to be built and installed along with all the other supporting Mono binaries. This procedure is detailed below, and an example Apache configuration is also provided for a basic Mono web-application that contains some standard ASP.NET pages (.aspx files) and a Web Service (.asmx file). With that in place, you can explore the rest of what Mono has to offer on a shared web server.

Pixel Boundaries for NTPCkr of SETI@home

Example usage of HEALPix pixel boundaries using Google Sky Maps with NTPCkr.The Near-Time Persistency Checker (NTPCkr) recently went online, which allows SETI@home to publish an up-to-date list of their best candidates for persistent extraterrestrial signals. The dynamic NTPCkr top-10 list also contains a “skyplot” link for each candidate, which shows a picture of the candidate’s location on the sky using a Google Sky Map with a custom crosshair marker indicating the center of the pixel region where the signals were detected. As pointed out by Jon Golding (in this forum comment), the NTPCkr should “perhaps show the region of interest on a skymap (i.e., not crosshairs)” to illustrate this more clearly. Joe Segur shared this sentiment, stating that “plotting would ideally show the boundaries of the pixels”. The equations needed for calculating these SETI@home pixel boundaries are given below, along with an example JavaScript implementation, making such an enhancement straightforward.

HEALPix: Errata and Additional Notes

HEALPix sphere with 4 divisions per side of each base-resolution pixelHEALPix is an interesting framework that can be used to store information about spherical surfaces in a digital format as pixels that have nice properties (hierarchical, equal-area and isolatitude), and it is used by NASA and SETI@home (among others). The detail of HEALPix is presented in a paper by Górski et al. (2005), which was published in The Astrophysical Journal and is titled “HEALPix: A Framework for High-Resolution Discretization and Fast Analysis of Data Distributed on the Sphere” (DOI:10.1086/427976). Despite being an excellent paper that is filled with mathematical info and descriptions, it seems like the authors ran out of steam as they got to Equation 18, since this equation apparently does not accurately reflect the general case for calculating the longitude index in the nested scheme of pixel indexing. The following describes a revised version of Equation 18, along with some additional comments. (Be sure to have a copy of the paper at hand — if you cannot download the original paper through the DOI link above, see the Harvard Astronomy Abstract Service for alternative links or visit arXiv:astro-ph/0409513.)

Logical Expressions (in Unicode) of Chinese Character Components

餜=飠+果 and 黽=蠅-虫The characters that are used for Chinese text can often be assembled from smaller components. Being familiar with these components can help with recognizing the characters and provide hints about their meaning or pronunciation. Although many, if not most, of modern Chinese characters have associated Unicode characters, many of the underlying components do not have a separate Unicode character to refer to them. However, being part of one or more composite Unicode character, these components can be defined in term of logical expressions involving the composite characters. For example, the component 刀 (which obviously do have a Unicode character, U+5200) can also be expressed as 刃-丶 (that is, U+5203 without the radical dot, U+4E36). Similarly one can write 扌=打-丁 and also 凵=[凶-㐅]/[㧄-扌], where the last example shows two alternatives to arrive at the desired component. The same can be done for components that do not have their own Unicode character, as illustrated below.

Reflect POCO Data as Key-Value Pairs using RouteValueDictionary

Although the developers of the RouteValueDictionary class (available since .NET Framework 3.5 SP1) may not have exactly envisioned the following general usage scenario for the class, it provides a convenient way to indirectly reflect over the properties of an object (such as a POCO entity) and extract the data as a basic key-value-set by simply calling one of the class constructors. The following C# console application illustrates how to use the constructor for this purpose and displays the key-value pairs of two examples as XML.

Create 3D WPF Models using XAML Exporter for Blender

3D model rendered from XAMLYou can create 3D meshes for XAML applications using Blender (which is free open-source 3D content creation software that can run on Windows, Linux, Mac OS X and other operating systems, currently at version 2.48a) combined with the XAML Exporter for Blender (a free open-source add-on script released separately under a slightly different license, currently at version 0.47, written by Daniel Lehenbauer and updated by Robert Hogue). For those who don’t know, Blender was used to create the free Big Buck Bunny movie. The following example shows the basics of what can be accomplished, starting with screenshots of the initial 3D model in Blender and the resulting WPF application using the exported data.

Removing Invalid Characters from Filenames

When you need to dynamically create names of files from text that might contain invalid characters, for example to generate user-friendly filenames that are based on free-form values entered by a user, you need to remove the invalid filename characters before you create the file and save the content (unless you prefer to get error messages during runtime). Such files can then be stored on disk or perhaps in a SharePoint document library. The following C# method may do the trick.

Vectorize Bitmaps to XAML using Potrace and Inkscape

Menu item in Inkscape for bitmap vectorization using PotraceTo create vector images from bitmap images can be useful, for example, if you already have a raster-based picture in a common graphics format (such as a PNG, JPG, BMP, GIF, TIF or ICO file) and want to convert it to a vector-based format (such as a XAML, SVG, EPS or EMF file) to perhaps use it in a Silverlight or WPF application or simply to enlarge the image without seeing individual pixels as large blocks. The process of such an image conversion is referred to as vectorization, and the free Inkscape application (which is “an Open Source vector graphics editor, with capabilities similar to Illustrator, CorelDraw, or Xara X” – currently at version 0.46) has built-in tracing functionality, and it supports all the file formats mentioned above and more (yes, including the Microsoft XAML format). To vectorize images, Inkscape uses Potrace by Peter Selinger. Potrace (currently at version 1.8) can also be used as a standalone command-line application or API to transform bitmaps into vector graphics.

Zune Local Time-Zone Wrong using XNA

Besides the leap-year issue that recently caused Zune 30 devices to freeze on New Year’s Eve, it appears that another clock-related issue affects all Zune devices. When developing an XNA application with Game Studio 3.0 for the Microsoft Zune, querying the DateTime.Now and TimeZone.CurrentTimeZone properties seems to always return the local time and time-zone for Pacific Standard Time, irrespective of the actual time-zone for which the device is configured.

Stopwatch for Silverlight

Silverlight 2 does not have an implementation of the .NET Framework’s Stopwatch class (from the System.Diagnostics namespace).  The Stopwatch class can be used for measuring time durations quite accurately, and it can be useful for basic performance profiling or as a simple timer mechanism.  However, this functionality is just not available to a Silverlight application, which is something that I needed, so I wrote an equivalent Stopwatch class in C# that can be used with Silverlight. [...]

Syndicate content