zondag, juni 01, 2008
Experimenting with Google translations
Google has a translation page, where you can translate sentences and web pages between many languages. It is automatic translation that is about 70% accurate I would say, and will in the other cases return wrong or funny results. Machine translation is still not at a point where it can reliably translate texts, but it can provide enough to get the gist of the text, and it helps translators out because the base translation is done, you just need to correct.So I have experimented with the Google AJAX Language API today. You can find more information and a sample on the following links:
http://code.google.com/apis/ajaxlanguage/documentation/
http://code.google.com/apis/ajaxlanguage/documentation/reference.html#LangContentType
http://www.google.com/uds/samples/language/translate.html
I was able based on this documentation to create a page where the original text of a question in in the left column, and the automatic translation in the right. An administrator can then verify and correct the new language, and save that question as a draft. As I'm using the Ajax calls, all is implemented in pure javascript on the browser itself, so I don't need any server-side calls or an API license, as it is the client that will request the translation to Google.
An what about the first results? Well, it is not perfect, but it does save a lot of time translating as especially the answer options are usually correct (they are short). The longer the question, the more trouble the automatic translation has to make a correct grammatical sentence out of it.
But first results are promising. I still need to work on it further, but I don't plan to make this a general tool on the site as I fear it will generate a lot of poorly translated questions. I prefer to keep it as a productivity tool to help real flesh and blood administrators to speed up the translation work.
Labels: asp.net, google, google language, machine translation
zondag, april 20, 2008
about2findout.mobi : what I learned so far
Here is what I wanted to share on making the limited mobile web version of the site:
- There is a special domain extension available for mobile sites: .mobi . As my normal registrant that I use for .com and other domains (directnic.com) did not offer .mobi domains, I registered it very cheap on godaddy.com . Godaddy.com is probably one of the biggest or the biggest web domain registrant and they offer a lot of add-on services. In fact, they are so commercially oriented it's very hard not to just buy what you wanted without anything more :-). I redirected the about2findout.mobi site to a subsection of the existing site, as it is in fact just part of the same asp.net web application. (www.about2findout.com/mobile)
- It was hard to choose what to implement and what not. So far it is a very limited site compared to the full web brother, but I hope just enough for mobile phones and their limited bandwidth and screen size.
- I wanted to make it look a little like iPhone applications. Apple does have a SDK (Software Development Kit) for the iPhone, but I didn't find my way in it immediately, and besides I have no time to learn yet another platform or programming language. As far as I know there are no 'iPhone button generators' on the net available, so I ended up making the buttons on the well known mycoolbutton.com, and adjusting them manually for size.
- If you want to test how your site looks like on an iPhone Safari browser, go to iphonetester.com .
- Windows Mobile devices and the provided Pocket Internet Explorer have a lot of issues with an asp.net Ajax enabled web site. The CSS style sheets don't always behave in the same way as on a computer, and for example the ProgressPanel didn't behave well. So I removed a lot of ajax functions in the end. It is possible to run limited Asp.net Ajax functionality on Windows Mobile version 6 or higher, but I just didn't want to figure out what works and what doesn't. If you have that time however, you can start with this excellent video tutorial on MSDN.
- If you make your mobile site with ASP.NET 2.0 on Visual Studio 2005, you will need to update the browsercap files, so that your site would recognize the Windows Mobile 6 platform. There is a good article on how to do that here (Jim Wilson).
- There is a special domain extension available for mobile sites: .mobi . As my normal registrant that I use for .com and other domains (directnic.com) did not offer .mobi domains, I registered it very cheap on godaddy.com . Godaddy.com is probably one of the biggest or the biggest web domain registrant and they offer a lot of add-on services. In fact, they are so commercially oriented it's very hard not to just buy what you wanted without anything more :-). I redirected the about2findout.mobi site to a subsection of the existing site, as it is in fact just part of the same asp.net web application. (www.about2findout.com/mobile)
- It was hard to choose what to implement and what not. So far it is a very limited site compared to the full web brother, but I hope just enough for mobile phones and their limited bandwidth and screen size.
- I wanted to make it look a little like iPhone applications. Apple does have a SDK (Software Development Kit) for the iPhone, but I didn't find my way in it immediately, and besides I have no time to learn yet another platform or programming language. As far as I know there are no 'iPhone button generators' on the net available, so I ended up making the buttons on the well known mycoolbutton.com, and adjusting them manually for size.
- If you want to test how your site looks like on an iPhone Safari browser, go to iphonetester.com .
- Windows Mobile devices and the provided Pocket Internet Explorer have a lot of issues with an asp.net Ajax enabled web site. The CSS style sheets don't always behave in the same way as on a computer, and for example the ProgressPanel didn't behave well. So I removed a lot of ajax functions in the end. It is possible to run limited Asp.net Ajax functionality on Windows Mobile version 6 or higher, but I just didn't want to figure out what works and what doesn't. If you have that time however, you can start with this excellent video tutorial on MSDN.
- If you make your mobile site with ASP.NET 2.0 on Visual Studio 2005, you will need to update the browsercap files, so that your site would recognize the Windows Mobile 6 platform. There is a good article on how to do that here (Jim Wilson).
Labels: .mobi, about2findout.mobi, ajax, asp.net, mobile
vrijdag, januari 11, 2008
We want your face
I spent (wasted?) all day figuring out how to make people select and upload an avatar or profile picture to their account on the site. But here it is, from today onwards you will find a link in the edit profile page to upload an avatar. That should give a face to the people solving and creating questions and quizzes.Asp.net (the programming language I use) only offers some file upload control, but I wanted something were users could crop the image their uploaded so the resulting avatar would always be 50 by 50 pixels. There is a great and expensive control available that does that (I-Load from Radactive) but I'm not going to spend 250$ on my free site. So I found a control named WebImageMaker. It was made by Tom Crane and does exactly what I wanted: upload an image, and select a part of it. I changed the control just a little bit so I could translate error messages and buttons in multiple languages.
The upload limit is 4 MB, and that is a default in asp.net. I did not see any reason to change that. Maybe one of these weeks you'll be able to upload images with questions, as I've figured out the basics.
Labels: about2findout.com, asp.net, avatars, new
vrijdag, december 28, 2007
Automatic adjustment of difficulty (by Otto)
I've implemented an automatic adjustment of the difficulty level of questions. As you know, the difficulty level is indicated by 1, 2 or 3 gray dots, and depending on the level you can win or loose 1, 2 or 3 points when you solve the questions. The level is set by the author in the Author Zone (properties tab).
But once a question has at least 10 views, the level gets updated automatically once a day by Otto, the new automatic agent of the site. The rules are:
- If more than 66% of people know the answer, the level is 1 (easy)
- If between 33% and 66% of people know the answer, the level is 2 (moderate)
- If less than 33% of people know the answer, the level is 3 (difficult)
Otto (the automatic agent of the site) is implemented in ASP.NET. I looked hard to find an asp.net task scheduler, but couldn't find one. Many implementations use a console application that calls a web service, or use the Windows Task Scheduler. I don't have access to either on my hosted environment at seekdotnet.com. If you do control your own server, those solutions might work for you:
http://www.codeproject.com/KB/aspnet/ASPNETService.aspx
http://www.codeproject.com/KB/vb/WebJobScheduler.aspx
I don't need fancy schedulers that run if the application is down or idle, so I just added some code in the global.asax file in the Session_End section. That way every time a session is ended, the code runs and checks the database if a job should run. It works.
While I was at it, I also made Otto send messages when your questions reach 10 or 100 views, or when someone adds you as a contact. Otto only speaks English, and I hope that is not a problem.
But once a question has at least 10 views, the level gets updated automatically once a day by Otto, the new automatic agent of the site. The rules are:
- If more than 66% of people know the answer, the level is 1 (easy)
- If between 33% and 66% of people know the answer, the level is 2 (moderate)
- If less than 33% of people know the answer, the level is 3 (difficult)
Otto (the automatic agent of the site) is implemented in ASP.NET. I looked hard to find an asp.net task scheduler, but couldn't find one. Many implementations use a console application that calls a web service, or use the Windows Task Scheduler. I don't have access to either on my hosted environment at seekdotnet.com. If you do control your own server, those solutions might work for you:
http://www.codeproject.com/KB/aspnet/ASPNETService.aspx
http://www.codeproject.com/KB/vb/WebJobScheduler.aspx
I don't need fancy schedulers that run if the application is down or idle, so I just added some code in the global.asax file in the Session_End section. That way every time a session is ended, the code runs and checks the database if a job should run. It works.
While I was at it, I also made Otto send messages when your questions reach 10 or 100 views, or when someone adds you as a contact. Otto only speaks English, and I hope that is not a problem.
Labels: about2findout, asp.net, new, otto
zaterdag, september 08, 2007
Google Analytics
I signed up for the free Google Analytics service. It helps you to track all kind of site statistics such as how many hits you have, what pages are the most visited, where users come from, how they found your site and the browsers they use, etc. How it works is pretty simple. Sign up for a free account and paste a small script in the HTML code of all your pages just before the closing /body HTML tag. That's it. The goal of Google Analytics is to optimise web sites for advertisement revenue, but it provides very useful insights for any webmaster.I've included the script on the master page of my asp.net application so it is automatically present on all pages of the site. It takes 24 hours to get the first reports so I can't tell you yet how the reports look like, but judging from the free tour they seem powerful yet simple. There is also a Google Analytics blog available.
zondag, september 02, 2007
ASP.NET: Moving an application to the net
I moved my site from my development computer to my hosted webspace on seekdotnet today. It involved:
- Moving all files from my computer to the web via ftp
- Making the directory where I put them an ASP.NET virtual directory
- Moving the database (SQL Server 2005 Express .mdf file) to the database server via the MDF attachment tool
- Creating the asp.net membership database on that database via the aspnet_regsql tool (as well described on 4GuysFromRolla)
- The tricky part: modifying the web.config file to use a customised provider for membership, profiles and roles. Failing one will lead to asp.net trying to use the default local SQL Server 2005 provider in the App_Data folder. (See MaximumASP.com article)
All in all, it was a quite smooth operation.
- Moving all files from my computer to the web via ftp
- Making the directory where I put them an ASP.NET virtual directory
- Moving the database (SQL Server 2005 Express .mdf file) to the database server via the MDF attachment tool
- Creating the asp.net membership database on that database via the aspnet_regsql tool (as well described on 4GuysFromRolla)
- The tricky part: modifying the web.config file to use a customised provider for membership, profiles and roles. Failing one will lead to asp.net trying to use the default local SQL Server 2005 provider in the App_Data folder. (See MaximumASP.com article)
All in all, it was a quite smooth operation.
Labels: asp.net
woensdag, augustus 22, 2007
Contact.Me: link to chat in AOL, MSN, Yahoo, ICQ, gTalk, Skype
So for example fields you can enter in your profile are country and birth date because later on I might program restrictions based on country or age. To give more information about yourself, you can then add a link to your blog or web site. In a next step I might add links to popular sites such as LinkedIn, MySpaces and the likes.
The same applies for communication. So far, you can add your IDs for MSN Messenger, Skype, Google Talk, Yahoo Messenger, AOL IM and ICQ. For privacy reasons you can also select who can see this information: no one, everyone or just your contacts. Today I have been searching how to start chat sessions to these clients via a simple URL link on the page.
There is a site called onlinestatus.org that hosts free online status indicators for these messaging clients (except GTalk). But unless your messaging program can't be bothered with privacy, these links will always show 'unknown' because you need to open up your online status to the general public. So I decided not to go that far and just add HTML links to start up the clients. These links will only work if the particular messaging client is installed on your computer. I found the links for skype, aol, yahoo in the onlinestatus.org generated code. The one for MSN came from a Microsoft forum post. The one for GTalk I found on the customizetalk.com forum. And the one for ICQ came from their own panel launchers.
So to save other people the trouble of looking them up, here are the URL links to start up chat sessions (change USERID with the person you want to talk to).
case 1: //AOL
"aim:goim?screenname=USERID"
case 2: //Skype
"skype:USERID?chat"
case 3: //Google Talk
"gtalk:chat?jid=USERID"
case 4: //Yahoo Messenger
"ymsgr:sendIM?USERID";
case 5: //ICQ
"http://www.icq.com/whitepages/cmd.php?uin=USERID&action=message"
case 6: //MSN
"msnim:chat?contact=USERID"
Labels: AOL, asp.net, GTalk, ICQ, MSN, skype, Yahoo
zondag, augustus 19, 2007
Country list
Today I started working on the profile page of the about2findout.com site-to-be. You would think it is simple to find a control that displays all known countries ready to plug into an asp.net application. But I only found a few. For example on egghead cafe. That is nice, but requires the list to be hard coded, which is not very maintenance-friendly. After all, the former Yugoslavia still splits off new countries every year :-). Luckily, Mads Christensen's blog has an XML file with all countries available. I've changed it a bit so the country name is an attribute like the code and ISO country number because that way asp.net is able to directly use it as an XML data source and I don't have to write any additional code.
In case you need it too, this the modified country-names.xml file, ready to serve as an XML data source and be bound to any capable asp.net control such as listbox or checkboxlist.
I also wanted to pre-populate the box with the country the IP connection originates from. I found a nice article by AdamNajmanowicz on Codeproject. It has a module to detect the country based on the IP address. It makes use of the geoiptool.com site to get country, region and provider information based on the IP address. Of course, this system is not 100% accurate and can be bypassed, but is makes a nice start to detect a user's country.
In case you need it too, this the modified country-names.xml file, ready to serve as an XML data source and be bound to any capable asp.net control such as listbox or checkboxlist.
I also wanted to pre-populate the box with the country the IP connection originates from. I found a nice article by AdamNajmanowicz on Codeproject. It has a module to detect the country based on the IP address. It makes use of the geoiptool.com site to get country, region and provider information based on the IP address. Of course, this system is not 100% accurate and can be bypassed, but is makes a nice start to detect a user's country.
Labels: asp.net, country list
zaterdag, juli 21, 2007
New CAPTCHA control
I started to work on the site again. I keep running into problems related to the CAPTCHA control that I'm using. It's the free one from the Codeproject site that I modified. Today I got InvalidCastException errors for the Anthem.NET Editlabel component due to this CaptchaWebControl control. So I finally gave up on it and started for a replacement.

Accidently I also found out what CAPTCHA stands for : Completely Automated Public Turing test to tell Computers and Humans Apart. Take that for an acronym :-) . It is an established way to protect web forms against robots and usually involves people filling in a code from an image.
First replacement control I tried was the one created by Peter Kellner. This Microsoft MVP did a nice job of a highly customizable component, but I did not run into the same errors. But the looks were a bit not-done and especially the component only works with events. There is no method to call for verification. As my CAPTCHA is at the bottom of every beta page to allow people to post comments on how to improve my site, I wanted to call verification only when the button was pressed. So I decided against this component.
So as a first for the about2findout.com project, I'm going to use a cheap commercial component. The LanapSoft BotDetect control is available from 59$ onwards and has some excellent features. Not only can I now choose between 50 different CAPTCHA rendering styles, it is also solving a major issue with CAPTCHA. Up till now every website using CAPTCHA was not compliant with section 508 and other accessibility standards because blind people cannot see the code and are thus unable to use the site. This component adds a button that reads out the code as well. Very cool indeed. So with a little investment I get a code that (so far) does not generate more trouble than it's worth and makes my site better adhere to accessibility standards.
Accidently I also found out what CAPTCHA stands for : Completely Automated Public Turing test to tell Computers and Humans Apart. Take that for an acronym :-) . It is an established way to protect web forms against robots and usually involves people filling in a code from an image.
First replacement control I tried was the one created by Peter Kellner. This Microsoft MVP did a nice job of a highly customizable component, but I did not run into the same errors. But the looks were a bit not-done and especially the component only works with events. There is no method to call for verification. As my CAPTCHA is at the bottom of every beta page to allow people to post comments on how to improve my site, I wanted to call verification only when the button was pressed. So I decided against this component.
So as a first for the about2findout.com project, I'm going to use a cheap commercial component. The LanapSoft BotDetect control is available from 59$ onwards and has some excellent features. Not only can I now choose between 50 different CAPTCHA rendering styles, it is also solving a major issue with CAPTCHA. Up till now every website using CAPTCHA was not compliant with section 508 and other accessibility standards because blind people cannot see the code and are thus unable to use the site. This component adds a button that reads out the code as well. Very cool indeed. So with a little investment I get a code that (so far) does not generate more trouble than it's worth and makes my site better adhere to accessibility standards.
dinsdag, juni 05, 2007
ASP.NET: FreeTextBox versus FckEditor
FreeTextBox is a pure asp.net component, written in C#. Inspite of the name, FreeTextBox comes in a (limited) free version and a full paying version. Also the source code has to be purchased, but the fees are small. You pay 50$ for a professional and 200$ for a source code license. FckEditor is a true open source project, and not exclusive to the .NET environment.
In the end I have chosen FreeTextBox because of one thing: its integration with the NetSpell spelling checker component that I already use in my project. I made the spelling screen multilingual, and manually set the language to check, but otherwise just plugged in the component as such and it works quite well.
The downside with including an HTML editor to your page is that you have to configure validateRequest="false" in the @Page directive af the .aspx file to prevent the build-in ASP.NET security checker to block the postback. It makes the page less secure, so be sure to manually delete all scripting tags or other unwanted tags from the HTML editor before storing it in your database.
Labels: asp.net, fckeditor, freetextbox
zaterdag, februari 10, 2007
ASP.NET: Multilingual site
I've been going back and forth on whether I want to build a multilingual site. It is just so much more work. In the end, I decided to make the complete site capable of handling multiple languages. It will make a better, more accessible project on one hand, but take a lot more time on the other hand to complete it.
My reasoning is that especially anything that touches learning should be as close as possible to the learner, and preferably in his or her own language. One of the barriers to e-learning today is still the lack of non-English content for many topics.
DECISION: about2findout.com will be capable of handling multiple languages. During the beta, I will develop for English and Dutch only. Later on other languages might or might not be added, but at least the project will never have to be rewritten to support other languages in the future.
So how did I do it? First, start with a video tutorial here. Then read this article.
Q: What are locales and cultures? What is Culture and UICulture? A: A browser uses a specific notation to identify the language and regional settings to use. For example nl means Dutch, en means English, fr means French. That just identifies the language. That is not enough to localise an application, because some settings such as date format and currency depend also on the specific place. That is called 'locale' and has two extra characters. So nl-BE for example is Dutch in Belgium, en-US is English/United States and fr-FR is French in France. Users can set their language preferences in their browsers (for IE: Internet Options and Languages button). In ASP.NET you can let the application automatically take the language of the browser preference by specifying the globalisation "auto" tab in the web.config file for UICulture and Culture properties. And you can manually overwrite the language settings with the InitialiseCulture method of a page.
The Culture and UICulture settings are stored in the Profile (see one of the previous posts). I also have a language selection menu at the top of the master page, created with a DrowDownExtender control from the Ajax Control Toolkit.
My reasoning is that especially anything that touches learning should be as close as possible to the learner, and preferably in his or her own language. One of the barriers to e-learning today is still the lack of non-English content for many topics.
DECISION: about2findout.com will be capable of handling multiple languages. During the beta, I will develop for English and Dutch only. Later on other languages might or might not be added, but at least the project will never have to be rewritten to support other languages in the future.

So how did I do it? First, start with a video tutorial here. Then read this article.
Q: What are locales and cultures? What is Culture and UICulture? A: A browser uses a specific notation to identify the language and regional settings to use. For example nl means Dutch, en means English, fr means French. That just identifies the language. That is not enough to localise an application, because some settings such as date format and currency depend also on the specific place. That is called 'locale' and has two extra characters. So nl-BE for example is Dutch in Belgium, en-US is English/United States and fr-FR is French in France. Users can set their language preferences in their browsers (for IE: Internet Options and Languages button). In ASP.NET you can let the application automatically take the language of the browser preference by specifying the globalisation "auto" tab in the web.config file for UICulture and Culture properties. And you can manually overwrite the language settings with the InitialiseCulture method of a page.
The Culture and UICulture settings are stored in the Profile (see one of the previous posts). I also have a language selection menu at the top of the master page, created with a DrowDownExtender control from the Ajax Control Toolkit.
Labels: asp.net
vrijdag, februari 09, 2007
ASP.NET: Basic security
The internet is a fine place. But of course there is also 'the dark side of the internet'. I am not a security specialist, and I realise my site might be vulnerable to attacks or exploits. But that doesn't mean I can't get the basics right and go for a reasonable level of security. I want to mention some examples used in the footer of each page during the beta. There is a box to add additional comments to each page. The box is accessible both to anonymous users and registered users. I'm taking this approach because I want the site to be as useful as possible without having to log in or register. God knows I hate having to register every time myself. Personally I rarely contribute to sites if I first need to register and/or login. But then I leave the site open to all sorts of spam of course... There are two things I want to protect: 1) avoid robots or spambots to enter text and 2) avoid people entering harmful text. There are ways to insert javascript, HTML or SQL code in a text box that can be used to get control over the application, or corrupt it.
Security should be enabled both on the client side and on the server side. Client side stuff is mostly to make it more comfortable for the user and prohibit entering faulty information. But it can always be circumvented by someone with the right skills, so you equally need some checks on the server side.
Client side:
The text box uses the FilteredTextBoxExtender from the Ajax Control Toolkit. Only 'safe' characters can be entered. For example the < and > or % or @ characters are not allowed and cannot be typed in the box.
Secondly, your text is only submitted if the CAPTCHA control code is the right one. I've blogged about the CAPTCHA control before. The purpose is to ensure only humans can enter text, not machines or bots. I've adapted the rendering of the CAPTCHA control from the codeproject.com site so it also displays in a row.
Server side:
On the server side I'm using the free Anti-Cross Site Scripting Library 1.5 to encode the text so potentially harmful characters are 'neutralised'. You can download the library here. Then you need to add a reference to your project (right-click in solution explorer and select Add Reference) by browsing to the AntiXssLibrary.dll file. To use it to encode potentially harmful input before rendering it to the screen use AntiXss.HtmlEncode or one of the other encoders. There is a good tutorial describing the risks, analysis and usage of the tool on the MSDN site.
Labels: asp.net
donderdag, februari 08, 2007
ASP.NET: Master Pages
Master pages are a way in ASP.NET 2.0 to have a common design, header and footer for all your pages. It is a nice concept, and very popular amongst 'newbies' such as myself it would seem. Anyway, I created a master page for about2findout.com. The basics on master pages can be seen in this excellent video tutorial.
My master page has methods to visualise the five categories of pages: findout (pink), explain (green), helping hand (yellow) and community (blue). It also has a method to display a warning, informational, error, security or confirmation message. At the bottom of the master page is a section to add comment such as bugs or suggestions to any page. This will be used to capture feedback during the beta testing phase.

Q: How can you access the methods and properties of the master page?
A: If you want the Master property to be available, with IntelliSense, just add a < @MasterType VirtualPath= > statement to the .aspx page. Once that is done, use the Master object as you would use any other object.
Q: Can master pages work with AJAX?
A: Sure. Just remember you should have only one ScriptManager object per page. In my case I also needed Ajax on the master page, so that is where I included it. The alternative approach is to have a ScriptManager control on every derived page, but not on the master itself.
Q: How about master pages and translation/localisation?
A: To override the locale (language) settings you should normally override the InitialiseCulture() event of the page. This will not work for a master page as this is technically not a page but a user control. So you need to override the method on the 'real' pages, not on the master. Of course, that is a lot of duplication. So I made a base class that all my pages inherit from.
My master page has methods to visualise the five categories of pages: findout (pink), explain (green), helping hand (yellow) and community (blue). It also has a method to display a warning, informational, error, security or confirmation message. At the bottom of the master page is a section to add comment such as bugs or suggestions to any page. This will be used to capture feedback during the beta testing phase.

Q: How can you access the methods and properties of the master page?
A: If you want the Master property to be available, with IntelliSense, just add a < @MasterType VirtualPath= > statement to the .aspx page. Once that is done, use the Master object as you would use any other object.
Q: Can master pages work with AJAX?
A: Sure. Just remember you should have only one ScriptManager object per page. In my case I also needed Ajax on the master page, so that is where I included it. The alternative approach is to have a ScriptManager control on every derived page, but not on the master itself.
Q: How about master pages and translation/localisation?
A: To override the locale (language) settings you should normally override the InitialiseCulture() event of the page. This will not work for a master page as this is technically not a page but a user control. So you need to override the method on the 'real' pages, not on the master. Of course, that is a lot of duplication. So I made a base class that all my pages inherit from.
Labels: asp.net
woensdag, februari 07, 2007
ASP.NET : Profile
ASP.NET 2.0 has a 'profile' feature. I use it to store user preferences for both anonymous and registered visitors such as language preference and last page visited. Learn more about how to use them here.
Q: What is a profile and how is it used?
A: A profile is a set of values that ASP.NET will automatically store in its membership database. You define the values in the web.config file. If you need it to be available for anonymous users, you also need to add a section "anonymousIdentification". You can use the Profile object on your ASP.NET pages to access the properties, for example Profile.Culture in this case.

Q: How is this different from using the session object?
A: The usage is similar. But anything you store in the Session object is lost when the session is done. Whatever is stored in the Profile object will be remembered next time the user visits your site. So that is the base decision criterium: if you need to remember settings like language, add them to the profile. If it are temporary values stored during one visit, use Session.
Q: Why doesn't the Profile object work anymore with Visual Studio 2005 SP1 'Web Application Project'?
A: I spend a few hours figuring this out. If you will do like in the tutorial video in a new project, you might get compilation errors on the Profile object, and you will notice the IntelliSense on it doesn't work. The reason is that since SP1 there is a new kind of project for web applications. Most tutorials and books will be about the 'Web Site Project'. But some things change when you create the newly available 'Web Application Project'. For one, the Profile object doesn't get generated automatically anymore. Scott Guthrie explains it all in his blog. You can download a free program here, called ASP.NET Web Profile Generator. Install it. Then, in the solution explorer right-click the web.config file and select 'Generate Web Profile'. This will generate a new class WebProfile.cs. Now the Profile object works again. Yes!
I don't know if it is related, but I do get a timeout error on the Profile every time I run my application for the first time after starting Visual Studio 2005. After that it works fine. If that is the only problem, I can live with it.
PS: The App_Code folder also doesn't exist anymore in Web Application Projects. Datasets for example can be stored just as normal classes anywhere.
Q: What is a profile and how is it used?
A: A profile is a set of values that ASP.NET will automatically store in its membership database. You define the values in the web.config file. If you need it to be available for anonymous users, you also need to add a section "anonymousIdentification". You can use the Profile object on your ASP.NET pages to access the properties, for example Profile.Culture in this case.
Q: How is this different from using the session object?
A: The usage is similar. But anything you store in the Session object is lost when the session is done. Whatever is stored in the Profile object will be remembered next time the user visits your site. So that is the base decision criterium: if you need to remember settings like language, add them to the profile. If it are temporary values stored during one visit, use Session.
Q: Why doesn't the Profile object work anymore with Visual Studio 2005 SP1 'Web Application Project'?
A: I spend a few hours figuring this out. If you will do like in the tutorial video in a new project, you might get compilation errors on the Profile object, and you will notice the IntelliSense on it doesn't work. The reason is that since SP1 there is a new kind of project for web applications. Most tutorials and books will be about the 'Web Site Project'. But some things change when you create the newly available 'Web Application Project'. For one, the Profile object doesn't get generated automatically anymore. Scott Guthrie explains it all in his blog. You can download a free program here, called ASP.NET Web Profile Generator. Install it. Then, in the solution explorer right-click the web.config file and select 'Generate Web Profile'. This will generate a new class WebProfile.cs. Now the Profile object works again. Yes!
I don't know if it is related, but I do get a timeout error on the Profile every time I run my application for the first time after starting Visual Studio 2005. After that it works fine. If that is the only problem, I can live with it.
PS: The App_Code folder also doesn't exist anymore in Web Application Projects. Datasets for example can be stored just as normal classes anywhere.
Labels: asp.net
maandag, februari 05, 2007
ASP.NET: getting started with Ajax
It's here and it's free. Formely known as 'the Atlas project', Microsoft released the 1.0 version of their free ASP.NET Ajax add-on end of January. All you need to get started is on the ajax.asp.net site. AJAX essentially will allow you to build richer client interfaces for the web. For example, it will allow you to only update a part of a page instead of remaking the whole page for every single click.
Q: What are all those different downloads?
A: There are 3 downloads in total that are important.
A: Easy. Just download it here, and run the installation program. It will install the extentions on your hard disk (normally in the \Program Files\Microsoft ASP.NET\ASP.NET 2.0 AJAX Extensions\v1.0.61025 folder). It will also install the extra controls in your Visual Studio 2005 toolbox, if installed. There is a good video on how to install the basic Ajax framework here. The major components are the ScriptManager and the UpdatePanel. You need to place one and only one ScriptManager control on every page you want to have Ajax functionality. And you use an UpdatePanel to mark a part of your page for partial updates. (Only what is in the UpdatePanel gets refreshed, the server doesn't need to waste its time on rebuilding the other parts of the page.)

Q: How to use the Ajax Control Toolkit?
A: There is a nice video describing the process here. You can download the toolkit from Codeplex. That is the place where you'll find the open source projects endorsed by Microsoft. There is a live preview site of all the controls in the toolkit on http://ajax.asp.net/ajaxtoolkit/. The toolkit does not have an installer. It comes as a .zip file, so you'll need to unzip it to your hard drive, for example also under the \Program Files\Microsoft ASP.NET\ folder. You will also need to manually add the controls to Visual Studio 2005. To do so, first make a new section in the toolbar: right-click and select 'Add new tab'. Give it any name, for example Ajax Toolkit. Then click right on that tab and select 'Choose Items...'.

On the next dialog box, Browse to the \Ajax Toolkit\SampleWebSite\Bin\AjaxControlToolkit.dll file (or where you unzipped it). This will add all the controls to your toolbox.
Q: How do the toolkit controls work?
A: You need to understand they are not controls on their own. They are extenders that add Ajax functionality to existing controls. For example, the TextBoxWaterMarkExtender will add a watermark to a textbox control, such as below. When nothing is typed in the box, your message shows. For most of the controls, there are excellent free videos here. Watch a few and you will get the hang of it. Then start experimenting and be amazed!

Q: What are all those different downloads?
A: There are 3 downloads in total that are important.
- The basic one is called the ASP.NET 2.0 Ajax Extensions. That is the 'official', released and supported version of the core Ajax functionality.
- The most useful one is the Ajax Control Toolkit. This is a collection of very useful, ready-to-use controls with Ajax behavior, such as watermarktextbox, hoovermenu, modal popup box, etc. They are created by an open source community that is supported by Microsoft.
- The Futures CTP. This is the beta of whatever functionality was not ready for the 1.0 release of the ASP.NET 2.0 Ajax Extensions. It is still in test and will be included in a later version. I'm not using this as I only want to use final and tested material.
A: Easy. Just download it here, and run the installation program. It will install the extentions on your hard disk (normally in the \Program Files\Microsoft ASP.NET\ASP.NET 2.0 AJAX Extensions\v1.0.61025 folder). It will also install the extra controls in your Visual Studio 2005 toolbox, if installed. There is a good video on how to install the basic Ajax framework here. The major components are the ScriptManager and the UpdatePanel. You need to place one and only one ScriptManager control on every page you want to have Ajax functionality. And you use an UpdatePanel to mark a part of your page for partial updates. (Only what is in the UpdatePanel gets refreshed, the server doesn't need to waste its time on rebuilding the other parts of the page.)

Q: How to use the Ajax Control Toolkit?
A: There is a nice video describing the process here. You can download the toolkit from Codeplex. That is the place where you'll find the open source projects endorsed by Microsoft. There is a live preview site of all the controls in the toolkit on http://ajax.asp.net/ajaxtoolkit/. The toolkit does not have an installer. It comes as a .zip file, so you'll need to unzip it to your hard drive, for example also under the \Program Files\Microsoft ASP.NET\ folder. You will also need to manually add the controls to Visual Studio 2005. To do so, first make a new section in the toolbar: right-click and select 'Add new tab'. Give it any name, for example Ajax Toolkit. Then click right on that tab and select 'Choose Items...'.

On the next dialog box, Browse to the \Ajax Toolkit\SampleWebSite\Bin\AjaxControlToolkit.dll file (or where you unzipped it). This will add all the controls to your toolbox.
Q: How do the toolkit controls work?
A: You need to understand they are not controls on their own. They are extenders that add Ajax functionality to existing controls. For example, the TextBoxWaterMarkExtender will add a watermark to a textbox control, such as below. When nothing is typed in the box, your message shows. For most of the controls, there are excellent free videos here. Watch a few and you will get the hang of it. Then start experimenting and be amazed!
zondag, februari 04, 2007
ASP.NET: Multilingual site
I've been going back and forth on whether I want to build a multilingual site. It is just so much more work. In the end, I decided to make the complete site capable of handling multiple languages. It will make a better, more accessible project on one hand, but take a lot more time on the other hand to complete it.
My reasoning is that especially anything that touches learning should be as close as possible to the learner, and preferably in his or her own language. One of the barriers to e-learning today is still the lack of non-English content for many topics.
DECISION: about2findout.com will be capable of handling multiple languages. During the beta, I will develop for English and Dutch only. Later on other languages might or might not be added, but at least the project will never have to be rewritten to support other languages in the future.
My reasoning is that especially anything that touches learning should be as close as possible to the learner, and preferably in his or her own language. One of the barriers to e-learning today is still the lack of non-English content for many topics.
DECISION: about2findout.com will be capable of handling multiple languages. During the beta, I will develop for English and Dutch only. Later on other languages might or might not be added, but at least the project will never have to be rewritten to support other languages in the future.
Labels: asp.net
Started programming
It's been longer than usual since I posted to this blog. The reason-slash-excuse is that I've started programming. It's going slower than I expected, and I've decided to take my time to get it right. After all, there are no project timelines, budgets or livehood dependencies involved in about2findout.com.
I'm using ASP.NET as you know, and the recently released Ajax add-on to it. So far the experience with Ajax has been quite good. The ASP.NET 2.0 Ajax Extension are a free download on the ajax.asp.net page and were released on 23th of January. So in the two weekend plus some evenings since, I've only managed to program the master template for the site. Not much, but I need to get the basics right first. It reminded me on the time I was programming the InStap software for Multitaal. I was in Lund (Sweden) at the time as an Erasmus exchange student. During my spare time I programmed and sometimes it would be past midnight before I knew it. Sometimes I would go to sleep thinking about a problem, start up my computer in the morning and finding a fix in just a few minutes. Those were the days :-).
Anyway, I'm not a programmer, nor do I have the ambition to be one. Just want to learn enough to make my project happening and want to do it right. I'm not an expert in GUI design, security, database, etc but I want to have an acceptable solution in all these areas. There has been a glitch along every step of the way so far in my programming experience. The learning curve is steep, but I find great help especially on the asp.net page, the ajax.asp.net page, the code project site and the blog of Scott Guthrie, one of the creators of the .net framework.
In the next posts I will share some of the technical programming experience so far. Some things have costed me a few hours to figure out, so I want to spare you that. :-)
PS: There is nothing new on the site yet, the mockup will stay until I have enough to upload.
I'm using ASP.NET as you know, and the recently released Ajax add-on to it. So far the experience with Ajax has been quite good. The ASP.NET 2.0 Ajax Extension are a free download on the ajax.asp.net page and were released on 23th of January. So in the two weekend plus some evenings since, I've only managed to program the master template for the site. Not much, but I need to get the basics right first. It reminded me on the time I was programming the InStap software for Multitaal. I was in Lund (Sweden) at the time as an Erasmus exchange student. During my spare time I programmed and sometimes it would be past midnight before I knew it. Sometimes I would go to sleep thinking about a problem, start up my computer in the morning and finding a fix in just a few minutes. Those were the days :-).
Anyway, I'm not a programmer, nor do I have the ambition to be one. Just want to learn enough to make my project happening and want to do it right. I'm not an expert in GUI design, security, database, etc but I want to have an acceptable solution in all these areas. There has been a glitch along every step of the way so far in my programming experience. The learning curve is steep, but I find great help especially on the asp.net page, the ajax.asp.net page, the code project site and the blog of Scott Guthrie, one of the creators of the .net framework.
In the next posts I will share some of the technical programming experience so far. Some things have costed me a few hours to figure out, so I want to spare you that. :-)
PS: There is nothing new on the site yet, the mockup will stay until I have enough to upload.
Labels: asp.net
zondag, januari 14, 2007
Ajax Rating Control
This weekend, I played with Ajax on my "toy" project 6C Quotes. More specifically, I added a star rating control to the site. You can see the differences for yourself:
- http://www.about2findout.com/6CQuotes/default.aspx is the 'normal' page
- http://www.about2findout.com/6CQuotes/defaultajax.aspx is the 'ajax' page
The quote (pink area) is now an autonomeous update panel. That means if you refresh the quote, only the pink square is refresed, and the rest of the page is not reloaded by a server round trip. That also means when you click the 'New Quote' button, you stay where you were on the page. The star rating control itself is part of the upcoming Microsoft ASP.NET Ajax Control Toolkit.
So what did I find out that I wanted to share?
- The start place for AJAX on an ASP.NET platform is the site http://ajax.asp.net . There are two parts you need do download and install. First of all the Ajax framework extention itself. This is the core functionality (codename ATLAS) made and supported by Microsoft. It is currently in release candidate 1 and will ship soon. Secondly the Ajax Control Toolkit. This is a set of ready-to-use controls that are built upon the framework and created by an open source community (so not Microsoft itself). It's a combination that seems to work.
- For the rating control and basic information on ajax on asp.net, have a look at the free video tutorials on asp.net (free) or on aspalliance.com (free registration). Highly recommended! I think they are made with Camtasia Studio, but I'm not sure.
- If you want to AJAX-enable existing asp.net applications, you need to add these lines in the web.config file (see attachment webconfigcode.txt)
- You also need to add the AjaxControlToolkit.dll in the \bin folder of your application. If your hosting provider hasn't installed the Ajax extentions on the server yet, you also need the core framework DLLs (System.Web.Extentions.dll) in that \bin folder.
- .PNG image files don't work in a transparant way in most browsers, so I chose some .GIF star images
- I couldn't figure out how to have a message 'Thank you for rating' without adding an extra button and adding a server round-trip. I don't want to add another button, users already need to click a lot.
- The System.Math.Round() function doesn't round properly, or at least not how I would like it to. (Which is how I learned it in school.) For example, it rounds 4.66 to 4. So I made my own rounding formula.
I want to use the Ajax controls on about2findout.com, so I need to play around with them. It's a slow start to implement one feature like star rating on an entire sunday, but I need to get the basics first. So far, Ajax seems a nice technology.
- http://www.about2findout.com/6CQuotes/default.aspx is the 'normal' page
- http://www.about2findout.com/6CQuotes/defaultajax.aspx is the 'ajax' page
The quote (pink area) is now an autonomeous update panel. That means if you refresh the quote, only the pink square is refresed, and the rest of the page is not reloaded by a server round trip. That also means when you click the 'New Quote' button, you stay where you were on the page. The star rating control itself is part of the upcoming Microsoft ASP.NET Ajax Control Toolkit.
So what did I find out that I wanted to share?
- The start place for AJAX on an ASP.NET platform is the site http://ajax.asp.net . There are two parts you need do download and install. First of all the Ajax framework extention itself. This is the core functionality (codename ATLAS) made and supported by Microsoft. It is currently in release candidate 1 and will ship soon. Secondly the Ajax Control Toolkit. This is a set of ready-to-use controls that are built upon the framework and created by an open source community (so not Microsoft itself). It's a combination that seems to work.
- For the rating control and basic information on ajax on asp.net, have a look at the free video tutorials on asp.net (free) or on aspalliance.com (free registration). Highly recommended! I think they are made with Camtasia Studio, but I'm not sure.
- If you want to AJAX-enable existing asp.net applications, you need to add these lines in the web.config file (see attachment webconfigcode.txt)
- You also need to add the AjaxControlToolkit.dll in the \bin folder of your application. If your hosting provider hasn't installed the Ajax extentions on the server yet, you also need the core framework DLLs (System.Web.Extentions.dll) in that \bin folder.
- .PNG image files don't work in a transparant way in most browsers, so I chose some .GIF star images
- I couldn't figure out how to have a message 'Thank you for rating' without adding an extra button and adding a server round-trip. I don't want to add another button, users already need to click a lot.
- The System.Math.Round() function doesn't round properly, or at least not how I would like it to. (Which is how I learned it in school.) For example, it rounds 4.66 to 4. So I made my own rounding formula.
I want to use the Ajax controls on about2findout.com, so I need to play around with them. It's a slow start to implement one feature like star rating on an entire sunday, but I need to get the basics first. So far, Ajax seems a nice technology.
woensdag, januari 10, 2007
CAPTCHA : to be (human) or not to be (human)
Over 90% of e-mail these days is spam. More than half of blog entries are also spam. Many forums or sites that allow commenting become victim of spam or inappropriate comments. Very often the spam is inserted automatically by bots. One way to fight bots is to check via CAPTCHA.
You have seen it before: the picture with a few characters that you need to type, for example when you sign up for an account or if you want to comment to this post on blogger. (Try it!) The idea is that software agents cannot recognise the characters within the picture.
I just added a CAPTCHA component to my experimental site about2findout.com/6CQuotes. From now on you can no longer suggest a new quote (which sends me a mail) without typing in the CAPTCHA 5-character code.
I've found this excellent CaptchaControl component on The Code Project. It's free to use.
What I learned in my little experiment:
- You can add a control to the Visual Studio toolbox by right-clicking the toolbox, selecting 'choose items...' from the drop down menu, clicking the Browse button and pointing to the DLL file of the provided component.
- You need to add the httphandler section in the web.config file of your application for the CaptchaControl to work. (as described in the CodeProject article or in provided example)
DECISION: I'm going to use CAPCHA on the about2findout.com site for login, setting up an account and posting comments.
You have seen it before: the picture with a few characters that you need to type, for example when you sign up for an account or if you want to comment to this post on blogger. (Try it!) The idea is that software agents cannot recognise the characters within the picture.I just added a CAPTCHA component to my experimental site about2findout.com/6CQuotes. From now on you can no longer suggest a new quote (which sends me a mail) without typing in the CAPTCHA 5-character code.
I've found this excellent CaptchaControl component on The Code Project. It's free to use.
What I learned in my little experiment:
- You can add a control to the Visual Studio toolbox by right-clicking the toolbox, selecting 'choose items...' from the drop down menu, clicking the Browse button and pointing to the DLL file of the provided component.
- You need to add the httphandler section in the web.config file of your application for the CaptchaControl to work. (as described in the CodeProject article or in provided example)
DECISION: I'm going to use CAPCHA on the about2findout.com site for login, setting up an account and posting comments.
Labels: 6C Quotes, asp.net, CAPTCHA
