Wednesday 18 June 2008

ASP/AJAX - Notes

Learning ASP.Net, AJAX and CSS.
There are a number of ways to work with these features in Visual Studio.
For example, with CSS, it is possible to build a sheet by hand in notepad, but it is easier to add a sheet as a new item to a web project.




If you have an existing StyleSheet, it can also be dragged and dropped into the solution.
Elements can be added to the style sheet by hand, but it is easier to right click and choose "Build Style". That brings up this dialog:

You can add styles for Elements - standard HTML parts, or user defined names which need to go into Classes.

ASP.Net has a feature called master pages. If you have design features you want to show on all pages you add them to the master page, then when adding new pages you can select the master page you wish to apply. So you need only attach a style sheet to the master page and you can see the result of all design changes apply to all pages in the site.

Working with Master Pages.
To add a new aspx formto a project that references a master pages, go to Add Existing Item and choose Web Content Form. The next step will give you the oppourtunity to choose the master file to link too.

Friday 13 June 2008

Dotfuscator

Dotfuscator makes compiled .Net applications much harder to reverse compile.
For example, applications such as Reflector.exe, download here, make it possible to browse through the namespaces and classes in a compile .net application.
There is a cut down version of Dotfuscator included with Visual Studio.
However, on trying this with one of our executables it did not manage to output an application but threw up various errors. After Googling I found others that had the same problem had updated to the latest version.

I finally got Dotfuscator to work without a problem after doing the following:
1) Start Dotfuscator from All Programs\Visual Studio 2005\Visual Studio Tools\Dotfuscator and then following the options to Register
2) On registering I was emailed a user name and password that enabled me to log on to Dotfuscator's web site and download the latest community edition of Dotfuscator.
3) I installed this, then started Visual Studio with my project.
4) From the visual studio "Tools" menu I started Dotfuscator.
5) On the build tab I sent the temp and output directories, then clicked the build button. That was all there was to it. The resulting executable was slightly smaller that the original. On running it started throwing up error messages as I navigated around the app. On the rename tab there is an exclude option. By specifying certain parts of the application here, the error messages stopped.

So - careful and thorough testing would be required before releasing code.

Thursday 12 June 2008

Instruction at referenced memory xyzxyz at the memory could not be written.

This error occurred in a friend's PC running Windows XP Service Pack 2.

The error occurred frequently while running different applications and even in the background.


I also received a similar message about the memory could not be read.

There are a number of suggested answers to this problem kicking around the Internet.

I tried disabling DEP. This seemed to stop the "write" error messages but I still get "read" error messages. The system is slow, I have been told that networking does not work and that plug and play does not work I tried plugging in a USB key, and this took ages to install and detect.
I may have to use system restore.

I should test the physical memory first.
Download and write to CD the bootable ISO with Memtest86+ from Memtest.org
1) Try running Dial a fix - down load here
2) It could be a bios problem - check with the Sony website for specific information.

I ran the memory tests and it reported no problems.
I then ran chkdsk /F and it found problems it could not fix. Running this a couple of times before windows started did not help. I also found Event Viewer messages that showed problems accessing the hard drive. I am thinking that the hard drive is to blame and am going to replace it.

Tuesday 10 June 2008

JavaScript

JavaScript is a C based language. It is not strongly typed. It does support object orientation. It is a client side scripting language like VBscript.
The Wikipedia article on JavaScript is here.




METHODS
document.write("Testing");
window.alert("Test Message"); - displays a pop-up window.

Variables
Variables are not stongly typed.
This is an example of declaring them:
var x =0; //Declares variable and sets value to zero.
x="Hello"; //resets the same variable to a string value.
x=true; //Example of assigning a boolean value

FLOW CONTROL
Switch - similar to the case statement in VB.net
If
For.. Next
Loop

ASP.Net AJAX Elements

SERVER CONTROLS
  • ScriptManager - This is required in on all pages that use AJAX. It can also be used project wide, but it is recommended to be on a per page basis. This references Javascript libraries.
  • UpdatePanel - This controls parts of the page that will be updated independently without needing to use PostBack.

AJAX - what it is and other definitions

AJAX stands for Asynchronous Javascript and XML.

It involves several components including:
  1. DOM - Document Object Model. This is on the client side and is modified by JavaScript to dynamically change what the users sees.
  2. XMLHttpRequest - this send and receives data to/from the server in the background. This does not require the page to be reloaded as is the case with the traditional HTML Post method.
  3. XML - or other format, for sending data back to server. It does not have to be XML format.
---------------------------------------------------------------------------------------------
Mashup - Combine output from several sites - using their APIs
JavaScript - the only script supported by all the major browers. IE, Firefox, Opera, Safari. There are cicumstances where it may not be supported, for example, the user may have disabled JavaScript in their brower, or they could be using a mobile phone.

Visual Studio 2005: "Project type is not supported by this installation"

When trying to create new Web/Ajax project in Visual Studio 2005 received error message, "Project type is not supported by this installation ". This occurred even after reboot. I am not aware of anything that may have caused this problem to start occurring but this feature had previously worked.

The first fix I tried worked, which was installing Microsoft Visual Studio 2005 - Update to Support Web Application Projects.
This is available here:

The file name is: VS80-KB915364-X86-ENU.exe
This occurred on my office PC, running Windows XP.