Using ints or floats for Color

Thanks in advance for taking time to read this message.
I am using "Color" and need the most accurate color rendering. I found that I was losing some accuracy with Color(int, int, int), with integers ranging from 0-255. Because of this loss of accuracy, I am contemplating using Color(float, float, float) to make my colors. The float values can range from 0 - 1.
"Theoretically" using integers one can effectively create 256^3 colors. How many colors can be created when using floats? More importantly, how do the float produced colors correspond to the more widely used int colors?
Thanks,
Every_man

Assuming you want a RGB color scheme, you could get approx (2^22)^3 different colors, since a float has 2^22 bits for the mantissa (assuming you want an even spread between 0 and 1).
When using Color(float, float, float) Java will try to map these values to the available system as best as possible. Therefore if your system can hadle more than 256 values for each of the RGB values you should get better color resolution.
If you system does not use RGB encoding, you should probably use Color(ColorSpace, float[], float)

Similar Messages

  • I am trying to connect a Macbook Pro to a projector for a Powerpoint presentation. When I use a VGA cable, the color of the projected images are not good. When I use a USB cable, the projected image includes the presenter notes on my computer screen?

    I am trying to connect a Macbook Pro to a projector for a Powerpoint presentation. When I use a VGA cable, the color of the projected images are not good. When I use a USB cable, the projected image includes the presenter notes on my computer screen?

    To move an iPhoto Library to a new machine:
    Link the two Macs together: there are several ways to do this: Wireless Network,Firewire Target Disk Mode, Ethernet, or even just copy the Library to an external HD and then on to the new machine...
    But however you do choose to link the two machines...
    Simply copy the iPhoto Library from the Pictures Folder on the old Machine to the Pictures Folder on the new Machine.
    Then hold down the option (or alt) key key and launch iPhoto. From the resulting menu select 'Choose Library'
    and select the Library that you moved.  That's it.
    This moves photos, events, albums, books, keywords, slideshows and everything else.
    Your first option didn't work because you imported one Library to another. Every version and thumbnail is imported like a distinct photo, you lose all your Albums, Keywords etc., the link between Original and Previews is destroyed, the non-destructive editing feature is ruined and so on. In summary: it's mess.
    Your second option didn't work because you simply referenced her library on the old machine.
    Regards
    TD

  • Stop it from using photo black ink for black text printing and where has the color ink gone?

    My HP Photosmart Prem C310 series all in one is using the Black Photo ink cartridge for text printing instead of the XL Black that I put in it for text printing. How can I get it to use the right cartridge for printing? Also, even though I have NOT printed ANY photo's and very few pages of text the new set of color cartridges I put in it a few months ago are almost empty. Why? How could they be almost empty when I have NOT printed anything in color? This is getting ridiculous replacing ink cartridges every few months WHEN I HAVE NOT BEEN PRINTING ANYTHING!!!
    The set of ink cartridges that came with it lasted for several months. Since then I've gone through two sets in less than a year. That's 3 sets of ink cartridges when I have only printed 3 photo's when I first set it up. And have only used les than a 1/4 of one package of printing paper. I've only put paper in it twice. Each time it was about a 1/4 inch or 3/8 of an inch thick stack of paper in the tray. I've even tried shutting the printer down when its not being used for a long period of time but the ink is still disapearing. Where is it going? Why is it going there? How do I stop it? This is rediculous. I may as well junk the thing even though it still works because I cant aford to keep feeding it ink when its just sitting there doing nothing most of the time.
    Thank you
    This question was solved.
    View Solution.

    I just got another email from HP about this problem wanting to know what I found for a solution to this problem. From all of the suggestions from the HP tec support all of them pretty much kept saying the same thing. That it is my fault that it's using so much ink because I have it on the wrong settings. One tec did slip and say that it doesn't matter what settings you have it on it will always use the Photo Black cartridge for printing plain black text and it doesn't matter if you have a X-Large Black cartridge in it for text printing because it was made to always use the Photo Black for text and even use some of the colors to blend with the black to make it stand out. Why anybody would need this when just printing shipping labels and things like that I don't know.
    Any who, The only solution for this problem is,,,, junk the printer and get a different brand & model of printer. Research it before buying to find out how much ink it wants to waste and if it will still print black text if it only has a black cartridge in it. I was going to get rid of mine by giving it to a friend since they don't have a printer. But since I want to keep him as a friend I decided not to give it to him. Since it cant be traded in for a different one even though it still works, Its going to the target shooting range the next time I go out shooting. Maybe I'll take a few video's clips of it getting blasted to pieces with a Ruger 10-22 .22 cal. rifle with 25 shot clips, a Ruger Mini-14 Ranch Rifle shooting .223 cal with a 30 shot clip, a Chinese SKS 7.62 with a 30 shot clip. And maybe use my Ruger P89 9mm pistol and put a couple 15 round clips of 9mm in it. If there's anything left I'll finish it off with a few 3" magnum loads of #2 steel shot with my 20 gauge shotgun.  Then I think I'll do the same thing to my Westinghouse 46" flat screen HDTV that just died.
       Then maybe I'll come back and post the video's of my "solution to this printers problem". It may not fix the problem, but it will be an entertaining way of getting rid of the problem.

  • Is it possible to use a still store for colorcorrection in FCP X like also exists similar to Color?

    Is it possible to use a still store for colorcorrection in FCP X like also exists similar to Color?

    DDo you want the image for comparison or to store the correction? If it's just for comparison, the roundabout way is to export a still frame and reimport it.

  • How to use a GradientPaint as background color in a JPopupMenu

    I want to use a GradientPaint as background color in a JPopupMenu.
    I try to use something like
    GradientPaint p;
    p = new GradientPaint(0, 12, Color.white, 0, 24, Color.pink);
    UIManager.put("MenuItem.selectionBackground", p);but it doesn't work.
    I also tried to extends BasicMenuItemUI in MenuItems
    public class CMenuItem extends JMenuItem {
         public CMenuItem(String text) {
              super(text);
              setUI(BUI.createUI(this));
         static final class BUI extends BasicMenuItemUI {
             private final static BUI ui = new BUI();
             public static BUI createUI(JComponent c) {
                 return ui;
             @Override
             public void update(Graphics g, JComponent c) {
                   if (c.isOpaque()) {
                        Graphics2D g2 = (Graphics2D)g.create();
                        int w = c.getWidth();
                        int h = c.getHeight();
                        GradientPaint p;
                        p = new GradientPaint(0, 12, Color.white, 0, 24, Color.pink);
                        g2.setPaint(p);
                        g2.fillRect(0, 0, w, h);
                        g2.dispose();
                   paint(g, c);
    }I used this technique for JLabel and it works fine.
    Please help

    ok, here the SSCCE. I hope its helpful for an answer.
    import java.awt.Color;
    import java.awt.GradientPaint;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import javax.swing.JComponent;
    import javax.swing.JFrame;
    import javax.swing.JMenu;
    import javax.swing.JMenuBar;
    import javax.swing.JMenuItem;
    import javax.swing.UIManager;
    import javax.swing.plaf.basic.BasicMenuItemUI;
    public class Menu {
        public JMenuBar createMenuBar() {
             JMenuBar menuBar;
            JMenu menu;
            JMenuItem menuItem;
            //Create the menu bar.
            menuBar = new JMenuBar();
            //Build the first menu.
            menu = new JMenu("A Menu");
            menuBar.add(menu);
             GradientPaint p;
             p = new GradientPaint(0, 12, Color.white, 0, 24, Color.pink);
             UIManager.put("MenuItem.selectionBackground", p);
            menuItem = new JMenuItem("1st item: when selected its background is black: wrong");
            menu.add(menuItem);
             UIManager.put("MenuItem.selectionBackground", Color.pink);
            menuItem = new JMenuItem("2nd item: when selected its background is pink: ok");
            menu.add(menuItem);
            menuItem = new CMenuItem("3rd item: when selected its background is pink: WRONG!");
            menu.add(menuItem);
            return menuBar;
        private static void createAndShowGUI() {
            //Create and set up the window.
            JFrame frame = new JFrame();
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            //Create and set up the content pane.
            Menu demo = new Menu();
            frame.setJMenuBar(demo.createMenuBar());
            //Display the window.
            frame.setSize(450, 260);
            frame.setVisible(true);
        public static void main(String[] args) {
            javax.swing.SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    createAndShowGUI();
    class CMenuItem extends JMenuItem {
         private static final long serialVersionUID = 1L;
         public CMenuItem(String text) {
              super(text);
              setUI(BUI.createUI(this));
         static final class BUI extends BasicMenuItemUI {
             private final static BUI ui = new BUI();
             public static BUI createUI(JComponent c) {
                 return ui;
             @Override
             public void update(Graphics g, JComponent c) {
                   if (true || c.isOpaque()) {
    //                    System.out.println("update()");
                        Graphics2D g2 = (Graphics2D)g.create();
                        int w = c.getWidth();
                        int h = c.getHeight();
                        GradientPaint p;
                        p = new GradientPaint(0, 0, Color.white, 0, 10, Color.pink);
                        g2.setPaint(p);
                        g2.fillRect(0, 0, w, h);
                        g2.dispose();
                   paint(g, c);
    }Thanks for the help

  • Int or float

    Hello,
    In my J2ee server, I have a lots of computation of money. Usually, the primitive type float is satisfied for presenting money. But I have a question, is it better to use int to store it. Even in database, I can save more space by using INT than using DECIMAL(10,2). My MySql, INT requires 4 bytes, DECIMAL(10,2) requires 12 bytes. At I/O moudle, I just simply multiply 100 for input and divid 100 for output. Because I suspect that using float may change a tiny bit at the end of the value. Any suggestions to me?
    Thanks!

    How are we saying opposite things? I said that he should use an int unless it doesn't matter if the results of a calculation are actually correct. Floats/doubles are generally a bad idea to use unless you know what you are doing, since the approximating effect they have on calculations can be strange to a newcomer. For printing the results of money calculations, floats might work fine. However, you will get a certain amount of error, so you just have to watch out. If you are not storing the results of calculations where the operands are floats, then the error might be ok.
    Rounding in accounting programs, like interest programs always have very specific business rules that specify to what degree of precision the calculation is to be performed and which style of rounding should be used. I most programs that need to deal with money, the smallest increment will usually be a cent (for US money anyway). And if they don't have specific rules, then maybe you should get some (or stash the error into an account in your name, Superman 2 thank you very much).
    BigDecimal is fine to use if you don't need to worry about speed, and if you have the possibility of overflow with longs, BigDecimal is probably a good idea since it can represent huge numbers that long cannot. I would imagine that most programs don't need more precision then a long can provide.

  • Why use int over double?

    i am using the book beginning java 2. and there is a example showing how the math class works
    the program calculates the radius of a circle in feet and inches given that the area is 100 square feet:
    public class MathCalc
    public static void main(String[]args)
    double radius = 0.0;
    double circlearea= 0.0;
    int feet = 0;
    int inches = 0;
    radius = Math.sqrt(circleArea/Math.PI);
    feet = (int)Math.floor(radius);
    inches = (int)Math.round (12.0 * (radius-feet));
    System.out.println( Feet + "feet" + inches + "inches");
    the output will be 5 feet 8 inches.
    my question is why bother with using 'int', why not simply use 'double' for all your variables?
    in feet and inches 'int' has been used as the result would have been a floating value. so casting as been used. But doesnt that complicate things?cant one just use long for all variables and forgot about worrying whether the value will fit or not.
    thanks
    Ali

    i am using the book beginning java 2. and there is a
    example showing how the math class works
    the program calculates the radius of a circle in feet
    and inches given that the area is 100 square feet:
    public class MathCalc
    public static void main(String[]args)
    double radius = 0.0;
    double circlearea= 0.0;
    int feet = 0;
    int inches = 0;
    radius = Math.sqrt(circleArea/Math.PI);
    feet = (int)Math.floor(radius);
    inches = (int)Math.round (12.0 *
    d (12.0 * (radius-feet));
    System.out.println( Feet + "feet" + inches +
    "inches");
    the output will be 5 feet 8 inches.
    my question is why bother with using 'int', why not
    simply use 'double' for all your variables?There are several reasons to use int (when appropriate) rather than double. More generally, there are several reasons to use integer arithmetic instead of floating point.
    First, integer arithmetic is precise whereas floating point arithmetic is always subject to imprecision. E.g. 6 / 2 always equals 3, 6.0 / 2.0 may equal something like 3.000000000000001.
    Second, (related to the above) the results of integer arithmetic operations will not vary from one machine to the next. The results of the same floating point operation may vary from one machine to the next.
    Third, integer arithmetic is always faster than floating point.
    >
    in feet and inches 'int' has been used as the result
    would have been a floating value. so casting as been
    used. But doesnt that complicate things?The results are cast back to an int because it would look silly and meaningless to print a result of, for instance, 5.00000001 feet, 8.00045 inches.
    cant one just
    use long for all variables and forgot about worrying
    whether the value will fit or not. No. You should never disregard whether the results of arithmetic operations will overflow the size of the word you are using. Even though a long type can contain a pretty huge number, you can still easily overflow it and get nonsensical results.
    Also, a 32 bit word is the native size for most of the machines most of us use. This means that arithmetic operations are fastest on int types (for most of us). This shouldn't be a primary design consideration but it should be taken into account.

  • Can we put condition for color in bex query designer

    hi all,
    can any one guide me how to put a condition for color settings in query designer
    for example:
    i have a key figure like ANSWERED%.in analyser it should display in red if  answered% exceeds 95%.
    please help me in this issue.
    regards
    Vamshi D Krishna.

    Hi,
    Use Exceptions while designing your Query.
    Please go through the link
    http://help.sap.com/saphelp_nw04s/helpdata/en/43/21b4cd14cd06f4e10000000a422035/frameset.htm

  • When i try to open a pdf using int exp i get a message that it has encountered a problem and will cl

    when i try to open a pdf using int exp i get a message that it has encountered a problem and will close

    Internet explorer.  I have adobe reader and flash player which I uninstalled and reinstalled.  I tried another browser and the pdf's open so it is a problem with IE .Thanks for your comments.
    [private data removed]

  • How to use the same keypair for both encrypt/decryprt-SunPKCS#11

    Dear All,
    Subject: To access iKey 2032 token, to retrieve public/private key from iKey 2032 token using pkcs#11 in sdk1.5, to encrypt/decrypt files.
    When I separate the encrypt and decrypt part of java program, encryption program works well, whereas decryption program does not decrypt anything in the decrypt file (But there is no error). I printed out the public and private key in both encrypt and decrypt part of java program, its displayed differently::
    Encrypt program:
    SunPKCS11-rainbow_token RSA public key, 1024 bits (id 10, session object)
    modulus: 114338469922835728259534620463489934081917342509275191892563243582065
    74380495029336519036972702864998634664269499641616889325482699399559620370181624
    72068116957594402738459932902481604823224406859575930392708524033619120886256353
    58738237376491107769961041015109436347533548940674900728805627968145581222172729
    public exponent: 65537
    SunPKCS11-rainbow_token RSA private key, 1024 bits (id 11, session object, sensi
    tive, unextractable)
    Decrypt Program::
    SunPKCS11-rainbow_token RSA public key, 1024 bits (id 12, session object)
    modulus: 138556361758970660122782926386849783732271581948935425587968692317930
    09262429353977097956605140384961825974398004270547046620971835394362397699233738
    54481804748731546655197744692886754946373745924825650876065903334173666990347814
    83727290962956934521650035029131176614982652900659797194703065074407857754883163
    public exponent: 65537
    SunPKCS11-rainbow_token RSA private key, 1024 bits (id 13, session object, sensi
    tive, unextractable)
    I suspect that every time program generates different set of key, therefore we need to store the generated key during encryption part (i believe it is to be in the keystore) and to use the same for decryption part. Could you please give me a tips how to do this?
    Encrypt Program ::
    import java.io.*;
    import java.util.*;
    import java.lang.*;
    import java.sql.*;
    import java.text.*;
    import java.math.*;
    import java.security.*;
    import java.security.cert.*;
    import java.security.interfaces.*;
    import javax.crypto.interfaces.*;
    import javax.net.ssl.*;
    import javax.crypto.*;
    import javax.crypto.spec.DESKeySpec;
    import java.security.KeyStore.*;
    * A class of Encrypt.
    public class Encrypt
    public Encrypt(){}
    public void loginToken() {
         Provider p = new sun.security.pkcs11.SunPKCS11(MQConfig.getvalue("SecurityPropertyPath"));
         Security.addProvider(p);
         KeyStore ks = null;
         try{
              String password = General.ReadFiles(MQConfig.getvalue("logFilePath"),"Simple");
              password = password.trim();
              char pin[] = password.toCharArray();
              ks = KeyStore.getInstance("pkcs11");
              ks.load(null,pin);
         KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA",p);
              KeyPair kp = kpg.genKeyPair();
              kpg.initialize(1024, new java.security.SecureRandom());
              FileInputStream in = new FileInputStream("C:\\ReportDBBE.properties");
              FileOutputStream out = new FileOutputStream("C:\\ReportDBAE.properties");
              Cipher cp=Cipher.getInstance("RSA/ECB/PKCS1Padding", p);
              cp.init(cp.ENCRYPT_MODE,kp.getPublic());
              CipherOutputStream cout=new CipherOutputStream(out,cp);
              byte[] input=new byte[8];
              int byteread=in.read(input);
              while(byteread!=-1){
                   cout.write(input,0,byteread);
                   byteread=in.read(input);
              cout.flush();
              in.close();
              cout.close();
         catch(NoSuchAlgorithmException nsae)
         System.out.println("No Such Algorithm Exception " + nsae.getMessage());
         catch(NoSuchPaddingException nspe)
         System.out.println("No Such Padding Exception " + nspe.getMessage());
         catch(InvalidKeyException ike)
         System.out.println("Invalid Key Exception " + ike.getMessage());
         catch(IllegalStateException ise)
         System.out.println("Illegal State Exception " + ise.getMessage());
         catch(KeyStoreException kse)
         System.out.println("Key Store Exception " + kse.getMessage());
         catch(CertificateException ce)
         System.out.println("Certificate Exception " + ce.getMessage());
         catch(IOException ioe)
         System.out.println("IO Exception " + ioe.getMessage());
    public static void main (String args[]) throws Exception {
         try{
         Encrypt tl = new Encrypt();
         tl.loginToken();
         }catch(Exception e){
         e.printStackTrace();
    Decrypt Program ::
    import java.io.*;
    import java.util.*;
    import java.lang.*;
    import java.sql.*;
    import java.text.*;
    import java.math.*;
    import java.security.*;
    import java.security.cert.*;
    import java.security.interfaces.*;
    import javax.crypto.interfaces.*;
    import javax.net.ssl.*;
    import javax.crypto.*;
    import javax.crypto.spec.DESKeySpec;
    import java.security.KeyStore.*;
    * A class of Decrypt.
    public class Decrypt
    public Decrypt(){}
    public void loginToken() {
         Provider p = new sun.security.pkcs11.SunPKCS11(MQConfig.getvalue("SecurityPropertyPath"));
         Security.addProvider(p);
         KeyStore ks = null;
         try{
              String password = General.ReadFiles(MQConfig.getvalue("logFilePath"),"Simple");
              password = password.trim();
              char pin[] = password.toCharArray();
              ks = KeyStore.getInstance("pkcs11");
              ks.load(null,pin);
         KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA",p);
              KeyPair kp = kpg.genKeyPair();
              kpg.initialize(1024, new java.security.SecureRandom());
              FileInputStream in1 = new FileInputStream("C:\\ReportDBAE.properties");
              FileOutputStream out1 = new FileOutputStream("C:\\ReportDBAD.properties");
              Cipher cipher=Cipher.getInstance("RSA/ECB/PKCS1Padding", p);
              AlgorithmParameters algParams = cipher.getParameters();
              cipher.init(Cipher.DECRYPT_MODE,kp.getPrivate(),algParams);
              CipherInputStream cin1=new CipherInputStream(in1,cipher);
              byte[] input1=new byte[8];
              int byteread1=cin1.read(input1);
              while(byteread1!=-1){
                   out1.write(input1,0,byteread1);
                   byteread1=cin1.read(input1);
              out1.flush();
              in1.close();
              out1.close();
              cin1.close();
         catch(NoSuchAlgorithmException nsae)
         System.out.println("No Such Algorithm Exception " + nsae.getMessage());
         catch(NoSuchPaddingException nspe)
         System.out.println("No Such Padding Exception " + nspe.getMessage());
         catch(InvalidKeyException ike)
         System.out.println("Invalid Key Exception " + ike.getMessage());
         catch(IllegalStateException ise)
         System.out.println("Illegal State Exception " + ise.getMessage());
         catch(InvalidAlgorithmParameterException iape)
         System.out.println("Invalid Algorithm ParameterException " + iape.getMessage());
         catch(KeyStoreException kse)
         System.out.println("Key Store Exception " + kse.getMessage());
         catch(CertificateException ce)
         System.out.println("Certificate Exception " + ce.getMessage());
         catch(IOException ioe)
         System.out.println("IO Exception " + ioe.getMessage());
    public static void main (String args[]) throws Exception {
         try{
         Decrypt tl = new Decrypt();
         tl.loginToken();
         }catch(Exception e){
         e.printStackTrace();
    Configuration file::
    name = rainbow_token
    library = c:\winnt\system32\dkck201.dll
    attributes(*,CKO_PRIVATE_KEY,*) = {
    CKA_SIGN = true
    attributes(*,CKO_PRIVATE_KEY,CKK_DH) = {
    CKA_SIGN = null
    attributes(*,CKO_PRIVATE_KEY,CKK_RSA) = {
    CKA_DECRYPT = true
    }

    Hi all,
    Now i manage to use the same keypair for both encrypt/decryprt-SunPKCS#11. Below is my code woks well. In my code i hard coded alias name of certificate, did anyone knows how to read alias name of certificate from iKey token 2032??
    import java.io.*;
    import java.util.*;
    import java.lang.*;
    import java.sql.*;
    import java.text.*;
    import java.math.*;
    import java.security.*;
    import java.security.cert.*;
    import java.security.interfaces.*;
    import javax.crypto.interfaces.*;
    import javax.net.ssl.*;
    import javax.crypto.*;
    import javax.crypto.spec.DESKeySpec;
    import java.security.KeyStore.*;
    * A class of Encrypt.
    public class Encrypt
    public Encrypt(){}
    public void loginToken() {
         Provider p = new sun.security.pkcs11.SunPKCS11(MQConfig.getvalue("SecurityPropertyPath"));
         String myAlias = "349eefd1-845b-4ba4-9f88-06e9f5cb82f6";
         /** to view alias name
         keytool -list -v -keystore NONE -storetype PKCS11 -storepass PASSWORD
         Security.addProvider(p);
         KeyStore ks = null;
         PrivateKey privKey = null;
         PublicKey pubKey = null;
         try{
              String password = General.ReadFiles(MQConfig.getvalue("logFilePath"),"Simple");
              password = password.trim();
              char pin[] = password.toCharArray();
              ks = KeyStore.getInstance("pkcs11");
              ks.load(null,pin);
              java.security.cert.Certificate cert = ks.getCertificate(myAlias);
              Key key = ks.getKey(myAlias, pin);
              if(key != null) {
                   System.out.println("key class: " + key.getClass().getName()); // -> sun.security.pkcs11.P11Key$P11PrivateKey
                   System.out.println("key bytes: " + key.getEncoded()); // -> null!!!!!!!
         if(PrivateKey.class.isInstance(key)) {
         privKey = (PrivateKey)key;
         System.out.println("algo: " + privKey.getAlgorithm()); // -> RSA
         //Signature rsasig = Signature.getInstance("SHA1withRSA");
         //rsasig.initSign(privKey);
         //rsasig.update(data.getBytes());
         //byte[] sigBytes = rsasig.sign();
         pubKey = cert.getPublicKey();
         //System.out.println("signed bytes: " +sigBytes);
         //return sigBytes;
         //KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA",p);
              //KeyPair kp = kpg.genKeyPair();
              //KeyPair kp = kpg.generateKeyPair();
              //kpg.initialize(1024, new java.security.SecureRandom());
              FileInputStream in = new FileInputStream("C:\\ReportDBBE.properties");
              FileOutputStream out = new FileOutputStream("C:\\ReportDBAE.properties");
              Cipher cp=Cipher.getInstance("RSA/ECB/PKCS1Padding", p);
    //cp.init(cp.ENCRYPT_MODE,kp.getPublic());
              cp.init(cp.ENCRYPT_MODE,pubKey);
              CipherOutputStream cout=new CipherOutputStream(out,cp);
              byte[] input=new byte[8];
              int byteread=in.read(input);
              while(byteread!=-1){
                   cout.write(input,0,byteread);
                   byteread=in.read(input);
              cout.flush();
              in.close();
              cout.close();
         catch(NoSuchAlgorithmException nsae)
         System.out.println("No Such Algorithm Exception " + nsae.getMessage());
         catch(NoSuchPaddingException nspe)
         System.out.println("No Such Padding Exception " + nspe.getMessage());
         catch(InvalidKeyException ike)
         System.out.println("Invalid Key Exception " + ike.getMessage());
         ike.printStackTrace();
         catch(IllegalStateException ise)
         System.out.println("Illegal State Exception " + ise.getMessage());
         catch(KeyStoreException kse)
         System.out.println("Key Store Exception " + kse.getMessage());
         catch(CertificateException ce)
         System.out.println("Certificate Exception " + ce.getMessage());
         catch(IOException ioe)
         System.out.println("IO Exception " + ioe.getMessage());
         catch(UnrecoverableKeyException unrke)
         System.out.println("Unrecoverable Key Exception " + unrke.getMessage());
    public static void main (String args[]) throws Exception {
         try{
         Encrypt tl = new Encrypt();
         tl.loginToken();
         }catch(Exception e){
         e.printStackTrace();
    Your help is very much appreciated!!!!

  • How to use the Output clause for the updated statment

    How to use the output clause for the below update stament,
    DECLARE @MyTableVar table(
        sname int NOT NULL)
    update A set stat ='USED' 
    from (select top 1 * from #A 
    where stat='AVAILABLE' order by sno)A
    Output inserted.sname
    INTO @MyTableVar;
    SELECT sname
    FROM @MyTableVar;
    Here am getting one error incorrect syntax near Output
    i want to return the updated value from output clause

    see
    http://blogs.msdn.com/b/sqltips/archive/2005/06/13/output-clause.aspx
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Using a background image for the buttons in spry menu

    Hi All,
    Going nuts here.
    I'm using the vertical spry menu widget w DW CS3 and trying
    to alter the css style sheet, so that I can use a li class for each
    of the 14 links on this page, with an upstate and a hover state
    only. (the focus, and hover while down will be the same as the
    others, to keep it simple and not too distracting)
    The page is here that I will be replacing the entire
    background image in sidebar1 and sidebar2 with a custom spry menu
    with the 14 li classes for 2 seperate menus:
    http://audibleimagesav.com/blank_doc.html
    Has anyone used a background image in place of just using
    bkgrd colors and borders for the spry menu ?
    I am aware of the attributes that the help docs suggest that
    need to be altered as listed here :
    http://livedocs.adobe.com/en_US/Spry/1.4/help.html?content=WS0BB04E11-1BE3-4a67-BC94-BE7DA 93A0159.html
    I have been working on just an experimental page, that is now
    hacked up, however if you want to see that it is here with only the
    first list item coded:
    http://audibleimagesav.com/site%20theme%20ideas/sprymenu_exp.html
    The spry css menu widget for that page is here:
    http://audibleimagesav.com/SpryAssets/SpryMenuBarVertical.css
    So in short, has anyone done a bkgrd image for the main menu
    (not submenu) in a spry widget?
    Thanks in advance.
    Art
    Art Hansen
    Web Design & Marketing
    http://www.innova-techsolutions.com
    321.750.3852 - Cocoa Beach, Florida, USA

    http://meyerweb.com/eric/css/edge/popups/demo2.html
    Maybe

  • Configuring an external Monitor for Color Correction?

    I currently have my Mac Book Pro 17in connected by the mini DV port and one USB port to a Mac 30" Cinema Display for editing on FCP7. I use it in a two monitor configuration with my Bin on the laptop screen and the FCP interface on the Cinema display. This works well for me.
    I also have an external ESata drive via PCI slot. I would like to connect an external video monitor as well for quality checks and Color correction purposes. I am also looking for advice on what sort of external video monitor I should get and how would I connect it to the laptop or via some external third party device. I would be hoping to use a video monitor connected via a hdmi connection. Most of the work I do is supplied on drives, original material EX3 or Canon and some on HDV (Camera) that I ingest via Firewire800. Many thanks in advance.

    Sorry Mark, you can't always have everything ... with the Matrox MXO2 (or similar, like Motu HDX-SDI) you wouldn't be able to use your eSATA drive at the same time as the I/O device as they both use the ExpressCard/34 port ... you would have to use a FW800 drive for your media instead. On the plus side the MXO2 includes a calibration tool which can help you calibrate your LCD/LED screen via HDMI for accurate color reproduction.
    An alternative device would be the AJA IoHD (or perhaps Motu V4HD) which connects via FW800. It's a superb piece of kit but is costly and doesn't offer any calibration utility ... that said, a good quality plasma display, such as a Panasonic Pro Plasma, can be found relatively cheaply and many of these have built in picture controls suitable for getting an accurate calibration.
    The future is much brighter for Mac laptop users with the introduction of the Thunderbolt connector on the latest MBP revisions. As with FireWire and ExpressCard, you can expect to see I/O devices, hard drives and monitors etc that will connect directly via that connection, greatly expanding the capabilities of a simple laptop setup.

  • LCD for Color Grading

    I'll need to dive into Color when I finish editing my one-hour long documentary in a couple months. The doc is intended to be shown on a large theatre screen one time, then broadcast on community-access television and lent through our regional public library system on DVD. My question(s): Can the Apple 30" Cinema Display be used for color grading? Or HP's 2480zx LCD Monitor? Would the Spyder3Elite Display Calibration product be useful? Thanks in advance.

    Interestingly enough, the options for trying to push a computer text display into being a grade monitor are narrowing down to nothing. The harder people have been trying to make a silk purse out of these sow's ears has resulted in the inevitable conclusion that hey, there really is no such thing as free lunch. Even the vaunted ACD's after watching two of them for nearly three years now, can't hold a calibration for more than a couple of hours and then go magenta. Its because we need so much green to make D65 white. Those poor green dots just peter out and then red and blue take over. So you better be fast, because you will be working with a different monitor for the second half of the day.
    An interesting thread on a pro telecine site has been discussing the HP Dreamcolor... the general conclusion is that it is probably great for a cubicle farm full of compositing and animation artists who more need a match between them than truly accurate colorimetry. At least its consistent. A high end grading device company member warned against using certain types of "probes", since at varying resolutions of display, you really have no idea what the thing is integrating to come up with a white point.
    One of the really huge things that is missing is the ENVIRONMENT that the grade is taking place in. Sure, the monitor is important... but almost equally so is the room in which it is situated... its ambient illumination and the requirement for a constant contrast neutral 18% D65 background against which to judge the monitor itself, not just what it is trying to display.
    That's one of the reasons that the COLOR GUI is that "ugly" grey.... even though its probably not grey at all if the monitor you're using to display it is whacked. Every time you look at it... it is influencing the balance of your target image. Imagine you're the beer taster at the world's finest brewery.... and what (hold on a minute while I savour the fantasy.... okay, I'm back) but between samples you take a big gulp of vinegar. Right. Is that going to work?
    jPo

  • Facing problem in using JEditorPane as renderer for JList

    I am trying to use JEditorPane as renderer for a list. But I am facing some problems. First problem is the output in the editorpane is not shown properly. I want to show a html file, but only portion of the first line that is viewable in the editorpane is shown. I, of course, need to show the total content of the file. Again sometimes the editorpane looks blank. If I click on the list then some text are shown in the editor pane. Please help me to overcome these problems.
    Here goes the code for the renderer.
    list.setCellRenderer(new ListCellRenderer() {
                private JEditorPane editor = new JEditorPane();
                public Component getListCellRendererComponent(JList mList, Object value, int index,
                                                            boolean isSelected, boolean hasFocus) {
                    try {
                        editor.setPage("file://localhost/C:/networks/network1/description.html");
                        editor.setBackground(isSelected ? mList.getSelectionBackground() : mList.getBackground());
                        editor.setForeground(isSelected ? mList.getSelectionForeground() : mList.getForeground());
                        editor.setBorder(BorderFactory.createRaisedBevelBorder());
                        editor.setOpaque(true);
                    } catch(Exception e) {
                        e.printStackTrace();
                    return editor;
            });

    hai ahmad,
    it could be bcoz of the size of the pane.... the size content might be too large to fit in that pane....... y dont u increase the width of the pane..
    or set the size of the pane..... its surely bcoz of the size only....
    hope this helps u...... or else revert back for further clarifications...
    Regards,
    Ciya.

Maybe you are looking for

  • How do I use the Airport Extreme feature.

    For a while I have used a Netgear WGR614 wireless router, which worked fine (with a cable modem). At this time I have a DSL modem, and for the life of me I can NOT get this Netgear router to work anymore. The period for free phone support has expired

  • Looking for Java programmers for a new project

    I am currently looking to find about 5 people to start a new company to develop some ebusiness related business ideas. Location does not matter, only creativity and a willingness to change the status quo. If you are interested email me at [email prot

  • Service Registry causing memory out of exception in Application Server

    Hi all, I have installed basic service registry on Oracle application server 10g.However I am ocassionally running into memory out of exception on the server. I have changed the opmn.xml with the following :- MaxPermSize=128m -Xmx1024m The configurat

  • FM/Program to find FILE Size

    Hi, Is thr any function module to find the size(in bytes) of a file? Regards, Ram.

  • Chinese Conversion Problem -Data Transfer

    Dear Guru's We are implementing SAP to china Client we are facing problems in following areas please suggest me as of how to go about in these aspects 1. Base Unit of measurement We are using PCS as our unit of measurement. In English Login we are ge