Asking user for value to resize?

Hello guys. I want to make a quick script that will take the selected finder item, ask the user for a value to resize (In the form of a dialog box) and then using that percentage, execute the scale image function under preview. Does anyone know how I could do this? Thanks!

Get Selected Finder Items
Scale Image (Preview Library, check the "show when run" option)
As written here, this works on the original. Put a Copy Finder items in Place of Get Selected Finder items if you want to work on a copy.
Kevin

Similar Messages

  • Upload file without asking user for the file

    Hi,
    I need to upload a file to server, but from my code, not using the file upload from page.
    I have created a xml file and I need to upload to server when user open a web browser (without asking user to select a file).
    How do I proceed??, or what kind of libraries do I must use?
    thanks

    davisote wrote:
    Hi,
    thanks for answer.
    Let me try to explain again (I think its very simple).Simple, yes. But not very thorough.
    I have developed a web application using JSF.So all the code is running on the server, right? There are no Applets, Applications or WebStart applications involved. Right?
    My application has a splash screen where I show data. I have developed a bean to connect to my database (sql server), extract this data and create an xml (using DOM) file like:
    <news>
    <simplenews id="1"> Value </simplenews>
    </news>And that bean runs ... where? Server again?
    (important step) Once I have created the xml file in my bean I want to upload to the server to a place like /WEB-INF/news.
    If the code is running on the server, then "uploading" is the wrong term, as there's nowhere to upload to, since you're already on the server.
    This may sound like nit-picking, but you're sending us on a wrong trail with this phrase.
    Once the file is on the server with another bean I read the xml fileWhy don't you simply store it in the application scope and let everyone access it from there? It doesn't sound as if the XML is huge.
    As you can see I haven't a web page where to show an upload file componetYou also don't want to "upload" anything from the client, from the sound of it.
    You simply want to transfer data between to server-side components, if I understood you correctly.

  • Best way to ask user for duration ??

    I am wondering what the best way to set up a dialog to ask the user for a duration is ?
    I need to query the user for the following duration example 1 month 3 days 5 hours 15 mins
    I have tried messing around with JSpinners with date formats but they really only work with fixed calendar dates not calendar durations...
    Any ideas on a neat approach..
    Currently i have an individual number spinner for each of the items which looks ugly and is hard to manage as you have to take care of up to 23 hours but 24 is one day so one day etc etc..
    Thanks in advance
    -Alan

    You continue along the same lines; keep the DTO in the session as an attribute. When you display your JSP, read the appropriate values for choices from the DTO and set your checkboxes/ radio buttons to 'selected' if they should be.
    When the page is submitted, read the parameters from the form submit and update your session attribute ( DTO ) to reflect any changes the user might have made like selecting a new option or deselecting a previously selected one.
    People on the forum help others voluntarily, it's not their job.
    Help them help you.
    Learn how to ask questions first: http://faq.javaranch.com/java/HowToAskQuestionsOnJavaRanch
    (Yes I know it's on JavaRanch but I think it applies everywhere)
    ----------------------------------------------------------------

  • Custom TrustManager example which asks user for trustability

    Hi!
    For I needed a trustmanager which shows an untrusted server certificate to the user and asks him if the certificate can be considered trustable I wrote an own trustmanager. As it took much time to find out how to do this here is my code to shorten your time if you need a similar functionality:
    NOTE:
    If a certificate is declared trustable by the user it is stored in a local keystore file. So if you use the code in an applet you need to sign it to get the appropriate permissions.
    To use it you have to put the following code where you get your SSLSocketFactory:
    try{
                   SSLContext sslContext=SSLContext.getInstance("SSL","SunJSSE");
                   TrustManager[] tm={new StoreCertTrustManager()};
                   sslContext.init(null,tm,null);
                   factory = ( SSLSocketFactory) sslContext.getSocketFactory();
    }catch(Exception e) { ... }
    Here is the implementation of the StoreCertTrustManager:
    * This class implements a TrustManager for authenticating the servers certificate.
    * It enhances the default behaviour.
    class StoreCertTrustManager implements X509TrustManager {
         /** The trustmanager instance used to delegate to default behaviour.*/
         private TrustManager tm=null;
         /** Password for own keystore */
         private final char[] keyStorePassword=new String("changeit").toCharArray();
         /** Path to own keystore. Store it into the home directory to avoid permission problems.*/
         private final String keyStorePath=System.getProperty("user.home")+"/https-keystore";
         /** The stream for reading from the keystore. */
         FileInputStream keyStoreIStream=null;
         /** The instance of the keystore */
         private KeyStore keyStore=null;
         * Creates a TrustManager which first checks the default behaviour of the X509TrustManager.
         * If the default behaviour throws a CertificateException ask the user if the certificate
         * should be declared trustable.
         * @throws Exception: If SSL - initialization failed.
         StoreCertTrustManager() throws Exception {
              /* Try to set the truststore system property to our keystore
              * if we have the appropriate permissions.*/
              try{
                   File httpsKeyStore=new File(keyStorePath);
                   if(httpsKeyStore.exists()==true) {
                        System.setProperty("javax.net.ssl.trustStore",keyStorePath);
              }catch(SecurityException se) {}
              /* Create the TrustManagerFactory. We use the SunJSSE provider
              * for this purpose.*/
              TrustManagerFactory tmf=TrustManagerFactory.getInstance("SunX509", "SunJSSE");
              tmf.init((java.security.KeyStore)null);
              tm=tmf.getTrustManagers()[0];
              /* Something failed we could not get a TrustManager instance.*/
              if(tm == null) {
                   throw new SSLException("Could not get default TrustManager instance.");
              /* Create the file input stream for the own keystore. */
              try{
                   keyStoreIStream = new FileInputStream(keyStorePath);
              } catch( FileNotFoundException fne ) {
                   // If the path does not exist then a null stream means
                   // the keystore is initialized empty. If an untrusted
                   // certificate chain is trusted by the user, then it will be
                   // saved in the file pointed to by keyStorePath.
                   keyStoreIStream = null;
              /* Now create the keystore. */
              try{
                   keyStore=KeyStore.getInstance(KeyStore.getDefaultType());
                   keyStore.load(keyStoreIStream,keyStorePassword);
              }catch(KeyStoreException ke) {
                   System.out.println("Loading of https keystore from file <"+keyStorePath+"> failed. error message: "+ke.getMessage());
                   keyStore=null;
         * Authenticates a client certificate. For we don't need that case only implement the
         * default behaviour.
         * @param chain In: The certificate chain to be authenticated.
         * @param authType In: The key exchange algorithm.
         public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
              ((X509TrustManager)tm).checkClientTrusted(chain,authType);
         * Authenticates a server certificate. If the given certificate is untrusted ask the
         * user whether to proceed or not.
         * @param chain In: The certificate chain to be authenticated.
         * @param authType In: The key exchange algorithm.
         public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
              /* Output the certifcate chain for debugging purposes */
              System.out.println("got X509 certificate from server:");
              for(int i=0; i<chain.length; i++) {
                   System.out.println("chain["+i+"]: "+chain.getIssuerDN().getName());
              try{
                   /* First try the default behaviour. */
                   ((X509TrustManager)tm).checkServerTrusted(chain,authType);
              }catch(CertificateException ce) {
                   System.out.println("in checkServerTrusted: authType: "+authType+", got certificate exception: "+ce.getMessage());
                   /* If we got here the certificate is untrusted. */
                   /* If we could not craete a keystore instance forward the certificate exception. So we have
                   * at least the default behaviour. */
                   if(keyStore==null || chain == null || chain.length==0) {
                        throw(ce);
                   try{
                        /* If we could not find the certificate in the keystore
                        * ask the user if it should be treated trustable. */
                        AskForTrustability ask=new AskForTrustability (chain);
                        boolean trustCert=ask.showCertificateAndGetDecision();
                        if(trustCert==true) {
                             // Add Chain to the keyStore.
                             for (int i = 0; i < chain.length; i++)
                                  keyStore.setCertificateEntry
                                       (chain[i].getIssuerDN().toString(), chain[i]);
                             // Save keystore to file.
                             FileOutputStream keyStoreOStream =
                                  new FileOutputStream(keyStorePath);
                             keyStore.store(keyStoreOStream, keyStorePassword);
                             keyStoreOStream.close();
                             keyStoreOStream = null;
                             System.out.println("Keystore saved in " + keyStorePath);
                        } else {
                             throw(ce);
                   }catch(Exception ge) {
                        /* Got an unexpected exception so throw the original exception. */
                        System.out.println("in checkServerTrusted: got exception type: "+ge.getClass()+" message: "+ge.getMessage());
                        throw ce;
         * Merges the system wide accepted issuers and the own ones and
         * returns them.
         * @return: Array of X509 certificates of the accepted issuers.
    public X509Certificate[] getAcceptedIssuers() {
              X509Certificate[] cf=((X509TrustManager)tm).getAcceptedIssuers();
              X509Certificate[] allCfs=cf;
              if(keyStore != null) {
                   try{
                        Enumeration ownCerts=keyStore.aliases();
                        Vector certsVect=new Vector();
                        while(ownCerts.hasMoreElements()) {
                             Object cert=ownCerts.nextElement();
                             certsVect.add(keyStore.getCertificate(cert.toString()));
                        int newLength=cf.length+certsVect.size();
                        allCfs=new X509Certificate[newLength];
                        Iterator it=certsVect.iterator();
                        for(int i=0; i<newLength ; i++) {
                             if(i<cf.length) {
                                  allCfs[i]=cf[i];
                             } else {
                                  allCfs[i]=(X509Certificate)it.next();
                   }catch(KeyStoreException e) {}
              for(int i=0; i<allCfs.length;i++) {
                   System.out.println("allCfs["+i+"]: "+allCfs[i].getIssuerDN());
              return allCfs;
         * This class implements an interactive dialog. It shows the contents of a
         * certificate and asks the user if it is trustable or not.
         class AskForTrustability implements ActionListener, ListSelectionListener {
              private JButton yes=new JButton("Yes"),no=new JButton("No");
              /** default to not trustable */
              private boolean isTrusted=false;
              private JDialog trust=null;
              private JList certItems=null;
              private JTextArea certValues=null;
              private JComboBox certChain=null;
              private final String certParms[]={"Version","Serial Number","Signature Algorithm", "Issuer", "Validity Period", "Subject", "Signature","Certificate Fingerprint"};
              private X509Certificate[] chain;
              private int chainIdx=0;
              * Creates an instance of the class and stores the certificate to show internally.
              * @param chain In: The certificate chain to show.
              AskForTrustability (X509Certificate[] chain) {
                   this.chain=chain;
              * This method shows a dialog with all interesting information of the certificate and
              * asks the user if the certificate is trustable or not. This method block

    Your code has some errors, I have correct it. Here is the new code:
    StoreCertTrustManager.java
    import java.io.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import java.security.*;
    import java.security.cert.*;
    import javax.swing.*;
    import javax.swing.border.*;
    import javax.swing.event.*;
    import javax.net.ssl.*;
    * This class implements a TrustManager for authenticating the servers certificate.
    * It enhances the default behaviour.
    class StoreCertTrustManager implements X509TrustManager {
         /** The trustmanager instance used to delegate to default behaviour.*/
         private TrustManager tm=null;
         /** Password for own keystore */
         private final char[] keyStorePassword=new String("changeit").toCharArray();
         /** Path to own keystore. Store it into the home directory to avoid permission problems.*/
         private final String keyStorePath=System.getProperty("user.home")+"/https-keystore";
         /** The stream for reading from the keystore. */
         FileInputStream keyStoreIStream=null;
         /** The instance of the keystore */
         private KeyStore keyStore=null;
          * Creates a TrustManager which first checks the default behaviour of the X509TrustManager.
          * If the default behaviour throws a CertificateException ask the user if the certificate
          * should be declared trustable.
          * @throws Exception: If SSL - initialization failed.
         StoreCertTrustManager() throws Exception {
              /* Try to set the truststore system property to our keystore
               * if we have the appropriate permissions.*/
              try{
                   File httpsKeyStore=new File(keyStorePath);
                   if(httpsKeyStore.exists()==true) {
                        System.setProperty("javax.net.ssl.trustStore",keyStorePath);
              }catch(SecurityException se) {}
              /* Create the TrustManagerFactory. We use the SunJSSE provider
               * for this purpose.*/
              TrustManagerFactory tmf=TrustManagerFactory.getInstance("SunX509", "SunJSSE");
              tmf.init((java.security.KeyStore)null);
              tm=tmf.getTrustManagers()[0];
              /* Something failed we could not get a TrustManager instance.*/
              if(tm == null) {
                   throw new SSLException("Could not get default TrustManager instance.");
              /* Create the file input stream for the own keystore. */
              try{
                   keyStoreIStream = new FileInputStream(keyStorePath);
              } catch( FileNotFoundException fne ) {
              // If the path does not exist then a null stream means
              // the keystore is initialized empty. If an untrusted
              // certificate chain is trusted by the user, then it will be
              // saved in the file pointed to by keyStorePath.
                   keyStoreIStream = null;
              /* Now create the keystore. */
              try{
                   keyStore=KeyStore.getInstance(KeyStore.getDefaultType());
                   keyStore.load(keyStoreIStream,keyStorePassword);
              }catch(KeyStoreException ke) {
                   System.out.println("Loading of https keystore from file <"+keyStorePath+"> failed. error message: "+ke.getMessage());
                   keyStore=null;
          * Authenticates a client certificate. For we don't need that case only implement the
          * default behaviour.
          * @param chain In: The certificate chain to be authenticated.
          * @param authType In: The key exchange algorithm.
         public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
              ((X509TrustManager)tm).checkClientTrusted(chain,authType);
          * Authenticates a server certificate. If the given certificate is untrusted ask the
          * user whether to proceed or not.
          * @param chain In: The certificate chain to be authenticated.
          * @param authType In: The key exchange algorithm.
         public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
         /* Output the certifcate chain for debugging purposes */
              System.out.println("got X509 certificate from server:");
              for(int i=0; i<chain.length; i++) {
                   System.out.println("chain["+i+"]: "+chain.getIssuerDN().getName());
              try{
              /* First try the default behaviour. */
                   ((X509TrustManager)tm).checkServerTrusted(chain,authType);
              }catch(CertificateException ce) {
                   System.out.println("in checkServerTrusted: authType: "+authType+", got certificate exception: "+ce.getMessage());
                   /* If we got here the certificate is untrusted. */
                   /* If we could not craete a keystore instance forward the certificate exception. So we have
                   * at least the default behaviour. */
                   if(keyStore==null || chain == null || chain.length==0) {
                        throw(ce);
                   try{
                   /* If we could not find the certificate in the keystore
                   * ask the user if it should be treated trustable. */
                        AskForTrustability ask=new AskForTrustability (chain);
                        boolean trustCert=ask.showCertificateAndGetDecision();
                        if(trustCert==true) {
                             // Add Chain to the keyStore.
                             for (int i = 0; i < chain.length; i++){
                                  keyStore.setCertificateEntry(chain[i].getIssuerDN().toString(), chain[i]);
                             // Save keystore to file.
                             FileOutputStream keyStoreOStream = new FileOutputStream(keyStorePath);
                             keyStore.store(keyStoreOStream, keyStorePassword);
                             keyStoreOStream.close();
                             keyStoreOStream = null;
                             System.out.println("Keystore saved in " + keyStorePath);
                        } else {
                             throw(ce);
                   }catch(Exception ge) {
                   /* Got an unexpected exception so throw the original exception. */
                        System.out.println("in checkServerTrusted: got exception type: "+ge.getClass()+" message: "+ge.getMessage());
                        throw ce;
         * Merges the system wide accepted issuers and the own ones and
         * returns them.
         * @return: Array of X509 certificates of the accepted issuers.
         public java.security.cert.X509Certificate[] getAcceptedIssuers() {
              X509Certificate[] cf=((X509TrustManager)tm).getAcceptedIssuers();
              X509Certificate[] allCfs=cf;
              if(keyStore != null) {
                   try{
                        Enumeration ownCerts=keyStore.aliases();
                        Vector certsVect=new Vector();
                        while(ownCerts.hasMoreElements()) {
                             Object cert=ownCerts.nextElement();
                             certsVect.add(keyStore.getCertificate(cert.toString()));
                        int newLength=cf.length+certsVect.size();
                        allCfs=new X509Certificate[newLength];
                        Iterator it=certsVect.iterator();
                        for(int i=0; i<newLength ; i++) {
                             if(i<cf.length){
                                  allCfs=cf;
                             else {
                                  allCfs=(X509Certificate[])it.next();
                   }catch(KeyStoreException e) {}
              for(int i=0; i<allCfs.length;i++) {
                   System.out.println("allCfs["+i+"]: "+allCfs[i].getIssuerDN());
              return allCfs;
         * This class implements an interactive dialog. It shows the contents of a
         * certificate and asks the user if it is trustable or not.
         class AskForTrustability implements ActionListener, ListSelectionListener {
              private JButton yes=new JButton("Yes"),no=new JButton("No");
              /** default to not trustable */
              private boolean isTrusted=false;
              private JDialog trust=null;
              private JList certItems=null;
              private JTextArea certValues=null;
              private JComboBox certChain=null;
              private final String certParms[]={"Version","Serial Number","Signature Algorithm", "Issuer", "Validity Period", "Subject", "Signature","Certificate Fingerprint"};
              private X509Certificate[] chain;
              private int chainIdx=0;
         * Creates an instance of the class and stores the certificate to show internally.
         * @param chain In: The certificate chain to show.
              AskForTrustability (X509Certificate[] chain) {
                   this.chain=chain;
         * This method shows a dialog with all interesting information of the certificate and
         * asks the user if the certificate is trustable or not. This method blocks until
         * the user presses the 'Yes' or 'No' button.
         * @return: true: The certificate chain is trustable
         * false: The certificate chain is not trustable
              public boolean showCertificateAndGetDecision() {
                   if(chain == null || chain.length == 0) {
                        return false;
                   trust=new JDialog((Frame)null,"Untrusted server certificate for SSL connection",true);
                   Container cont=trust.getContentPane();
                   GridBagLayout gl=new GridBagLayout();
                   cont.setLayout(gl);
                   JPanel pLabel=new JPanel(new BorderLayout());
                   Icon icon = UIManager.getIcon("OptionPane.warningIcon");
                   pLabel.add(new JLabel(icon),BorderLayout.WEST);
                   JTextArea label=new JTextArea("The certificate sent by the server is unknown and not trustable!\n"+
                   "Do you want to continue creating a SSL connection to that server ?\n\n"+
                   "Note: If you answer 'Yes' the certificate will be stored in the file\n\n"+
                   keyStorePath+"\n\n"+
                   "and the next time treated trustable automatically. If you want to remove\n"+
                   "the certificate delete the file or use keytool to remove certificates\n"+
                   "selectively.");
                   label.setEditable(false);
                   label.setBackground(cont.getBackground());
                   label.setFont(label.getFont().deriveFont(Font.BOLD));
                   pLabel.add(label,BorderLayout.EAST);
                   GridBagConstraints gc=new GridBagConstraints();
                   gc.fill=GridBagConstraints.HORIZONTAL;
                   gl.setConstraints(pLabel,gc);
                   pLabel.setBorder(new EmptyBorder(4,4,4,4));
                   cont.add(pLabel);
                   Vector choices=new Vector();
                   for(int i=0; i<chain.length ; i++) {
                        choices.add((i+1)+". certificate of chain");
                   certChain = new JComboBox(choices);
                   certChain.setBackground(cont.getBackground());
                   certChain.setFont(label.getFont().deriveFont(Font.BOLD));
                   certChain.addActionListener(this);
                   JPanel pChoice=new JPanel(new BorderLayout());
                   pChoice.add(certChain);
                   gc=new GridBagConstraints();
                   gc.fill=GridBagConstraints.HORIZONTAL;
                   gc.insets=new Insets(4,4,4,4);
                   gc.gridy=1;
                   gl.setConstraints(pChoice,gc);
                   pChoice.setBorder(new TitledBorder(new EmptyBorder(0,0,0,0), "Certificate chain"));
                   cont.add(pChoice);
                   certItems=new JList(certParms);
                   certItems.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
                   certItems.addListSelectionListener(this);
                   JPanel pList=new JPanel(new BorderLayout());
                   pList.add(certItems);
                   pList.setBorder(new TitledBorder(new EtchedBorder(), "Certificate variables"));
                   gc=new GridBagConstraints();
                   gc.fill=GridBagConstraints.HORIZONTAL;
                   gc.insets=new Insets(4,4,4,4);
                   gc.gridy=2;
                   gl.setConstraints(pList,gc);
                   cont.add(pList);
                   certValues=new JTextArea();
                   certValues.setFont(label.getFont().deriveFont(Font.BOLD));
                   certValues.setEditable(false);
                   certValues.setBackground(cont.getBackground());
                   certValues.setLineWrap(true);
                   certValues.setWrapStyleWord(true);
                   JPanel pVals=new JPanel(new BorderLayout());
                   pVals.add(certValues);
                   pVals.setBorder(new TitledBorder(new EtchedBorder(), "Variable value"));
                   gc=new GridBagConstraints();
                   gc.insets=new Insets(4,4,4,4);
                   gc.weightx=1.0;
                   gc.weighty=1.0;
                   gc.fill=GridBagConstraints.BOTH;
                   gc.gridy=3;
                   gl.setConstraints(pVals,gc);
                   cont.add(pVals);
                   JPanel p=new JPanel();
                   yes.addActionListener(this);
                   no.addActionListener(this);
                   p.add(yes);
                   p.add(no);
                   gc=new GridBagConstraints();
                   gc.weightx=1.0;
                   gc.fill=GridBagConstraints.HORIZONTAL;
                   gc.gridy=4;
                   gl.setConstraints(p,gc);
                   cont.add(p);
                   //This should be the subject item
                   certItems.setSelectedIndex(5);
                   certItems.requestFocus();
                   trust.pack();
                   trust.setSize(500,600);
                   trust.setVisible(true);
                   return isTrusted;
         * Listener method for changin the contents of the JTextArea according to the
         * selected list item.
              public void valueChanged(ListSelectionEvent e) {
                   if (e.getValueIsAdjusting()){
                        return;
                   JList theList = (JList)e.getSource();
                   if (theList.isSelectionEmpty()) {
                        certValues.setText("");
                   } else {
                        String selVal = theList.getSelectedValue().toString();
                        if(selVal.equals("Version")==true) {
                             certValues.setText(String.valueOf(chain[chainIdx].getVersion()));
                        } else if(selVal.equals("Serial Number")==true) {
                             certValues.setText(byteArrayToHex(chain[chainIdx].getSerialNumber().toByteArray()));
                        } else if(selVal.equals("Signature Algorithm")==true) {
                             certValues.setText(chain[chainIdx].getSigAlgName());
                        } else if(selVal.equals("Issuer")==true) {
                             certValues.setText(chain[chainIdx].getIssuerDN().getName());
                        } else if(selVal.equals("Validity Period")==true) {
                             certValues.setText(chain[chainIdx].getNotBefore().toString()+" - "+chain[chainIdx].getNotAfter().toString());
                        } else if(selVal.equals("Subject")==true) {
                             certValues.setText(chain[chainIdx].getSubjectDN().getName());
                        } else if(selVal.equals("Signature")==true) {
                             certValues.setText(byteArrayToHex(chain[chainIdx].getSignature()));
                        } else if(selVal.equals("Certificate Fingerprint")==true) {
                             try{
                                  certValues.setText(getFingerprint(chain[chainIdx].getEncoded(),"MD5")+"\n"+
                                  getFingerprint(chain[chainIdx].getEncoded(),"SHA1"));
                             }catch(Exception fingerE) {
                                  certValues.setText("Couldn't calculate fingerprints of the certificate.\nReason: "+fingerE.getMessage());
         * This method calculates the fingerprint of the certificate. It takes the encoded form of
         * the certificate and calculates a hash value from it.
         * @param certificateBytes In: The byte array of the encoded data.
         * @param algorithm In: The algorithm to be used for calculating the hash value.
         * Two are possible: MD5 and SHA1
         * @return: Returns a hex formated string of the fingerprint.
              private String getFingerprint(byte[] certificateBytes, String algorithm) throws Exception {
                   MessageDigest md = MessageDigest.getInstance(algorithm);
                   md.update(certificateBytes);
                   byte[] digest = md.digest();
                   return new String(algorithm+": "+byteArrayToHex(digest));
         * This method converts a byte array to a hex formatted string.
         * @param byteData In: The data to be converted.
         * @return: The formatted string.
              private String byteArrayToHex(byte[] byteData) {
                   StringBuffer sb=new StringBuffer();
                   for (int i = 0; i < byteData.length; i++) {
                        if (i != 0) sb.append(":");
                        int b = byteData[i] & 0xff;
                        String hex = Integer.toHexString(b);
                        if (hex.length() == 1) sb.append("0");
                        sb.append(hex);
                   return sb.toString();
         * The listener for the 'Yes', 'No' buttons.
              public void actionPerformed(ActionEvent e) {
                   Object entry =e.getSource();
                   if(entry.equals(yes)==true) {
                        isTrusted=true;
                        trust.dispose();
                        } else if(entry.equals(certChain)==true) {
                             int selIndex=certChain.getSelectedIndex();
                             if(selIndex >=0 && selIndex < chain.length) {
                                  chainIdx=selIndex;
                                  int oldSelIdx=certItems.getSelectedIndex();
                                  certItems.clearSelection();
                                  certItems.setSelectedIndex(oldSelIdx);
                        } else {
                             trust.dispose();
    -----------------------------------------------end------------------------------------------------
    We can use follow code in main class to complete SSL authorize:
             SSLSocketFactory factory = null;
              KeyManager[] km = null;
              TrustManager[] tm = {new StoreCertTrustManager()};
              SSLContext sslContext = SSLContext.getInstance("SSL","SunJSSE");
              sslContext.init(null, tm, new java.security.SecureRandom());
              factory = sslContext.getSocketFactory();
             SSLSocket socket =
              (SSLSocket)factory.createSocket("localhost", 7002);

  • Cant get IMAQ write file 2 to ask user for the path.

    I am currently using an IMAQ write file 2 to create a .bmp image. I have the VI attached to a control path that allows the user to enter the path where they want to save the file. However I dont want the user to have to make sure they typed the path in before the IMAQ write file executes. I want the program to work so that when the IMAQ write file executes a window appears asking the user where they would like to save the file. If someone could help me out I would appreciate it thanks.
    Solved!
    Go to Solution.

    Use the File dialog VI under File I/O >> Advanced File Functions palette

  • Ask user for date

    Is there a standard dialog for this?
    I googled but the things I found was
    * JDatePicker (some sort of commercial product - ?)
    * JXDatePicker (belongs to org.jdesktop.swingx, a packet I cannot import)
    sure there must be a simpler way?

    of you can try to find out plenty od JDatePicker, JDate or JCalendar
    then google returns ...., check and compare its funcionalities with calendar by "toedter"
    on check posts on some forums (inc. this one), its can get you answer

  • Ask user for input after Workflow has already started?

    I am in the process of creating an "expense report" declarative workflow in Designer. I want to have it start automatically when a new document (here, an Excel file) is uploaded to the Library. I also want some user input (e.g. "Is this
    ER urgent?"). Is there a way to this without requiring the workflow to start manually?

    You can have required information as metadata on your library and user needs to fill those information. You read that information in your workflow.
    Amit

  • How can I keep the name of the user around for each JSP without asking user

    I have a number of JSP pages that I give the user access to once they login successfully. I want to be able to keep the name of the user present on every page without having to ask them for it each time.
    How can I do this? Currently I have a user object that is access through use of a request bean in my JSP's.
    Any suggestions???

    Thanks for the help. A few questions though...
    Can you just clarify how the 2 different SessionTest2.jsp's differ. I am right in thinking that the second one will instantiate a new bean object which if I do every time I go to the page, I will be getting the same name but in a different session each time. In the first SessionTest.jsp, I get the same name but from the same session object each time??
    Please clarify???
    SessionTest1.jsp
    <%@ page language="java" import="test.*" %>
    <jsp:useBean id="testBean" scope="session"
    class="test.TestBean" />
    <jsp:setProperty name="testBean" property="name"
    value="ZZZZZ" />
    <jsp:setProperty name="testBean" property="status"
    value="Married" />
    <%
         response.sendRedirect("SessionTest2.jsp");
         return;
    %>
    SessionTest2.jsp
    <%@ page import="test.*" %>
    <jsp:useBean id="testBean" scope="session"
    class="test.TestBean" />
    <%
    out.println("User Name is : "+testBean.getName());
    %>or SessionTest2.jsp
    <%@ page import="test.*" %>
    <jsp:useBean id="testBean" scope="session"
    class="test.TestBean" />
    <%
    TestBean testBean =
    (TestBean)session.getAttribute("testBean");
         out.println("Name is : "+testBean.getName());
    %>Hope this helps.
    Sudha

  • How to ask user to enter value in select statement

    Hi,
    Can anyone tell me syntax of select statement where i can ask user to enter value .
    for example i am trying to use belowthing but it displaying error
    select * from emp where empname=:empname
    SP2-0552: Bind variable "empname" not declared.
    2.Is there any data dictionary table to see all pl/sql procedures and corresponding code?
    Thanks,
    sri

    user632733 wrote:
    Can anyone tell me syntax of select statement where i can ask user to enter value .None. The SQL engine resides on the server. It is incapable of prompting for data entry on the client.
    The client interacts with the user. The client is suppose to:
    a) prompt for variable values
    b) send a SQL statement to Oracle
    c) bind values to bind variables in the SQL statement
    for example i am trying to use belowthing but it displaying error
    select * from emp where empname=:empnameIn SQL*Plus, you need to create a bind variable:
    SQL> var empname varchar2(200)
    And then assign a value to it:
    SQL> exec :empname := 'John Doe';
    Note that this is still not ideal - as the assignment is also done via the server and sends a PL block to the server. This block contains non-sharable code and this can lead to fragmentation of the server's Shared Pool.
    But it does illustrate the basic principle.

  • I bought a iPhone and I was able to log into my iCloud with no problem and when I tried to update it it kicked me out and now it's asking me for the old apple user please help what can I do...?

    I bought a iPhone and I was able to log into my iCloud with no problem and when I tried to update it it kicked me out and now it's asking me for the old apple user please help what can I do...?

    Contact the original owner, and ask them to remove the device from their icloud.
    http://support.apple.com/kb/PH13695
    HTH

  • How to get the User entered value in the Submit request form for a parameter of a concurrent program in Oracle applications.

    Hi All,
    I have a requirement where i need to get the user entered value in the Parameter of a concurrent program while submitting it. i tried to query the FND_CONCURRENT_REQUESTS table but in that it stores the ID values from the value set of the Parameter.
    After submitting the Concurrent request when we click on the view Details button it opens a form where it displays the arguments in the parameter field .  i want to get that string.
    Thanks a lot in advance for your time and help.
    - Vijay

    Hi All,
    I have a requirement where i need to get the user entered value in the Parameter of a concurrent program while submitting it. i tried to query the FND_CONCURRENT_REQUESTS table but in that it stores the ID values from the value set of the Parameter.
    After submitting the Concurrent request when we click on the view Details button it opens a form where it displays the arguments in the parameter field .  i want to get that string.
    Thanks a lot in advance for your time and help.
    - Vijay

  • When I try installing Firefox 6.0 from the binary file, a box with "Run As" in the type field appears, which asks me for user name and password. Please advise about the course of action that I should take.

    Trying to run it as the current user, or as one from a different account(administrator in this case) also doesn't work.

    I think the client is not able to do a HTTP POST
    to the WLS server but it can do a HTTP GET.
    I dont know why.
    http://manojc.com
    "Ganesh" <[email protected]> wrote in message
    news:3eba91bc$[email protected]..
    >
    Hi,
    I deployed a rpc web service using WLS 7.0 SP2 in HP-UX 11 environment.When I
    invoke the web service through my browser (IE 6.0) using the web servicesurl,
    it brings my service method correctly. From there, if I click the invokebutton
    it asks me for a network user name and password under "weblogic" realm???If I
    provide the admin user credentials (which I supplied while creating mydomain)
    it is not accepting that it keeps popping up this network user passwordwindow
    over and over. Not sure which username/password I have to provide here tosee
    the result of my service.
    If I try to invoke the web service through my client (static) I am gettinga connection
    refused exception. I guess either way, I am not able to access my webservice.
    In the attached file, I have cut and pasted the client stack trace as wellas
    the server log trace from weblogic.
    Any ideas would be highly appreciated.
    Thanks,
    Ganesh

  • Itunes keeps asking me for a user name and password when I first open it.

    I do not allow apple to access my library or my hard drive because you guys are predators, and I have NO interest in using the app store.  I have disabled access to the store, so i do not know why it keeps asking me for a user name and password.  You have NO right to see the music THAT I PURCHASED a loooooooooong time ago.  It is my license. I should be able to play it whenever and wherever I like...and NO, I do not burn and copy my music.  I just want to play it on MY MACHINES. So, I do not need your useless snooping, which is probably the reason you want me to log in.  Who do you think you are? You didn't write the songs.  You just sell licenses. Period.  And I purchased mine, thank you.  I no longer use your store for these reasons.  I use Amazon.

    Not control-R. Command-R. Shut the computer down. Reboot it. Hold down cmd-R when you hear the chime. Keep it held down and you should see the Lion recovery partition.
    http://support.apple.com/kb/ht4718
    http://support.apple.com/kb/ts3273
    Matt

  • After I updated user for i phone 4 s iCloud password is no way I can not phone and e-mail address has been blocked. I did not bring the solution to Turkey APPLE chief BILKOM is forgotten the password and e-mail address in the e-mail address asking for hel

    After I updated user for i phone 4 s iCloud password is no way I can not phone and e-mail address has been blocked. I did not bring the solution to Turkey APPLE chief BILKOM is forgotten the password and e-mail address in the e-mail address asking for help from you I will make the iphone does not open e-mail address associated with it @hotmail.com mail to this address icloud iphone phone's password is forgotten, I want to thank you in advance for your help tell a method of opening up again.
    <Email Edited by Host>

    Welcome to the Apple Community.
    I have asked for your email address to be edited out. Posting your address in an open thread is a sure way to be bombarded by unwanted email, remember it will be here long after you have resolved your problem, for automated detection software to find.
    If you want people to contact you, enable others to see your email address in your profile.
    This feature has been introduced to make stolen phones useless to those that have stolen them.
    However it can also arise when the user has changed their Apple ID details with Apple and not made the same changes to their iCloud account/Find My Phone on their device before upgrading to iOS 7.
    The only solution is to change your Apple ID back to its previous state with Apple at My Apple ID, verify the changes, enter the password as requested on your device and then turn off "find my phone".
    You should then change your Apple ID back to its current state, verify it once again, delete the iCloud account from your device and then log back in using your current Apple ID. Finally, turn "find my phone" back on once again.
    Apple Topluluk hoş geldiniz.
    Ben düzenlenebilir için e-posta adresi için istedi. Açık bir konu adres gönderme istenmeyen e-posta ile bombardıman bir emin yoludur, bulmak için otomatik algılama yazılımı için, size sorunu giderilmiştir sonra burada uzun olacak unutmayın.
    Eğer insanlar sizinle iletişim istiyorsanız, başkalarının profilinizde e-posta adresinizi görmelerini sağlar.
    Bu özellik onları çalıntı olduğunu bu işe yaramaz çalıntı telefonları için getirilmiştir.
    Ancak aynı zamanda kullanıcı Apple ile Apple ID ayrıntıları değişti ve iCloud hesabı için aynı değişiklik yapmamış ortaya çıkar / iOS 7 yükseltmeden önce cihaz üzerinde My Phone bul olabilir.
    Tek çözüm My Apple ID de Apple ile önceki durumuna geri Apple ID değiştirmek için, değişiklikleri doğrulamak cihazınızda talep olarak, şifreyi girin ve sonra kapatın "benim telefon bulmak".
    Daha sonra tekrar bugünkü durumuna Apple ID değiştirmek gerekir, bir kez daha doğrulamak cihazınızdan iCloud hesabı silmek ve daha sonra mevcut Apple kimliği kullanarak oturum açın. Son olarak, geri bir kez daha üzerinde "benim telefon bulmak" açın.

  • When I run my SQL query in MS Access it ask for value ...I don't know why

    Hi,
    Below is my SQL Query:
    SELECT employee.Name, employee.Emplid, payudds.Udds, data.Budget, data.Fund, data.FTE, data.[Annualized Rate], data.[FN Dist Pct], data.Udds, data.Project, data.[Empl Class]
    FROM ((employeeuddslink INNER JOIN employee ON employeeuddslink.[employee_ID] = employee.[ID]) INNER JOIN payudds ON employeeuddslink.[payudds_ID] = payudds.[ID]) INNER JOIN data ON employee.[Emplid] = data.[Emplid]
    GROUP BY employee.Name, employee.Emplid, payudds.Udds, data.Budget, data.Fund, data.FTE, data.[Annualized Rate], data.[FN Dist Pct], data.Udds, data.Project, data.[Empl Class], employeeuddslink.employee_ID, employeeuddslink.payudds_ID;
    When I run this it ask for value for employee.Emplid.
    I just want my query to run.  How do I resolve this.
    Regards, Hitesh

    FROM ((employeeuddslink INNER JOIN employee ON employeeuddslink.[employee_ID] =     
    employee.[ID])      INNER JOIN payudds ON employeeuddslink.[payudds_ID] = payudds.[ID]) INNER JOIN data ON                       
       employee.[Emplid]
    In the FROM you have     employee.[ID]     and    employee.[Emplid]   as both being in table [employee].
    Build a little, test a little

Maybe you are looking for

  • How do I create an email signature for .me email account

    Hi, I would like to creat an email signature that will work for my .me account on the iCloud.  I know how to do it on my iPhone.  Does the iCloud automatically inherit that signature or do you have to do it on the web.  I want the signature to work w

  • Contract and PO

    Dear Seniors,      I had set release procedure already for contract and purchase order. Whenever i do po w.r.to contract, i have to release both contract and PO to do GRN. For example, consider vendor X and Y, i have contract for these 2 vendors and

  • Settlement of proj cost to AUC and final settmnt to f.asset for closed proj

    Hi PS Experts, If the project (Investment Projects) has been closed and AUC has been fully settled to final asset but in some cases they still received invoices for the same project. Would it be correct if they undo closed and undo teco the project a

  • Does a flex ios app support international characters?

    does a flex ios app support international characters? i just built an app using flash builder 4.6 and the ios 5.1 sdk... and my text fields won't show international characters. is this supported? Also... i'm embedding the arial unicode font... and it

  • Adding Text

    Can anyone help me out on adding text to an image. I have followed the instructions in both books and videos on how to add text (using the text tool) and when I get to the point of typing text in, it doesn't go 'in'. The box that I assume it should s