Archive for the ‘Tech’ Category

Response.Write in ASP

Sunday, September 16th, 2007 | Programming, Tech

Changes are if you are using ASP you will sometime want to write in something into a page without going back into HTML. You can always open an IF then close the ASP script write in your HTML then open the ASP script up again and END IF. However this is not always practical.

When it’s needed

Some WYSIWYG editors will display little ASP icons where ASP scripts are and if you are using one page to house several pages of content then you will want it all to be inside the ASP script so that it doesn’t mess up and stretch the layout of your page.

However if you are opening and closing ASP scripts with HTML in between, all the HTML will display in between all these scripts and will be fully visible on your page rather than being contained in the little ASP script icon.

Another instance would be when you want your HTML content to be in a variable. Say if you wanted to use the same block of HTML script in two places or repeatedly say for a newsletter script then it would be easy if all the HTML was in a variable you could just include anywhere in your ASP script.

Being ASP ready

Most HTML tags will go in the basic format for Response Write in ASP fine as there are no limitations as its al contained within markers to show what is ASP script and what is the content you are setting as a variable. For example:

Response.Write("all the code goes here and its all contained in this area nicely")

The problem is that often in HTML, the quote mark is used. But using one of these ” in a response write ASP command will close the Response Write area and code will be left out and start causing all sorts of errors. For example:

Response.Write("<img src="somepath_is_outside_the_quotes"")

Quoting the problem

How do you contain these problems then? By removing or even adding quotes. The first option is to simply remove all the quotes or as many as you can. This means that it isn’t formatted correctly and W3C won’t be happy with you but they never are anyway ;). It will still work in the user’s browser at any rate.

<img src=somefile.gif width=100 height=200 border=0 />

This code appears fine, and it would display fine. This can then be put between the quotes in a Response Write tag in ASP. Problems do not end there though – what happens if your need spaces in a variable. There you couldn’t use the above tactic.

Spaces and doubles

Take a look at the following code. There may be better examples but this one works fine. Its an image with an ALT tag with some keywords in it.

<img src=somefile.gif border=0 alt="some keywords go here" />

There is a problem. The ALT tag has spaces in, so after some, the browser may think that everything beyond there is something else. And with good reason as we could replace keywords go here with width=50 and we wouldn’t want that to be part of the ALT tag.

The solution it to use double quotes.

<img src=somefile.gif border=0 alt=""some keywords go here"" />

This keeps the ASP code correct and adds a quote into the HTML when it is sent to the browser. It’s a bit longer and more code that usual but you can easily change all the ” to “” with a quick find and replace.

Using Request in ASP

Sunday, September 16th, 2007 | Programming, Tech

The request function, suprising requests a value. This could be a query string, form variable, or some other value. For example if you were at the following URL.

http://www.somepage.com/home.asp?ID=23

And you had a script as such.

Request.QueryString("ID")

The call would return the value 23.

An example of where this can be used is on the M World News channel. The news is stored dynamically in a databasde so when you click on a link to the full story from the news homepage you are taken to a dynamic page which selects the story based on the ID of the story you want passed to the page as a url variable. For example the link could be:

http://www.mworld.us/news/story.asp?ID=52

Examples of use:

Request.QueryString("SomeURLVariable")
Request.Form("SomeFormElement")
Request.Cookies("SomeCookie")

Hello World in ASP

Saturday, September 15th, 2007 | Programming, Tech

This is how to do a basic Hello, World! in ASP.

<html>
<head>
<title>Hello World in ASP</title>
</head>
<body>

<%
Response.Write("Hello, World!")
%>

</body>
</html>

There are two parts. The first is the Response, this tells the server that it needs to do something – to send something out as it were. The second part, in this case Write, is what it has to do.

ASP basics

Saturday, September 15th, 2007 | Programming, Tech

ASP code is added like scripts to HTML. You open an ASP script using the tag.

<%

You close it using the reverse.

%>

Therefore in a HTML page it would look like the following.

<html>
<head>
<title>Example script</title>
</head>
<body>

<%
' here is some ASP script
%>

</body>
</head>

Notice the use of a comment in the script.

<%
' This is an ASP comment
' Here is another
%>

Worfolk.org

Tuesday, August 21st, 2007 | Tech

Doing a random search I suddenly stumbled upon the fact that Worfolk.org was available for registration. Confirming that it was indeed available (I didn’t want to get my hopes up as someone has been sat on it for a while) I snapped it up with great pleasure. It’s currently just redirecting to Worfolk.biz but at least now it’s under my control.

Unfortunately there are still squatters sat on the .com and .net.

All my fonts have disappeared

Friday, August 17th, 2007 | Tech

I think I’ve finally found the reason why all my dialog boxes and default fonts on my laptop have started to look strange – I have 8 fonts left on my computer.

I thought it a little wierd when I went into PowerPoint today and I only had a very small choice of fonts. Then when opening up the source files for some posters I had done I was informed the fonts were missing by a different application. I checked the system folder which contains fonts and it looked fine. But when I tried to copy them to my desktop I got an error and all but 8 of them disappeared. Weird.

To be honest, I never thought I would really use the backups I made of my font files. OCD for the win.

iPod video first impressions

Tuesday, August 14th, 2007 | Reviews, Tech

I finally got round to replacing my MP3 player on Saturday getting an 80GB iPod video. As I have previously mentioned, I installed Rockbox on the device so I didn’t have to use iTunes and spent most of Saturday loading as much of my music collection onto it as I could fit.

So far it’s pretty good. It’s easy enough to use once I get used to it although I end up struggling to decide what to listen to :D. The interface is a bit small given the size of the screen and I haven’t worked out how to make it bigger yet (if indeed it is possible). Battery life is awful as expected, I have to charge it up every few days (or every day if in heavy yse) but I wasn’t expecting anything better from a rechargeable battery.

Every eternity feels like a moment

Thursday, August 9th, 2007 | Tech

I got out of work (well, on my break) yesterday to find a text from Maths Chris informing me the internet was now working! Looks like whatever UK Online got BT to do at the exchange has solved the problem.

The battle is far from over though. It’s still causing problems due to it all being in testing mode at the moment and therefore having multiple DHCP servers. Also UK Online were limiting us due to the testing so I may need to get that sorted out if they haven’t done it automatically.

I tried pinging the modem from home today and that didn’t work, nor did my remote administration attempts so I need to sort that. Also working out how the port forwards flow through the network to make sure the modem doesn’t get in the way of the router doing it’s job which is probably going to take quite a bit of testing.

Rockbox

Thursday, August 2nd, 2007 | Reviews, Tech

Continuing my research into what MP3 player to get, I am considering going with an iPod. The latest generation all seem to be video for which you can pick up a 30GB one for £150 or an 80GB for £215. I’m toying with the idea of going for the more expensive option as I would be able to fit lots more of my music collection on it though I only budgeted for £150 (ha, not that my budget even balances, it’s in a bad state as it is).

As I said in my previous post I can’t deal with iTunes or DRM or any of that crap. To get round that I would need to clear off the crap you get with the iPod and replace the firmware with Rockbox (as good as the site is, especially with the comparison and feature list, the Wikipedia article is perhaps a better read).

Rockbox Rockbox Rockbox

It’s an open source firmware ported to most of the popular MP3 players and plays Vorbis, FLAC, WAV and they are working on WMA as well as a tonne of cool features.

As for an in-car solution, my car doesn’t have any inputs (or outputs for that matter) which leaves me with the solutions of either radio transmission or stand-alone speakers (which I really don’t want to go with as it’s no way near the same) so I’m going to have to keep searching for a solution there.

The continuing saga of CCL

Tuesday, July 24th, 2007 | Tech

Yesterday my motherboard arrived back for my new server (which I ordered like two months ago). No information what they had done with it. They had closed by the time I got it yesterday so I phoned first thing this morning to find out if they had actually fixed it or not. They had tested it and found it to be faulty and so replaced it I was informed when speaking to them on the phone.

So I have just come to assemble it all back together. But something was missing. What you may ask? The CPU and the memory I left attached to the board (and clearly marked in my covering letter with the returns package I had left on for convenience of testing). They were not on the board nor had they been sent back with the rest of the packaging. Back to the phone.

I eventually find out that they are being shipping in a seperate delivery. I go online to track the order and find out they attempted to deliver it this morning but nobody was there so they left a card. I don’t have a card. Where did they try to deliver it to? Back on the phone to customer services. I spent 30 minutes on hold before being transfered to voice mail.

I ring back an hour later and finally get through to Alan. Yes, I’m now recognising names of the customer services team. He informs me it will be re-delivered tomorrow.