Posts

Simple Slideshow System: S5

S5 has been around a few years now, but some may not be aware of it. S5 stands for 'Simple Standards-Based Slide Show System'. The XHTML code is simple to modify (adding / removing slides) and understand. Styling via CSS is also very simple to do. It gracefully degrades - so if JavaScript is disabled, you can still see the content. Slideshows are also printer friendly. Like a slideshow you would do in Microsoft Office PowerPoint or OpenOffice Impress, you have to make sure not too much content is added to a slide, since any overflow is hidden. The keyboard or mouse can be used to navigate the S5 slideshow (although there are no context menu options).

Microsoft.NET Framework directory locations

Since there are directories all over the place for the Microsoft.NET Framework, I have decided to compile a list of some of the key ones used. Compilers, GACUtil, ASP.NET Register IIS/SQL, Assemblies etc. .NET 1.0: C:\Windows\Microsoft.NET\Framework\v1.0.3705 .NET 1.1: C:\Windows\Microsoft.NET\Framework\v1.1.4322 .NET 2.0: C:\Windows\Microsoft.NET\Framework\v2.0.50727 After 2.0, more directories were added, the build number was also omitted from the directory name. Some key utilities (for Global Assembly Cache (GAC), ASP.NET, Code Access Security Policy Tool (caspol.exe)) weren't part of future versions, so, as a result, .NET 2.0 is required by them. .NET 3.0 uses .NET 2.0 compiler. New directories: C:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation C:\Windows\Microsoft.NET\Framework\v3.0\Windows Workflow Foundation (only SQL scripts in here) C:\Windows\Microsoft.NET\Framework\v3.0\WPF (Windows Presentation Foundation) C:\Program Files\Reference A...

jQuery newsticker: SharePoint WebPart

It is possible to integrate the jQuery newsticker plugin into a SharePoint site using a WebPart: News Ticker Web Part . SmartTools is used to integrate jQuery into SharePoint, via the SmartTools.jQuery component. Anyone else integrated the newsticker plugin into a module / add-on for a Web CMS?

Visual Studio Macro: Wrap Selected Text in Tag

This simple macro allows you to wrap whatever text is selected in a tag - a feature that somehow is missing from Visual Studio 2008... Sub SurroundWithTag() Dim selectedText = DTE.ActiveDocument.Selection.Text Dim tag As String tag = InputBox("Enter tag name", "Tag", "strong") If (tag = "") Then MsgBox("No tag defined") Else ' no end tag needed as Visual Studio creates the end tag.. DTE.ActiveDocument.Selection.Text = String.Format("<{0}>{1}", tag, selectedText) End If End Sub Based on the answer to this question found on Stack Overflow: Macro to wrap selected text with tags in Visual Studio (which also details how you can create a macro)

jQuery Quick Tip: Extract CSS Background Image

jQuery allows you to get the background image of any element on a web page: $("#myelement").css("background-image"); However, this returns it in an undesirable format: url(http://example.com/images/image.jpg) or url("http://example.com/images/image.jpg") . With a bit of string replacement, you can get extract the URL: function extractUrl(input) { // remove quotes and wrapping url() return input.replace(/"/g,"").replace(/url\(|\)$/ig, ""); } So now you can just do this: extractUrl($("#myelement").css("background-image")) Which will return the URL on its own http://example.com/images/image.jpg .

ASP.NET Snippet: Delete All Users and Roles

Deleting all users and related data from a site using ASP.NET authentication is fairly simple. Useful if copying a database and you want to remove all the users, but keep the structure and other data (e.g. user content) intact. Delete all users: foreach (MembershipUser u in Membership.GetAllUsers()) { Membership.DeleteUser(u.UserName, true); } Delete all roles: foreach (string role in Roles.GetAllRoles()) { Roles.DeleteRole(role); }

ASP.NET Snippet: Quick Password Reset

Here is a simple way, via code to reset a password when you are using the built-in ASP.NET authentication system. Useful if you either don't have a reset password form, or you just want to quickly change a password. Create a blank page, and place in the code behind Page_Load event. C# protected void Page_Load(object sender, EventArgs e) { MembershipUser u = Membership.FindUsersByName("Username")["Username"]; u.UnlockUser(); u.ChangePassword(u.ResetPassword(), "newpassword"); } VB Public Sub Page_Load(sender As Object, e As EventArgs) Dim u As MembershipUser = Membership.FindUsersByName("Username")("Username") u.UnlockUser() u.ChangePassword(u.ResetPassword(), "newpassword") End Sub Just delete the page when done. Update (8 July 2009) : If a question and answer is required when you create a user, you have to pass on the answer to u.ResetPassword , e....