Monday, January 31, 2005

Repair MDAC setup

Follow these steps if you have problems with Microsoft Data Access Components (MDAC) : MDAC - Download and Repair-Page


Tags: ,

Friday, January 28, 2005

PDFizer Library (.NET)

About the PDFizer Library: "PDFizer is a simple XHTML to PDF converter; with this library, you can transform simple XHTML pages into nice and printable PDF files."

For Microsoft.NET / Mono.


Tags: , ,

Thursday, January 27, 2005

Programmers Notepad 2 Tips

Tips for the latest beta build of Programmers Notepad, by the developer Simon Steele.


Tags:

Programmers Notepad 2.0.5.48 Released

Programmers Notepad 2.0.5.48 Released. Looks good and is fast loading and stable. Very customisable (syntax schemes and ability to use other tools with it). When it is final (i.e. not beta as it is now) it should be even better.


Tags:

Wednesday, January 26, 2005

Answers.com - Online Dictionary, Encyclopedia and much more

Answers.com - Online Dictionary, Encyclopedia and much more. Very good site. You can even search by a persons name as well. Searches Wikipedia and has thesaurus and translation features.

Wired 13.02: The Firefox Explosion

Wired 13.02: The Firefox Explosion: "It's fast, secure, open source - and super popular. The hot new browser called Firefox is rocking the software world. (Watch your back, Bill Gates.)"

Friday, January 21, 2005

Semantic Markup (CSS, HTML)

Hixie's Natural Log: <div style="font-weight: bold">Lost cause</div>. Makes a good point. Why change from deeply nested <table> tags and liberal use of <font> tags to deeply nested <div> tags and inline css (the code, although taking up less disk space, is still untidy) when it is better to design pages semantically (i.e. the code is self descriptive and content truly is seperated from layout). It is easier to modify as well, and any kind of layout can be designed using CSS. So instead of:

<div id="leftfloat">
Menu here...
</div>
<div id="middle">
Contents here...
</div>

You do:

<div id="navmenu">
Menu here...
</div>
<div id="contents">
<a name="contents"></a>
Contents here...
</div>

That way if you decide the menu needs to float to the right, or be below the content then it makes more sense (you can also apply a style switcher to the site as well). Have added an anchor tag as well to contents. The anchor tag was added to allow the user to can skip to the contents by adding the following to the top of the page (above navmenu):

<div id="skipmenu"><a href="#contents">Skip Menu</a></div>

CSS for skipmenu (which hides the link from browsers that lack the proper CSS support)

#skipmenu {
	display: none;
}

Jeffrey Zeldman's site is a good example of semantic markup: http://www.zeldman.com/

It is much better to do this right the first time (i.e. when doing a new site, or redeveloping an old one), rather than try and fix an existing, poorly marked up site.

Thursday, January 20, 2005

Nofollow in Firefox

Nofollow in Firefox. Shows you how to highlight hyperlinks in web pages that will be not be followed by search engines (Google, Yahoo and MSN).

Wednesday, January 19, 2005

PostgreSQL 8.0

PostgreSQL 8.0 (open source database) is out. It runs natively on Windows, so performs much faster that the previous versions (which used Cygwin to emulate Linux and thus suffered a performance penalty). Highly scalable and enterprise ready as well as completely free (commercial support is available). How will it do against DB2, SQL Server and Oracle? Only time will tell. May bring down prices on these proprietary databases.

gemal.dk - Netscape Updates Browser Prototype

gemal.dk - Netscape Updates Browser Prototype. More screenshots of the new Firefox based Netscape browser. Based on version 1.0 rather than 0.9.3. I wonder if it will be popular when finally released? Perhaps if it offers corporate features that Firefox does not (like an MSI installer, ability to disable user from changing settings or installing extensions/themes).

Monday, January 17, 2005

FreePOPs

FreePOPs: "FreePOPs is an easily extensible program, which allows to have an access to the most varied resources through the POP3 protocol. Mainly, it can be used to download mail from the most famous webmails, but it could also be used as an aggregator for RSS feeds and many more. This way it is possible to get all your messages in your favourite email client."

Friday, January 14, 2005

Foxit PDF Reader

Foxit PDF Reader is an alternative to Adobe Reader. A much smaller download, so lacks some features that Adobe's offering has (which you may not need if all you want to do is read PDF's).

XML Menu UserControl (ASP.NET)

A UserControl for ASP.NET that displays a menu generated from an XML file. Very basic. If the XML file is missing (or not valid XML markup) nothing renders.

UserControl: menu.ascx

<%@ Control Language="C#" src="menu.ascx.cs" Inherits="Menu" %>
<asp:Repeater runat="server" id="rptMenu">
<HeaderTemplate>
<ul>
</HeaderTemplate>
<ItemTemplate>
	 <li><asp:HyperLink runat="server" Tooltip='<%# DataBinder.Eval(Container.DataItem, "Tooltip") %>' NavigateUrl='<%# DataBinder.Eval(Container.DataItem, "NavigateUrl") %>' Text='<%# DataBinder.Eval(Container.DataItem, "Text") %>' /></li>
</ItemTemplate>
<FooterTemplate>
</ul>
</FooterTemplate>
</asp:Repeater>

Code Behind: menu.ascx.cs

using System;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml;

public class Menu : UserControl
{

	#region Web Form Designer generated code
	override protected void OnInit(EventArgs e)
	{
		//
		// CODEGEN: This call is required by the ASP.NET Web Form Designer.
		//
		InitializeComponent();
		base.OnInit(e);
	}
	
	/// <summary>
	/// Required method for Designer support - do not modify
	/// the contents of this method with the code editor.
	/// </summary>
	private void InitializeComponent()
	{
		this.Load += new System.EventHandler(this.Page_Load);
	}
	#endregion
	
	// the xml file to load the data from
	public string XmlFile = "menu.xml";
	// data table for storing menu data
	protected DataTable MenuData;
	// menu repeater
	protected Repeater rptMenu;
	
	private void Page_Load(object sender, EventArgs e)
	{
		SetupDataTable();
		if (!Page.IsPostBack) {
			SetupMenu();
		}
	}
	// sets up the data table that is to be bound to the repeater
	private void SetupDataTable()
	{
		MenuData = new DataTable();
		MenuData.Columns.Add(new DataColumn("Text", System.Type.GetType("System.String")));
		MenuData.Columns.Add(new DataColumn("NavigateUrl", System.Type.GetType("System.String")));
		MenuData.Columns.Add(new DataColumn("Tooltip", System.Type.GetType("System.String")));
	}
	private void SetupMenu()
	{
		DataRow NewRow;
		XmlTextReader reader = null;
		try {
			reader = new XmlTextReader(MapPath(ResolveUrl(XmlFile)));
			// ignore whitespace
			reader.WhitespaceHandling = WhitespaceHandling.None;
			// move to first node
			reader.MoveToContent();
			// loop until there is nothing left to read and the end node hasn't been reached
			while (reader.Read()) {
				// if current node is not menu item, move to next node
				if(reader.Name != "MenuItem") continue;
				// if same as current page, move to next node
				if(SameAsCurrent(reader.GetAttribute("page"))) continue;
				NewRow = MenuData.NewRow();
				NewRow["Text"] = reader.GetAttribute("text");
				NewRow["NavigateUrl"] = reader.GetAttribute("page");
				NewRow["Tooltip"] = reader.GetAttribute("tooltip");
				MenuData.Rows.Add(NewRow);
			}
			// close reader
			reader.Close();
			// set datasource to populated data table and bind
			rptMenu.DataSource = MenuData;
			rptMenu.DataBind();
		} catch (System.Exception ex) {
			// close reader if error has occured
			if (reader != null) {
				reader.Close();
			}
			Trace.Write(ex.Source,ex.Message);
		}
	}
	// same as current page
	private bool SameAsCurrent(string page)
	{
		// use RawUrl to include query string when resolving, Path to exclude it
		return ResolveUrl(page)==ResolveUrl(HttpContext.Current.Request.Path);
	}
}

Menu Items: test.xml

<?xml version="1.0" encoding="utf-8"?>
<Menu>
	<MenuItem page="~/1.aspx" tooltip="Tooltip 1" text="Item 1" />
	<MenuItem page="~/2.aspx" tooltip="Tooltip 2" text="Item 2" />
	<MenuItem page="~/3.aspx" tooltip="Tooltip 3" text="Item 3" />
</Menu>

Test Page: menutest.aspx

<%@ Page Language="C#" %>
<%@ Register TagPrefix="Menu" TagName="Test" src="menu.ascx" %>
<script runat="server">
	private void DoPostBack(object sender, EventArgs e)
	{
		MyLabel.Text = "Posted back";
	}
</script>
<html>
<head>
<title>XML Menu</title>
</head>
<body>
<form runat="server">
<Menu:Test XmlFile="test.xml" runat="server" />
<asp:Button runat="server" OnClick="DoPostBack" Text="Button" />
<asp:Label id="MyLabel" runat="server" />
</form>
</body>
</html>

Wednesday, January 12, 2005

Add .NET Framework Folder to PATH via batch file

When compiling a .NET application you often use the command line tools csc or vbc to compile the code to a dll file. However, the path environment variable does not always contain it (if all you have done is install the framework, or use SharpDevelop). Here is a way to add the folder to the path via a batch file. It does not add it twice if you have already added it to the path (i.e. it checks the path before adding).

Don't run directly, rather place it somewhere that is already in the path (e.g. c:\windows\system32), and do Start > Run > cmd /k DotNetSetPath[1.0|1.1|2.0]

"DotNetSetPath 1.0" for v1.0 of the framework, "DotNetSetPath 1.1" for v1.1, "DotNetSetPath 2.0" or "DotNetSetPath" for v2.0

Update (13 Feb, 2006): .NET 2.0 is now an option

DotNetSetPath.cmd

@echo off
rem v1.0.3705 is .NET 1.0, v1.1.4322 is .NET 1.1, v2.0.50727 is .NET 2.0
if "%1"=="2.0" goto dotnet20
if "%1"=="1.1" goto dotnet11
if "%1"=="1.0" goto dotnet10
:dotnet20
set dotnetver=v2.0.50727
goto checkpath
:dotnet11
set dotnetver=v1.1.4322
goto checkpath
:dotnet10
set dotnetver=v1.0.3705
:checkpath
rem check if framework path has been set.
echo %path% | find /I "%windir%\Microsoft.NET\Framework\%dotnetver%" > nul
rem if not contained in path then set
if errorlevel 1 goto setpath
echo .NET %dotnetver% framework folder already in path
goto end
:setpath
set path=%windir%\Microsoft.NET\Framework\%dotnetver%;%path%
echo .NET %dotnetver% framework folder added to path
:end

For another useful batch file for working with .NET check out .NET Command Prompt


Tags: ,

Hendrix - mozilla.org Feedback System

A web tool for general feedback to Mozilla. Bugs should still go via bugzilla.

Formatting forms using CSS and definition lists

ASP.NET Resources has an article (CSS Challenge: Styling Definition Lists) on using CSS to format forms, using definition lists for the markup. Less code than using tables, and a lot tidier. A tweak was needed to get it to work with Internet Explorer. Opera seems to have an issue (but someone has posted a possible fix). Despite it primarily being an ASP.NET site, the code is only CSS and HTML, so will work with whatever language is used server-side and on static HTML pages).

Pageable, Bi-Directional Sortable DataGrid (ASP.NET)

A template from 4Guys for creating a DataGrid that you can page and sort (both ascending and descending): A Code Template for a Pageable, Bi-Directional Sortable DataGrid. Class extends the System.Web.UI.Page class.

Monday, January 10, 2005

PCWorld.com - The New Web Challengers

PCWorld.com - The New Web Challengers: "Watch out, Internet Explorer and Google: A pack of powerful browsers and search engines are gunning for you. We rate 45 tools--and crown a new champion browser." Firefox comes out at the top. Includes Gecko based browser (Firefox, Mozilla, Netscape), Opera and Internet Explorer Shells.

Web File Manager (ASP.NET)

Web File Manager (@ Code Project) has been updated to include the ability to create zip files and sort.

Sunday, January 09, 2005

Working with URL Parameters (ASP.NET)

CodeProject article: A small Class for simplifying the Work with URL Parameters. Similar to UrlQuery (Url Manipulation (C#) - Jul 22nd, 2004, Url Manipulation v2 (C#) - Sep 22nd, 2004)

Creating a toolbar for Firefox

Tutorial for creating a toolbar for the Firefox web browser. Born Geek: Firefox Toolbar Tutorial. Creating extensions would be a lot easier if there was a Visual IDE for doing them (rather than hand coding the visual aspects).

Friday, January 07, 2005

Set Default Browser / Email Client

DefaultBrowser allows you to set a default browser on a per user basis (so each user can have their own). DefaultMail does this for the email client. For Windows XP (older versions can only have a machine default).

Click Button on Enter in TextBox (ASP.NET)

DefaultTextBoxControl is an ASP.NET Web Control that you can use to specify which button to 'click' on a form when a user presses Enter when focused on a text box (otherwise the first button in the form gets 'clicked'). You have to replace TextBox controls with DefaultButtonTextBox and add DefaultButtonControl. Works with LinkButton and Button.

DefaultButtons (by Andy Smith of MetaBuilders) also does the same thing (without the need to change any controls, just add extra tags at start of page/user control), but only works on Button controls for submitting.

Does not solve the accessibility issue (if it is even solvable) when JavaScript is disabled (as ASP.NET pages can only have one server form on a page).

Improve Adobe Reader Loading Time

Adobe Reader SpeedUp is a utility that helps speed up the loading of Acrobat Reader. It does this by enabling you to prevent plugins from loading. PDF SpeedUp also does the same thing.

w.bloggar v 4.00

w.bloggar, a desktop tool for publishing to web logs has a new version for download (4.00). A useful tool for working on posts offline through a Windows based application, supports many different types of web log system (including Nucleus, WordPress, .Text and Blogger)

Wednesday, January 05, 2005

.NET Open Source

There are a few projects for .NET that are available as Open Source. A lot are hosted on SourceForge. Tom Gilkison has a list: ASP.NET Article: Open Source ASP.NET?.

Tuesday, January 04, 2005

Source Code Syntax Highlighting (JavaScript)

dp.SyntaxHighlighter can highlight your source code on a web page (inludes line numbers and the ability to print or view in plain text format) and supports the following languages:

  • C#
  • VB
  • VB.NET
  • JavaScript
  • PHP
  • SQL
  • XML style (XHTML, XML, HTML etc)

If used, the page will not validate (at W3C's validator), due to use of <textarea name="code" language="vb"> but if 100% validation is not required, this is a good tool.


Tags: ,