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

Adsense

Sunday, April 30, 2006

Opening URL from within the C# program

Use this function to retrieve path of default browser

/// <summary>

/// Reads path of default browser from registry

/// </summary>

/// <returns></returns>

private static string GetDefaultBrowserPath()

{

string key = @"htmlfile\shell\open\command";

RegistryKey registryKey =

Registry.ClassesRoot.OpenSubKey(key, false);

// get default browser path

return ((string) registryKey.GetValue(null, null)).Split('"')[1];

}

Opens URL in default browser from within the C# program.

string defaultBrowserPath = GetDefaultBrowserPath();


try

{

// launch default browser

Process.Start(defaultBrowserPath, "http://www.yahoo.com");

}

catch (Exception exp)

{

MessageBox.Show(exp.Message);

}



Opens URL in separate instance of default browser from within the C# program.

// open URL in separate instance of default browser

Process p = new Process();

p.StartInfo.FileName = GetDefaultBrowserPath();

p.StartInfo.Arguments = "http://www.yahoo.com";

p.Start();

Technorati : , , , , , ,

Thursday, April 27, 2006

Zoundry Blog Writer

The Zoundry Blog Writer is a blog editor that makes editing and manging your posts across your blogs simpler and faster.It's as easy to use as a word processor, also it contains smart tools to add links, tags, photos, music and video files, and many more.I've summarized some of the coolest features of Zoundry Blog Writer.


Features

  1. Drag and drop support for pictures, image tags, links, and text from your computer and the Web
  2. Automatically integrate product search
  3. Integrated Tagging for IceRocket, Technorati, Flikr etc.
  4. Create links to Google, Technorati, etc.
  5. Template based preview
  6. Spellcheck
  7. Support for BlogThis via browser toolbar plug-in
  8. Open and edit existing html file on your computer
  9. Save post as a file to your computer
  10. Automatic thumbnailing of pictures
  11. Picture style settings - change border, dimensions, margins, alignment easily.
  12. Automatically create podcast enclosures when you drag and drop MP3 files
  13. Media repository that uploads pictures and podcast files
  14. Upload pictures using FTP


Download Zoundry Blog Writer



Tuesday, April 25, 2006

Convert .Net Type to SqlDbType or DbType and vise versa

This class can be useful when you make conversion between types .The class supports conversion between .Net Type , SqlDbType and DbType .


using System;

using System.Collections;

using System.Data;


namespace Devintelligence.Common.Data

{

/// <summary>

/// Convert a base data type to another base data type

/// </summary>

public sealed class TypeConvertor

{


private struct DbTypeMapEntry

{

public Type Type;

public DbType DbType;

public SqlDbType SqlDbType;

public DbTypeMapEntry( Type type, DbType dbType, SqlDbType sqlDbType )

{

this.Type = type;

this.DbType = dbType;

this.SqlDbType = sqlDbType;

}


};


private static ArrayList _DbTypeList = new ArrayList();




#region Constructors


static TypeConvertor()

{

DbTypeMapEntry dbTypeMapEntry

= new DbTypeMapEntry(typeof(bool), DbType.Boolean , SqlDbType.Bit);

_DbTypeList.Add( dbTypeMapEntry );


dbTypeMapEntry

= new DbTypeMapEntry(typeof(byte), DbType.Double , SqlDbType.TinyInt);

_DbTypeList.Add( dbTypeMapEntry );


dbTypeMapEntry

= new DbTypeMapEntry(typeof(byte[]), DbType.Binary , SqlDbType.Image);

_DbTypeList.Add( dbTypeMapEntry );


dbTypeMapEntry

= new DbTypeMapEntry(typeof(DateTime), DbType.DateTime , SqlDbType.DateTime);

_DbTypeList.Add( dbTypeMapEntry );


dbTypeMapEntry

= new DbTypeMapEntry(typeof(Decimal), DbType.Decimal , SqlDbType.Decimal);

_DbTypeList.Add( dbTypeMapEntry );


dbTypeMapEntry

= new DbTypeMapEntry(typeof(double), DbType.Double , SqlDbType.Float);

_DbTypeList.Add( dbTypeMapEntry );


dbTypeMapEntry

= new DbTypeMapEntry(typeof(Guid), DbType.Guid , SqlDbType.UniqueIdentifier);

_DbTypeList.Add( dbTypeMapEntry );


dbTypeMapEntry

= new DbTypeMapEntry(typeof(Int16), DbType.Int16 , SqlDbType.SmallInt);

_DbTypeList.Add( dbTypeMapEntry );


dbTypeMapEntry

= new DbTypeMapEntry(typeof(Int32), DbType.Int32 , SqlDbType.Int);

_DbTypeList.Add( dbTypeMapEntry );


dbTypeMapEntry

= new DbTypeMapEntry(typeof(Int64), DbType.Int64 , SqlDbType.BigInt);

_DbTypeList.Add( dbTypeMapEntry );


dbTypeMapEntry

= new DbTypeMapEntry(typeof(object), DbType.Object , SqlDbType.Variant);

_DbTypeList.Add( dbTypeMapEntry );


dbTypeMapEntry

= new DbTypeMapEntry(typeof(string), DbType.String , SqlDbType.VarChar);

_DbTypeList.Add( dbTypeMapEntry );



}



private TypeConvertor()

{



}


#endregion




#region Methods


/// <summary>

/// Convert db type to .Net data type

/// </summary>

/// <param name="dbType"></param>

/// <returns></returns>

public static Type ToNetType(DbType dbType)

{

DbTypeMapEntry entry = Find( dbType );

return entry.Type;

}



/// <summary>

/// Convert TSQL type to .Net data type

/// </summary>

/// <param name="sqlDbType"></param>

/// <returns></returns>

public static Type ToNetType(SqlDbType sqlDbType)

{

DbTypeMapEntry entry = Find( sqlDbType );

return entry.Type;

}


/// <summary>

/// Convert .Net type to Db type

/// </summary>

/// <param name="type"></param>

/// <returns></returns>

public static DbType ToDbType( Type type )

{

DbTypeMapEntry entry = Find( type );

return entry.DbType;

}


/// <summary>

/// Convert TSQL data type to DbType

/// </summary>

/// <param name="sqlDbType"></param>

/// <returns></returns>

public static DbType ToDbType( SqlDbType sqlDbType )

{

DbTypeMapEntry entry = Find( sqlDbType );

return entry.DbType;

}



/// <summary>

/// Convert .Net type to TSQL data type

/// </summary>

/// <param name="type"></param>

/// <returns></returns>

public static SqlDbType ToSqlDbType( Type type )

{

DbTypeMapEntry entry = Find( type );

return entry.SqlDbType;

}



/// <summary>

/// Convert DbType type to TSQL data type

/// </summary>

/// <param name="dbType"></param>

/// <returns></returns>

public static SqlDbType ToSqlDbType( DbType dbType )

{

DbTypeMapEntry entry = Find( dbType );

return entry.SqlDbType;

}



private static DbTypeMapEntry Find( Type type )

{

object retObj = null;

for( int i=0; i<_DbTypeList.Count; i++ )

{

DbTypeMapEntry entry = (DbTypeMapEntry)_DbTypeList[i];

if( entry.Type == type )

{

retObj = entry;

break;

}

}

if(retObj==null)

{

throw

new ApplicationException("Referenced an unsupported Type");

}


return (DbTypeMapEntry)retObj;

}


private static DbTypeMapEntry Find( DbType dbType )

{

object retObj = null;

for( int i=0; i<_DbTypeList.Count; i++ )

{

DbTypeMapEntry entry = (DbTypeMapEntry)_DbTypeList[i];

if( entry.DbType == dbType )

{

retObj = entry;

break;

}

}

if(retObj==null)

{

throw

new ApplicationException("Referenced an unsupported DbType");

}


return (DbTypeMapEntry)retObj;

}

private static DbTypeMapEntry Find( SqlDbType sqlDbType )

{

object retObj = null;

for( int i=0; i<_DbTypeList.Count; i++ )

{

DbTypeMapEntry entry = (DbTypeMapEntry)_DbTypeList[i];

if( entry.SqlDbType == sqlDbType )

{

retObj = entry;

break;

}

}

if(retObj==null)

{

throw

new ApplicationException("Referenced an unsupported SqlDbType");

}


return (DbTypeMapEntry)retObj;

}


#endregion

}

}

Technorati : , , , ,

Sunday, April 23, 2006

Google Sitemap Generator

Introduction

A simple and easy to use Sitemap Generator tool to help you make Google sitemaps.

Current feature list

The following features are currently included in Sitemap Generator:

  • Crawl website based on known URL
  • Edit the list of collected URLs Edit priority and frequency data per URL
  • Only working URLs are automatically included in the listing
  • Automatically create sitemap files
  • Automatically gzip sitemap files
  • Automatically upload sitemap files by FTP

Screen shots

Download Google Sitemap Generator

Technorati : , , , ,

Log4Net Viewer 0.7

Introduction

Log4Net Viewer is a GUI log viewer and filter for the Log4Net library. By default it listens for LoggingEvent objects sent using the UdpAppender and displays them in a table.

The events can be filtered based on:

  • Level
  • Logger
  • Message

All the details for each event can be displayed by selecting the event in the table.


Screen shot


Download Log4Net Viewer 0.7


The universal freeware editor - PSPad

PSPad editor

The universal freeware editor is for you if you need to:

  • work with plain text - the editor has a wealth of formatting functions, including a spell checker
  • create web pages - as web authoring editor, PSPad contains many unique tools to save your time
  • use a good IDE for your compiler - editor PSPad catch and parse compiler output, integrate external help files, compare versions, and much more...

mainfull.png mainmini.png

PSPad Features:

  • work with projects
  • work on several documents at the same time (MDI)
  • Save desktop session to later reopen all open files
  • FTP client - you can edit files directly from the web
  • macro recorder to record, save and load macros
  • search and replace in files
  • text difference with color-coded differences highlighted
  • templates (HTML tags, scripts, code templates...)
  • installation contains templates for HTML, PHP, Pascal, JScript, VBScript, MySQL, MS-Dos, Perl,...
  • syntax highlighting auto set by file type
  • user-defined highlighters for exotic environments
  • auto correction
  • intelligent internal HTML preview using IE and Mozilla
  • full HEX editor
  • call external programs, different for each environment
  • external compiler with catch command output, log window, log parser for each environment for "IDE" effect
  • color syntax highlight printing and print preview
  • integrated TiDy library for formatting and checking HTML code, conversion to CSS, XML, XHTML
  • integrated free version of top CSS editor TopStyle Lite
  • export with highlight to RTF, HTML, TeX format into file or clipboard
  • column block select, bookmarks, line numbers, ...
  • reformat and compress HTML code, tags char case change
  • line sorting with ability to sort on defined column, with option to drop duplicates
  • ASCII chart with HTML entities
  • Code explorer for Pascal, INI, HTML, XML, PHP, and more in future
  • spell checker
  • internal web browser with APACHE support
  • matching bracket highlighting

  • Download PSPad editor

Technorati : , , , ,