Check string length server-side

Hi guys,
how do i check the string length server-side?
I am using the date object to gather the current date.
quote:
var d = new Date();
var mm = d.getMonth()+1;
var yy = d.getFullYear();
var dd = d.getDate();
month is returned as "2" which is correct
but i need to be able to check for a single char so that i
can add a leading zero before it is submitted to the database. This
is also required for day.
thanks
Paul

Unfortunately, it's not possible to evaluate an environment variable within an SHTML tag.

Similar Messages

  • Power View with dynamic connection string, but server-side

    We'd like to evaluate using Power View to provide exploratory BI over data output from HDInsight, onto Azure Storage. We need to let users select which segments of data to load but through a web-ui (not Excel on the desktop). We expect to have a standard
    data model, it's just the segments of data that will be dynamically selected by the user. Basically the Power Query will need to be updated dynamically, but on the server-side. Is this scenario currently possible?

    Any suggestions for SFiorito?
    Thanks!
    Ed Price, Power BI & SQL Server Customer Program Manager (Blog,
    Small Basic,
    Wiki Ninjas,
    Wiki)
    Answer an interesting question?
    Create a wiki article about it!

  • Server side error checking

    How do I check for alpha numeric charcters on the server side. Page is JSP.
    I have a string username and want to check to ensure that all characters are alphanumeric

    if you are using Java 1.4, you can use regular expressions. Conditions and terms apply. Consult your local API docs for details.

  • Checking Offline Files Usage by Domain User - Server Side

    Hello.
    Our IT staff is looking for a way to determine which domain users have Offline Files set up on their PCs. I don't fully understand how Offline Files works, but I'm guessing it is mostly a client-side mechanism. That having been said, does anyone know
    of a way or a place on the file server which can tell us exactly who in the domain is using O.F.? I'm sure there is some kind of script that can be written to query each PC individually, but we would prefer to check server-side if possible.
    Domain Controller OS: Windows Server 2003
    File Server OS: Windows Server 2003
    Client OS: Some Windows XP, Most Windows 7
    Thank you in advance for your help.

    Hi, 
    It seems that some kind of scrip can achieve this. I suggest you ask for help from The Official Scripting Guys Forum:
    http://social.technet.microsoft.com/Forums/en-US/home?forum=ITCG
    Regards, 
    Mandy
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • Server side spell checker plugin

    Hi,
    Is there a server side spell checker plugin that I can use within the CQ server for checking the spelling of text written within textareas and textboxes on my page?
    Thanks in advance
    Shriram

    Hi Shriram,
        For rte it is available [1]. In case you are looking to validate the user form submission for textareas and textboxes. It is not available.
        Might be you need to develop one using [2].
    [1]   http://dev.day.com/docs/en/cq/current/widgets-api/index.html?class=CQ.form.rte.plugins.Spe llCheckerPlugin
    [2]
    http://wiki.apache.org/jackrabbit/SpellChecker
    http://dev.day.com/docs/en/cq/5-4/javadoc/com/day/cq/wcm/foundation/Search.Result.html#get Spellcheck%28%29
    Thanks,
    Sham

  • This is a server side problem. Check the URI.

    This page has three 500 errors on it. I guess I don't understand the problem. The things that have errors work ok. Is this something I can fix or do I complain to my webhost?
    http://www.newyorkhistoryreview.com/call.html
    Line: 124 http://www.newyorkhistoryreview.com/restprocess.html
    Status: 500 Server closed connection without sending any data back
    This is a server side problem. Check the URI.
    Line: 125 http://www.dianejanowski.com/
    Status: 500 Server closed connection without sending any data back
    This is a server side problem. Check the URI.
    Line: 97 http://www.newyorkhistoryreview.com/annualissues.html
    Status: 500 Server closed connection without sending any data back
    This is a server side problem. Check the URI.
    Diloretta

    Where are you seeing these errors?
    They must be temporary as you have apparently accessed them without trouble.

  • Checking the length of a string in sapscript

    Is there a way to check the length of a string in sapscript?
    What I want to do is, if the length of two strings is greater than a certain ammount, truncate the string.
    But I don't know if is possible inside the sapscript

    Never mind, I did it with a perform instead

  • Is there a way to dynamically determine the number of out parameters for a server side procedure?

    Hi,
    Below is a helper method used for calling a server-side function which loops through the inbound bindVars parameter to populate the function's IN parameters. Is there a way to dynamically determine the IN/OUT parameters based on the procedure name in the stmt parameter? No members of the CallableStatement class seemed promising, but the getParameterMetaData() method in the PreparedStatement class seemed like it could be helpful lead. However, I have not found any detailed descriptions (yet) of how to use it.
    protected Object callStoredFunction(int sqlReturnType, String stmt,
      Object[] bindVars) {
      CallableStatement st = null;
      try {
      // 1. Create a JDBC CallabledStatement 
      st = getDBTransaction().createCallableStatement(
      "begin ? := "+stmt+";end;",0);
      // 2. Register the first bind variable for the return value
      st.registerOutParameter(1, sqlReturnType);
      if (bindVars != null) {
      // 3. Loop over values for the bind variables passed in, if any
      for (int z = 0; z < bindVars.length; z++) {
      // 4. Set the value of user-supplied bind vars in the stmt
      st.setObject(z + 2, bindVars[z]);
      // 5. Set the value of user-supplied bind vars in the stmt
      st.executeUpdate();
      // 6. Return the value of the first bind variable
      return st.getObject(1);
      catch (SQLException e) {
      throw new JboException(e);
      finally {
      if (st != null) {
      try {
      // 7. Close the statement
      st.close();
      catch (SQLException e) {}
    James

    The PreparedStatement.getParameterMetaData() object is exactly what you need for this task.
    Once you have the ParameterMetaData you can ask it how many parameters are present and which mode they are. The parameters are numbered from 1 to n and you can use ParameterMetaData.getParameterMode(1); to get the mode of the 1st parameter. The modes are defined as static values in the ParameterMetaData object. Check out the doc at http://docs.oracle.com/javase/7/docs/api/java/sql/ParameterMetaData.html
    Timo

  • Server side validation

    Hi I am trying to validate two forms the first form allows a customer to register if it is correctly validated then it proceeds to address form as these two tables are linked by foreign key so when u create account in one need to do it at the same time for both. I tried client side JavaScript to validate the forms which works but don t prevent the accounts from being created if wrong. This method I tried to implement:
    ackage projectshowbeans;
    import java.sql.*;
    import java.util.*;
    import java.util.HashMap;
    public class customer2 {
         private String bnDbDriver = "org.gjt.mm.mysql.Driver";
         private String bnDbId = "jdbc:mysql://localhost/c99nrdb";
         private String bnDbUser = "c99nr_web";
         private String bnDbPassword = "Thank=88";
         private String custId;
         private String bnTitle="";
         private String bnFirstName="";
         private String bnLastName="";
         private String bnType_Of_Occupation="";
         private String bnemail="";
         private String bnpassword="";
         private String bnpassword2="";
         private String bnType="";
         private String bnNumber="";
         private String bnExp_Date="";
         private String bnCardholder_Name="";
         private String bnemail2="";
         private String mostRecentDeletion = "Nothing has been deleted";
         private int validate = 0;
         private String custid="";
         private int validatem = 0;
         private HashMap validationerrors = new HashMap();
         //StringTokenizer is used to check for empty spaces as in prevents user from submitting a empty form
         //countTokens count the number of empty spaces between the words if no words no token it would be empty and validate to 0
         //otherwise it would equal 1 and the message output shall appears on the screen. To be exact as long as it count the number of whitespaces this means
         //if it is more then 1 it can be then there must be text present in the text field and thus tokens can be made.
         /*public String getIsEmpty()
              String output = "nothing";
              StringTokenizer Email = new StringTokenizer(getBnEmail());
              StringTokenizer Title = new StringTokenizer(getBnTitle());
              StringTokenizer FirstName = new StringTokenizer(getBnFirstName());
              StringTokenizer LastName = new StringTokenizer(getBnLastName());
              StringTokenizer Occupation = new StringTokenizer(getBnType_Of_Occupation());
              StringTokenizer Password = new StringTokenizer(getBnpassword() );
              StringTokenizer confirmpass = new StringTokenizer(getBnpassword2());
              StringTokenizer Numbers = new StringTokenizer(getBnNumber());
              StringTokenizer Date1 = new StringTokenizer(getBnExp_Date());
              StringTokenizer Type = new StringTokenizer(getBnType() );
              StringTokenizer cardholder = new StringTokenizer(getBnCardholder_Name());
              if (Email.countTokens() < 1 || Title.countTokens() < 1 || FirstName.countTokens() < 1 || LastName.countTokens() < 1 || Occupation.countTokens() < 1 || Password.countTokens() < 1 || confirmpass.countTokens() < 1 || Numbers.countTokens() < 1 || Date1.countTokens() < 1 || Type.countTokens() < 1 || cardholder.countTokens() < 1)
                   output = "Please fill in all fields. Thank you.";
                   System.out.println("this is empty at first attempt and then second time nothing typed");
                   validatem = 0;
                   output = "To fill in your address details proceed to this page by <a href=\"../jsp/NewAddress.jsp\"> clicking here</a>";
                   validatem = 1;
              return output ;
         public boolean isValidUserData() {
                   System.out.println(bnFirstName);     
                   return (( bnFirstName !=null) && (bnFirstName.length() >0) &&
                        (bnpassword !=null) && (bnpassword.length() != 8) &&
                        (bnpassword2 !=null) && (bnpassword2.length() != 8)&&
                        (bnemail !=null) && (bnTitle !=null) &&
                        (bnLastName != null) && (bnLastName.length() >0) &&
                        (bnType !=null) && (bnNumber !=null) &&
                        (bnExp_Date !=null) && (bnCardholder_Name != null) &&
                        (bnType_Of_Occupation !=null));
         public String getFieldError(String fieldname) {
              return ((String) validationerrors.get(fieldname));
         public void addFieldError(String fieldname, String error) {
              validationerrors.put(fieldname, error);
         public boolean validateCustomer() {
              validationerrors.clear();
              boolean valid = true;
              if ((bnemail == null) ||
                   (bnemail.length() == 0)) {
                   addFieldError("frmemail", "email address is required.");
                   valid = false;
              } else {
                   if (bnemail.indexOf("@")== -1) {
                        addFieldError("email", "please supply a valid address");
                        valid =false;
              if ((bnpassword == null) ||
                   (bnpassword.length() != 8)) {
                   addFieldError("frmpassword", "Password is required.");
              return valid;
    if(form1.frmpassword.value.length != 8 )
                        //alert(form1.frmpassword);
                        alert("Password must be eightt characters long");
                        form1.frmpassword.focus();
                        form1.frmpassword.select();
                        return(false);
                   else
                        if(form1.frmpassword2.value != form1.frmpassword.value)
                             alert("The confirmation password does not match the original password");
                             form1.frmpassword2.focus();
                             form1.frmpassword2.select();
                             return(false);
              </SCRIPT>
              <% if (request.getParameter("SUBMITTED") != null) {
                   try {
                        if (newcust.validateCustomer()) {
                             newcust.createcustomer();
                             response.sendRedirect("NewSuccess1.jsp");
                   } catch (Exception e){
                        //System.out.println("customer2.JSP:" + e);
                        newcust.addFieldError("frmemail", "email already in use");
              if (newcust.getBnEmail() == null) {
                   newcust.setBnEmail(" ");
              if (newcust.getBnpassword() == null) {
                   newcust.setBnpassword("");
              %>
              <TITLE>
                   Create New Customer Account
              </TITLE>
         </HEAD>
         <BODY>
              <table border ="0" width="100%" bgcolor="#BDC6DE">     
                   <tr>
                        <td>
                             <jsp:include
                                  page="main menu 2.jsp"
                                  flush="true"
                                  />
                             <td>
                             </tr>
                             <Form method="post" action="NewSuccess1.jsp" id="form1" name="form1" return onsubmit="validation()"> <%--post prevents the variable being passed in the url--%>
                                  <input type="Hidden" name="SUBMITTED" Value="T">
                                  <table border ="1">
                                       <tr>
                                            <%--/*if (newcust.getFieldError("frmemail") != null) {%>
                                            <%//newcust.getFieldError("frmemail")%></font><br></td>*\--%>
    Java methods aree fine but when I try to access these ion the JSP page it fucks up I can t see how to resolve the issues can anyone help ?

    Hi the code that I showed you was on two separate pages one in the java file where I have tried numerous methods at server side validation
    e.g.
    private int validate = 0;
    //StringTokenizer is used to check for empty spaces as in prevents user from submitting a empty form
         //countTokens count the number of empty spaces between the words if no words no token it would be empty and validate to 0
         //otherwise it would equal 1 and the message output shall appears on the screen. To be exact as long as it count the number of whitespaces this means
         //if it is more then 1 it can be then there must be text present in the text field and thus tokens can be made.
         /*public String getIsEmpty()
              String output = "nothing";
              StringTokenizer Email = new StringTokenizer(getBnEmail());
              StringTokenizer Title = new StringTokenizer(getBnTitle());
              StringTokenizer FirstName = new StringTokenizer(getBnFirstName());
              StringTokenizer LastName = new StringTokenizer(getBnLastName());
              StringTokenizer Occupation = new StringTokenizer(getBnType_Of_Occupation());
              StringTokenizer Password = new StringTokenizer(getBnpassword() );
              StringTokenizer confirmpass = new StringTokenizer(getBnpassword2());
              StringTokenizer Numbers = new StringTokenizer(getBnNumber());
              StringTokenizer Date1 = new StringTokenizer(getBnExp_Date());
              StringTokenizer Type = new StringTokenizer(getBnType() );
              StringTokenizer cardholder = new StringTokenizer(getBnCardholder_Name());
              if (Email.countTokens() < 1 || Title.countTokens() < 1 || FirstName.countTokens() < 1 || LastName.countTokens() < 1 || Occupation.countTokens() < 1 || Password.countTokens() < 1 || confirmpass.countTokens() < 1 || Numbers.countTokens() < 1 || Date1.countTokens() < 1 || Type.countTokens() < 1 || cardholder.countTokens() < 1)
                   output = "Please fill in all fields. Thank you.";
                   System.out.println("this is empty at first attempt and then second time nothing typed");
                   validatem = 0;
                   output = "To fill in your address details proceed to this page by <a href=\"../jsp/NewAddress.jsp\"> clicking here</a>";
                   validatem = 1;
              return output ;
    This method works it counts the empty spaces and if any it does not allow the user to proceed to same page but if correct it goes to the same page but show all their answers filled using jsp:get Property and then the link above to the other form to fill in the code. However no indivdual messages can be passed to the user which is crap as the people keeps pressing he won t know what is wrong.
    The method that I am currently using is this one:
         public boolean isValidUserData() {
                   System.out.println(bnFirstName);     
                   return (( bnFirstName !=null) && (bnFirstName.length() >0) &&
                        (bnpassword !=null) && (bnpassword.length() != 8) &&
                        (bnpassword2 !=null) && (bnpassword2.length() != 8)&&
                        (bnemail !=null) && (bnTitle !=null) &&
                        (bnLastName != null) && (bnLastName.length() >0) &&
                        (bnType !=null) && (bnNumber !=null) &&
                        (bnExp_Date !=null) && (bnCardholder_Name != null) &&
                        (bnType_Of_Occupation !=null));
    again this method is held in the Java file. This works the best as it checks for empty spaces however the password verification it does not do check whether password 1 matches password 2 nor the fact that password should be 8 characters only or check whether the user is typing in an integer or not etc. I can do this in JavaScript the integer one I am not sure. I then use JSP page which is this below:
    <jsp:useBean
         id="newcust"
         scope="session"
         class="projectshowbeans.customer2"
         />
    <!--
    <jsp:useBean
         id="newaddress"
         scope="page"
         class="projectshowbeans.Address"
         />
    <jsp:setProperty
         name="newaddress"
         property="bnemail"
         param="frmemail"
         />
    -->
    <jsp:setProperty
         name="newcust"
         property="bnEmail"
         param="frmemail"
         />
    <jsp:setProperty
         name="newcust"
         property="bnFirstName"
         param="frmFirstname"
         />
    <jsp:setProperty
         name="newcust"
         property="bnLastName"
         param="frmLastname"
         />
    <jsp:setProperty
         name="newcust"
         property="bnType"
         param="frmtype"
         />
    <jsp:setProperty
         name="newcust"
         property="bnTitle"
         param="frmtitle"
         />
    <jsp:setProperty
         name="newcust"
         property="bnCardholder_Name"
         param="frmcard"
         />
    <jsp:setProperty
         name="newcust"
         property="bnExp_Date"
         param="frmDate"
         />
    <jsp:setProperty
         name="newcust"
         property="bnNumber"
         param="frmnumber"
         />
    <jsp:setProperty
         name="newcust"
         property="bnExp_Date"
         param="frmDate"
         />
    <jsp:setProperty
         name="newcust"
         property="bnpassword2"
         param="frmpassword2"
         />
    <jsp:setProperty
         name="newcust"
         property="bnpassword"
         param="frmpassword"
         />
    <jsp:setProperty
         name="newcust"
         property="bnType_Of_Occupation"
         param="frmoccupation"
         />
    <html>
         <HEAD>
              <SCRIPT language="JavaScript" type="text/javascript">
              /*function validation() {
                        if(form1.frmnumber.value==0)
                             //alert(form1.frmpassword);
                             alert("Please fill in the number field. Thank you");
                             form1.frmnumber.focus();
                             return(false);
                        if(form1.frmemail.value==0)
                             //alert(form1.frmpassword);
                             alert("Please fill in the email field. Thank you");
                             form1.frmemail.focus();
                             return(false);
                        if(form1.frmtitle.value==0)
                             //alert(form1.frmpassword);
                             alert("Please fill in the title field. Thank you");
                             form1.frmtitle.focus();
                             return(false);
                        if(form1.frmFirstname.value==0)
                             //alert(form1.frmpassword);
                             alert("Please fill in the First Name field. Thank you");
                             form1.frmFirstname.focus();
                             return(false);
                        if(form1.frmLastname.value==0)
                             //alert(form1.frmpassword);
                             alert("Please fill in the Last Name field. Thank you");
                             form1.frmLastname.focus();
                             return(false);
                        if(form1.frmDate.value==0)
                             //alert(form1.frmpassword);
                             alert("Please fill in the Exp Date field. Thank you");
                             form1.frmDate.focus();
                             return(false);
                        if(form1.frmcard.value==0)
                             //alert(form1.frmpassword);
                             alert("Please fill in the CardholderName field. Thank you");
                             form1.frmcard.focus();
                             return(false);
                        if(form1.frmpassword.value.length != 8 )
                             //alert(form1.frmpassword);
                             alert("Password must be eightt characters long");
                             form1.frmpassword.focus();
                             form1.frmpassword.select();
                             return(false);
                        else
                             if(form1.frmpassword2.value != form1.frmpassword.value)
                                  alert("The confirmation password does not match the original password");
                                  form1.frmpassword2.focus();
                                  form1.frmpassword2.select();
                                  return(false);
              </SCRIPT>
              <TITLE>
                   Create New Customer Account
              </TITLE>
         </HEAD>
         <BODY>
              <table border ="0" width="100%" bgcolor="#BDC6DE">     
                   <tr>
                        <td>
                             <jsp:include
                                  page="main menu3.jsp"
                                  flush="true"
                                  />
                             <td>
                             </tr>
              <Form method="post" action="NewSuccess.jsp"> <%--post prevents the variable being passed in the url--%>
                                  <table border="0">
                                       <tr>
                                       <td><p>Please ensure you fill in all fields below in the form. Once everything is successfully validated you will be taken to another form to fill in your address details.</p></td>
                                       </tr>
                                  <table border ="1">     
                        <tr>
                             <td>email address:</td> <td><Input Name="frmemail" Type="Text" Size="50" value='<jsp:getProperty name="newcust" property="bnEmail" />' >
    </td>
                        </tr>
                        <tr>               
                   <td>Password:</td>
                             <td><Input Name="frmpassword" Type="password" Size="50">
    </td><%--this form simply shows password and studentid type password allows it to be encoded--%>
                        </tr>
                        <tr>
                        <td>Password(Verification):</td>
                        <td><Input Name="frmpassword2" Type="password" Size="50">
    </td><%--this form simply shows password and studentid type password allows it to be encoded--%>
                   </tr>
                        <tr>
                   <td> Title:</td>
                             <td><input name="frmtitle" type="text" size="10" value='<jsp:getProperty name="newcust" property="bnTitle"/>'>
    </td>
                        </tr>
                        <tr>
                   <td>First Name:</td>
                             <td><input name="frmFirstname" type="text" size="30"value='<jsp:getProperty name="newcust" property="bnFirstName"/>'>
    </td>
                        </tr>
                        <tr>
                             <td>Surname:</td>
                             <td><input name="frmLastname" type="text" size="30" value='<jsp:getProperty name="newcust" property="bnLastName"/>'>
    </td>
                        </tr>
                        <tr>
                             <td>Occupation:</td>
                             <td><select name="frmoccupation">
                                       <option> student </option>
                                       <option> doctor </option>
                                       <option> businesman/woman </option>
                                       <option> teacher </option>
                                       <option> other </option>
                                  <jsp:getProperty name="newcust" property="bnType_Of_Occupation"/>>
                                  </select>
                             </td>
                        </tr>
                        <tr>
                             <td>Number:</td>
                             <td><input name="frmnumber" type="text" size="20" value='<jsp:getProperty name="newcust" property="bnNumber"/>'>
    </td>
                        </tr>
                        <tr>
                             <td>Type:</td>
                             <td><select name="frmtype" '<jsp:getProperty name="newcust" property="bnType"/>'>
                                  <option> Mastercard</option>
                                  <option> Visa </option>
                                  <option> Switch </option>     
                                  </select>
                             </td>
                        </tr>
                        <tr>
                             <td>exp date(DD/MM/YY):</td>
                             <td><input name="frmDate" type="text" value='<jsp:getProperty name="newcust" property="bnExp_Date"/>'>                                   
                        </tr>
                        <tr>
                             <td>cardholder name:</td>
                             <td><input name="frmcard" type="text" size="10"value='<jsp:getProperty name="newcust" property="bnCardholder_Name"/>'>
    </td>
                        </tr>
                   <tr>
                             <td><input type="submit" value="submit"></td>
                        </tr>
              </form>
              </table>
              <%
              //newcust.createcustomer();
              //newcust.getIsEmpty();
              %>
              <%--
              newaddress.createaddress();
              newaddress.createcustomerID();
              --%>          
         </Body>
    </html>
    I have cancelled the JavaScript as it does not work well with it the NewSucess page is the process page and states if all validation rules are correct carried out on the form by the boolean isValidUserData method then it will create the record in the customer table and provide a link to the following Address form. Otherwise if is false it goes to error page the code is below:
    <html>
         <HEAD>
              <TITLE>
                   Cuystomer Successfully Added
              </TITLE>
         </HEAD>
    <jsp:useBean
         id="newcust"
         scope="session"
         class="projectshowbeans.customer2"
         />
         <jsp:setProperty
              name="newcust"
              property="bnpassword"
              param="frmpassword"
              />
         <jsp:setProperty
              name="newcust"
              property="bnFirstName"
              param="frmFirstname"
    />
         <jsp:setProperty
              name="newcust"
              property="bnpassword2"
              param="frmpassword2"
              />
         <jsp:setProperty
              name="newcust"
              property="bnType_Of_Occupation"
              param="frmoccupation"
              />
         <jsp:setProperty
              name="newcust"
              property="bnNumber"
              param="frmnumber"
              />
         <jsp:setProperty
              name="newcust"
              property="bnExp_Date"
              param="frmDate"
              />
         <jsp:setProperty
              name="newcust"
              property="bnEmail"
              param="frmemail"
              />
         <jsp:setProperty
              name="newcust"
              property="bnFirstName"
              param="frmFirstname"
              />
         <jsp:setProperty
              name="newcust"
              property="bnLastName"
              param="frmLastname"
              />
         <jsp:setProperty
              name="newcust"
              property="bnType"
              param="frmtype"
              />
         <jsp:setProperty
              name="newcust"
              property="bnTitle"
              param="frmtitle"
              />
         <jsp:setProperty
              name="newcust"
              property="bnCardholder_Name"
              param="frmcard"
              />
    <BODY bgcolor="#BDC6DE">
              <%
              if (newcust.isValidUserData()) {
                   newcust.createcustomer();
              %>
              <table border ="0" width="100%" bgcolor="#BDC6DE">     
                   <tr>
                        <td>
                             <jsp:include
                                  page="main menu3.jsp"
                                  flush="true"
                                  />
                             <td>
                             </tr>
                        </table>
         <H1> Validating user data </H1>
         <H2> user data validated </h2>
              <p> To fill in your address details proceed to this page by clicking here</p>
              <% } else {
              %>
              <table border ="0" width="100%" bgcolor="#BDC6DE">     
                   <tr>
                        <td>
                             <jsp:include
                                  page="main menu3.jsp"
                                  flush="true"
                                  />
                             <td>
                             </tr>
                        </table>
                   <H1> Validating user data </H1>
              <h2> validation failed you have some missing fields</h2>
              <%}%>
    </Body>
    </html>
    Hopefully you have followed that. Ultimately if I can have it working in JavaScript that would excellent it does all form validation the previous code use saw the first JSP page however to then say only create record once I need to say function validation is validated = true then proceed to the next form else false appear with the message to the user and allow them to re - enter their answer I can t do that. I tried just putting the      
    newcust.createcustomer(); and the link to address on a separate page with String email request.getParameter("frmemail") for all of them but did not work. Hopefully you understand my dilemna more clearly now
    and can help me uinforunately I ain t got too long I need to have it done by tuesday its my final year project for my degree. Any help much appreciated.

  • Server side override

    Since the documents created in ifs don't inherit the ACL of the folder, I wrote
    a server side override. I tested with the JDeveloper, everything worked fine,
    a file of right ACL is created with my testing program. Then I moved the
    java class (S_TieFolderPathRelationship.class) to
    custom_classes/oracle/ifs/server and my testing program to
    $ORACLE_HOME/9ifs/myclasses (I created this directory myself). Everything also
    runs fine in the server side if I have the right classpath. However, if I
    upload a file to the ifs through webui or winui, The
    S_TieFolderPathRelationship.class in the custom_class is not being called,
    since the ACL is not right. Does anyone have any idea on this?
    Thanks,
    Jean

    The following is what I have implemented before (Change the ACL to its parent). It runs good.
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.IOException;
    import java.util.Date;
    import javax.mail.Session;
    import javax.mail.internet.MimeMessage;
    import javax.mail.internet.InternetAddress;
    import oracle.ifs.common.*;
    import oracle.ifs.beans.*;
    import oracle.ifs.management.domain.IfsServer;
    import oracle.ifs.adk.mail.IfsTransport;
    import oracle.ifs.adk.filesystem.*;
    public class MY_iFS_Agent extends IfsServer implements IfsEventHandler
         public static void main(String[] args) throws Exception
              // Verbose exception messages on.
              IfsException.setVerboseMessage(true);
              // Construct a parameter table from the command-line arguments.
              ParameterTable pt = new ParameterTable(args, "parameterfile");
              // Extract some additional parameters required for standalone operation.
              String serviceName = pt.getString("IFS.SERVER.Service");
              String schemaPassword = "ifssys";
              // Start a service against which to run a Notification Agent.
              LibraryService.startService(serviceName, schemaPassword);
              // Construct, initialize, and start the Notification Agent.
              MY_iFS_Agent agent = new MY_iFS_Agent();
              agent.initialize("MY_iFS_Agent", serviceName, schemaPassword, pt, null, LEVEL_HIGH);
              agent.start();
    public MY_iFS_Agent() throws IfsException
    super();
    public void run()
    try
    log(IfsServer.LEVEL_MEDIUM, "Start MY_iFS_Agent request");
    // Ensure a connection.
    connectSession();
    // Enable event listening.
    enableEventListening();
    while (!stopRequested())
    try
    // Handle any status changes firsts.
    handleRequests();
    // Process events.
    processEvents();
    // Wait for something to do.
    waitServer();
    catch (Exception e)
    log(IfsServer.LEVEL_MEDIUM, "Exception" + " in handle loop; continuing:");
    log(IfsServer.LEVEL_MEDIUM, e.getMessage());
    } // End the while loop.
    catch (IfsException e)
    // Exception that takes us out of the run loop;
    // this will cause a stop.
    log(IfsServer.LEVEL_MEDIUM, "IfsException" + " in run(): ");
    log(IfsServer.LEVEL_MEDIUM, e.toLocalizedString(getSession()));
    catch (Exception e)
    log(IfsServer.LEVEL_MEDIUM, "Exception" + " in run(): ");
    log(IfsServer.LEVEL_MEDIUM, e.getMessage());
         * Gets whether suspend/resume is supported.
         * @return                    true
         public boolean supportsSuspendResume()
              return true;
    * Handles the suspend request. Subclasses can override this to
    * perform custom tasks as part of a Suspend request.
    protected void handleSuspendRequest() throws IfsException
    log(IfsServer.LEVEL_MEDIUM, "Suspend request");
    // Disable event listening.
    disableEventListening();
    * Handles the resume request. Subclasses can override this to
    * perform custom tasks as part of a Resume request.
    protected void handleResumeRequest() throws IfsException
    log(IfsServer.LEVEL_MEDIUM, "Resume request");
    // Re-enable event listening.
    enableEventListening();
    * Performs post-run tasks.
    public void postRun()
    log(IfsServer.LEVEL_MEDIUM, "postRun");
    try
    // Disable event listening.
    disableEventListening();
    // Disconnect our session.
    disconnectSession();
    catch (Exception e)
    log(IfsServer.LEVEL_MEDIUM, "Exception" + " in postRun:");
    log(IfsServer.LEVEL_MEDIUM, e.getMessage());
    * Enables listening for events
    public void enableEventListening() throws IfsException
    LibrarySession session = getSession();
    try
    log(IfsServer.LEVEL_MEDIUM, "Enabling MY_iFS_Agent listening....");
    // Register for events on all PublicObject classes
    Collection c = session.getClassObjectCollection();
    //"true" in the argument means registering for all the objects of PublicObjects
    session.registerClassEventHandler((ClassObject)c.getItems(Folder.CLASS_NAME), true, this);
    session.registerClassEventHandler((ClassObject)c.getItems(Document.CLASS_NAME), true, this);
    log(IfsServer.LEVEL_MEDIUM, "Enabled MY_iFS_Agent listener!!");
    catch (IfsException e)
    log(IfsServer.LEVEL_MEDIUM, "IfsException" + " enabling Event Listening; re-throwing:");
    log(IfsServer.LEVEL_MEDIUM, e.toLocalizedString(session));
    throw e;
    catch (Exception e)
    log(IfsServer.LEVEL_MEDIUM, "Exception" + " enabling Event Listening; re-throwing:");
    log(IfsServer.LEVEL_MEDIUM, e.getMessage());
    // throw "agent unable to enable event listening"
    throw new IfsException(46002, e);
    * Disables listening for VersionDescription events
    * @nopub
    public void disableEventListening()
    LibrarySession session = getSession();
    try
    // Deregister for events on objects of VersionDescription class.
    Collection c = session.getClassObjectCollection();
    session.deregisterClassEventHandler((ClassObject)c.getItems(Document.CLASS_NAME), true, this);
    session.deregisterClassEventHandler((ClassObject)c.getItems(Folder.CLASS_NAME), true, this);
    catch (Exception e)
    log(IfsServer.LEVEL_MEDIUM, "Exception" + " disabling Event Listening:");
    log(IfsServer.LEVEL_MEDIUM, e.getMessage());
    * Handles events. This queues the events for processing by
    * the main agent thread.
    public void handleEvent(IfsEvent event)
    // Just queue the event and signal the main thread to process.
    // The only tasks that should be performed in this method
    // are any quick filtering.
    try
    //Only handle the event generated by the creation of an object.
    if (event.getEventType() == IfsEvent.EVENTTYPE_CREATEINSTANCE)
    queueEvent(event);
    log(IfsServer.LEVEL_MEDIUM, "Event received for Create");
    catch (Exception e)
    log(IfsServer.LEVEL_MEDIUM, "Exception" + " at handleEvent");
    log(IfsServer.LEVEL_MEDIUM, e.getMessage());
    * Processes the de-queued event. This sends an e-mail to the original owner
    * of the versioned document if the new version is created by a different user.
    public void processEvent(IfsEvent event) throws IfsException
    try
    Long id = event.getId();
    int eventType = event.getEventType();
    int eventSubType = event.getEventSubtype();
    PublicObject po = getSession().getPublicObject(id);
    if (po != null)
    switch (eventType) {
    case IfsEvent.EVENTTYPE_CREATEINSTANCE:
    log(IfsServer.LEVEL_MEDIUM, "Processing Create event for a " + po.getClassObject().getName() + " object." );
    PublicObject [] parentFolderList = po.getLeftwardRelationshipObjects("FolderPathRelationship");
    oracle.ifs.beans.Folder parentFolder = null;
    //IfsFileSystem fs=new IfsFileSystem(po.getSession());
    //Folder[] parentFolders=fs.getParents(po);
    if(parentFolderList.length>0) {
    //Change the object owner if it is not the same as its parent
    parentFolder = (oracle.ifs.beans.Folder) parentFolderList[0];
    DirectoryUser parentOwner = parentFolder.getOwner();
    DirectoryUser childOwner = po.getOwner();
    log(IfsServer.LEVEL_MEDIUM, (po.getCreator()).getDistinguishedName() + " created a new object" );
    //if (((parentFolder.getOwner()).getDistinguishedName()).equals("system"))
    // log(IfsServer.LEVEL_MEDIUM, "ACL and Owner wasn't updated to the system's subfolder" );
    //else
    if (!childOwner.equals(parentOwner)) po.setOwner(parentOwner);
    //Change the object Acl if it is not the same as its parent
    AccessControlList parentAcl = parentFolder.getAcl();
    AccessControlList childAcl = po.getAcl();
    if (!childAcl.equals(parentAcl)) po.setAcl(parentAcl);
    //log the result
    //log(IfsServer.LEVEL_MEDIUM, (parentFolder.getOwner()).getDistinguishedName() );
    log(IfsServer.LEVEL_MEDIUM, "ACL and Owner is updated to its parent" );
    else
    log(IfsServer.LEVEL_MEDIUM, "The parent list of current object is empty: Check MY_IFS_Agent.java");
    break;
    case IfsEvent.EVENTTYPE_FREE:
    log(IfsServer.LEVEL_MEDIUM, "Free the current object");
    break;
    default:
    log(IfsServer.LEVEL_MEDIUM, "Event: "+IfsEvent.EVENTTYPE_CREATEINSTANCE);
    break;
    catch (Exception e)
    log(IfsServer.LEVEL_MEDIUM, "Exception" + " at processEvent");
    log(IfsServer.LEVEL_MEDIUM, e.getMessage());

  • Client-Server side GUI programming

    I want to create a client-server side gui programming with java
    i read this web adress
    http://java.sun.com/docs/books/tutorial/networking/sockets/clientServer.html
    for information but there are some parts that i didnt understand and wait for your help
    i m trying to build an online-help(live chat) system so when people press the start chat button a java page will appear but i wonder how this will connect to the person who is on server side
    i mean is it possible to 2 users connect the same port and chat with each other
    I mean when user press the chat button the online help supporter will be informed somebody wants to speak with him and they will start a chat
    how can i do something like that
    any help would be usefull thanks

    Below is an example of a client/server program.
    It shows how the server listens for multiple clients.
    * TriviaServerMulti.java
    * Created on May 12, 2005
    package server;
    * @author johnz
    import java.io.*;
    import java.net.*;
    import java.util.Random;
    * This TriviaServer can handle multiple clientSockets simultaneously
    * This is accomplished by:
    * - listening for incoming clientSocket request in endless loop
    * - spawning a new TriviaServer for each incoming request
    * Client connects to server with:
    * telnet <ip_address> <port>
    *     <ip_address> = IP address of server
    *  <port> = port of server
    * In this case the port is 4413 , but server can listen on any port
    * If server runs on the same PC as client use IP_addess = localhost
    * The server reads file
    * Note: a production server needs to handle start, stop and status commands
    public class TriviaServerMulti implements Runnable {
        // Class variables
        private static final int WAIT_FOR_CLIENT = 0;
        private static final int WAIT_FOR_ANSWER = 1;
        private static final int WAIT_FOR_CONFIRM = 2;
        private static String[] questions;
        private static String[] answers;
        private static int numQuestions;
        // Instance variables
        private int num = 0;
        private int state = WAIT_FOR_CLIENT;
        private Random rand = new Random();
        private Socket clientSocket = null;
        public TriviaServerMulti(Socket clientSocket) {
            //super("TriviaServer");
            this.clientSocket = clientSocket;
        public void run() {
            // Ask trivia questions until client replies "N"
            while (true) {
                // Process questions and answers
                try {
                    InputStreamReader isr = new InputStreamReader(clientSocket.getInputStream());
                    BufferedReader is = new BufferedReader(isr);
    //                PrintWriter os = new PrintWriter(new
    //                   BufferedOutputStream(clientSocket.getOutputStream()), false);
                    PrintWriter os = new PrintWriter(clientSocket.getOutputStream());
                    String outLine;
                    // Output server request
                    outLine = processInput(null);
                    os.println(outLine);
                    os.flush();
                    // Process and output user input
                    while (true) {
                        String inLine = is.readLine();
                        if (inLine.length() > 0)
                            outLine = processInput(inLine);
                        else
                            outLine = processInput("");
                        os.println(outLine);
                        os.flush();
                        if (outLine.equals("Bye."))
                            break;
                    // Clean up
                    os.close();
                    is.close();
                    clientSocket.close();
                    return;
                } catch (Exception e) {
                    System.err.println("Error: " + e);
                    e.printStackTrace();
        private String processInput(String inStr) {
            String outStr = null;
            switch (state) {
                case WAIT_FOR_CLIENT:
                    // Ask a question
                    outStr = questions[num];
                    state = WAIT_FOR_ANSWER;
                    break;
                case WAIT_FOR_ANSWER:
                    // Check the answer
                    if (inStr.equalsIgnoreCase(answers[num]))
                        outStr="\015\012That's correct! Want another (y/n)?";
                    else
                        outStr="\015\012Wrong, the correct answer is "
                            + answers[num] +". Want another (y/n)?";
                    state = WAIT_FOR_CONFIRM;
                    break;
                case WAIT_FOR_CONFIRM:
                    // See if they want another question
                    if (!inStr.equalsIgnoreCase("N")) {
                        num = Math.abs(rand.nextInt()) % questions.length;
                        outStr = questions[num];
                        state = WAIT_FOR_ANSWER;
                    } else {
                        outStr = "Bye.";
                        state = WAIT_FOR_CLIENT;
                    break;
            return outStr;
        private static boolean loadData() {
            try {
                //File inFile = new File("qna.txt");
                File inFile = new File("data/qna.txt");
                FileInputStream inStream = new FileInputStream(inFile);
                byte[] data = new byte[(int)inFile.length()];
                // Read questions and answers into a byte array
                if (inStream.read(data) <= 0) {
                    System.err.println("Error: couldn't read q&a.");
                    return false;
                // See how many question/answer pairs there are
                for (int i = 0; i < data.length; i++)
                    if (data[i] == (byte)'#')
                        numQuestions++;
                numQuestions /= 2;
                questions = new String[numQuestions];
                answers = new String[numQuestions];
                // Parse questions and answers into String arrays
                int start = 0, index = 0;
                   String LineDelimiter = System.getProperty("line.separator");
                   int len = 1 + LineDelimiter.length(); // # + line delimiter
                boolean isQuestion = true;
                for (int i = 0; i < data.length; i++)
                    if (data[i] == (byte)'#') {
                        if (isQuestion) {
                            questions[index] = new String(data, start, i - start);
                            isQuestion = false;
                        } else {
                            answers[index] = new String(data, start, i - start);
                            isQuestion = true;
                            index++;
                    start = i + len;
            } catch (FileNotFoundException e) {
                System.err.println("Exception: couldn't find the Q&A file.");
                return false;
            } catch (IOException e) {
                System.err.println("Exception: couldn't read the Q&A file.");
                return false;
            return true;
        public static void main(String[] arguments) {
            // Initialize the question and answer data
            if (!loadData()) {
                System.err.println("Error: couldn't initialize Q&A data.");
                return;
            ServerSocket serverSocket = null;
            try {
                serverSocket = new ServerSocket(4413);
                System.out.println("TriviaServer up and running ...");
            } catch (IOException e) {
                System.err.println("Error: couldn't create ServerSocket.");
                System.exit(1);
            Socket clientSocket = null;
            // Endless loop: waiting for incoming client request
            while (true) {
                // Wait for a clientSocket
                try {
                    clientSocket = serverSocket.accept();   // ServerSocket returns a client socket when client connects
                } catch (IOException e) {
                    System.err.println("Error: couldn't connect to clientSocket.");
                    System.exit(1);
                // Create a thread for each incoming request
                TriviaServerMulti server = new TriviaServerMulti(clientSocket);
                Thread thread = new Thread(server);
                thread.start(); // Starts new thread. Thread invokes run() method of server.
    }This is the text file:
    Which one of the Smothers Brothers did Bill Cosby once punch out?
    (a) Dick
    (b) Tommy
    (c) both#
    b#
    What's the nickname of Dallas Cowboys fullback Daryl Johnston?
    (a) caribou
    (b) moose
    (c) elk#
    b#
    What is triskaidekaphobia?
    (a) fear of tricycles
    (b) fear of the number 13
    (c) fear of kaleidoscopes#
    b#
    What southern state is most likely to have an earthquake?
    (a) Florida
    (b) Arkansas
    (c) South Carolina#
    c#
    Which person at Sun Microsystems came up with the name Java in early 1995?
    (a) James Gosling
    (b) Kim Polese
    (c) Alan Baratz#
    b#
    Which figure skater is the sister of Growing Pains star Joanna Kerns?
    (a) Dorothy Hamill
    (b) Katarina Witt
    (c) Donna De Varona#
    c#
    When this Old Man plays four, what does he play knick-knack on?
    (a) His shoe
    (b) His door
    (c) His knee#
    b#
    What National Hockey League team once played as the Winnipeg Jets?
    (a) The Phoenix Coyotes
    (b) The Florida Panthers
    (c) The Colorado Avalanche#
    a#
    David Letterman uses the stage name "Earl Hofert" when he appears in movies. Who is Earl?
    (a) A crew member on his show
    (b) His grandfather
    (c) A character on Green Acres#
    b#
    Who created Superman?
    (a) Bob Kane
    (b) Jerome Siegel and Joe Shuster
    (c) Stan Lee and Jack Kirby#
    b#

  • Server side buffering settings for video

    I pump my video (both live streaming and VOD) through a popular CDN.  They control the server side (FMS) settings.  I can request that they change things and they do so and let me know when I can test.
    I'm wondering about server side buffering settings.  Is there supposed to be some sort of coordination between the buffering settings there and the client side buffering settings I implement in my video player?
    The reason I ask is I get wierd buffering behaviors in my client side player under certain conditions and there doesn't seem to be much to adjust there other than the NetStream.bufferTime property.
    For instance, if I set the bufferTime property in my client viewer to 10 seconds, the player just seems to ignore it and starts playing the stream right away or within a second or two.  Other times I see crazy values in the bufferTime property, like 400 seconds (I check the property's value about every second).
    I'm wondering if there are some FMS settings that are overriding or are not working well with my client side buffer settings.  Is this possible?

    Not sure how to get this code to you.  There is no option here to  attach a file.  Trying to post inline here.  Hope it comes out ok.
    This  is a simple player.  The simplest.  No frills.  Just insert your RTMP  url to your FMS and your stream name in the string variables "rtmpURL"  and "streamName" at the top, compile and run.
    Here is a deployment of this player connected to my CDN where the file is currently playing:
    http://dcast.dyventive.com/cast/simple_player/player.html
    Also,  attached is an image I took when I ran the program and hit the refresh  button in the browser.  Note the giant bufferLength numbers in the debug  panel.
    Again note, I do not get this problem linking  directly to a recorded file.  I see this problem when playing a file on a  server or with a live stream.
    Can you see anything  obviously wrong?
    <?xml  version="1.0" encoding="utf-8"?>
    <mx:Application
         xmlns:mx="http://www.adobe.com/2006/mxml"
         layout="absolute"
         backgroundColor="#333333"
         initialize="init()">
         <mx:Script>
             <![CDATA[
                 //Note:  the method "connect()" on  line #49 starts the area  with the important connection code
                 import mx.containers.Canvas;
                 import flash.media.Video;
                 import flash.net.NetConnection;
                 import flash.net.NetStream;
                 private var vid:Video;
                 private var nc:NetConnection;
                 //Path to your FMS live streaming application
                 private var rtmpURL:String = "Insert your URL"; //Will be  used to connect to your FMS
                 private var buffer:Number = 5; //NetStream.bufferTime  property will be set with this.
                 private var streamName:String =  "Insert your server side  stream name here"; //This determines the channel you're watching  on the  server.           
                 private var ns:NetStream;
                 private var msg:Boolean;
                 [Bindable]
                 private var canvas_video:Canvas;//Will display some live  playback  stats
                 private var intervalMonitorBufferLengthEverySecond:uint;
                  private function init():void
                     vid=new Video();   
                     vid.width=720;
                     vid.height=480;                   
                     vid.smoothing = true;               
                     uic.addChild(vid);
                     connect();
                 public function onSecurityError(e:SecurityError):void
                     trace("Security error: ");
                 public function connect():void
                     nc = new NetConnection();
                     nc.client = this;
                     nc.addEventListener(NetStatusEvent.NET_STATUS,  netStatusHandler);
                     nc.connect(rtmpURL);                    
                 public function netStatusHandler(e:NetStatusEvent):void
                       switch (e.info.code) {
                         case "NetConnection.Connect.Success":
                             netconnectionStatus.text = e.info.code;
                             reconnectStatus.text = "N/A";
                             trace("Connected successfully");
                             createNS();                    
                             break;                                               
                 public function createNS():void
                     trace("Creating NetStream");
                     ns=new NetStream(nc);
                     ns.addEventListener(NetStatusEvent.NET_STATUS,  netStreamStatusHandler);
                     vid.attachNetStream(ns);
                     //Handle onMetaData and onCuePoint event callbacks:  solution at http://tinyurl.com/mkadas
                     //See another solution at  http://www.adobe.com/devnet/flash/quickstart/metadata_cue_points/
                     var infoClient:Object = new Object();
                     infoClient.onMetaData = function oMD():void {};
                     infoClient.onCuePoint = function oCP():void {}; 
                     ns.client = infoClient;   
                     ns.play(streamName);   
                     ns.bufferTime = buffer;                   
                     ns.addEventListener(AsyncErrorEvent.ASYNC_ERROR,  asyncErrorHandler);
                     function asyncErrorHandler(event:AsyncErrorEvent):void {
                         trace(event.text);
                     //Set up the interval that will be used to monitor the  bufferLength property.
                     //monPlayback() will be the funciton that will do the  work.   
                     intervalMonitorBufferLengthEverySecond =  setInterval(monPlayback, 1000);
                 public function  netStreamStatusHandler(e:NetStatusEvent):void
                      switch (e.info.code) {
                         case "NetStream.Buffer.Empty":
                             netstreamStatus.text = e.info.code;
                             textAreaDebugPanel.text += "Buffer empty:\n";
                             trace("Buffer empty: ");
                             break;
                         case "NetStream.Buffer.Full":
                             netstreamStatus.text = e.info.code;
                             textAreaDebugPanel.text += "Buffer full:\n";
                             trace("Buffer full:");
                             break;
                          case "NetStream.Play.Start":
                              netstreamStatus.text = e.info.code;
                              textAreaDebugPanel.text += "Buffer empty:\n";
                             trace("Play start:");
                             break;                        
                 //Get the current ns.bufferLength value, format it, and  display it to the screen.
                 //"bufferLen" is the key var here.
                 public function monPlayback():void {               
                     var currentBuffer:Number =  Math.round((ns.bufferLength/ns.bufferTime)*100);
                     var bufferLen:String = String(ns.bufferLength);//Here is  the actual bufferLength reading.
                                                                    //Use it  to show the user what's going on.
                     pb.value = currentBuffer;//updates the little buffer  slider on the screen
                     bufferPct.text = String(currentBuffer) + "%";
                     bufferTime.text = String(ns.bufferTime);
                     bufferLength.text = String(ns.bufferLength);
                     //Dump the bufferLen value to the debug panel.
                     textAreaDebugPanel.text += bufferLen + "\n";                
                     trace("Buffer length: " + bufferLen);
             public function onBWDone():void
                 //dispatchComplete(obj);
             ]]>
         </mx:Script>
         <mx:Canvas id="monitor"
             y="10" right="50">
             <mx:Text x="0" y="25" text="Buffer:" color="#FFFFFF"/>
             <mx:Text x="0" y="50" text="Buffer Time:"  color="#FFFFFF"/>
             <mx:Text x="0" y="75" text="Buffer Length:"  color="#FFFFFF"/>   
             <mx:Text x="0" y="100" text="NetConnection netStatus:"  color="#FFFFFF"/>
             <mx:Text x="0" y="125" text="NetStream netStatus:"  color="#FFFFFF"/>
             <mx:Text x="0" y="150" text="Reconnect:" color="#FFFFFF"/>
             <mx:HSlider x="145" y="25" id="pb" minimum="0" maximum="100"  snapInterval="1" enabled="true"/>
             <mx:Text x="100" y="25" height="20" id="bufferPct"  color="#FFFFFF"/>   
             <mx:Text x="145" y="50" height="20" id="bufferTime"  color="#FFFFFF"/>
             <mx:Text x="145" y="75" height="20" id="bufferLength"  color="#FFFFFF"/>   
             <mx:Text x="145" y="100" height="20" id="netconnectionStatus"  color="#FFFFFF"/>
             <mx:Text x="145" y="125" height="20" id="netstreamStatus"  color="#FFFFFF"/>
             <mx:Text x="145" y="150" height="20" id="reconnectStatus"  color="#FFFFFF" text="N/A"/>
         </mx:Canvas>
         <mx:UIComponent id="uic"
              x="50" y="10"/>
          <mx:TextArea id="textAreaDebugPanel"
              width="300" height="300"
              right="50" top="300"
               valueCommit="textAreaDebugPanel.verticalScrollPosition=textAreaDebugPanel.maxVerticalScro llPosition"/>
    </mx:Application>

  • How can i load file into database from client-side to server-side

    i want to upload file from client-side to server-side, i use the following code to load blob into database.
    if the file is in the server-side, it can work, but if it in the client-side, it said that the system cannot find the file. i think it only will search the file is in the server-side or not, it will not search the client-side.
    how can i solve it without upload the file to the server first, then load it into database??
    try
    ResultSet rset = null;
    PreparedStatement pstmt =
    conn.prepareStatement ("insert into docs values (? , EMPTY_BLOB())");
    pstmt.setInt (1, docId);
    pstmt.execute ();
    // Open the destination blob:
    pstmt.setInt (1, docId);
    rset = pstmt.executeQuery (
    "SELECT content FROM docs WHERE id = ? FOR UPDATE");
    BLOB dest_lob = null;
    if (rset.next()) {
    dest_lob = ((OracleResultSet)rset).getBLOB (1);
    // Declare a file handler for the input file
    File binaryFile = new File (fileName);
    FileInputStream istream = new FileInputStream (binaryFile);
    // Create an OutputStram object to write the BLOB as a stream
    OutputStream ostream = dest_lob.getBinaryOutputStream();
    // Create a tempory buffer
    byte[] buffer = new byte[1024];
    int length = 0;
    // Use the read() method to read the file to the byte
    // array buffer, then use the write() method to write it to
    // the BLOB.
    while ((length = istream.read(buffer)) != -1)
    ostream.write(buffer, 0, length);
    pstmt.close();
    // Close all streams and file handles:
    istream.close();
    ostream.flush();
    ostream.close();
    //dest_lob.close();
    // Commit the transaction:
    conn.commit();
    conn.close();
    } catch (SQLException e) {

    Hi,
    Without some more details of the configuration, its difficult to know
    what's happening here. For example, what do you mean by client side
    and server side, and where are you running the upload Java application?
    If you always run the application on the database server system, but can't
    open the file on a different machine, then it sounds like a file protection
    problem that isn't really connected with the database at all. That is to
    say, if the new FileInputStream (binaryFile) statement fails, then its not
    really a database problem, but a file protection issue. On the other hand,
    I can't explain what's happening if you run the program on the same machine
    as the document file (client machine), but you can't write the data to the
    server, assuming the JDBC connection string is set correctly to connect to
    the appropriate database server.
    If you can provide some more information, we'll try to help.
    Simon
    null

  • Insert data 32K into a column of type LONG using the oracle server side jdbc driver

    Hi,
    I need to insert data of more than 32k into a
    column of type LONG.
    I use the following code:
    String s = "larger then 32K";
    PreparedStatement pstmt = dbcon.prepareStatement(
    "INSERT INTO TEST (LO) VALUES (?)");
    pstmt.setCharacterStream(1, new StringReader(s), s.length());
    pstmt.executeUpdate();
    dbcon.commit();
    If I use the "standard" oracle thin client driver from classes_12.zip ("jdbc:oracle:thin:@kn7:1521:kn7a") every thing is working fine. But if I use the oracle server side jdbc driver ("jdbc:default:connection:") I get the exception java.sql.SQLException:
    Datasize larger then max. datasize for this type: oracle.jdbc.kprb.KprbDBStatement@50f4f46c
    even if the string s exceeds a length of 32767 bytes.
    I'm afraid it has something to do with the 32K limitation in PL/SQL but in fact we do not use any PL/SQL code in this case.
    What can we do? Using LOB's is not an option because we have client software written in 3rd party 4gl language that is unable to handle LOB's.
    Any idea would be appreciated.
    Thomas Stiegler
    null

    In rdbms 8.1.7 "relnotes" folder, there is a "Readme_JDBC.txt" file (on win nt) stating
    Known Problems/Limitations In This Release
    <entries 1 through 3 omiited for brevity >
    4. The Server-side Internal Driver has the following limitation:
    - Data access for LONG and LONG RAW types is limited to 32K of
    data.

  • HTTP SERVICE - How to get the value of my params on the server side

    I am new to flex and with the url limitation i was trying to
    do the following ....send a bunch of ids... using params variable
    var myservice:HTTPService = new HTTPService();
    myservice.url = url;
    myservice.method = "POST";
    myservice.resultFormat = "e4x";
    myservice.send(params);
    The question is how do i get the value i passed on using
    params on the server side? can the variable params be a string or
    array or does it have to be object type?
    Any help would be greatly appreciated.

    Most server side languages have a function or an array where
    you extract the variables. in PHP they arrive in global arrays
    called $_POST and $_GET.
    Other languages have methods like request.formvars or
    request.query. Check your serverside language on how that is
    done.

Maybe you are looking for

  • Loops in AGAL shaders?

    Hello! I am currently working on a SSAO implementation for Molehill but I'm constantly hitting my head against the 256 instruction limit of AGAL shaders. This is a consequence of a fairly complex inner sampling loop which I need to unroll because AGA

  • Error While creating new iview

    Hi, I am trying to create an iview in Portal 6.0 & while creating iview getting following error Portal Runtime Error <b>An exception occurred while processing a request for : iView : pcd:portal_content/com.sap.pct/admin.templates/iviews/editors/com.s

  • Problem with database control returning multiple rows as Array  using Oracle

    Has anybody using Oracle gotten a Database control that returns multiple rows to work returning an array? The only way I can seem to return multiple rows is by returning a RowSet. Returning an array gives me a NullPointerException (when called within

  • Change WBS BOM Structure

    Dear Experts, I have a WBS BOM ( Copied from Material BOM) in which one common child level component is used for differernt Superior Assembleis. Now when i am deleting this component from one of the Superior Assembly, a POP UP is coming stating that

  • Aperture 2.1.4 & SL -- Any Light at the end of the Tunnel?

    On my Macbook, Aperture with SL dies just after the initial screen comes up (the one with the SN, etc). Activity Monitor and Force Quit suggests that it is running, but just not ever getting to the main screen. I've read through the long threads here