Posts

Google now hosting JavaScript libraries (jQuery, Prototype et al)

Google now offers a service for hosting popular JavaScript libraries, so for any website this is used on the performance will be better (the user may have already downloaded the file on another site and it is cached) and it will reduce the bandwidth your server uses. So far it hosts jQuery, prototype, script.aculo.us, Mootools and Dojo. You can either load it via the Google AJAX API or the <script/> tag. The advantage of using the Google API is that it can be used for Google's services as well (like Maps, RSS/Atom Feeds and Search (Analytics is missing from the list though)). Ajaxian » Announcing AJAX Libraries API: Speed up your Ajax apps with Google’s infrastructure Google AJAX Libraries API , Developers Guide

jQuery Quick Tip: Rollover images with jQuery

Update : Demo page created There are several sites that show you how to create rollover images with jQuery (just search Google, Ask, A9, Yahoo etc) for "rollover image jquery"), but they do sometimes have more code than needed (like using $(this).attr("src") instead of this.src for determining the image source. Here is another method that does not use jQuery unnecessarily (which may be faster if there are lots of images). Create two images, for the 'off' state (when mouse is not over it) and the 'on' state (on mouse over). Name them button_off.gif and button_on.jpg (the button bit can be anything, as can the extension ( .gif ) - the important bit is the _off and _on suffix. HTML code: <a id="mylink" href="/go/somewhere/"><img src="/images/button_off.gif" alt="" title="" border="0" width="100" height="30" /></a> Then in your $(document).ready ...

pastebin sites

A pastebin is a site that allows you to share text with other, most commonly source code, but could be anything else as well (like prose or poetry - e.g. you are writing a novel or poem and want to share what you write). They are useful if you do not have a web site to post what you have written and want to share it to get any feedback (like spotting any bugs or spelling mistakes). They allow you to post without registering or paying and the pastes normally expire after a set period (e.g after a month) so as to reclaim any lost disk space for the host. Source Code highlighting is often a feature of many as well. Some of them offer more than this, like comparison (e.g. diff 's), password protection / encryption and notifications (to alert you of new pastes, or replies to pastes - normally through a chat system like IRC). The open nature of them could render them susceptible to spam though. The following is a list of pastebin's I am aware of. All offer syntax highlighting. pa...

jQuery Quick Tip: Select text on focus

Just a quick tip on how to select all text when focus is given to a textarea or input (only if the value has not changed) . $("input, textarea").focus( function() { // only select if the text has not changed if(this.value == this.defaultValue) { this.select(); } } )

ASP.NET: Binding alphabet to dropdown list

Update: Added VB code. There may be some cases where you want a DropDownList to list all the letters in the alphabet (i.e. A - Z). Rather than add the letter individually (through using <asp:ListItem> ) you can create an ArrayList and bind to that. In your ASPX page: <asp:DropDownList ID="Letters" DataSource='<%# Alphabet %>' runat="server" /> In your code behind. Create your Alphabet property: private ArrayList _Alphabet; protected ArrayList Alphabet { get { if (_Alphabet == null) { _Alphabet = new ArrayList(); for (int i = 65; i < 91; i++) { _Alphabet.Add(Convert.ToChar(i)); } } return _Alphabet; } } Protected ReadOnly Property Alphabet() As ArrayList Get If _Alphabet Is Nothing Then _Alphabet = New ArrayList() For i As Integer = 65 To 91 - 1 _Alphabet.Add(Convert.ToChar(i)) Next End If Return _Alphabet End Get End Property Bind on Page_Load: private void Page_Load(object sender...

Adding rounded corners to your web pages

There are several ways of adding rounded corners to your web page. There is a large list of methods found at Rounded Corners - css-discuss , but also a few other ways using JavaScript (some using jQuery): The first (as far as I am aware) jQuery corner plugin (Dave Methvin) An improved version (Mike Alsup) of the above plugin curvyCorners - anti-aliased corners, supporting borders and background images A modified version of curvyCorners made to work with jQuery. The above plugin was rather big and couldn't be packed , so someone else made a futher modification that reduced its size and enabled it to be packed. Cornerz - smooth, anti-aliased corners. Another jQuery plugin. Anti-aliased, but does not support backgrounds. Rounded corners using <canvas> . <canvas> is a way of drawing/manipulating images via scripting (e.g. draw vector images, transformation, compositing, animations etc). There is a tutorial available on how to use it. Firefox 1.5+, Opera 9+, ...

Free Alternatives to Adobe Reader

As the years have gone by, Adobe Reader (formally Adobe Acrobat Reader) has got bigger (version 5.05 is 8.6MB and will probably still handle many PDF's OK, the latest, 8.1.1 is 22.3MB) and invariably slower with each release. Thankfully there are free alternatives, that are both a smaller download and much faster at opening PDF's. SumatraPDF (< 1MB, still in beta, open source) Foxit Reader (around 2MB download) PDF XChange Viewer (13MB, but still smaller than Adobe Reader and supports comments/annotations, filling in forms and exporting text and images) Alternatively, you could still have Adobe Reader, and use a tool that disables the plugins that slow the startup - e.g. Adobe Reader SpeedUp or PDF SpeedUp (although I haven't tested either of these).