RSS RSS feed | Atom Atom feed

Java vs ASP in Fortune 50 companies

Who has more market Sun or Microsoft

I wanted to to find out who had more market, the ASP and .NET crowd or the JSF, JSP, and Servlet people.  Below is my informal start at
Microsoft = 8
Sun = 12
Cold Fusion = 2

Continued...

Read more...

Java Label Printing to DYMO Printers

Label printing

I have done many bar code printing projects in the past for Zebra printers.  In fact those projects were more complicated then the one I was going to work on today.  Today I just wanted to print out Salesforce contacts onto a DYMO LabelWriter 330, no barcodes, no images, nothing to complicated.  I wrote the part to pull our contact data from salesforce with their wonderful web services (If only they allowed you into ALL your data / Settings) but then ran into trouble with the printer.  It would work fine when prompting the user with the print dialog, even though my margins, paper size, layout, .... was all the same as the format returned from the prompt, it would not work.  Finally I just started a small trial and error, and after about 20 wasted labels I got it working.  Below is a small extract from the project to hopefully help people not waste there time like I did, and not waste labels / trees.

Click Read More For the Full Source Code


        DocFlavor flavor = DocFlavor.SERVICE_FORMATTED.PRINTABLE;
        PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
        aset.add(OrientationRequested.LANDSCAPE);
        aset.add(new Copies((copies<1?1:copies)));
        aset.add(new JobName((jobName==null?"My Labels":jobName), null));

        PrintService[] services = PrintServiceLookup.lookupPrintServices(flavor, aset);
        PrintService service = null;
       
        if (services.length > 0)
        {
            for (int i = 0; i < services.length; i++)
            {
                System.out.println(services[i].getName());
               
                if(service == null && services[i].getName().indexOf(printerName) != -1)
                {
                    service = services[i];
                }
            }
           
            if(service != null)
            {
                DocPrintJob pj = service.createPrintJob();

                try
                {
                    Doc myDoc = new SimpleDoc(this, flavor, null);

                    PrintRequestAttributeSet atSet = new HashPrintRequestAttributeSet();
                    MediaPrintableArea printableArea  = new MediaPrintableArea(0, 0, 612, 792, MediaPrintableArea.MM);
                    atSet.add(printableArea);
                    atSet.add(OrientationRequested.LANDSCAPE);
                    atSet.add(new JobName((jobName==null?"My Labels":jobName), null));
                    aset.add(new Copies((copies<1?1:copies)));
                    pj.print(myDoc, atSet);
                   
                }
                catch (Exception e)
                {
                    System.err.println(e);
                    e.printStackTrace();
                }
            }
           
 

Read more...