Archive for April, 2007

Apr
26
Using ASP.Net / AJAX slide extender to create a color selector


Posted: 26th April 2007
Tags: , , ,
Posted in .Net, Javascript
Comments: 1 Comment »

Using the MS AJAX ASP.Net Extensions and the Ajax Control Toolkit (available through codeplex) You can easily make a colour selector using the Ajax Control Toolkits Slider Extender control.

The Slider Extender included in the Ajax control toolkit renders on the screen as a control that allows the user to click and drag to adjust a numerical value. Out of the box the slider extender is given an ASP:TextBox as it’s Target Control ID, the slider extender automatically hides these textboxes. We can use three slider controls to create a Red, Green and Blue sliders to set a colour. When working in RGB we can set a value of 0 to 255 for each of Red, Green or Blue. So the first thing we need is the three sliders on our HTML page.

 

ASP.Net MVC Diagram

Read the rest of this article »





Apr
24
Tip: ASP.Net/AJAX - Javascript in Label/Textbox Text


Posted: 24th April 2007
Tags: , , , ,
Posted in .Net
Comments: No Comments »

Hi All,

I though I would share a problem that I had (and resolved) using ASP.Net AJAX. The problem occurs if you want to output some Javascript to a Textbox (for example: for a user to copy and paste into their own page), which is nested in an UpdatePanel. AJAX returns an HTTP 500 error.

The reason seems to be that the Javascript in the textbox interferes with the javascript generated by MS AJAX to handle the partial page updates of the UpdatePanel.

So if like me you need to output some Javascript to the page for a user to cut and paste, a work around is to use a literal control and the HTMLEncode function of the Server object as follows:

  1. Literal1.Text = Server.HTMLEncode(<Script src=’example.js’ type=’text/javascript’></script>)

I hope that helps anyone that has been puzzled by this error.





Apr
23
Tip: Creating stronger passwords.


Posted: 23rd April 2007
Tags: , ,
Posted in Misc..
Comments: No Comments »

In this day and age we often get asked for passwords to secure our content or personal information. Many people find if difficult to come up with memorable passwords and popular choices are things like the day of the week when they set it or literally the word “password”! So, I though I would share my way of coming up with a memorable password that appears to be a random string of characters

For this method you need to come up with a phrase of several words. This may be relevant to a particular the site or company or personal to you in some way, it could be some lyrics to a song or poem or a private thought etc. For an example I will use the following well known line from a nursery rhyme:

Jack and Jill went up the hill to fetch a pale of water”

We can easily turn this into a memorable password by using the first letters, so in the above case, we get:

jajwuthtfapow

Already, we have a 13 character password. However, we can make this stronger still, by using other common techniques, for example swapping words that sound like numbers for their corresponding number. i.e. to = 2 or for = 4. So with the above example, we get:

jajwuth2fapow

We can also add in symbols (where supported). For example we could swap and for + or &. So again with the example above we end up with:

j+jwuth2fapow

Remembering the phrase and the simple substitution rules for numbers and symbols provides us with a good strengthen password. Obviously we still should use different passwords for different sites and it is also wise to have a phrase that isn’t obviously related to a particular site.





Apr
20
Excellent WYSIWYG HTML editor (all platforms)


Posted: 20th April 2007
Tags: , ,
Posted in .Net, Javascript, Ruby on Rails
Comments: 4 Comments »

I have been trying out several HTML editors for ASP.Net and thought I would share this excellent find that works with several platforms, including ASP.Net, ASP, PHP, Java etc. Up until now I was using FreeTextBox, however this was giving me grief in Firefox so decided that I needed to find a new solution.

FCKeditor is an excellent HTML WYSIWYG editor for ASP.Net as an ASP.Net control is available to use with the Javascript source files to allow you to interact (Get / Set text) etc programmatic ally as you can do with FreeTextBox. In addition to this, FCKEditor allows you to upload images and other files making adding images a breeze and also includes a spell-checker.

Read the rest of this article »