MattEvans 473 Veteran Poster Team Colleague Featured Poster

I'm not suprised that you're finding it hard to get hold of Maya 4.0, it's pretty ancient. What kind of plugin is the one you need? Is it one of those Maya pseudo-dlls or a MEL script? If it's a MEL script then you can look right at the plugin source and probably fix it up for a later Maya version; if not, you may have a problem. Have you tried the plugin with a more current Maya version? Maya PLE is free for non-commercial use; theres no harm in downloading it just to check if the plugin works or not...

Overall, I'd suggest migrating to an new engine... Working with a now-unsupported engine is guaranteed to be a source of pitfalls..

MattEvans 473 Veteran Poster Team Colleague Featured Poster

That's a horrible way to influence the page dynamically. Don't 'print' HTML into an already-opened page in that way, i.e. never use document.write( ) unless its only to influence the first page render ( and even then, there are better alternatives ).

Instead, maintain the x and y position of the token within the script ( e.g. use 2 global JS variables ), and use a single element ( any visual element [div,img,span,etc] ) to represent the token. Assign it a constant ( fixed ) style that sets position:absolute; . Then use calls like: thetoken.style.top = ...; where 'thetoken' is the element you used for the token ( use DHTML/document.getElementID( ) to obtain a reference to it ).

If you're only moving things around occasionally ( i.e. a board game ) then Javascript/CSS/HTML will work fine, but if you want performant interactive movement; alternatives include Flash, among others..

MattEvans 473 Veteran Poster Team Colleague Featured Poster

You can't stop the right click action in a plain XML file. On some browsers, you can prevent the right click action in an HTML file, because an HTML file is allowed to run javascript, which is allowed to intercept the right click ( as you've surely discovered ). If you're displaying plain XML, you can't usually run javascript in the same frame.

However, if you don't mind learning XSLT, you can add a client-side XSL transform directive to the plain XML file, and have the transformation add javascript and alternate HTML rendering to the plain XML. In that way, you can get Javascript in the same frame as the XML. So in a given browser ( one that supports oncontextmenu ), you can stop the user getting a right-click menu in an XML file; if you don't mind learning/doing what I just suggested. ( Not all browsers support client side XSL, although IE6+ and Firefox 2+ certainly do ). Depending on how you want the XML displayed, that may not be appropriate.

You can't stop View Source, regardless! Even if you hide the toolbar of a frame using a popup/inner frame and successfully manage to disable right-click, there could be a hotkey bound to View Source, and blocking right-click only ever works with JS enabled, and on certain browsers. ( The Opera browser for e.g. makes it very easy to selectively ignore one page's Javascript temporarily, so it's not like a user has to go to any …

MattEvans 473 Veteran Poster Team Colleague Featured Poster

The first meta tag in that page is in the wrong place... move it to be inside the head section. Try validating the code aswel, correct any errors and see if it still has a problem.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Yeah, it's just faking it. The little yellow alert region is simply a CSS styled div element. It works on all browsers, and looks quite out-of-place in Opera :D.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Designers need to know that the stuff they throw at the programmers is feasible. That means they need to be able to make more than just pretty head-in-the-sky designs, but workable designs. It's the same in every multimedia field. The designers need to know what they can and can't do subject to the project/product actually being ready on time, and for that they need a little knowledge about capabilities. This is especially true in web development, since you just can't do some seemingly simple things that work in 'real' applications with web applications. Keep the two separate to your own detriment. Programmers who know better are the ones that don't always say 'yeah, we can do that'..

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Have you tried setting height:100% to the body and html element? CSS:

html,body{
  height:100%;
}

This should allow you to make content stretch when it's "too short" to fill the page ( anything height:100% in the page should fill up the height of the page, which shouldn't ever be smaller than the height of the window ). It wont work the other way though ( it wont shrink large content to fill a small page ). Also wont work everywhere, particularly in ancient browsers that dont have any grip of CSS, but these browsers tend to have this behaviour automatically..

MattEvans 473 Veteran Poster Team Colleague Featured Poster

It's not a kludge to have an outer style affect the list ( including the bullets/numbers ) and have an inner style affect the content of items themselves. Use 'relative' styles if possible , e.g use font-size: 80%; on the outside, font-size: 125%; on the inside. If you have no way to speak 'relatively' e.g. if you're setting font-face for the list and want to restore it within items; plan this from the beginning and make style selectors that summarize and apply properties to the 'outer' body text, and text inside list items. Then use deep, more specific selectors to affect certain lists and their outer areas differently, etc, etc. You may find that it becomes quite less of a problem than you imagine it may be.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

That image is an 8-bit per pixel PNG, and 8bpp PNGs can only contain 1 bit transparency ( a pixel is either fully opaque, or fully transparent ). With higher bpp PNGs, you're allowed to use alpha translucency ( a pixel can be 25%, 50%, 68%, etc transparent ). Microsoft IE versions have been OK with the transparency in 8bpp PNGs for some time, but not with the translucency in 32 bpp PNGs.

To solve... make sure you dont use translucency ( only transparency ), and save as 8bpp PNG to force 1-bit transparency.

See two attached images. They both work nicely on my browser ( Opera ), but I would imagine that only the 8bpp has a transparent background in IE ( especially IE6 or earlier ).

shmay commented: Awesome, thank you. My picture is now transparent in IE. Unfortunately it looks like complete ass now. stupid IE. +3
MattEvans 473 Veteran Poster Team Colleague Featured Poster

If the mouse is locked, how do you click again to unlock it?

What do you mean exactly by 'locked'? I took that to mean disabled/no longer functional.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

This is Java code not Javascript code; the languages are entirely different.

The thread has been moved to the Java forum.

On another note, you're more likely to get help with the problem if you explain the problem briefly -- rather than just posting a block of code and expecting others to actually find the problem aswel.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

No. No sane browser / OS setup will let a webpage 'lock the keyboard or mouse'. Think for 30 seconds why this is the case.

If you want to disable all interaction with your site when the user clicks something.. oh-k, something like document.body.disabled = true/false; should suffice, although I can't see why you'd want to do this.

The other case, actually locking the keyboard or mouse system-wide; no chance. Even some application programming languages ( non-web ) wont let you do this. I'm sure your individual motives are good, but that's far from the point.

Maybe throw a little popup window that says 'please unplug your peripherals'... O_o

MattEvans 473 Veteran Poster Team Colleague Featured Poster

It sounds like the `students' template isn't being matched atall ( that would cause the output to end up only as text nodes ). Silly question - did you change the capitalization of the match="students" in the 2nd template to match the capitalization of the `Students' node in your document?

The only other thing I can think of is changing the <apply-templates> in the first template to explicitly select only the Students ( root ) node, i.e:

<xsl:template match="/">
  <xsl:apply-templates [b]select="Students"[/b]>
    <xsl:with-param name="first" select="1"/>
    <xsl:with-param name="last" select="8"/>
  </xsl:apply-templates>
</xsl:template>

If the root node is `Students', that should be the same as <apply-templates> without an explicit select, but, I guess all xslt processors are a bit different..

tgreer commented: Thanks for your help. +7
MattEvans 473 Veteran Poster Team Colleague Featured Poster

Which processor are you using? If your processor doesn't support position( ).. that's strange; because it's been around a long time. Anyway, try this replacement for the 2nd template:

<xsl:template match="students">
    <xsl:param name="first"/>
    <xsl:param name="last"/>    
    <students>
      <xsl:for-each select="student">
        <xsl:variable name="position"><xsl:number/></xsl:variable>
        <xsl:if test="( number( $position ) &gt;= $first ) and ( number( $position ) &lt;= $last )">
          <xsl:copy-of select="."/>
        </xsl:if>
      </xsl:for-each>
    </students>
  </xsl:template>

Something like this should also work:

<xsl:template match="students">
    <xsl:param name="first"/>
    <xsl:param name="last"/>    
    <students>
      <xsl:for-each select="student">
        <xsl:variable name="num_preceding" select="count( preceding-sibling::student )"/>
        <xsl:if test="( $num_preceding &gt;= ( $first - 1 ) ) and ( $num_preceding &lt; $last )">
          <xsl:copy-of select="."/>
        </xsl:if>
      </xsl:for-each>
    </students>
  </xsl:template>

Also, what's the structure of your input document? Is it as simple as the example I gave ( i.e. all student elements are sibling level within the root node ) or more complex?

MattEvans 473 Veteran Poster Team Colleague Featured Poster

There's a couple of ways to do this; probably the most imperative is:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:template match="/">
    <xsl:apply-templates>
      <xsl:with-param name="first" select="1"/>
      <xsl:with-param name="last" select="8"/>
    </xsl:apply-templates>
  </xsl:template>
  
  <xsl:template match="students">
    <xsl:param name="first"/>
    <xsl:param name="last"/>    
    <students>
      <xsl:for-each select="student[position()&gt;=$first and position()&lt;=$last]">
        <xsl:copy-of select="."/>
      </xsl:for-each>
    </students>
  </xsl:template>

</xsl:stylesheet>

That's assuming an input like:

<students>
  <student a="1">data</student>
  <student a="2">data</student>
   ....
  <student a="20">data</student>
</students>
MattEvans 473 Veteran Poster Team Colleague Featured Poster

Your present user figures speak for themselves. You certainly need to keep supporting IE6 until it's in negligable use.

The best way to solve the problem is to---from the beginning---only use techniques that are known to work everywhere, where 'everywhere' currently, unfortunately, includes IE6.

Since you've just done a bit of a redesign and it looks good from where I'm sitting ( Opera ); if I were you I wouldn't invest too much time making everything look perfect in IE6. Just get the functional part working ( you said the site is 'practically unusable' in places, so sort that bit out ), but leave any tiny visual discrepancies alone, or assign them a very low priority, and then just watch the user browser figures. Maybe in 6 months things will be different. Maybe in 6 months all those IE6 sufferers will find Opera ^_-

You know, Opera users may well appear as IE6 users. Personally, I always indentify as IE because certain sites refuse to open up to browsers that identify as Opera, so.. maybe your user stats are a little skewed by Opera users ( for which the site works fine ). Last time I looked at the browser ID string in this mode ( was Opera 8, sometime last year ) it was equiv. to the IE6 browser ID string.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Thread moved to Software Developers Lounge, since this question was multiply-posted and thus probably doesn't relate specifically to Web Development.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

>> I don't think it's any harder to create a fluid CSS design than a tabular CSS design.

It's hard, but not impossible, to create a tabular design without tables, and it's hard, but not impossible, to create a fluid design without... fluid. O_o ( meaning, of course, it's hard to create a fluid design with only tables ).

If you have a design, then you have a design; there's a tool for every design, within the bounds of reason. My only gripe is that there's no reason to for someone to inflict a limit on design potential ( or ease-of-implementation ) based only on hype and misplaced elitism.

You can't say Daniweb is table-less =p I see your tables. You can only say something like; it's ' low in tables', or even '98% table-free'. I myself don't value 'table-free' as a claim; for obvious and oft-stated reasons, so, good on you x100 for using tables to present tabular data.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

The only way to stop "piracy" is to release truly open, public domain, software; nobody can pirate something that's already theirs!

I guess that's not what you want to do, though. As Auzzie said, all you can do is make it more difficult for someone to steal your software, make sure it has a tight license, and then sue if/when someone does eventually 'pirate' it.

The means for 'making it difficult' depends on what kind of software it is. Generally, you can't protect HTML and Javascript using any technical means, because it has to be translated into source code before the browser reads it, and any good 'pirate' can outdo your attempts to encrypt or 'hide the code' in these languages with only one tool ( a customized browser ). You can of course, use the law to protect what you don't want others to take, in just about any medium.

In other mediums, perhaps its easier to 'make it difficult'. Anything that is serverside code ( PHP, Perl, CGI, JSP, ASP, etc, etc ) is protected very well because it's never sent to the browser: unless you give it to someone or go lax with the security at the server, nobody can get their hands on it.

Any deliverable application can be protected with keys and then low-level obfuscated; but, to my knowledge, no-one's ever released a useful software application with protection that someone else hasn't cracked ^_-

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Fixed it. Turns Out I was using the wrong function in my mouse function.

Cool; good to know it's working :)

Disregard my last post; although, the -g3 flag is quite useful to remember ( with full debug info you can see all the values passed into methods aswell as the method names ).

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Ok, the method NodeGL:plot is very small, the only thing that could be wrong in that method itself is the array not being instantiated ( or being too short ), however, there could be something wrong higher up ( the pointer 'this' can be 0 sometimes! ).

To get more useful info from the debugger, you need to add an option when compiling: recompile all of your files with the option -g3 to emit debugging information ( I hope that works on your G++ version, I'm using G++4 ).. after recompiling -- you need to recompile ALL of the files with this option, so not just the hex3.cpp file, but the file(s) for bezier, node, etc aswell -- after doing that, run the application with GDB again, and post the output of backtrace if you dont mind.. that will tell me ( and I can tell you ) whether or not it's an error within the code in the method NodeGL:plot, or an error higher in the call chain.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

>_< oops, sorry;

$ gdb ./hex3
[b](gdb) run[/b]
..wait for error..
(gdb) backtrace
MattEvans 473 Veteran Poster Team Colleague Featured Poster

There is probably something wrong in your not-shown classes ColorGL &| BezierGL, since the code runs fine with all reference to those classes commented.

Have you got a debugger? I'm guessing if your PC is saying 'Segmentation fault' that you're using some breed of Linux? If so, run your application from the command like like this... gdb ./a.out ...and when it segfaults, do... backtrace ...and you'll have a much better idea where your error is ( since gdb is an interactive debugger, and 'backtrace' gives you the callstack before the error ).

If you're not on Linux.. er.. dno, what are you on? I've never seen Windows say 'Segmentation fault'... Visual Studio has an integrated debugger, but you'll have to work out how to use it yourself.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

I'm not sure what configuration tricks you'll need to perform to get this to work on Windows + XAMPP, but, the following looks 'wrong':

- your href in the HTML goes to a local file, this certainly wont work. You'll need to move the compiled C++ application into the folder which XAMPP maps to 127.0.0.1, and change the link to href="http://127.0.0.1/HelloWorld.exe".
- It is possibly the case that the C++ app will have to go into the cgi-bin folder, I haven't used XAMPP for a long time, and cant remember how it deals with executables and permissions.. read the XAMPP docs if in doubt.
- The program will not work properly as a CGI script because it's not sending an HTTP header. Change to the following ( although the program should work [ as in write to the file ] if you set everything up properly, it will display an Error 500 if you do not make this change ):

// Filename        : HelloWorld.cpp
// Executable Name : HelloWorld.exe
#include <fstream>
#include <iostream>
using namespace std;
 
int main (int argc, char* argv[])
{
    cout << "Content-Type:text/html;charset=iso-8859-1\n\n";
    ofstream outs;
    outs.open ("HelloWorld.txt");
    outs << "Hello World" << endl;
    return 0;
}

Don't worry about security right now ( but certainly read up about it when you get the time ). XAMPP doesn't make your computer a public server with the default settings, and nobody but you can access 127.0.0.1 and see your …

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Initially, the click handlers for all objects are assigned to the size change function. When you click an object for the first time, the size is changed, and the click handler for that object is re-assigned to the function that performs a size restore. When you click again, the size is restored, and the click handler is assigned to size change again. The statements like: this.onclick = sizeRestore; don't actually call the function; they infact use the name of the function as an identifier. You can tell the difference between a call to a function and a use of the name of a function because a call always has parenthesis even if the function has no arguments, i.e. sizeRestore( ); .

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Just about any language can be used, although some languages are more/less suitable for various reasons. C++ can be used for web applications quite comfortably, when coupled with a database and perhaps XML parsing libraries ( + other libraries as appropriate ).

Big web applications are pretty heavy-duty/high-load, and complicated.

As far as I know, the PHP interprettor is written in C++, so really, when you write/run a PHP app, you're just providing very detailed instructions to a C++ application. Same goes for Perl: it's interpretted by a program written in C(++?). Other languages are different, though.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Right.. not entirely sure what you're after; I can't work out which you want:

1: The first 'click' to perform 'sizeChange' and the next click to perform 'sizeRestore' ( and then to repeat for subsequent clicks ).
2: The click 'down' to perform 'sizeChange' and the release of the click to perform 'sizeRestore'.
3: Something else?

If you want number 1:

//Note: this is NOT the only way to do this.
var animElements = document.getElementById("both").getElementsByTagName("p");
  for(var i=0; i<animElements.length; i++) {
    animElements[i].onclick = sizeChange;
    }
  function sizeChange() {
    if (!this.currentWidth) this.currentWidth = 150;
    doWidthChangeMem(this,this.currentWidth,170,10,10,0.333);
    this.onclick = sizeRestore;
    }
  function sizeRestore() {
    doWidthChangeMem(this,this.currentWidth,150,10,10,0.5);
    this.onclick = sizeChange;
    }

If you want number 2, use the first example, but use mousedown and mouseup instead of mouseover and mouseout.

If something else, be more clear about exactly what you intend to do.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

You can do this with frames, i.e. make blah.com/index.html a frameset document with a single frame, all pages and clicked links will appear to be the same page on the browser address bar.. Why you'd want to do this is beyond me, and you should be careful to load 'external' links using target="_top", since otherwise it'll look like all links are internal.

If you're on Apache, you can perhaps do this with ModRewrite directives in a directory .htaccess configuration. Research ModRewrite, it's pretty powerful, it allows you to basically fake the address bar address of a page, but it's usually used in the opposite direction ( i.e. to route pattern-matched page requests to a single server application ), so I'm not sure it'd be helpful here.

Otherwise, using forms instead of <a href=''..> and manually printing a different page depending on POST data will work, but it's an awful approach -- you lose any benefit of caching, and there's no way to bookmark individual pages.

The frames method is probably the best, in terms of usability + simplicity.

Update: Just looked at runescape.com; the frames approach is exactly what they are doing.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Thread has been moved to the ASP.NET forum.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Ah.. you Americans always have to have it bigger. Cars .. meals .. earthquakes ..

MattEvans 473 Veteran Poster Team Colleague Featured Poster

I was/am fine with the Who's Online list, the Member Profile link, and the 'Currently Active Users Viewing This Thread' list. I am, of course, also happy that my posts appear publicly as they are created.

Maybe I'll stop being invisible if/when I get used to it ( the spy ) being there, since I do like being 'publicly present' in any given thread; but not so much having a slightly persistant public trail showing, not just where I am, but where I came from, and where I subsequently go to..

Incidently.. it seems that I can see where other invisible users are.. is that right? Do all invisible users exist in a different slice of reality, where they can see each other but no-one can see them, or is it a moderator thing?

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Oh my. I just saw the news. We had a country-wide earthquake. I didn't even notice. I vaguely heard something about it this morning but it didn't sink in.

Anyone experience this? It didn't affect Deptford, although.. I would probably have slept through it.

We never have big earthquakes! O_o

MattEvans 473 Veteran Poster Team Colleague Featured Poster

I honestly find the fact that anyone can track my every movement on that page to be a little too 'Big Brother' for my liking, so I also go invisible now. I quite like the feature though: I'll happily one-way spy.

I did notice that it tended to keep saying I'd viewed or was viewing a thread long after I'd left the thread.. that's also a reason I went invisible: since more than once, it would say on the spy page that I'd read a given thread once every minute for 5-10 minutes even if I'd just glanced at the thread in question momentarily..

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Moved to C# forum.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

>> I've just seen a lot of, and herd of, talk about pure CSS layouts

I have also heard a lot of this talk. I can't imagine a CSS-only layout, since these layouts do use a few (X)HTML elements ( div, p, span, ul, strong, em, etc.. )*. So, I will use 'no tables' for what might be called 'CSS-only', and I don't need a special word for normal coding practice, because it's normal coding practice.

* don't get me wrong, these are all great elements.

For certain layouts, it is perfectly feasible, even elegant, to use minimilistic markup and it is most certainly the case that not every layout needs a table.

Many of the 'no tables' pages are fixed-width -- as is Daniweb -- the entire content is set at some defined width ( suitable for the majority of users, but smaller than the available visible width on an average display ), this makes it easier to use positioning and strictly-defined sizes for elements. 'No tables' design also favours sites without complex non-flowing layout ( text and pictures, newspaper/magazine-esque pages ); sites where alot of the layout is made of vertically stacked blocks ( like Daniweb again, although, there used to be tables here in places [ yep, there still are ] ); and sites that are sent to small devices, since reduced layout works well there. Some of these sites are indeed really pretty, and examining source code is a good way to …

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Only one rule from me.. Don't set out to "work with divs to create a pure CSS layout", unless you're entering some wannabe-elitist competition. Use whatever's appropriate and whatever works best: tables, frames, etc.

Nothing but a table does what a table does, and nothing but a frame does what a frame does. Those elements would have been W3C-deprecated in the last recommendation if they were redundant, and they are certainly not redundant. There is no suggestion by anyone worth listening to that the table or the frame tag are, or will soon be, deprecated*, and there is no reason to punish yourself by ignoring these valid, useful, elements. Just don't use tables for anything you can do easily in CSS ( note 'easily' ), and avoid frames like the plague unless you're making a certain kind of site: frames are great for offline API documentation minisites, and sites that are supposed to be read like books, but they are, of course, quite awful for most sites.

The font tag was deprecated, because it's redundant and difficult; don't use the font tag.

In a way, it makes me laugh that certain people took this WAI guideline so far: http://www.w3.org/TR/WAI-WEBCONTENT/#gl-table-markup, yet will blissfully ignore the rest of the WAIs recommendation, to the detriment of many. One can create a usability atrocity without using a single table, frame or font tag; and equally, one can create a blissful user experience with a frame and some layout tables. …

Venom Rush commented: Your response was brilliant ;) Thanks +1
MattEvans 473 Veteran Poster Team Colleague Featured Poster

Alternatively, try this trick, if you don't mind presetting the available colors ( in a way, it's better because those colours can be defined in the CSS ). This works by dynamically changing the class of the containing element, the CSS 'cascade' effect sorts out the rest:

<html>
  <head>
    <title>Color changing magic with a classname trick</title>
    <style type="text/css">
      div.red_links a
      {
        color:red;
      }
      div.blue_links a
      {
        color:blue;
      }
    </style>
    <script type="text/javascript">
      function set_linkcolor( to )
      {
        document.getElementById( "color_state" ).className = 
              to + "_links";
      }
    </script>
  </head>
  <body>
    <div id="color_state" class="red_links">
      <ul>
        <li><a>An anchor</a></li>
        <li><a>Another</a></li>
        <li><a>And another</a></li>
        <li>Some normal text</li>
        <li>Some more..</li>
        <li>And some more</li>
      </ul>
    </div>
    <span onmousedown="set_linkcolor( 'blue' )" 
         onmouseup="set_linkcolor( 'red' )" 
         style="border:solid 1px black;">
      Click me!
    </span>
  </body>
</html>
MattEvans 473 Veteran Poster Team Colleague Featured Poster

The way to look at injection protection is not to "take the bad things out" but to "only let the good things in". There is, funnily enough, a big difference.

Properly quoting the input text to make it impotent is a reasonable strategy in this case, since you're accepting a wide range of legal input characters; but for a web forum also consider sanitising HTML markup in any uploaded data: since you don't want anonymous people posting working Javscript onto your hosted pages. It's not a risk to your server, or even user's machines -- but it can be used to steal online identities.

As for the professional forum software, most are open source so you could have a look at how they do it. It's a good bet they use either the builtin PHP string escape methods as ryan suggested; or regular expression based sanitisers; or state-based parsers as sanitisers.

Sanitising using stringwide-replace operations as you suggested in the original two examples is not even marginally safe. Consider this input ( to your first sanitiser ): del[b]delete[/b]ete * from * Your code will replace the highlighted instance of delete, creating a new delete as it does so, which will be subsequently un-noticed ( since that's how replace works ). Yay!

MattEvans 473 Veteran Poster Team Colleague Featured Poster

The first link is the 'tidy' I'm talking about.

To use it would be a case of:

- Open page in browser
- View > Source
- Select All
- Copy
- Open Editor
- Paste
- Save as thefile.html
- Go to cmd line
- Run tidy -im thefile.html - Reopen thefile.html in editor
- Examine.

Seems long.. but not really. Bluefish has tidy integrated as a plugin, but, you'd need to configure it to enable the indent option ( it's off by default )

'tidy' is listed by my package manager ( urpmi for Mandriva, offical repos ).

MattEvans 473 Veteran Poster Team Colleague Featured Poster

This seems to work fine for me (Opera):

<html>
  <head>
    <title>Hanging indents..</title>
    <style type="text/css">
      p.question, p.answer
      {
        margin-left:1.2em;
        text-indent:-1.2em;
        padding-bottom:0;
        padding-top:0;
        margin-top:0;
      }
      p.question
      {
        margin-bottom:0;
      }
      p.answer
      {
        margin-bottom:1em;
      }
    </style>
  </head>
  <body>
    <p class="question">Q: Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
    <p class="answer">A: Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
    <p class="question">Q: etc...</p>
    <p class="answer">A: etc....</p>
    <p class="question">Q: etc...</p>
    <p class="answer">A: etc....</p>
  </body>
</html>
MattEvans 473 Veteran Poster Team Colleague Featured Poster

You can also use a commonly available command-line program called 'tidy' ( thats also the command name ) to automatically layout an HTML file.. but, read the 'tidy' documentation first; because its also an error-fixer, and can thus be quite invasive..

MattEvans 473 Veteran Poster Team Colleague Featured Poster

I think kingvjack is saying that VB will automatically format and layout code neatly (i.e. indentation, newlines, etc )

On Linux.. Quanta Plus does that, I think. Not sure about any Gnome apps, but any decent HTML/XHTML editor should have this as a feature.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

This thread has been merged and re-named. The original merge sources were 'can anyone help' and 'To the second listbox'. Replies are now in chronological order as posted in both original threads.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Hm.. try setting the 5px top and bottom margins on the h1 to 0, and adding a padding top/ padding bottom of 5px to the div. ( same as you had before; but without setting the width of the div, or a large inner left padding on the div )

MattEvans 473 Veteran Poster Team Colleague Featured Poster

try:

body
{
  margin:0;
  padding:0;
}

div.header
{
  background-color:#000;
  height:110px;
}
h1
{
  margin-top:5px;
  margin-left:120px;
  margin-bottom:5px;
}
MattEvans 473 Veteran Poster Team Colleague Featured Poster

Use CSS:

body, html
{
  margin:0;
  padding:0;
}

Should get rid of borders on the page itself..

MattEvans 473 Veteran Poster Team Colleague Featured Poster

Err... you could remember where the song is and restart it at the correct place on every page; but getting it syncronized properly over the Internet will be hell. It would take a long time to implement, a long time to test, and might not ever work without noticeable gaps or jumps in the song.

A frame is probably your best bet. I wouldn't worry about it 'runing the design', no1 need ever see the frames, and theres no reason you can't place a conformant W3C strict XHTML page inside a conformant W3C frameset XHTML frameset document. The only issue with frames is you lose the ability to use the address bar effectively.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

@ niek_e : use Opera! You can setup auto-refresh every x-mins for any page. I dont have this enabled, mind -- I feel it'd be an uncessary strain on the server, since I'd likely forget it was on and leave it running for days/weeks/months on end.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

As it looks; you're doing one test for the mouse click ( testing MouseButton(0); ) - this means the function 'miss' will only be true if the user clicks the mouse at the exact moment that the code is running. I would set up an event to wait for the mouseclick or do a time-locked loop to poll the mouse until a click occurs; and THEN test to see whether or not it's a hit.

MattEvans 473 Veteran Poster Team Colleague Featured Poster

You're right rick. There is an error. In the vector method; there are two lines that assign to 'p2'. One of those should assign to 'p1' ( it doesn't matter which, but, it will affect CW/CCW winding of the points in the triangle ).

d_n = normalize( d )
  pd_n = perp( d_n )

  p0 = o + ( d_n * (h/2) )
  [b]p1[/b] = o - ( d_n * (h/2) ) + ( pd_n * (b/2) )
  p2 = o - ( d_n * (h/2) ) - ( pd_n * (b/2) )

Otherwise; both the vector and component method work fine, after converting into C code. ( I have just checked )