Posts

Showing posts from September, 2003

Open maximised window (JavaScript)

The following will open a maximised window, with scrollbars, menubar, but no toolbar (only works with links to pages on the same site - ../folder/file.htm or /folder/file.html not http://www.google.com - Access denied error will occur): function showDocument(sDocURL){ var newwin = window.open(sDocURL,'newwin','scrollbars=yes,toolbar=no,menubar=yes'); newwin.window.moveTo(0,0); newwin.window.resizeTo(screen.availWidth,screen.availHeight); newwin.focus(); return false; } Call function as follows: <a href="../folder/file.htm" onclick="showDocument(this.href); return false">File</a> Will set focus on page and replace any existing page that was called in the same way.

Convert ASP page to Microsoft Word document

Insert the following at the top of an ASP page to convert it to a Word document (Word 97+ required on client desktop). It uses Microsoft Word's HTML parser to generate the page. JScript: <%@LANGUAGE="JSCRIPT" CODEPAGE="1252"%> <% Response.ContentType = "application/msword"; Response.AddHeader("Content-Disposition","attachment;filename=filename.doc"); %> VBScript: <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%> <% Response.ContentType = "application/msword" Response.AddHeader "Content-Disposition","attachment;filename=filename.doc" %> Note that only the text will be saved if you save the file to disk (i.e. images will not be downloaded and embedded into the document)

CSS Design

css Zen Garden: The Beauty in CSS Design site layouts done in CSS - all images that are displayed on the page are defined in the style sheet. It shows that you can add images to pages using nothing but CSS. Other CSS Sites: CSS Creator - added on 25/09/2003 Bluerobot Glish css/edge css-discuss - css mailing list house of style the noodle incident

Delete file (ASP)

Delete file using ASP JScript (pass filename on in form [hidden input called 'deletefile'] or QueryString [page.asp?deletefile=myfile.doc]): <% // delete file var oFSO = Server.CreateObject("Scripting.FileSystemObject"); // get path to file (relative to current document) sPathToFile = Server.MapPath("/path/to/upload/folder/"+Request("deletefile")); // if file exists, delete it if(oFSO.FileExists(sPathToFile)) oFSO.DeleteFile(sPathToFile) // file deleted %> Or using ASP VBScript <% ' delete file Dim oFSO, sPathToFile Set oFSO = Server.CreateObject("Scripting.FileSystemObject") ' get path to file (relative to current document) sPathToFile = Server.MapPath("/path/to/upload/folder/"&Request("deletefile")); ' if file exists, delete it If oFSO.FileExists(sPathToFile) Then oFSO.DeleteFile(sPathToFile) ' file deleted %> N.B. Folder must have modify permissions set for the Internet Gu...

Connect to Database (ASP)

The following connects to a database with ASP JScript: <% // create connection var oConn = Server.CreateObject("ADODB.Connection"); // open connection to database oConn.Open(CONNECTION_STRING); // generate SQL sSQL = "SELECT * FROM tablename"; // create recordset from SQL var oRS = oConn.Execute(sSQL); // work with recordset Response.Write(oRS("fieldname")); // close recordset and connection oRS.Close(); oConn.Close; %> And with ASP VBScript: <% Dim oConn, sSQL, oRS ' create connection Set oConn = Server.CreateObject("ADODB.Connection") ' open connection to database oConn.Open(CONNECTION_STRING) ' generate SQL sSQL = "SELECT * FROM tablename" ' create recordset from SQL Set oRS = oConn.Execute(sSQL) ' work with recordset Response.Write(oRS("fieldname")) ' close recordset and connection oRS.Close() Set oRS = Nothing oConn.Close() Set oConn = Nothing %>

Folder Size Browser program

Found this .NET program that shows folder sizes for the various drives in My Computer: Folder Size Browser program . .NET Framework Required Folder Size Shell Extension adds to the properties dialog of all folders the amount of space that is used up - this is good, but a standalone utility (i.e. running off a floppy disk) will also be good.

Blogging

Blogger sites Movable Type - uses Perl (needs hosting account with Perl support) Typepad - hosted service (not free) Blogspot - hosting for Blogger (free) EraBlog.NET - hosted service (free) Upsaid - hosted service (free) b2 - PHP and MySQL needed Nucleus - PHP and MySQL needed Drupal - PHP and MySQL, PostgreSQL or mSQL needed Blogging tools w.blogger - freeware blogBuddy - open source Radio Userland - not free (also offers hosting)

ASP.NET Forums / Groups

Some ASP.NET discussion groups: DevASP www.asp.net forums DotNet Forums Directory of Forums Newgroups (via Google) microsoft.public.dotnet.general microsoft.public.dotnet.csharp.general microsoft.public.dotnet.vb.general microsoft.public.dotnet.languages