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 strongm 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

    ...is '\' '.' This then ensures the period is not treated as a special metacharacter. One way to get round this problem for large pieces of text is: "\\Q your text containing metachars like . + *\\E" See also: http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/Pattern.html Cheers, Neil
  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

    ...name; } public void setName(String name) { this.name = name; } } Then your JSP can access this like: <%@ page import="beans.*" %> <% String value = application.getInitParameter("foo"); %> <jsp:useBean id="test" class="beans.TestBean"/> <jsp:setProperty name="test"...
  17. toolkit

    stripping lines completely from file into new file

    ...-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; print; } rename $file1, $file...
  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