Fungus1487 55 Posting Pro in Training

Hi Guys,

I have a gigabit switch which supports auto MDIX, is there any performance overhead using this feature to connect for instance a router to it via a patch cable rather than a crossover cable?

Help much appreciated.

Fungus1487 55 Posting Pro in Training

Hi Guys/Gals,

Setting up my home network (I am not a networking guru) and wanted your expert opinion on the best configuration for my hardware.

I have the following generalized pieces of gear...

  1. Gigabit Switch#1
  2. Gigabit Switch#2
  3. Wireless N Router Supporting Gigabit
  4. PC#1
  5. PC#2
  6. XBOX
  7. AV Receiver
  8. HTPC (Media Centre Running XBMC)
  9. NAS Drive (Main)
  10. NAS Drive (Backup)

They are physically separated as follows...

  • Room #1
    • Wireless N Router Supporting Gigabit
    • PC#1
    • PC#2
    • NAS Drive (Main)
    • NAS Drive (Backup)
  • Room #2
    • XBOX
    • AV Receiver
    • HTPC (Media Centre Running XBMC)

I logically have them seperated as follows...

  • Wireless N Router Supporting Gigabit
    • Gigabit Switch#1
      • PC#1
      • PC#2
      • NAS Drive (Main)
      • NAS Drive (Backup)
      • Gigabit Switch#2
        • XBOX
        • AV Receiver
        • HTPC (Media Centre Running XBMC)

Due to me stacking two switches am I limiting bandwidth from my HTPC directly to the router by having it pass through a second switch? My understanding on this is that when PC#1 and PC#2 are at full load on the network (e.g. reading from the NAS) and my HTPC accesses the internet it will only be allocated a 1/3 of the total gigabit allowed by the switch #1. Would a better option be to connect both switches directly to the router?

  • Wireless N Router Supporting Gigabit
    • Gigabit Switch#1
      • PC#1
      • PC#2
      • NAS Drive (Main)
      • NAS Drive (Backup)
    • Gigabit Switch#2
      • XBOX
      • AV Receiver
      • HTPC (Media Centre Running XBMC)
Fungus1487 55 Posting Pro in Training

I replied to your personal message, but to clarify I made a "boo boo" in the above code listing (Context change from C# to VB.Net produced a nice schoolboy error :D)

Anyway the above code listing should look like the following for generic types in VB.Net

Public anscapp As New List(Of Double)
Fungus1487 55 Posting Pro in Training

If you just want to keep remembering values then use a List as it dynamically resizes for you.

Public anscapp As New List<Double>()

Then you can add elements like so...

anscapp.Add(Double.Parse(Combocapp.Text) * 2.35);
Fungus1487 55 Posting Pro in Training

You want to use the following...

var session = <%=Session["username"] != null ? "true" : "false"%>;

Now for as to why you would want to do this is beyond me? If you can check this when the page is being processed on the server you can simply force a redirect like the following...

if(Session["username"] == null) {
    Response.Redirect("login.aspx", true);
}

But i'm assuming this is also not what your after. If you want to check the users session is valid repeatedly e.g every 30 seconds then neither of those methods will work.

The reason being is that once the server has sent the page to the user the session check is calculated and hard-coded into the JavaScript. It will NOT be re-assessed everytime you call the javascript method as it is static.

To perform this you will need two steps, the first is to setup a page to return a flag indicating whether a users session is valid and secondly perform an asynchronous request to fetch the users session state.

First of all create a page e.g. SessionCheck.aspx and add the following...

{"valid":<%=Session["username"] != null ? "true" : "false" %>}

Secondly add the following script to your existing page...

function checkSession() {
    var request = false;

    if(window.XMLHttpRequest) { // Mozilla/Safari
        request = new XMLHttpRequest();
    } else if(window.ActiveXObject) { // IE
        request = new ActiveXObject("Microsoft.XMLHTTP");
    }
    request.open('POST', 'SessionCheck.aspx', true);
    request.onreadystatechange = function() {
        if(request.readyState == 4) {
            var session = eval('(' + request.responseText + …
Fungus1487 55 Posting Pro in Training

Also the script tag should be written as...

<script type="text/javascript"> ... </script>

The attribute language has been deprecated a while now.

Fungus1487 55 Posting Pro in Training

Try using the new HTML5 attribute placeholder, this will only work in modern browsers.

<input type="text" name="myinput" placeholder="enter something" />
Fungus1487 55 Posting Pro in Training

I believe so, I just wonder if there are any circumstances where Microsoft Word will not create the ~$ prefixed system file.

Fungus1487 55 Posting Pro in Training

Well could you not perform the following...

Dim workbook As String = "C:\MyWorkBook.xls"
Dim isOpen As Boolean

' The method should try to open your workbook, if failure then return true
isOpen = CheckIsWorkbookOpen()

While isOpen
  Interaction.GetObject(workbook).close(False)

  ' Force garbage collection
  GC.Collect()

  ' Check if workbook can be opened again
  isOpen = CheckIsWorkbookOpen()
End While

' Eurika! The loop has completed, the workbook must be closed

This way you keep closing any remaining instances that are open until you hit the jackpot.

And to be honest if the guy wanted to give his management team advice he probably wouldn't have posted to the VB.Net DaniWeb forum.

Fungus1487 55 Posting Pro in Training

You will need to check the exact instance name under the processes tab in task manager, it will be something like EXCEL.exe

As with your posted code there is no way to cast from a Process to an Application instance. The Workbook is a wrapper around the api calls required to talk to excel whilst the Process is just a pointer that an Application is in memory.

I'm afraid I have had little success finding any way to connect to an already open instance of Excel.

You may be able to use Interaction.GetObject to return instances of excel that are open but I'm afraid it looks as though it is quite random to which instance you will return.

Fungus1487 55 Posting Pro in Training

Nope. A process is just a pointer. Same as your processes tab in task manager.

There may be a way using the process Id to connect to live instances of excel. Ill take a quick look.

Fungus1487 55 Posting Pro in Training

Hi all.

I have a requirement to collect a bitmap image directly from a given AVI file.
Does anyone know of any decent .Net only libraries that by any chance can achieve this?

I would like to avoid any COM interops if possible but if you have had experience using any in a .Net environment which worked well I am open to suggestion.

I have given DirectShow a go and while it works, it seems pretty cumbersome to for what I am trying to achieve.

Thanks

Fungus1487 55 Posting Pro in Training

A simpler approach would be to iterate through all the comboboxes on your form (or control that holds combo boxes e.g. a Panel), build up a collection of these comboboxes then compare them accordingly. The following code contains two methods, AreSelectedComboBoxValuesDuplicated and GetComboBoxes.

GetComboBoxes does exactly what it says on the tin and gets a controls child combobox controls, it is recursive so it will check within the controls child controls and within their controls etc.

Once we have this list of combo boxes we can then check to see if any contain the same value. AreSelectedComboBoxValuesDuplicated simply loops through all combo boxes we have found and compares each found combobox against all the others, the search IS case sensitive. The method will then return a flag indicating whether any values were duplicated or not.

Private Function AreSelectedComboBoxValuesDuplicated(parent As Control) As Boolean
        ' Get all combo boxes
	Dim comboBoxes As IList(Of ComboBox) = GetComboBoxes(parent)
	For i As Int32 = 0 To comboBoxes.Count - 1
                ' Get current combobox
		Dim comboBox As ComboBox = comboBoxes(i)
		For k As Int32 = 0 To comboBoxes.Count - 1
			If k <> i Then
                                ' If the combobox to compare to is not the same one then check value
				If [String].Compare(comboBox.Text, comboBoxes(k).Text, False) = 0 Then
					Return True
				End If
			End If
		Next
	Next
	Return False
End Function

Private Function GetComboBoxes(parent As Control) As IList(Of ComboBox)
	Dim comboBoxes As IList(Of ComboBox) = New List(Of ComboBox)()
	For Each child As Control In parent.Controls …
Fungus1487 55 Posting Pro in Training

Just out of curiosity why would you want to do this?

You can change your theme programmatically by changing the registry values found at...

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes

Fungus1487 55 Posting Pro in Training

Im not sure you will be able to check if excel has a specific file open but you could easily close all Excel instances from your application with something along the lines of.

Dim instances() As Process = Process.GetProcessesByName("EXCEL.EXE")
For Each instance As System.Diagnostics.Process In instances
	instance.Kill()
Next

Note that this will close ALL instances of excel that are open.
You could always prompt the user to make sure they want to do this before hand as well as first check if you can open the file and only close all excel instances if opening fails.

Fungus1487 55 Posting Pro in Training

This should do the trick

// Split the values by comma
String[] values = "a,b,c,d,-,,e,f".Split(',');

// Create a new list to hold filtered content
List<String> filtered = new List<String>();

// Create regex to check each value
Regex reg = new Regex(@"^[a-zA-Z]+$", RegexOptions.IgnoreCase);

// Loop through values
foreach(String value in values)
{
    // Check if value is valid
    if(reg.Match(value))
    {
        // If value is valid then add to list
        filtered.Add(value);
    }
}

// Convert list back to values array if you need it in an array
values = filtered.ToArray();
Fungus1487 55 Posting Pro in Training

tonymuilenburg has it right, spawn another thread to do the work then show the dialog to continue with whatever logic you require.

Fungus1487 55 Posting Pro in Training

This is an old thread but the principle is the same for an image.

First of all get yourself an animated gif.

Then change the above code to look something like..

function callAHAH(url, pageElement, errorMessage) {
    $(pageElement).html('<img src="yourimage.gif" />').load(url, function(responseText, textStatus, XMLHttpRequest) {
        if(textStatus == "error") {
            $(this).text(errorMessage);
        }
    });
}

Just change the 'yourimage.gif' to the path of your animated gif

Fungus1487 55 Posting Pro in Training

I have changed my original code to work only by calculating the sum of rows that have 'Donation $' in the first column.

var trs = document.getElementById('cbtf_24').getElementsByTagName('tr');
var sum = 0;
for(var i = 0; i < trs.length; i ++) {
    if(trs[i].childNode[1].className == 'fieldCell') {
        var lbl = trs[i].getElementsByTagName('label')[0].innerHTML;
        if(lbl.indexOf('Donation $') !== -1) {
            sum += isNaN(trs[i].childNode[1].innerHTML) ? 0 : parseInt(trs[i].childNode[1].innerHTML);
        }
    }
}
document.getElementById('cbtf_24').innerHTML += '<tr> <td> Total </td> <td> ' + sum + ' </td> </tr>';
Fungus1487 55 Posting Pro in Training

Hi there, I agree with everyones comments including creating functions for re-usability yadda yadda yadda, BUT the kid asked how to total up a table using just DHTML.

Here is the revised code to not add the Check Number rows to the sum.

var trs = document.getElementById('cbtf_24').getElementsByTagName('tr');
var sum = 0;

// Loop through each row
for(var k = 0; k < trs.length; k ++) {
    var tds = trs[k].getElementsByTagName('td');
    var lbl = tds[0].getElementsByTagName('label')[0].innerHTML;

    // Check the first column does not contain the word Check Number
    if(lbl.indexOf('Check Number') == -1) {
        sum += isNaN(tds[1].innerHTML) ? 0 : parseInt(tds[1].innerHTML);
    }
}

document.getElementById('cbtf_24').innerHTML += '<tr> <td> ' + sum + '</td> <td> total</td> </tr> ';
Fungus1487 55 Posting Pro in Training

As a side to this its great to learn from the ground up but save yourself some time and use a javascript library. jQuery (and many others) can achieve what you are trying to do in 5 lines.

function callAHAH(url, pageElement, errorMessage) {
    $(pageElement).load(url, function(responseText, textStatus, XMLHttpRequest) {
        if(textStatus == "error") {
            $(this).text(errorMessage);
        }
    }).text('Loading...');
}
Fungus1487 55 Posting Pro in Training

Having used jQuery alot and spry very little I am perhaps biased towards jQuery but from what I have seen and used, Spry seems to be Adobe's play on providing rich "widgets" or controls via javascript whilst they are very good as you have said...

everything that the instructor did with jQuery was very similar to other videos that I have seen discussing Spry

jQuery in a nutshell is more robust than Spry as an API for client side web development as it not only caters for some UI components (some you will still need to create) using jQuery UI but covers the bases of what older libraries such as dojo achieved, also at this moment jQuery has a more active community.

Fungus1487 55 Posting Pro in Training

Below is code i wrote as a wrapper for the microsoft office interops. It provides ways to establish the instance of the application and cleanup any remaining office processes after use.

Note the class I use is alot bigger but i have added the basics as a starting point.

This class is intended to be built upon and simply makes sure you do not leave several office instances open on a machine. which commonly can happen when doing this for the first time.

Fungus1487 55 Posting Pro in Training

I browsed google and found nothing so thought i would put my efforts up here.
hope this all helps.

this function will allow you to return the number of days between two dates minus saturdays and sundays. (including the start date)

Fungus1487 55 Posting Pro in Training

This is a very brief overview of how to achieve an ON-THE-FLY creation of an appointment in the clients outlook calendar. This will not force the user to add it to there calendar but gives them the option to add it automated. Using the older .vcs file extension for outlook we can add an appointment easily by creating this document and letting hte user open it via the web. I have used the .vcs extension as it is compatible with older versions of outlook (mine being 2002) and not just 2007 +

Fungus1487 55 Posting Pro in Training

below is a very simple encryption class which shows how to encrypt sensitive data (very simply) this example converts a string to hexadecimal form and back again with some simple error handling. please leave some feedback if you find this useful

Fungus1487 55 Posting Pro in Training

Theres no doubting that using Java Swing is time consuming on load times. So heres a demo splash screen to keep your users captivated.

You will need two classes for this example

i.e. Splash.java and SplashWindow.java

(remember line: 8 change this to match your splash image)

just change the class name to match your entry class and bobs your uncle.


Hope this has helped.... remotely

Fungus1487 55 Posting Pro in Training

No problem, if your all sorted you can mark the thread as solved.

Fungus1487 55 Posting Pro in Training

Hello All,

I haven't posted a question in sometime, im hoping this is where all my previous help pays off :P

Basically starting a newish project which must be written in VB.Net (great) but I am implementing the MVC pattern pretty much throughout the entire project as there is a requirement that after the initial project is done the underlying structure (model) will be replaced with one of our own building.

So having not much related to the above I have a question or i suppose more of a debate of how to implement MVC using events or interfaces. A simple example below shows what I mean.

I have a class which holds data (model)

Public Class DataClass

    Private _name As String

    Public Property Name() As String
        Get
            return Me._name
        End Get
        Set(ByVal value As String)
            Me._name = value
        End Set
    End Property

End Class

My form (view) obviously updates according to the data held in this class. In this case the "Name" property. But I understand I can use any of the following two methods attach listeners using the Observer Pattern.

' ###
' Example 1: Interface (The way I would program with Java)

Public Interface IDataClassListener

    Sub OnNameChange(ByVal d As DataClass)

End Interface

Public Class DataClass

    ' Add a list of listeners for this object
    Private _listeners As New List(Of IDataClassListener)
    Private _name As String

    Public Property Name() As String
        Get
            return Me._name
        End Get
        Set(ByVal value As String)
            Me._name = value …
Fungus1487 55 Posting Pro in Training

Yes I believe you could, sadly I have never worked with it so I cant offer any help

Fungus1487 55 Posting Pro in Training

1. Don't use ID like you do. ID's are meant to be unique but your first section use "qa1" and "qa2" twice in both anchors and is then used in the divs as part of the second section.

2. You dont need the "OnClick" attribute if using jQuery (it is not recommended practice)

3. The easiest way would be to change your anchors id to different attributes (perhaps your own) or seeing as you are using the id in the href attribute use that instead e.g.

<div id="mainq" style="padding:10px;" class="mainq"><a name="top"></a>
    <h3>Payment and Billing.</h3><br />
    <a href="#aq1">What is water?</a><br />
    <a href="#aq2">What is copper?</a><br />
    <h3>Payment and Billing.</h3><br />
    <a href="#aq1">What is water?</a><br />
    <a href="#aq2">What is copper?</a><br />
</div>

And then change your JavaScript to read...

<script type="text/javascript">
    $(function() {
        $('#mainq a').click(function() {
            var id = $(this).attr('href');
            $(id).highlightFade({speed:2000});
        });
    });
</script>

With the above code you then seperate the actual javascript from the page view. I have changed your id variable to get the href attribute which would be '#qa1' or '#qa2' and then it finds this element using another jQuery selector $(id).

Hope this helps

Fungus1487 55 Posting Pro in Training

you would need some form of server side language to dynamically create a folder/file listing in html using php, asp.net or other.

Fungus1487 55 Posting Pro in Training

You will need to randomly generate numbers and check that they have not already been displayed. The below does this by continuosly looping until it has found the total range of values. Each loop generates a new number then checks if it exists in the array. If not the new value is appended and output to the screen.

var arrayContains = function(array, value) {
    for(var i in array) {
        if(array[i] == value) { return true; }
    }
    return false;
};

var found = [];
var range = 4; // 0 - 4
while(found.length < range) {
    var num = Math.floor(Math.random() * (range + 1));
    // If it is new then add it and print it
    if(!arrayContains(found, num)) {
        found[found.length] = num;
        document.writeln(num);
    }
}
Fungus1487 55 Posting Pro in Training

javascript is especially useful serverside, where ASP.NET is absolutely weak... ;) from this point on you can guess my answer. Or maybe we wouldn't need servers in the future...

Are you saying that javascript is useful serverside? Or is it intended to be sarcastic, i hope so!

I agree with sedgey about the hosting but any dynamically data driven site; daniweb, msdn, facebook, google etc. could not be entirely JavaScript this is a useless comparison as they require server side code be it ASP.Net, ASP, PHP etc. to perform some heavy lifting of data to output content to a page.

Fungus1487 55 Posting Pro in Training

it is very hard for a developer on any platform to break through on any freelance website, most projects get underbid and legit projects usually require the developer to have several samples to show a client before they will even consider you. That said, good luck but I would work on perhaps pulling together some sort of portfolio or showcase, perhaps even doing some work very cheaply or free so you have some public facing exposure.

Fungus1487 55 Posting Pro in Training

I mean in a form that i make in Html, i need to check that the user name name value doesn't contain the first name of the person.
so what You wrote instead of the 3rd line(replacing by) I can write return s; ? It's in a function...
so the ".contains" works on javascript?
awesome!
thanks :D

i think you mis interpreted my response then to check if a string contains a string in javascript you want the following.

function stringContains(string, value) {
    // To make this case insensitive comment out the following 2 lines
    // string = string.toLowerCase();
    // value = value.toLowerCase();
    return string.indexOf(value);
}

// Then call it with the following
var g = 'ZOMGGGG';
var s = stringContains(g, 'GGGG');
Fungus1487 55 Posting Pro in Training

you cant directly as they are two seperate languages. you could output content to the page using a script block somthign like the following

string g = "ZOMGGGG";
bool s = g.contains("GGGG");
Response.Write("<script type=\"text/javascript\">alert('" + s + "');</script>");
Fungus1487 55 Posting Pro in Training

marjaan_m

at first glance it looks like your this line is wrong
give the full path and then try
e.g if you are at localhost then

http://localhost/xyz/functions/travellerdetail.php

obj_t.open("GET","functions/travellerdetail.php?tid="+id,true);

it does not require a full URL but give it a try anyway.

Does the page POST BACK?
This might happen cuz you have not specified '#' in the href property of the anchor tag

Fungus1487 55 Posting Pro in Training

so does it still do this with my example ?

Fungus1487 55 Posting Pro in Training

First of all if the document is (X)Html then your link tag needs to be closed.

<link rel="stylesheet" type="text/css" href="stylesheet/style.css">

should be

<link rel="stylesheet" type="text/css" href="stylesheet/style.css" />

Secondly the script tag REQUIRES you to specify its type.

<script>

should be

<script type="text/javascript">

You also need a closing </body> and </html> tag at the end of the document. Ive taken your script and reformatted it, try the following.

<?
	include "functions/mysql.php";
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>Find Travellers</title>
    <link rel="stylesheet" type="text/css" href="stylesheet/style.css" />
    <script language="javascript" type="text/javascript">
        function createXmlHttpRequest() {
            var x;
            try {
                x = new XMLHttpRequest();
            } catch(ex) {
                try {
                    x = new ActiveXObject("Msxml2.XMLHTTP");
                } catch(ex2) {
                    try {
                        x = new ActiveXObject("Microsoft.XMLHTTP");
                    } catch(ex3) {
                        x = false;
                    }
                }
            }
            if(x) { return x; } else { return false; }
        }

        function showdetail(tid) {
            var xmlHttp = createXmlHttpRequest();
            if(xmlHttp) {
                xmlHttp.onreadystatechange = function() {
                    if(xmlHttp.readyState === 4) {
                        var data = xmlHttp.responseText;
                        var dv = document.getElementById('tdetail');
                        dv.innerHTML = data;
                    }
                };
                xmlHttp.open('GET', 'functions/travellerdetail.php?tid=' + id, true);
                xmlHttp.send(null);
            }
            return false;
        }
    </script>
  </head>
  <body>
    <table>
      <tr>
        <td>
          <?$Q = mysql_query("select * from travellers where t_type = 'air'");?>
          <div id="byair">
            <?
              while($R = mysql_fetch_array($Q)) {
            ?>
            <br />
            <a href="#" class="tlink" onclick="return showdetail(<? echo $R["t_id"]; ?>)" id="<? echo $R["t_id"]; ?>" name="<? echo $R["t_name"]; ?>"><? echo $R["t_name"]; ?></a>
          <? } ?>
        </div>
      </td>
    </tr>
    <tr>
       <td> 
         <div id="tdetail"></div>
        </td>
      </tr>
    </table>
  </body>
</html>
Fungus1487 55 Posting Pro in Training

you would do the following. Hope it helps.

<html>
    <head>
    </head>
    <body>
        <table id="countit">
            <tr>
                <td class="count-me">12</td>
                <td>Some value</td>
            </tr>
            <tr>
                <td class="count-me">2</td>
                <td>Some value</td>
            </tr>
            <tr>
                <td class="count-me">17</td>
                <td>Some value</td>
            </tr>
        </table>
        <script language="javascript" type="text/javascript">
            var tds = document.getElementById('countit').getElementsByTagName('td');
            var sum = 0;
            for(var i = 0; i < tds.length; i ++) {
                if(tds[i].className == 'count-me') {
                    sum += isNaN(tds[i].innerHTML) ? 0 : parseInt(tds[i].innerHTML);
                }
            }
            document.getElementById('countit').innerHTML += '<tr><td>' + sum + '</td><td>total</td></tr>';
        </script>
    </body>
</html>
Fungus1487 55 Posting Pro in Training

seems fine but a tip is dont use document.writeln.
try having a content area in the page e.g. a "<div>" then give this element and ID and set its innerHTML property to the text you want.

document.getElementById('someelement').innerHTML += 'your text';
Fungus1487 55 Posting Pro in Training

you have alerted the 'obj_t.responseText' value and it definately is returning text ? Also do you have an element in the page with ID 'tdetail'. If so can you post your pages HTML as there may be a problem elsewhere

Fungus1487 55 Posting Pro in Training

This should be in the JavaScript forum but from looking at your code quickly it seems ok but you need to make sure the browser your using supports creating your XMLHttpRequest object like you do. The following code is taken from a project of mine which I know works feel free to try it out and see if its working in place of your code.

var createXmlHttpRequest = function() {
    var x;
    try {
        x = new XMLHttpRequest();
    } catch(ex) {
        try {
            x = new ActiveXObject("Msxml2.XMLHTTP");
        } catch(ex2) {
            try {
                x = new ActiveXObject("Microsoft.XMLHTTP");
            } catch(ex3) {
                x = false;
            }
        }
    }
    if(x) { return x; } else { return false; }
};
	
var createUniqueUrl = function(url) {
    return url + (url.indexOf('?') !== -1 ? '' : '?') + '&$=' + new Date().getTime();
};

var ajax = function(url, id) {
    var xmlHttp = createXmlHttpRequest();
    if(xmlHttp) {
        xmlHttp.onreadystatechange = function() {
            if(xmlHttp.readyState === 4) {
                var data = xmlHttp.responseText;
            }
        };
        url = createUniqueUrl(url + '?id=' + id);
        xmlHttp.open('GET', url, true);
        xmlHttp.send(null);
    }
};
Fungus1487 55 Posting Pro in Training

why use javascript for this ? CSS is perfectly capable of doing this without the scripting overhead.

/* Example changing a td elements background colour */
td {
    background-color:transparent;
}
td:hover {
    background-color:yellow;
}

/* Example changing a div's background image */
div {
    background:transparent url('some_image.jpg');
}
div:hover {
    background:transparent url('another_image.jpg');
}
Fungus1487 55 Posting Pro in Training

just add a function to the onload method of the document this will fire when the page has finished loading all external content. You can use this then to hide your gif after the page is done.

<html>
    <head>
    <script language="javascript" type="text/javascript">
        function hideLoading() {
            document.getElementById('loadingMessage').style.display = 'none';
        }
    </script>
    </head>
    <body onload="hideLoading();">
        <div id="loadingMessage">
            <img src="loading_image.gif" />
        </div>
        <img src="your_massive_image.jpg" />
    </body>
</html>
Fungus1487 55 Posting Pro in Training

you wouldnt want to put a value through all them methods in fact doing so would counteract some of the methods used e.g.

$value = "abc '123'";
$value = addslashes($value);
$value = stripslashes($value);

the previous would return the same string not performing any validation at all.

From experience all i have ever required to validate values before using them in potentially unsafe areas such as sql strings is the following.

function makeVarSqlReady($value) {
    if(get_magic_quotes_gpc()) {
        $value = stripslashes($value);
    }
    return mysql_real_escape_string($value);
}

// Example usage

$input = $_POST['somevalue'];
$input = makeVarSqlReady($input);
$sql = "SELECT * FROM table WHERE field = '$input'";

obviously other validation is required for the given circumstance e.g. if the value is meant to be numeric you would check it using "is_numeric" etc.

Fungus1487 55 Posting Pro in Training

why not just use an ID

document.getElementById('myDiv').style.background = 'url(' + url + ')';

if your deperate to use classes and write your own code you will have to perform something like so

var divs = document.getElementsByTagName('div');
var url = document.getElementById('textbox').value;
for(var i = 0; i < divs.length; i ++) {
    if(divs[i].classname == 'dc m1_t') {
        divs[i].style.background = 'url(' + url + ')';
        break;
    }
}
Fungus1487 55 Posting Pro in Training

use a javascript library with CSS selectors such as jQuery. You can then perform a css selector query to get the node your after. Example

$('.dc').filter('.m1_pad').css('background-image', 'url(' + url + ')');

There are many other very good CSS based javascript libraries

Fungus1487 55 Posting Pro in Training

im guessing you mean the built in treeview control? in short no although you could have a fiddle with the CSS that is generated in the background. I would warn against using it though as having tried to use it in previous projects it is very slow, cumbersome and if you have anywhere near verging on 100 nodes or more will probably kill your viewstate.

That said if you have no qualms with using a javascript treeview (on the client) try the Yahoo UI library.