It's posible inject a String in a InputStream??

Hi all.
I'm beginning work with XML, and in this moment i need process not very big xml FILES, this because files arrives in very short time, my problem now is with SAX/DOM, in general this process "files" and i have a string variable with the xml inside!!
It's possible inject this String in a InputStream to don't create a temp file???
Ideas to work and process xml directly (links to read about this) is welcome.
thank's

DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse(new org.xml.sax.InputSource(new java.io.StringReader("your_string")));

Similar Messages

  • Gettig SOAPBody as string or as InputStream

    I am receiving SOAP messages over jms Queues. After receiving messages I need to get the content of SOAP:Body as a String or as InputStream. How can this be done?

    depending on the type of message u're receiving, by that i mean the class of the message, e.g. OMElement?

  • SQL injection recon detection

    Why are there no vendor provided signatures that detect SQL injection reconnaissance? I recently did an internal pen test and it reminded me again of this deficiency. I've been meaning to write my own for the longest time, but frankly...why should I need to? It is simply amazing to me that I can throw standard SQL injection tests at a web app and our network IDS is "blind" to them.
    http://ha.ckers.org/sqlinjection/

    I agree in the sense that the SQL Signature set of ASA IPS is a bit poor. If it can help someone, I've wrote my oun signature in order to catch an attacker. It's working fine, and I think that is easy to modify.
    signatures 60000 0
    alert-severity medium
    sig-fidelity-rating 75
    sig-description
    sig-name CHZ SQL Injection
    sig-string-info CHZ SQL Injection
    sig-comment SQL Injection written by CHZ
    exit
    engine string-tcp
    event-action produce-alert|deny-packet-inline|reset-tcp-connection
    regex-string ([Dd][Ee][Cc][Ll][Aa][Rr][Ee])\%20\@.\%20([Vv][Aa][Rr][Cc][Hh][Aa][Rr])(.*);([Ss][Ee][Tt])\%20\@.=([Cc][Aa][Ss][Tt])
    service-ports #WEBPORTS
    exit
    alert-frequency
    summary-mode summarize
    exit
    exit
    status
    enabled true
    exit
    specify-mars-category yes
    mars-category DoS/WebServer
    exit
    exit
    Best Regards
    Chz

  • Include constant String values in javadoc?

    I just got tired of search/replace in JavaDoc parts and asked myself if the following is possible:
    (I use JSP Syntax for the part that I don't know if it's posible)
    public static String insert = "this ist the insert";
    * Display here: <%=insert%>
    */Any ideas!?

    Was this {@value variable} feature ever implemented?
    I really think is is a great idea and wish I could
    use it.It has been added for 1.5. For 1.4 you can use this simple taglet:
    import com.sun.tools.doclets.Taglet;
    import com.sun.tools.doclets.standard.HtmlStandardWriter;
    import com.sun.tools.doclets.standard.tags.AbstractInlineTaglet;
    import com.sun.javadoc.*;
    import java.util.Map;
    public class MyValueTaglet extends AbstractInlineTaglet {
        private static final String NAME = "my.value";
         * Return the name of this custom tag.
        public String getName() {
            return NAME;
        public boolean inField() {
            return true;
        public boolean inConstructor() {
            return true;
        public boolean inMethod() {
            return true;
        public boolean inOverview() {
            return false;
        public boolean inPackage() {
            return false;
        public boolean inType() {
            return true;
        public boolean isInlineTag() {
            return true;
         * Register this Taglet.
         * @param tagletMap   the map to register this tag to.
        public static void register(Map tagletMap) {
           MyValueTaglet tag = new MyValueTaglet();
           tagletMap.put(tag.getName(), tag);
        public String toString(Tag tag, Doc doc, HtmlStandardWriter hsw) {
            ClassDoc lookup = null;
            if ( doc instanceof ClassDoc )
                lookup = (ClassDoc)doc;
            else if ( doc instanceof MemberDoc )
                lookup = ((MemberDoc)doc).containingClass();
            if ( lookup == null )
                return "";
            final String fieldName = tag.text();
            final FieldDoc[] fields = lookup.fields();
            for (int i = 0; i < fields.length; ++i)
                if ( fieldName.equals( fields.name() ) )
    final Object value = fields[i].constantValue();
    return (value != null) ? value.toString() : "";
    return "";
    Note:
    In order to get this to work project wide, you need to have full qualified names as tag text and use the RootDoc to locate the appropriate packages and classes.

  • Strange exception when deploying BC4J as EJB in 8i CORBA.BAD_PARAM: null Strings are

    I am trying to deploy BC4J as Ejb to 8i (8.1.6). I use the following deployment method with j: my Jdev root.
    setjboenv j: ejb8i
    loadjava - u user/passwd@host:port:sid - thin -v - r grant "SYS,PUBLIC" j:lib\xmlparserv2.jar
    loadjava - u user/passwd@host:port:sid - thin -v - r grant "SYS,PUBLIC" j:lib\jbomt.zip
    loadjava - u user/passwd@host:port:sid - thin -v - r grant "SYS,PUBLIC" j:lib\jboejb.jarI then create a deployment profile for ejb 8i with the ide. (Without deploying)
    I then use loadjava outside the IDE to deploy the 2 jar files created
    MyProject1CommonEJB.jar
    and
    Myproject1.jar
    I then use the ide again to deploy the bean profile
    Package1ModuleServerEJB.prf
    The last step fails with the error :
    Publishing EJBHome...org.omg.CORBA.BAD_PARAM: null Strings are illegal in IIOP. Please correct your application or run the ORB in backward compatibility mode. minor code: 0 completed: No
    void oracle.aurora.ejb.deployment.GenerateEjb.invoke()
    void oracle.aurora.server.tools.sess_iiop.ToolImpl.invoke(java.lang.String[], java.io.InputStream, java.io.PrintStream, java.io.PrintStream)
    void oracle.aurora.ejb.deployment.GenerateEjb.main(java.lang.String[])
    Exception in thread main
    Strangely, when I test this EJB with the tester (middle tier = remote ejb) it works, but from JSP's I get an application error : "Unknown Exception"
    I am using Jdev 3.1
    Also using the deploy option when creating the deployment profile fails apparantly due to the missing grant "SYS,PUBLIC" when loading classes to the database before deploying the bean.
    What can be done ?
    null

    Hi Blaise
    Thanks for the reply. I have tried to do the complete deployment from within Jdev, but now I get the following error right at the end of the deployment.
    /BC4J1AppModuleEjb/EjbObject_RemoteBC4J1AppModuleEjb:ORA-29535: source requires recompilationjava.lang.NullPointerException at sun.tools.java.Environment.error(Environment.java) at sun.tools.java.Environment.error(Environment.java) at sun.tools.java.Environment.error(Environment.java) ..... etc.
    I have tried to deploy to a clean schema with the java privilages granted as described in the Jdev release notes.
    I included the following libraries in my project :
    JBO JDBC816 PATCH
    JBO OSQL Domains
    JDeveloper Runtime
    Oracle 8.1.6 JDBC
    Connection Manager
    JBO Runtime
    JBO VB Runtime
    JBO 8i Runtime
    SQLJ Runtime
    JBO 8i Client
    JBO Vanilla Domains
    JBO EJB Runtime
    JServer
    Oracle XML SQL Utility
    ORACLE XML Parser 2.0
    Then I just used the deployment wizzard
    null

  • How to get InputStream from String ?

    Hi !
    I want to get InputStream object from String.
    String str = "balabalabala";
    InputStream stream = getInputStream(str);
    How to realize getInputStream(str) function ?
    Thanks!

    The preferred method nowadays is to use Readers and Writers for String data - hence StringReader(String). If you're going to operate on the InputStream directly, then I'd modify your code to use the Reader calls and go that route.
    If, however, you need to pass the InputStream to some other piece of API that requires an InputStream instead of a Reader, then the ByteArrayInputStream is probably your best bet. StringBufferInputStream is deprecated because it doesn't work reliably in the face of many character encodings.
    Speaking of encodings - never call Strng.getBytes() - always use the getBytes(character-encoding) version, so you KNOW what encoding you're getting!
    Grant

  • XML document - request string

    Hi Experts,
    Could you please tell me, how to pass XML document as a request string to the webservice scenario. Inside the service, I have to do the schema validation for the request . Please guide me, how to proceed further?
    Regards
    Sara

    Hi SARA,
    use following Code written in SAX parsing .this will fulfil your requirment.This handle Special character also.
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.io.OutputStreamWriter;
    import java.io.Writer;
    import java.util.ArrayList;
    import java.util.Calendar;
    import java.util.GregorianCalendar;
    import java.util.HashMap;
    import java.util.List;
    import java.util.Map;
    import javax.xml.parsers.FactoryConfigurationError;
    import javax.xml.parsers.ParserConfigurationException;
    import javax.xml.parsers.SAXParser;
    import javax.xml.parsers.SAXParserFactory;
    import org.xml.sax.Attributes;
    import org.xml.sax.helpers.DefaultHandler;
    import org.xml.sax.SAXException;
    import com.sap.aii.mapping.api.StreamTransformation;
    import com.sap.aii.mapping.api.StreamTransformationException;
    public class SimpleForwardMappingString extends DefaultHandler implements StreamTransformation
         private List m_arlCurrent = new ArrayList();
         private List m_arlBOList = new ArrayList();
         private List m_arlObjectList = new ArrayList();
        public static int counter = 0;
         String listName = "newList";
         public  StringBuffer m_totalElementsBuffer = new StringBuffer();
         String startData = "<inCanonStream>";
         String endData = "</inCanonStream>";
         private Map param = null;
         /** Constant Strings used in Forward Mapping */
         public static void main(String args[])
              try {
                      InputStream in = new FileInputStream(new File("C:
    Documents and Settings
    281152
    Desktop
    Cannonical12321.xml"));
                   OutputStream out = new FileOutputStream(new File("C:
    Documents and Settings
    281152
    Desktop
    Cannonical21.xmlOut.xml"));               
                   SimpleForwardMappingString myMapping = new SimpleForwardMappingString();
              catch (Exception e)
                   e.printStackTrace();
         public void execute(InputStream arg0, OutputStream arg1)
         throws StreamTransformationException
              Writer out;
              try
                   out = new OutputStreamWriter(arg1, "UTF16");
                   /** Building the SAX parser */
                   getXMLDoc(arg0, arg1);
                   arg1.write(m_totalElementsBuffer.toString().getBytes("UTF16"));
              catch (IOException e)
                   System.out.println("Error : io" + e.getMessage());
              catch (Exception e)
                   System.out.println("Error :" + e.getMessage());
         /* (non-Javadoc)
    @see com.sap.aii.mapping.api.StreamTransformation#setParameter(java.util.Map)
         public void setParameter(Map arg0)
         public void getXMLDoc(InputStream inputStream, OutputStream outputStream)
    Defines a factory API that enables applications to configure and
    obtain a SAX based parser to parse XML documents. Once an application
    has obtained a reference to a SAXParserFactory it can use the
    factory to configure and obtain parser instances.
              SAXParserFactory factory = SAXParserFactory.newInstance();
              try
                   factory.setNamespaceAware(true);
                   factory.setValidating(true);
                   SAXParser saxParser = factory.newSAXParser();
    Parse the content of the given {@link java.io.InputStream}
    instance as XML using the specified
    {@link org.xml.sax.helpers.DefaultHandler}.
    @param inputstream InputStream containing the content to be parsed.
    @param cobject The SAX DefaultHandler to use.
    @exception IOException If any IO errors occur.
    @exception IllegalArgumentException If the given InputStream is null.
    @exception SAXException If the underlying parser throws a
    SAXException while parsing.               
                   saxParser.parse(inputStream, this);
              catch (FactoryConfigurationError e)
                   System.out.println("Error");
              catch (ParserConfigurationException e)
                   e.printStackTrace();
              catch (SAXException e)
                   e.printStackTrace();
              catch (IOException e)
                   e.printStackTrace();
         /** ===========================================================
                             Methods Overriding in SAX Default Handler
              ===========================================================
    Receive notification of the beginning of the document.
    By overriding this method in a subclass to take specific actions
    at the beginning of a document (such as allocating the root node
    of a tree or creating an output file)     
         public void startDocument()throws SAXException
              if(m_totalElementsBuffer.length()>0)
                                m_totalElementsBuffer = new StringBuffer();
                                counter = 0;
              m_totalElementsBuffer.append(m_prologue);
              m_totalElementsBuffer.append(m_nameSpace);
              m_totalElementsBuffer.append(startData);     }
    Receive notification of the end of the document.
    By overriding this method in a subclass to take specific
    actions at the end of a document (such as finalising a tree
    or closing an output file)     
         public void endDocument()throws SAXException
              m_totalElementsBuffer.append(endData);
              m_totalElementsBuffer.append(m_rootElementEnd);
    Receive notification of the start of an element.
    By overriding this method in a subclass to take specific
    actions at the start of each element (such as allocating
    a new tree node or writing output to a file)
         public void startElement(String namespaceURI, String name, String qName, Attributes attrs)
              throws SAXException
              /** If current List is not empty then append node to StringBuffer */
                   m_totalElementsBuffer.append("&lt;" + name + "&gt;");
    Receive notification of the end of an element.
    By overriding this method in a subclass to take specific
    actions at the end of each element (such as finalising
    a tree node or writing output to a file)
         public void endElement(String uri, String name, String qName) throws SAXException
                   m_totalElementsBuffer.append("&lt;/" + name + "&gt;");
    Receive notification of character data inside an element.
    By overriding this method to take specific actions for each
    chunk of character data (such as adding the data to a node
    or buffer, or printing it to a file)     
         public void characters(char buf[], int offset, int len)
              throws SAXException
              String s = new String(buf, offset, len);
              if (null != s && s.length() >0)
                   if(s.equalsIgnoreCase("&"))
                         //System.out.println("FOUND AND SYMBOL");
                         String s1 = s.replaceAll("&","_-#_");
                         //System.out.println("s= " +s1);
                         s = s1;
                   if(s.equalsIgnoreCase("<"))
                         //System.out.println("FOUND AND SYMBOL");
                         String s1 = s.replaceAll("<","_#-_");
                         //System.out.println("s= " +s1);
                         s = s1;
                   m_totalElementsBuffer.append(s);
    Thanks
    Sunil Singh

  • String to Stream

    Hi!
    How do you convert a String to an InputStream?
    I'm sending more than one XML file in a String through a Socket. I receive an Input Stream and convert it to a String. but i now need this String to be an Input Stream!
    Andr�

    Hi!
    How do you convert a String to an InputStream?
    I'm sending more than one XML file in a String through
    a Socket. I receive an Input Stream and convert it to
    a String. but i now need this String to be an Input
    Stream!
    Andr�Why ? Can't you use the original input stream (the socket's one)?

  • String to inputStream

    Hi I'm trying to "convert a string to an inputstream. I'm working with the JTidy API which needs an inputstream for doing the parseDOM(var,var) method, everything works fine when my data comes from a file and when I use FileInputStream but it wont work with the InputStream.
    It looks to me that the InputStream is empty. What I'm basically doing is:
    String myInputStream = "blahdiblah";
    try{
    System.out.println("myInputStream:" + + myInputStream.read()); // gives me 98 the value of the first char
    }catch( Exception e ) {
    System.err.println("error:" + e.toString() );
    InputStream in = null;
    StreamSource myStreamSource = new StreamSource(myInputStream);
    in = myStreamSource.getInputStream();
    try{
    System.out.println("1 test" + + in.read()); // gives me nothing back, while it should give 98
    }catch( Exception e ) {
    System.err.println("error:" + e.toString() );
    Why does the first read-method returns the Decimal ASCII of the letter "b" and the second does not?
    Can anyone tell me what I'm doing wrong? I'm not really familiar with these streaming stuff, any help would be great !

    String data = "sfgafgagafg";
    ByteArrayInputStream bais = new ByteArrayInputStream(data.getBytes())

  • Unable to create a report based on a text field which returns , separat val

    hi,
    i have created a sql report which fetches the values depending on values in text field,
    select * from emp where empno in :P2_xwhere P2_x is a text field,
    if i enter only one value then report is generated and if i enter two values separated by ","
    says no data found
    thanks,
    Little Foot

    >
    i have created a sql report which fetches the values depending on values in text field,
    select * from emp where empno in :P2_x
    where P2_x is a text field,
    if i enter only one value then report is generated and if i enter two values separated by ","
    says no data found
    >
    In
    select * from emp where empno in (7788, 7839, 7876)<tt>(7788, 7839, 7876)</tt> is an expression list and the predicate is evaluated as a membership condition.
    In
    select * from emp where empno in :P2_x<tt>:P2_X</tt> is a scalar string, incapable of containing multiple values.
    See +varying elements in IN list+ on Ask Tom, and +emulating string-to-table functionality using sql+ for potential solutions.
    In an APEX standard report, use a PL/SQL function body returning an SQL query report source with lexical substitution to produce a "varying IN-list":
    return 'select * from emp where empno in (' || :P2_X || ')';where <tt>P2_X</tt> has been sanitized for SQL injection and string values are properly quoted.

  • Setting column for filter function

    I've got the following code working for filtering data in a
    grid, but it's currently hard-coded to only filter on the
    "Character" column. (see the searchData function) I'm capturing the
    string for the column that should be searched in the filterColumn
    variable, but now I'm stuck as to how to 'inject' that string into
    the IF statement of the searchData function. If someone can offer
    an explanation I'd appreciate it.
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="vertical"
    creationComplete="init()">
    <mx:Script>
    <![CDATA[
    import mx.collections.ArrayCollection;
    private function init():void {
    initData();
    setFilterColumn();
    [Bindable]
    private var dataList:ArrayCollection ;
    private function initData():void{
    dataList= new ArrayCollection([
    {character:"Peter Gibbons", actor:"Ron Livingston"},
    {character:"Joanna", actor:"Jennifer Aniston"},
    {character:"Michael Bolton", actor:"David Herman"},
    {character:"Samir Nagheenanajar", actor:"Ajay Naidu"},
    {character:"Lawrence", actor:"Diedrich Bader"},
    {character:"Milton Waddams", actor:"Stephen Root"},
    {character:"Bill Lumbergh", actor:"Gary Cole"},
    {character:"Tom Smykowski", actor:"Richard Riehle"},
    {character:"Anne", actor:"Alexandra Wentworth"},
    {character:"Dom Portwood", actor:"Joe Bays"},
    {character:"Bob Slydell", actor:"John C. McGinley"},
    {character:"Bob Porter", actor:"Paul Wilson"},
    {character:"Nina", actor:"Kinna McInroe"},
    {character:"Brian", actor:"Todd Duffy"},
    {character:"Drew", actor:"Greg Pitts"}
    private function filterData():void{
    dataList.filterFunction = searchData;
    dataList.refresh();
    private function searchData(item:Object):Boolean{
    var isMatch:Boolean = false;
    // character is hard coded below
    if(item.character.toLowerCase().search(filterInput.text.toLowerCase())
    != -1){
    isMatch = true;
    return isMatch;
    private function clearFilter():void{
    dataList.filterFunction = null;
    dataList.refresh();
    filterInput.text = '';
    [Bindable]
    private var filterColumn:String;
    private function setFilterColumn():void {
    filterColumn = columnCombo.selectedItem.value;
    ]]>
    </mx:Script>
    <mx:HBox verticalAlign="middle">
    <mx:Label text="Filter:" />
    <mx:ComboBox id="columnCombo"
    change="setFilterColumn()">
    <mx:dataProvider>
    <mx:ArrayCollection id="views">
    <mx:Object label="Character" value="character" />
    <mx:Object label="Actor" value="actor" />
    </mx:ArrayCollection>
    </mx:dataProvider>
    </mx:ComboBox>
    <mx:TextInput id="filterInput" change="filterData()"
    />
    <mx:Button label="Clear" click="clearFilter()" />
    </mx:HBox>
    <mx:DataGrid dataProvider="{dataList}" width="400"
    height="400">
    <mx:columns>
    <mx:DataGridColumn headerText="Character"
    dataField="character" />
    <mx:DataGridColumn headerText="Actor" dataField="actor"
    />
    </mx:columns>
    </mx:DataGrid>
    </mx:Application>

    Josh Johnson a écrit :
    > That definitely took me another step. To fit my
    previously posted code, I
    > edited your suggestion to this:
    >
    > public function searchData(item:Object):Boolean {
    > var isMatch:Boolean=false;
    > var pattern:RegExp = new
    RegExp("^"+filterInput.text,"i");
    > if (!item[String(columnCombo.selectedItem.value)].length
    ||
    >
    item[String(columnCombo.selectedItem.value)].match(pattern))
    > isMatch=true;
    > return isMatch;
    > }
    >
    > This now works as advertised apart from one bug. It only
    does matches to the
    > beginning of the strings. (i.e if I type in "eter" it
    wouldn't return "Peter
    > Gibbons" through the filter.)
    >
    Just remove anchor 'start of string' from the regexp ("^").
    new RegExp(filterInput.text,"i");

  • Having troubles passing values of Shuttle control to SQL Query of Report and Chart Region

    Hello,
    I am very new to APEX and need help for one of the Pa.I have a shuttle control on my page which populates Categories. Once user selects Categories from this control, I wish to pass the values to following SQL query :
    select * from emp_class where category IN ( LIST of VALUES FROM RIGHT SIDE SHUTTLE).
    I tried various ways of doing this including writing a java scripts which reads shuttle value, converts it into below string
    'Category1',Category2',Category3'. Then I set this value to a text box. And then I was expecting that below trcik would work
    select * from emp_class where category IN (:TXT_VALUES)
    I am sure this is not right way and hence its not working. Can you please guide me here with options?
    Many Thanks,
    Tush

    b96402b4-56f7-44ba-8952-fb82a61eeb2c wrote:
    Please update your forum profile with a real handle instead of "b96402b4-56f7-44ba-8952-fb82a61eeb2c".
    I am very new to APEX and need help for one of the Pa.
    Don't understand what this means. What is "Pa"?
    select * from emp_class where category IN (:TXT_VALUES)
    I am sure this is not right way and hence its not working. Can you please guide me here with options?
    This is a common fallacy. In
    select * from table where columnvalue in (7788, 7839, 7876)
    (7788, 7839, 7876) is an expression list and the predicate is evaluated as a membership condition.
    In
    select * from table where columnvalue in :P1_X
    :P1_X is a scalar string, incapable of containing multiple values.
    In an APEX standard report, a PL/SQL function body returning an SQL query report source with lexical substitution can be used to produce a "varying IN-list":
    return 'select * from table where columnvalue in (' || :P1_X || ')';
    where P1_X contains fewer than 1000 values, has been sanitized for SQL injection, and string values are properly quoted.
    Some people suggest the following approach, which will also work in APEX interactive reports:
    select * from table where instr(':' || :P1_X || ':', ':' || columnvalue || ':') > 0
    However this is non-performant as it eliminates the possibility of the optimizer using indexes or partition pruning in the execution plan.
    See varying elements in IN list on Ask Tom, and emulating string-to-table functionality using sql for efficient solutions.

  • Formating and operating with integer values

    I am new to XML Publisher.
    I have a task to make a layout using rtf. The problem is that I must do an arithmetical operation using data generated from a system report. I must not modify the report!!!
    The value retrieved from report is of X.Y format which means a time period (X - years, Y - months). So I want to split this value in two - one for years and other for months with a posibility of making arithmetical operations over them. Is it possible?? And if so, cand anybody give me a solution for this...?

    ok, back to the problem. As I red in the XML Publihser Users Guide there is a posibility to transform strings in numbers, but I can't figure out how it works! As speaking of my problem I can not do arithmetical operations with that value (YEARS.MONTHS). I tried the to_number function described in XML Publisher User's Guide (page 7-3) over the vlaue x.y, I tried to change the point (x.y) to a comma (x,y) and again aply to_number function over resulted value, but it doesn't work. What do I do wrong?
    I tried the solution of spliting the x from y, but I run into a problem again. The years part x has a variable length so I can't get the y part. (the substr function didn't worked with negative start position - substr(DATE, -3, 3))
    Generaly I'm a very confused about XML Publisher. There are examples in User's Guide which didn't work for me...
    If anybody has some links with documentation about XML Publisher, other than those from ORACLE, please share them with me.
    10x!

  • Captcha form validation ?

    Hi -
    Is there any plans to make the Captcha image form validator available for asp vbscript users as well?
    Bjørn-T

    Captcha is good until they hack around it.  I had a form with Capthca  that was being spam every other day.  I came up with an additional steps in the form processing code to check for spam if they get pass Captcha.
    1. Most spam has a link in the content.  I coded a loop that checks each form field that checks for the string url.
    foreach (string name in Request.Form.AllKeys)
                    if (name != "submit")
                        value = Request.Form[name];
                        checkvalue(value);
        public void checkvalue(string somevalue)
                    if (somevalue.IndexOf("[url=") != -1)
                        Response.Redirect("home.htm");
    2. To catch spam without the string url.  Most spam bots are dumb and they will place a value in every text in a form. So, I place a hidden field in the form that is blank.  In the form processing code, I check to see if that hidden field is still blank. If the hidden field has a value, I redirect the bot.
                string hiddentext= Request.Form["hiddentext"];
                if (hiddentext.Length > 1)
                    Response.Redirect("index.html");   //Wonder if I could redirect the bot to the FBI or cybercrime office
    Results:
       This web site does not have anymore spam.  This works great until the hackers figure it out.  The example code is written in C#, but can easy rewritten in PHP or Classis ASP.
    Note: the loop can be use to check for the bots that are trying to hack SQL databases by looking for the common SQL injections attacks strings like 'SET%20'.
    David Pearson
    www.saludalabs.com
    www.workhorsecreative.net

  • Weird APEX error when refreshing report

    Hi All,
    I am trying to refresh a report with dynamic action. And getting the following errors:
    {"dialog":{"uv":true,"row":[{"V":"Widget Failure
    ORA-20876: Stop APEX Engine,
    classic_report"}]}}
    I have identified the problematic part. I have a multi-select select list and my query goes like this:
    select o.order_id, s.salesrep_name
    from ml_orders o, ml_order_salesrep_mapping m
    where m.order_id(+) = o.order_Id
    and case when :P22_SALESREP is null then 1
    when :P22_SALESREP IS NOT NULL and m.salesrep_id in (:P22_SALESREP) then 1
    else 0
    end = 1Previously this line: when :P22_SALESREP IS NOT NULL and m.salesrep_id in (:P22_SALESREP) then 1 used to be just when :P22_SALESREP IS NOT NULL and m.salesrep_id i=:P22_SALESREP then 1 and it would work. But have requirement to make this select list multi-select.
    Any help appreciated.
    Using Apex 4.2, classic report with refresh by dynamic action upon button click.

    William Wallace wrote:
    I am trying to refresh a report with dynamic action. And getting the following errors:
    {"dialog":{"uv":true,"row":[{"V":"Widget Failure
    ORA-20876: Stop APEX Engine,
    classic_report"}]}}
    I have identified the problematic part. I have a multi-select select list and my query goes like this:
    select o.order_id, s.salesrep_name
    from ml_orders o, ml_order_salesrep_mapping m
    where m.order_id(+) = o.order_Id
    and case when :P22_SALESREP is null then 1
    when :P22_SALESREP IS NOT NULL and m.salesrep_id in (:P22_SALESREP) then 1
    else 0
    end = 1Previously this line: when :P22_SALESREP IS NOT NULL and m.salesrep_id in (:P22_SALESREP) then 1 used to be just when :P22_SALESREP IS NOT NULL and m.salesrep_id i=:P22_SALESREP then 1 and it would work. But have requirement to make this select list multi-select.It doesn't work like that. In
    select * from table where columnvalue in (7788, 7839, 7876)<tt>(7788, 7839, 7876)</tt> is an expression list and the predicate is evaluated as a membership condition.
    In
    select * from table where columnvalue in (:P1_X)<tt>:P1_X</tt> is a scalar string, incapable of containing multiple values.
    See +varying elements in IN list+ on Ask Tom, and +emulating string-to-table functionality using sql+ for potential solutions.
    In an APEX standard report, use a PL/SQL function body returning an SQL query report source with lexical substitution to produce a "varying IN-list":
    return 'select * from emp where empno in (' || :P1_X || ')';where <tt>P1_X</tt> has been sanitized for SQL injection and string values are properly quoted if necessary.

Maybe you are looking for