Friday, September 09, 2005

Handling gz2 file using linux

tar -xjf 'filename'

Passing variables using forms and sessions

The following are used for passing variables using forms.

 $_POST[]; $_GET[];

The next is for passing variables using a session variable…

$_SESSION[];

PHP Redirection

<?
//if IE then
if ($name = strstr ($HTTP_USER_AGENT, "MSIE"))
{
     Header ("Location: http://www.gohere.com/");
}
else
{
     Header ("Location: http://www.gothere.com/");
}
?>

Thursday, September 08, 2005

ASP.NET 2.0 Dynamically Fill Checkboxes on TreeView filled from XML

ASP.NET 2.0 Dynamically Fill Checkboxes on TreeView filled from XML

TreeView.Nodes.Count = 1 when filled by XMLDataSource.

Need to use the TreeNodeDataBound event. This fires EVERY time that a node on the tree is bound the the XML datasource.

Create a event handler.

protected void LoadCheckBoxes(object sender, TreeNodeEventArgs e){

if (event){
e.Node.Checked = true;
}


}

Monday, August 01, 2005

Javascript Breadcrumbs

Thanks to: http://webreference.com/js/scripts/breadcrumbs/

function breadcrumbs(){
sURL = new String;
bits = new Object;
var x = 0;
var stop = 0;
var output = "<a href=\"/\">Home</a> > ";
sURL = location.href;
sURL = sURL.slice(8,sURL.length);
chunkStart = sURL.indexOf("/");
sURL = sURL.slice(chunkStart+1,sURL.length)
while(!stop){
chunkStart = sURL.indexOf("/");
if (chunkStart != -1){
bits[x] = sURL.slice(0,chunkStart)
sURL = sURL.slice(chunkStart+1,sURL.length);
}else{
stop = 1;
}
x++;
}
for(var i in bits){
output += "<a href=\"";
for(y=1;y<x-i;y++){
output += "../";
}
output += bits[i] + "/\">" + bits[i] + "</a> > ";
}
document.write(output + document.title);
}

    

Wednesday, July 20, 2005

Webmaster Vs. Webslave... Webminion... etc.

Being a webmaster would lead one to believe that you are an expert in the black art of the web. You belong to the priesthood, you know-all, you perform magic, etc.

However, what are the people who do not fit in the above category called?

Web slaves?
Web minions?
Web undergraduates?
Web apprentices?

Tuesday, July 12, 2005

Unveiled: How to Create a Default 'Enter' Button!

Thanks to: http://www.developer.com/net/asp/article.php/1594521


This is one of those little code snippets you can pull your hair out trying to find. And no help file nor book I've come across actually gives reference to it. So, surely it can't be that important?
Imagine you've created an ASP.NET Web page with a search button. The user taps a phrase into a text box and presses Enter. On most regular Web pages (think: Google), the form would be submitted and the results returned. In other words, the search button is automatically "clicked" for you.


However on an ASP.NET Web page, pressing Enter resubmits the form to the server, but actually does nothing... which is pretty useless, really.
So, how do you set a default button to be clicked when the user presses Enter? Simply add the following line to your page's Load event, replacing "btnSearch" with the name of your button. It uses a hidden Page method called RegisterHiddenField and works splendidly:Page.RegisterHiddenField("__EVENTTARGET", "btnSearch")

adding javascript pop-ups to ASP.NET

Thanks to: http://www.developer.com/net/asp/article.php/1594521

Switch to the HTML view of your Web form and add the following immediately after the close of the tag:

Enter the code window behind your Web form and add the following underneath the Public Class and Inherits lines, which allows us to manipulate this control in code:

Protected WithEvents ltlAlert As System.Web.UI.WebControls.Literal

Sub Say(ByVal Message As String)
' Format string properly
Message = Message.Replace("'", "\'")
Message = Message.Replace(Convert.ToChar(10), "\n")
Message = Message.Replace(Convert.ToChar(13), "")
' Display as JavaScript alert
ltlAlert.Text = "alert('" & Message & "')"
End Sub

Friday, July 08, 2005

RSS --> HTML thanks to www.Bytescout.com

How to display RSS/XML news feed in ASP/ASP.NET using RSS2HTML.ASP script

This page provides quick guide for displaying of RSS/XML feed using free RSS2HTML ASP script in ASP or ASP.NET environment. This script can be used free of charge on any ASP or ASP.NET web-server and generate HTML from RSS feed.
This free ASP script uses MSXML to load RSS feed from URL and display it. You can use it standalone or call from script on HTML page to generate HTML content from RSS feed and then display on your HTML page.

You can download the source code of this example here: asp_rss2html.zip

Thursday, July 07, 2005

ASP.NET Alert Box on Error

INTRODUCTION

WebPage based applications display unhandled errors messages in ways which sometimes can be very confusing. A lot of technical information is displayed on the screen, which may annoy the users. Perhaps your applications handle the errors properly, but you can’t find a nice way to display them on the screen. This FAQ document shows how to display popup windows containing details about the error being handled or any other message you want to display....

http://www.vbcity.com/forums/faq.asp?fid=37&cat=Error+Handling