Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. toolkit

    cross browser code for finding class attribute of anchors

    Hi there. Was wondering if anyone could help me on this (hopefully straightforward) question: I have a test function that accepts an element parameter, and attempts to use DOM to find all child anchor elements below this node, and then find the class attribute for each anchor. The code should...
  2. toolkit

    JSP - XML

    If this is a really simple application, then you could read the XML directly from your JSP using JSTL XML tags. http://java.sun.com/products/jsp/jstl/ For anything more complicated, you should really use the MVC design pattern. Have a JavaBean class to model your XML, and have the JSP access...
  3. toolkit

    String.replace() with unusual characters

    The char '.' is a literal '.' The string "." is evaluated as a regular expression in the replace call. To escape this, try using "\\." instead. The first '\' escapes the second '\', so that the character sequence passed to the regular expression engine is '\' '.' This then ensures the period...
  4. toolkit

    Using XPath to extract data from XML ( DOM or other source )

    How about: Java 5.0: http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/xpath/package-summary.html Or Xalan: http://xml.apache.org/xalan-j/apidocs/org/apache/xpath/package-summary.html Cheers, Neil
  5. toolkit

    Command opposte of \n

    $string = "Foo\nFoo2"; $string =~ s/\n//g; Cheers, Neil
  6. toolkit

    Command opposte of \n

    chomp ? $string = "foo\n"; chomp($string); Cheers, Neil
  7. toolkit

    Does the switch statement accepts a byte to evaluate?

    This is an example of Widening Primitive Conversion
  8. toolkit

    How do I invert a file

    Or perhaps: grep -n . test.txt | sort -nr | cut -d: -f 2 ;-)
  9. toolkit

    How do I invert a file

    Its on my Sun box. Ah, oops, was in a set of GNU utilities we installed. Oh well ;-)
  10. toolkit

    How do I invert a file

    IMHO the easiest way: man tac :-)
  11. toolkit

    Sorting in foreach

    A minor variation on Dinesh's (19decsat) answer using a sub for clarity: foreach (sort byVal keys %hash) { print "$_ $hash{$_}\n"; } sub byVal { return $hash{$b} <=> $hash{$a}; } Cheers, Neil
  12. toolkit

    System V IPC

    Perhaps this article may help? http://www.bmsi.com/java/posix/package.html
  13. toolkit

    need regex help again.

    Here's a modified version of the regexp which should work: #!/usr/bin/perl -w while (<DATA>) { if (/^ # start of line \s # a single whitespace ( # start grouping [0-9]+ # 1 or more digits \s+ # 1 or more whitespace...
  14. toolkit

    need regex help again.

    Its quite useful to use the 'x' modifier to explain complex regular expressions: while (<DATA>) { if (/^ # start of line \s # a single whitespace ( # start grouping [0-9]{1,} # 1 or more digits \s{5} # exactly 5 spaces )...
  15. toolkit

    Servlet context for non-servlet bean

    Alternatively, if you intend all instances of your beans to share initialisation strings, then you can have: public class MyBean { private static String initValue; public static void setInitValue(String value) { initValue = value; } } Then, create and register a...
  16. toolkit

    Servlet context for non-servlet bean

    Assuming you have a context parameter defined as: <context-param> <param-name>foo</param-name> <param-value>bar</param-value> </context-param> And assuming you have a simple class like: package beans; public class TestBean { private String name; public String...
  17. toolkit

    stripping lines completely from file into new file

    Here's one way using perl. #!/usr/bin/perl -w $file = shift; $file1 = "${file}1"; $file2 = "${file}2"; open FILE, $file or die; open FILE1, ">$file1" or die; open FILE2, ">$file2" or die; while (<FILE>) { # determine destination select substr($_, 44, 3) eq "002" ? *FILE2 : *FILE1...
  18. toolkit

    Test for the existence of a file

    http://www.perldoc.com/perl5.8.4/pod/func/-X.html Cheers, Neil
  19. toolkit

    directory pruning script

    Note that the second example has removed the "!". So instead of "! -mtime -1", it is "-mtime +7" Cheers, Neil
  20. toolkit

    directory pruning script

    Oops, instead of "! -mtime -1" I think you can use "-mtime +7" Cheers, Neil

Part and Inventory Search

Back
Top