The blog has moved to a new address. The blog is now located at http://devintelligence.com

Adsense

Monday, August 28, 2006

SyntaxColor4Writer

SyntaxColor4Writer is a plugin for Windows Live Writer that enables you to embed syntax highlighting in your blog posts. This plugin uses an excellent component called Code Highlighter . The following syntax languages are included and can be customized and extended:

  • C#
  • CSS
  • HTML
  • INI File
  • Java
  • JScript  
  • Perl
  • PHP
  • Python
  • SQL
  • VB.NET
  • VBScript
  • XML

Download & Installation

 

 

Technorati Tags: 
 
 
 

Monday, August 21, 2006

Monopix-Live CD Linux distribution

 

Monoppix is a Live CD Linux distribution (based on Knoppix), which means you pop it in your CD drive, reboot, and you're running Linux. It works without installing a thing on your hard drive - it runs completely off the CD and RAM.

What's on the CD?

- Mono runtime environment, complier and class libraries
- Monodevelop - Mono enabled IDE
- XSP - ASP.NET web server
- GTK# - for desktop applications (sample included)
- MySQL database server
- Quickstarts and Mono walkthroughs and tutorials,

How to get started?

- Download the latest ISO.
- Burn the ISO to a bootable CD.
- Reboot your computer with the mono CD and CDRom boot enabled in your bios.

Saturday, August 12, 2006

How can I make the SplitContainer continuously update its contents while the splitter is moving?


Note: Continuously updating a SplitContainer's contents can lead to poor performance, and should be used sparingly.
By default, when moving a SplitContainer's splitter a preview is shown of the splitter's future location. Then when the splitter is released, the SplitContainer resizes to that position. If you want the SplitContainer to be constantly resizing as the splitter is moving, you can do one of two things:


Insert the following code in your project, and attach these events to all of the SplitContainers that you want to continuously update.


private void splitContainer_MouseDown(object sender, MouseEventArgs e)
{
// This disables the normal move behavior
((SplitContainer)sender).IsSplitterFixed = true;
}


private void splitContainer_MouseUp(object sender, MouseEventArgs e)
{
// This allows the splitter to be moved normally again
((SplitContainer)sender).IsSplitterFixed = false;
}


private void splitContainer_MouseMove(object sender, MouseEventArgs e)
{
// Check to make sure the splitter won't be updated by the
// normal move behavior also
if (((SplitContainer)sender).IsSplitterFixed)
{
// Make sure that the button used to move the splitter
// is the left mouse button
if (e.Button.Equals(MouseButtons.Left))
{
// Checks to see if the splitter is aligned Vertically
if (((SplitContainer)sender).Orientation.Equals(Orientation.Vertical))
{
// Only move the splitter if the mouse is within
// the appropriate bounds
if (e.X > 0 && e.X < ((SplitContainer)sender).Width)
{
// Move the splitter
((SplitContainer)sender).SplitterDistance = e.X;
}
}
// If it isn't aligned vertically then it must be
// horizontal
else
{
// Only move the splitter if the mouse is within
// the appropriate bounds
if (e.Y > 0 && e.Y < ((SplitContainer)sender).Height)
{
// Move the splitter
((SplitContainer)sender).SplitterDistance = e.Y;
}
}
}
// If a button other than left is pressed or no button
// at all
else
{
// This allows the splitter to be moved normally again
((SplitContainer)sender).IsSplitterFixed = false;
}
}
}




Technorati : , , ,

Friday, August 11, 2006

Why are user scoped settings present in the app.config?


The configuration system is hierarchical and has the following ordering:

Machine à Application à Roaming User à Local User


When you query a configuration section at any level, you get a merged view of the sections declared in that level and those below it (with machine being the lowest level and local user the highest). The section handler defines how the merge happens and for settings, a setting value specified in, say, local user config trumps the one specified in application config.


So for user scoped settings, you can think of the values specified in app.config to be install time defaults. When the settings are saved into user.config, those values will override these defaults. This way admins have the option of changing the defaults. Note that the defaults can also be specified by means of a DefaultSettingValueAttribute. The provider will use this value if no value is specified for a setting in any level of config.






Technorati : ,

How are my strongly typed properties serialized as settings?


There are two primary mechanisms that ApplicationSettingsBase uses to serialize settings:



  1. If a TypeConverter exists that can convert to and from string, it is used.

  2. Otherwise, the XmlSerializer is used.

Are there multiple config files for an application or just one?


The default SettingsProvider for client applications (called the LocalFileSettingsProvider) stores settings in the application configuration files. In .NET v1 and v1.1, there were two levels of config files - machine.config and app.exe.config (where 'app.exe' is the name of the application). In v2.0, we have added two more levels of configuration to store user specific data - one that goes in the roaming user profile path and another in the local user profile path. On XP, the profile directories would be something like 'c:\Documents and Settings\<username>\Application Data' and 'c:\Documents and Settings\<username>\Local Settings\Application Data' respectively. These directories are the recommended location (per Windows Logo requirements) for storing user specific information, and most applications (like Outlook and Visual Studio) put user data somewhere under here.




Technorati : , ,

How do I know when to call Upgrade in a non-Clickonce app?


In non-Clickonce cases, there is no automatic upgrade - you have to call Upgrade yourself. Here is one idea for determining when to call Upgrade:
Have a boolean setting called CallUpgrade with a default value of true. When your app starts up, do the following:


if (Properties.Settings.Value.CallUpgrade)
{
Properties.Settings.Value.Upgrade();
Properties.Settings.Value.CallUpgrade = false;
}
This will ensure that Upgrade( ) is called only the first time the application runs after a new version is deployed.




Technorati : , , ,

How do I know when to call Upgrade in a Clickonce app?


In Clickonce, when you install a new version of your application, ApplicationSettingsBase will detect it and automatically upgrade settings for you at the point settings are loaded.




Technorati : , , ,

If I deploy a new version of my application, will the user lose all the settings saved by the previous version?


It is easy to upgrade settings from a previous version of the application to the latest. Simply call ApplicationSettingsBase.Upgrade() and it will retrieve settings from the previous version that match the current version of the class and store them out in the current version's user.config file. You also have the option of overriding this behavior either in your settings class or in your provider implementation.




Technorati : , ,

Where is the user.config file located if I deployed my application using Clickonce?


The path algorithm mentioned above is not used in the Clickonce case. Instead, the local user.config file goes in the Clickonce Data directory (the <Version> part of the path will still be included). There is no roaming user.config file for Clickonce applications.




Technorati : , ,