Help with HashMap - what am I doing wrong?!?!

I'm hoping to create multiple instances of an object and identify each one differently. On an earlier thread, someone recommended I use a hashmap to do this. I'm trying but failing. The following code is intended to allow me to ask for 1 and get apple and ask for 2 and get banana. Instead, when I ask for either I get banana, which is making me think that I'm just rewriting over my object and putting two of the same instances in the hashmap.
Thanks in advance!
import java.util.HashMap;
import java.util.Map;
public class HashMapTest {
     private static Map <Integer, Bids> map;
     public static void main (String[] args) {
          Map map = new HashMap<Integer, Bids>();
          Bids myBids = new Bids("apple", 1.5, 1);
          map.put(1, myBids);
          myBids = new Bids("banana", 2.0, 2);
          map.put(2, myBids);
          Bids aBids = (Bids) map.get(1);
          String cat = aBids.getProductCategory();
          System.out.println(cat);
Bids code:
public class Bids {
     static String productCategory;
     private static Double price;
     private static int id;
     public Bids(String myProductCategory, Double myPrice, int myId) {
          productCategory = myProductCategory;
          price = myPrice;
          id = myId;
     public String getProductCategory(){
          return productCategory;
     public Double getPrice(){
          return price;
     public int getId(){
          return id;
}

jverd wrote:
You have to override equals() and hashCode() in your Bids class.I'm not questioning the desirability of that, but is it mandatory? This works fine, without overriding either.import java.util.HashMap;
import java.util.Map;
public class HashMapTest {
  public static void main(String[] args) {
    Map<Integer, Bids> map = new HashMap<Integer, Bids>();
    Bids myBids = new Bids("apple", 1.5, 1);
    map.put(1, myBids);
    myBids = new Bids("banana", 2.0, 2);
    map.put(2, myBids);
    Bids aBids = map.get(1);
    System.out.println("1: " + aBids.getProductCategory());
    aBids = map.get(2);
    System.out.println("2: " + aBids.getProductCategory());
class Bids {
  private String productCategory;
  public Bids(String myProductCategory, Double myPrice, int myId) {
    productCategory = myProductCategory;
    price = myPrice;
    id = myId;
  public String getProductCategory() {
    return productCategory;
}db
Edited by: DarrylBurke - I hate a laptop keyboard!

Similar Messages

  • I can't sync my calendar with outlook, what am i doing wrong

    I am trying to sync my new iphone 3GS & the calendar only seems to copy 1 way ie: from PC to phone thereby deleting info already in the phone.
    Where am I going wrong - please help if you can
    Thnks

    In the settings in itunes, Info > Advanced all the small "boxes" should be unmarked. Then it should sync both ways.

  • Communicate with process � what am I doing wrong?

    Hi,
    I able to Execute a process, to read and to write to the application ( using the JVM).
    My problem is that when I tray to send to the process another String, and to read the results,
    The process isn�t receiving or displaying the results back .
    In the example below: by typing the word 'HELP' I am receive a menu items. But when I send once again this String (or any other) noting happens.
    The results is that only the first 'write' to the stream buffer work � the second word that I am sending is not getting to the process.
    I will be very happy to get any help
    Thank in advanced.
    package com.surf.process;
    import java.io.BufferedReader;
    import java.io.BufferedWriter;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.io.OutputStreamWriter;
    import java.io.PrintWriter;
    import junit.framework.*;
    public class PrcInt {
         protected BufferedReader is;
    protected BufferedWriter bw;
         PrintWriter pw;
         private String prcPath="";
         private int prcDelay;
         private String prcData="";
         private Process p;
         public void openPrc()throws IOException, InterruptedException{
         String prcWin="";
         Runtime r = Runtime.getRuntime();
         String[] nargs = {prcPath};
         p = r.exec(nargs);
         Thread.sleep(prcDelay);      
         is = new BufferedReader(new InputStreamReader(p.getInputStream()));
         bw=new BufferedWriter(new OutputStreamWriter(p.getOutputStream()));
         public void write(String wData) throws InterruptedException, IOException{
                   Thread.sleep(prcDelay);
              //      bw=new BufferedWriter(new OutputStreamWriter(p.getOutputStream()));
                   bw.write(wData);
                   bw.flush();
              Thread.sleep(prcDelay);
         public String read() throws IOException, InterruptedException{
              String line="";
              String prcWin="";
         //     is = new BufferedReader(new InputStreamReader(p.getInputStream()));
              while (is.ready())     {
                   line=is.readLine();     
                   prcWin=prcWin+line+"\n\r";
                        return prcWin;
         public void close() throws IOException{
              is.close();
              bw.close();
              p.destroy();
         public void setPrcDelay(int prcDelay) {
              this.prcDelay = prcDelay;
         public void setPrcPath(String prcPath) {
              this.prcPath = prcPath;
         public void clearR() throws IOException{
              is.close();
    package com.surf.process;
    import java.io.IOException;
    import com.surf.process.C64Cmd.C64C;
    public class PrcTest extends PrcInt implements C64C {
    public static void main(String[] sd)throws IOException, InterruptedException{
              PrcInt ma =new PrcInt();
              ma.setPrcPath("C:\\D.exe");
              ma.setPrcDelay(500);     
              ma.openPrc();
              String g=ma.read();     
              System.out.println(g);
              ma.write("HELP"+Enter);
              String f=ma.read();
              System.out.println(f);
              ma.write("HELP"+Enter);
              String k=ma.read();
              System.out.println(k);
              ma.close();
    }

    In the settings in itunes, Info > Advanced all the small "boxes" should be unmarked. Then it should sync both ways.

  • I have created a word document but am sending to recipients in pdf format. They told me they cannot open it. Can you tell me what I am doing wrong? Thank you.

    I have created a document in word and sent it to my recipients in pdf format so they would receive it just as I had formatted it. I used an unusual font. But my recipients tell me they cannot open it. Can you help me understand what I am doing wrong. Thank you.

    How are you generating the PDF file? Are you zipping (compressing) the file before sending it? Is Mail configured to send Windows-friendly files?
    If you are using Word to generate the PDF file, then try instead to use the Word Print dialog. Click on the PDF dropdown menu in the lower left corner and select the option to Save as PDF.... You can save the output to the Desktop or any location your prefer. Use that document to send to others via email, but remember to compress the file first.

  • Hi.  I am having issues with copying files to my shared WB 2TB HDD connected to my airport extreme.  Comes up with error 50.  I am using a Macbook Pro to copy from so not sure what I am doing wrong.  Can someone help? thanks Rory

    Hi.  I am having issues with copying files to my shared WB 2TB HDD connected to my airport extreme.  Comes up with error 50.  I am using a Macbook Pro to copy from so not sure what I am doing wrong.  Can someone help? thanks Rory

    These links might provide some information that may be of help.
    http://support.apple.com/kb/TA20831
    https://discussions.apple.com/message/2035035?messageID=2035035
    I've encountered this error myself upon occasion.  If I remember correctly, it was a permissions/ownership issue with the some of the files I was copying.

  • When I connect my iPad with usb to my mac the iPad gives me a "blinking" message asking to trust the computer.  Problem is it does not give me enough time to select yes.  What am I doing wrong?  Help!

    When I connect my iPad with usb to my mac the iPad gives me a "blinking" message asking to trust the computer.  Problem is it does not give me enough time to select yes.  What am I doing wrong?  Help!

    Everything that you sync to the iPad is done through iTunes or from downloading from the cloud if they are iTunes purchases or through iTunes Match, if subscribed.
    It is also not possible to transfer music or certain other files though Bluetooth between other iPhones or Android devices. You can transfer between iOS devices, pictures through devices that are Airdrop capable.

  • HELP - hi with apple Configurator why does it show with a yellow triangle on the right side of the screen what am i doing wrong for the ipads not syncing or whatever and how do i fix that?

    HELP -- hi with apple Configurator why does it show with a yellow triangle on the right side of the screen what am i doing wrong for the ipads not syncing or whatever and how do i fix that? although i have looked online to try and figure it out and here is the website i found is this the stuff i need to do to fix this? is this site what i need to do to fix this? http://edtechstandish.wordpress.com/what-ive-learned-about-apple-configurator-so -far/  Thanks

    Sorry but I don't know anything about this.  But you might have better luck posting this question over ing the iPad in Business and Education forum here: https://discussions.apple.com/community/ipad/ipad_in_business_and_education?view =discussions.

  • What am i doing wrong with this class please help

    What am i doing wrong with this class? I'm trying to create a JFrame with a JTextArea and a ScrollPane so that text can be inserted into the text area. however evertime i run the program i cannot see the textarea but only the scrollpane. please help.
    import java.io.*;
    import java.util.*;
    import java.awt.event.*;
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.event.*;
    public class Instructions extends JFrame{
    public JTextArea textArea;
    private String s;
    private JScrollPane scrollPane;
    public Instructions(){
    super();
    textArea = new JTextArea();
    s = "Select a station and then\nadd\n";
    textArea.append(s);
    textArea.setEditable(true);
    scrollPane = new JScrollPane(textArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    this.getContentPane().add(textArea);
    this.getContentPane().add(scrollPane);
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    this.setTitle("Instructions");
    this.setSize(400,400);
    this.setVisible(true);
    }//end constructor
    public static void main(String args[]){
    new Instructions();
    }//end class

    I'm just winging this so it might be wrong:
    import java.io.*;
    import java.util.*;
    import java.awt.event.*;
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.event.*;
    public class Instructions extends JFrame{
    public JTextArea textArea;
    private String s;
    private JScrollPane scrollPane;
    public Instructions(){
    super();
    textArea = new JTextArea();
    s = "Select a station and then\nadd\n";
    textArea.append(s);
    textArea.setEditable(true);
    scrollPane = new JScrollPane(textArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    // Here you already have textArea in scrollPane so no need to put it in
    // content pane, just put scrollPane in ContentPane.
    // think of it as containers within containers
    // when you try to put them both in at ContentPane level it will use
    // it's layout manager to put them in there side by side or something
    // so just leave this out this.getContentPane().add(textArea);
    this.getContentPane().add(scrollPane);
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    this.setTitle("Instructions");
    this.setSize(400,400);
    this.setVisible(true);
    }//end constructor
    public static void main(String args[]){
    new Instructions();
    }//end class

  • HT4623 Hi, every body please help trying to update my I pad with new iOS but there is no soft wear update tab what I am doing wrong

    Hi,
         all trying to update my iPad with new iOS but when in the settings tab there is no software update tab
    What I am doing wrong please or i,m going to throw it

    The Settings > General > Software Update option only appears when you have iOS 5+ installed, if you have iOS 4 then you will need to do the update via your computer's iTunes as described half-way down the page that you posted from.
    Connect the iPad to your computer's iTunes and copy any purchases off the iPad to your computer via File > Transfer Purchases (File > Devices > Transfer Purchases on iTunes 11). You may also want to copy photos and any important documents off the iPad as well e.g. via the file sharing section at the bottom of the device's apps tab when connected to iTunes, via wifi, email, dropbox etc - they should be included in the backup, but it's best to have a copy of them outside of the backup just in case. You can then force a backup of the iPad by right-clicking the iPad 'Device' on the left-hand sidebar of iTunes and selecting 'Backup' (on iTunes 11 you can enable the left-hand sidebar via option-command-S on a Mac, control-S on a PC)
    Then start the update by selecting the iPad on the left-hand sidebar, and on the Summary tab on the right-hand side clicking the Check For Updates button
    Updating to iOS 5+ : http://support.apple.com/kb/HT4972
    A first gen iPad will be updated to iOS 5.1.1, and an iPad 2 and 3 to iOS 6.1.3

  • What am I doing wrong with this filter (counter/frequency issue), probably another newb question.

    I extracted the part of my VI that applies here.  I have a 6602 DAQ board reading a counter for frequency, using a Cherry Corp proximity sensor.  Getting a lot of noise and errant ridiculously high readings.  Speed of shaft which it's measuring is currently 2400rpm with one pulse per revolution so 40hz. 
    Trying to use the express filter VI to clean up the signal and ignore anything over, say, 45hz and under 35hz.  No matter what setting I choose I continually get the  20020 error, Analysis:  The cut-off frequency, fc, must meet:  0 <= fc <= fs/2.  I know this relates to sample period somehow, but for the life of me I can't understand what I'm doing wrong. 
    I used this VI without filtering on bench tests with a hand-drill and got perfect output every time.  Now it's on the machine and being erratic.  Any help here will ease my stress level significantly, thanks.
    VI attached
    Still confused after 8 years.
    Attachments:
    RPM.vi ‏92 KB

    Hello Ralph,
    I'm not sure about mounting your sensor to your rig, but I can provide a couple ideas about the filtering. Depending on the type of noise, the digital filters on the PCI-6602 could help eliminate the behavior you are seeing. If the noise manifests as a "glitches" or a bouncing signal, you could use another counter with a minimum period to help eliminate the noise. This concept is discussed in greater detail in this KnowledgeBase. I noticed that you are using NI-DAQmx; the practical application of the digital filters on the PCI-6602 in NI-DAQmx is discussed in this KnowledgeBase. A more detailed description of the behavior of these filters is provided in the NI-DAQmx Help (Start>>All Programs>>National Instruments>>NI-DAQ) in the book entitled "Digital Filtering Considerations for TIO-Based Devices".
    I also wanted to comment on your original post and explain why you were receiving error -20020. For convenience, I have copied the text of the error code below.
    Error -20020 occurred at an unidentified location
    Possible reason(s):
    Analysis:  The cut-off frequency, fc, must meet:  0 <= fc <= fs/2.
    I think you may have misunderstood exactly what the Filter express VI does. The Filter express VI takes a series of values in a waveform and performs filtering on those signals. So, it will look at a waveform made up of X and Y values and apply the defined filter to this waveform. Specifically in your application, the cut-off frequency (fc) is the Upper Cut-Off level that you specified in the Filter express VI; any frequency components of the waveform outside of the range you have defined will be filtered. The fs is the sample rate based on the data that you wire to the Signal input of the Filter express VI. In your VI, this data is coming from the DAQ Assistant. So, fs will be the sample rate of the DAQ Assistant and is associated with the rate at which points are acquired. The sample rate does NOT relate to the bandwidth of the signal, except that the Nyquist theorem tells us that the sample rate must be at least twice the signal bandwidth in order to determine periodicity of the signal. So, in this case, the sample rate of the DAQ Assistant would need to be at least double the high cut-off frequency.
    However, you are performing a frequency measurement using a counter. I think this is where the confusion comes in. For the frequency measurement using a counter, the DAQ Assistant returns a decimal value which represents the rate of the pulse train being measured by the counter. It does not return the actual waveform that is being read by the counter. It is this waveform that would be band-pass filtered to eliminate frequency content outside of the filter's bandwidth. Instead of the Filter express VI, I would recommend that you simply discard values that are outside the range you specify. I have modified the code you posted earlier to perform this operation. The image below shows the changes that I made; rather than using the Filter express VI, I simply compare the frequency to the "Low Threshold" and "High Threshold". I use a Case structure to display the value on if it is within the limits. Otherwise, I display a "NaN" value. I have also attached the modified VI to this post.
    Message Edited by Matt A on 09-04-2007 07:58 PM
    Matt Anderson
    Hardware Services Marketing Manager
    National Instruments
    Attachments:
    RPM (Modified).JPG ‏17 KB
    RPM (modified).vi ‏72 KB

  • My iPad one won't charge with any cable I buy? Tell me what I am doing wrong.

    I have an iPad 1 and have had no major problems with it til now. I want to continue using it, I use it for many things and it would suck if it stoped working because of something IDK about. My first and only apple product.
    The charger cable (That came with it) finally broke. The wires just came apart and it wasn't salvagable. I had an Ipod cord here that a friend left and plugged it into the original port (The one that was working fine with original charger and came with ipad). It was a tight squeze into the iPad (which I thought was normal) but I got it into there so I thought it would work. It won't work. So i bought a charger said to be used to ipads, and I plugged it in, same thing happened. I did however still sync it into the computer with the new cable I bought. What am I doing wrong that it won't charge on the wall anymore? Wrong cable? I'm confused. Please help!

    Could be the charger, cable or iPad. Plug the USB cable into your computer. It may say "Not Charging", however, it is charging slowly and will verify that the cable is good.
    Try this first - Reset the iPad by holding down on the Sleep and Home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons. (This is equivalent to rebooting your computer.)
    The quickest way (and really the only way) to charge your iPad is with the included 10W or 12W (5W on Mini) USB Power Adapter. iPad will also charge, although more slowly, when attached to a computer with a high-power USB port (many recent Mac computers) or with an iPhone Power Adapter (5W). When attached to a computer via a standard USB port (2.5W, most PCs or older Mac computers) iPad will charge very slowly (but iPad indicates not charging). Make sure your computer is on while charging iPad via USB. If iPad is connected to a computer that’s turned off or is in sleep or standby mode, the iPad battery will continue to drain.
    Apple recommends that once a month you let the iPad fully discharge & then recharge to 100%.
    How to Calibrate Your Mac, iPhone, or iPad Battery
    http://www.macblend.com/how-to-calibrate-your-mac-iphone-or-ipad-battery/
    At this link http://www.tomshardware.com/reviews/galaxy-tab-android-tablet,3014-11.html , tests show that the iPad 2 battery (25 watt-hours) will charge to 90% in 3 hours 1 minute. It will charge to 100% in 4 hours 2 minutes. The new iPad has a larger capacity battery (42 watt-hours), so using the 10W charger will obviously take longer. If you are using your iPad while charging, it will take even longer. It's best to turn your new iPad OFF and charge over night. Also look at The iPad's charging challenge explained http://www.macworld.com/article/1150356/ipadcharging.html
    Also, if you have a 3rd generation iPad, look at
    Apple: iPad Battery Nothing to Get Charged Up About
    http://allthingsd.com/20120327/apple-ipad-battery-nothing-to-get-charged-up-abou t/
    Apple Explains New iPad's Continued Charging Beyond 100% Battery Level
    http://www.macrumors.com/2012/03/27/apple-explains-new-ipads-continued-charging- beyond-100-battery-level/
    New iPad Takes Much Longer to Charge Than iPad 2
    http://www.iphonehacks.com/2012/03/new-ipad-takes-much-longer-to-charge-than-ipa d-2.html
    Apple Batteries - iPad http://www.apple.com/batteries/ipad.html
    iPhone: Hardware troubleshooting (Power/Battery section also applies to iPad)
    http://support.apple.com/kb/TS2802
    Extend iPad Battery Life (Look at pjl123 comment)
    https://discussions.apple.com/thread/3921324?tstart=30
    iOS 7 Battery Life Draining Too Fast? It’s Easy to Fix
    http://osxdaily.com/2013/09/19/ios-7-battery-life-fix/
    New iPad Slow to Recharge, Barely Charges During Use
    http://www.pcworld.com/article/252326/new_ipad_slow_to_recharge_barely_charges_d uring_use.html
    iPad: Charging the battery
    http://support.apple.com/kb/HT4060
    Best Practices for iPad Battery Charging
    http://www.ilounge.com/index.php/articles/comments/best-practices-for-ipad-batte ry-charging/
    How to Save and Prolong the battery life of your new ipad
    https://discussions.apple.com/thread/4480944?tstart=0
    Prolong battery lifespan for iPad / iPad 2 / iPad 3: charging tips
    http://thehowto.wikidot.com/prolong-battery-lifespan-for-ipad
    iPhone, iPod, Using the iPad Charger
    http://support.apple.com/kb/HT4327
    Install and use Battery Doctor HD
    http://itunes.apple.com/tw/app/battery-doctor-hd/id459702901?mt=8
    To Extend a Device’s Battery Life, Get to Know It Better
    http://tinyurl.com/b67c7xz
    iPad Battery Replacement
    http://www.apple.com/batteries/replacements.html
    In rare instances when using the Camera Connection Kit, you may notice that iPad does not charge after using the Camera Connection Kit. Disconnecting and reconnecting the iPad from the charger will resolve this issue.
     Cheers, Tom

  • I am trying to save a photoshop CS6 psd file to jpg and get an option jpg, jpg2000 or jpg stereo, I choose jpg and then Mac 256 colours, normal or interlaced.  I just want regular jpg with a high resolution.  What am I doing wrong, never had this problem

    I am trying to save a photoshop CS6 psd file to jpg and get an option jpg, jpg2000 or jpg stereo, I choose jpg and then Mac 256 colours, normal or interlaced.  I just want regular jpg with a high resolution.  What am I doing wrong?  , never had this problem before.  Help!!! 

    Your description of the issue is not clear:
    What format, bit depth and color was your original file "from the net"?  It sounds like it was a Color Indexed GIF, which would cause what you are describing.
    In the Macintosh Finder, select said "net image" and do a Get Info on it (Command+i). When the Info box appears in the Finder, take a screen shot and upload it here by using the little camera icon in the Reply Editor in the forum's web interface.
    If the image is a 256-color GIF, remember the rule:  GIGO = garbage in, garbage out.

  • HT2486 birthday are not saving in my contacts? What am I doing wrong.  I always have put in birthday before with no problems

    Birthday are not saving in some of my contacts? What am I doing wrong.  I always have put in birthday before with no problems.  Some contacts it works and others do not?  help me.

    Arnis and Jeff,
    Thank you both very much for your assistance.  I was able to figure out why the Adobe Application Manager kept failing on installing the patches.  Idiot me didn't unzip them first.  Once I unzipped the patch files, the installer worked fine.  Both patches are now successfully installed; my FM version is now 12.0.2..
    To answer some of your questions:
    Yes, I have administrator privileges on my PC.
    Yes, I had all of the files in the book opened when I generated and/or updated the LOR file.  So that was not the issue.
    With the patches installed, I opened a book and all of its files.  I updated the LOR and all works fine – it gives me all of the Imported Graphic references. So there must have been an issue with that release of FM12 (12.0.0.329), which was fixed with the patches.
    Again, thank you both for your help!
    Best regards,
    Beverly

  • Help, i am trying to print my JPEG file that i created in photoshop at a photo lab but it is coming out like an X-ray. I have printed these files before so i have no idea what i am doing wrong.

    Help, i am trying to print my JPEG file that i created in photoshop at a photo lab but it is coming out like an X-ray. I have printed these files before so i have no idea what i am doing wrong.
    Could it be something i have done in my settings?
    or when i am saving the file to JPEG?

    Basically you're approaching this the wrong way around. What you need is the extreme sections to be quieter, not louder. The problem with moving the lower end of the audio is that you'll move the noise floor too, and get what's generally referred to as a 'pumping' effect. So what you do is to use a compressor to tame the peaks, and leave the lower level sound alone. When you've done that, you amplify (or normalize to a level you can determine) the whole signal. So the noise floor will be higher, but constant and not pumping. 'Match Volume' is a completely different tool for setting the overall levels of different tracks so that they sound approximately the same - it doesn't even begin to do what you want.
    If it's music you are treating, then I'd almost certainly use the multiband compressor, because you get less artefacts with this. You need to experiment with the threshold levels, and almost certainly not use a massive compression ratio - 3:1 or 4:1 should be sufficient (although it's hard to tell without actually hearing the audio). You can tell what it's doing at any given point because the downward meter indicates how hard it's working. In theory you can apply make-up gain with it as well, but personally I leave that until everything's treated and use the 'Normalize' tool to set an absolute max level.

  • I am trying to print redplum coupons and I can't, help.  I have updated java, adobe flash, and made sure my printer was set on default.  I am not sure what I am doing wrong.  I have contacted redplum and no one will help.

    I am trying to print redplum coupons and I can't, help.  I have updated java, adobe flash, and made sure my printer was set on default.  I am not sure what I am doing wrong.  I have contacted redplum and no one will help.

    No Apple response???  Redplum/Valassis will not help either.  I searched, using the cups error message and though it is Unbuntu, same error so maybe useful...only problem: details would not display unless I join Unbuntu forum.  What a pain to do anything with my Mac or find any help.  I honestly regret buying this buggy OS.
    Anyway, here is what I found, FYI:
    http://ubuntuforums.org/showthread.php?t=483415
    As the old saying goes: when in doubt, consult the manual. The problem appears to be that I added the printer using the KDE Add Printer Wizard. It was automatically given a "socket" URI instead of an "lpd" one. When I:
    - altered the printer settings at http://localhost:631 (the CUPS admin page) as instructed in the manual for the printer, and
    - copied the PPD file into a second place on the hard drive (as instructed on ubunutuforums, see the link above)
    ..everything started working.
    It's still slower than windows, but I can live with that
    Probably a simple fix. Change the socket I.P. to match the printer I.P. like this:
    socket://192.168.1.86:9100. The thing I'm concerned with using socket:// is that AFAIK the printer I.P. must not change. In my case I'm able to assign a static I.P. address to the printer but it's something to consider.
    I found that the only thing I needed to do was change socket to lpd (and remove :9100 off the end as well). See Solving Ubuntu printer “broken pipe” problem (DocuPrint C525A) . BTW thanks for steering me in the right direction - very grateful.      
    Solving Ubuntu printer “broken pipe” problem (DocuPrint C525A)
    Posted on November 25, 2008
    Are you having a problem with your printer under the latest versions of Ubuntu (perhaps it worked under an older version)? Are you able to print short documents, but not longer, or more graphics-intensive, documents? (e.g. the unfortunate people at http://ubuntuforums.org/showthread.php?t=625493). Do they sit there as Processing for ages and then switch to Held? If you have the same problem I had the solution I tried may work for you too. Firstly, check your cups error log:
    sudo gedit /var/log/cups/error_log
    If you see anything like the following, the solution may be simple:
    [Job 201] Unable to write print data: Broken pipe
    PID 13359 (/usr/lib/cups/backend/socket) stopped with status 1!
    System > Administration > Printing and right click on your printer, selecting Properties. Settings > Device URI
    If you see something like socket://your_printer_ip_address:9100 just change socket to lpd and remove the :9100 off the end. Then click on apply.
    Apparently lpd is a more modern protocol which works with most printers whereas socket is more raw (and potentially faster but riskier in a network situation). Somewhere along the line, the default Ubuntu/Gnome setup for networked printers shifted from lpd to socket. Some primitive printers will have benefited whereas a larger number of more modern printers will have suffered.
    Please correct me if I am wrong (which is highly possible) but the underlying problem could be that socket may make the printer wait a long time for a large file to be processed ready for printing. Some printers, such as the Fuji Xerox DocuPrint C525A, may drop the socket if things take too long to start coming through.
    Changing timeout settings might work but lpd is better than socket so it is the preferred solution in any case.
    If this works for you, please leave a comment to let others know (ideally with a description of the printer and Ubuntu version). Printer may be relevant if it doesn’t support the direct stream protocol properly. NB I may take a while to let your comment through because of the volume of spam. Sorry about that.
    Finally, thanks to sphilli8 for the steer in the right direction at http://ubuntuforums.org/showthread.php?p=6245626.
          http://ubuntuforums.org/showthread.php?t=483415

Maybe you are looking for

  • HT204053 changing two apple ids into one

    My husband and I have two different Apple Ids and we are finding extremely difficult when we are trying to download all the music we want into our IPad Air. I made the mistake of creating a new ID not knowing I could have used the main one weve been

  • Less than symbol,   shows as XML value &lt ; in translate table drop down

    We are upgrading from 8.19 to 8.49. We have set up a field that has translate values of <, <=, >, >=, <> and =. We use this field as a drop down on a page and they should display as shown. For some reason, when you click the drop down, any of the cho

  • Extracting Image Links From HTML

    Hi, at the moment am trying to extract image locations from the html files i.e. the "src" part of <img> tag. Have tried using HTMLParserCallback as I know this allow you to extract links from a page. However when I open a document I know to have <img

  • Having lots of problems with getting a phone line ...

    this may be a bit of a long story sorry, but this has now stretched to nearly 2 months without phone and internet and i desperately need help as i rely on both for my business. we moved in to our new house in october and ordered BT phone and internet

  • Copy Entry Workflow

    Hallo there, i need a very short workflow. After creating an Wiki Entry this entry should be copied to another folder. Sounds easy and i tried it, but with no success and i guess because of this restriction (from docu): Copy Entry: Allows you to copy