Posts

Select box manipulation with jQuery - update to removeOption

The previous update to this collection of plugins introduced a cache when adding options (i.e. made it much faster if adding a lot of options). However, it was not cleared when remove options (causing possible conflicts). This is now done and an extra parameter has been added to removeOption (of boolean type), that when set to true, will only remove options if it matches any option(s) defined by the first parameter. More details and download from the Select Box Manipulation project page at the jQuery site. A demo is also available.

FileHelpers - a library for worked with CSV files (.NET)

Best described in the words on the FileHelpers website : The FileHelpers are a free and easy to use .NET library to import/export data from fixed length or delimited records in files, strings or streams. It is a library that can be used to work with flat text files (e.g. Comma Separated Value (CSV) or Tab Separated Values (TSV) etc). Available for commercial and non-commercial use (under the LGPL). They also have a blog . There is also a CSV parser on CodeProject if you can't use a library licensed under the LGPL: A Fast CSV Reader . Not as powerful as FileHelpers but still good nonetheless.

Text Clips for Programmers Notepad 2 (jQuery)

I have not updated my jQuery Text Clips for Programmer's Notepad 2 for a while (since 1.0.2) so have added them for jQuery 1.1.2 @ Text Clips for Programmer's Notepad 2 (generated using the jQuery Text Clip Generator ).

Sending emails with C#

I'm sure many may already know how to do this, but for those that don't, sending an email using .NET is very easy and can be used in ASP.NET as well as Windows Forms or Console applications (assuming you have CDOSYS installed). This example also shows how to send an email to multiple recipients (requires you to import the namespace System.Collections ). .NET 1.0 / 1.1 (import the namespace System.Web.Mail ) MailMessage m; SmtpMail.SmtpServer = "smtpservername"; ArrayList recipients = new ArrayList(); recipients.Add("fred@bloggs.com"); recipients.Add("jane@doe.com"); for (int i = 0;i < recipients.Count;i++) { m = new MailMessage(); m.To = recipients[i].ToString(); m.From = "me@mysite.com"; m.BodyFormat = MailFormat.Html; m.Subject = "Subject of the email"; m.Body = String.Format( "<p style='font: 12px Arial'>Sending email to {0}</p>", recipients[i] ); SmtpMail.Send(m); } .NET 2.0+ ...

Windows Scripting: Adding/removing network printers and drives

While I normally make posts related to web development, I may occasionally post something that isn't used in web development, but still has some kind of relationship (normally the underlying technology used) - for example: VBScript - Set Homepage (MSIE) / Add Notepad to Send To . In this case, it is VB Scripting and is an example of how to perform several common tasks (related to printers and drives) that network/server administrators may want to do, through a simple script (could be via login script, or executed directly on the client) rather than using the Windows GUI. It also demonstrates how to do basic error handling. Just take the following code (tweak as needed) and paste it in a script file (e.g. login.vbs). Only been tested in Windows XP (for Windows 98, you have to also define the driver name as a second parameter for AddWindowsPrinterConnection , it should work as is in Windows 2000). Option Explicit Dim WSHNetwork Dim WSHShell On Error Resume Next Set WSHNetwork = C...

Link: HTML Entity Character Lookup

HTML Entity Character Lookup is a useful web based tool for looking up HTML entities codes for characters that you have an idea what they look like (e.g. a 'c'), but not sure what the entity code (e.g &copy; for ©) to use is.

Controlling browser scrollbars

In Firefox, the vertical scrollbar only shows when the page contents do not go beyond the height of the browser window (i.e. you just have a simple 'Hello World' or very little content on your page). On the other hand, the scrollbar always shows if you are using Internet Explorer. For consistency across these (and possibly other browsers as well), you can apply a little bit of CSS. To make IE behave like Firefox (only show scrollbar when needed), just do this: html { overflow-y: auto; } To always show the scrollbar (to prevent the layout changing when more content-rich pages are loaded on your site): html { overflow-y: scroll; } I also use the same trick to only show scrollbars in <textarea> 's when needed: textarea { overflow: auto; }