New C programmer, criticism

Hi! I've been learning C lately. I've been doing some programming in Python before, but C is fairly new to me. I've written a small "Todo manager", https://github.com/stritfajt/Todo, and while it works just fine, I'm afraid that I've made some stupid mistakes that would lead me into bad habits later on.
I'm also thinking about how I would go about implementing a function to delete a todo. Is there a simple way to delete a line of a file in C? Or will I have to read the file in to a string and then write the desired lines to a temporary file wich I later move to the correct location? Is there anything wrong with that approach?
Please excuse my language, I'm not a native English speaker.
Simon.

ewaller wrote:
Well...
I would not hard code the file names.
You perform no error checking when performing file operations.
You use the file pointers without having checked that they are valid.
Instead of long if..then..else structures, I prefer to build tables driven logic.
I've declared the path with an #define line now, that seems nicer. In the future I might add a config file.
As for the error checking, should I just check the return value of fopen, fgets and fputc? Or where you thinking of anything else?
Could you elaborate on the tables driven logic? I don't think I understand what you mean there, any examples?
gbrunoro wrote:Hi korkadapa,
I'll add up two things to ewaller remarks:
1) I wouldn't use "r+" mode for files in this case, you'd be better off with a temp file. Using read-write mode can bring some serious trouble.
2) Try to follow some style guidelines, as the column 80 rule. You can read some open source code (for instance the kernel) to get an idea what real life C looks like.
I can't see why, but I'll trust you regarding the r+ mode!
I read about the column 80 rule and added some stuff in my .vimrc so help me follow it. Any more style guidelines that I should follow?
/dev/zero wrote:I wouldn't hard code the magic number "100".
I would use more comments.
I would consider using lex/yacc to parse the input. Also, if you used a config file to avoid hard coding the file names, you could use lex/yacc to parse that too.
How do you do it without hardcoding the array size then? With a file I would have read it twice and counted the size the first time, but I can't think of a way to do that with an input...
lex/yacc seems great, I will have to learn that sometime!

Similar Messages

  • I am having problems importing my Iphoto pics into new Photo programme. I am inporting approx 11,000 pics that all seem fine in Iphoto but the iport rejects around 7,000 of them with incorrect mete data. What can I do to import these?

    I am having problems importing my I photo pics into new Photo programme. I am importing approx 11,000 pics that all seem fine in I photo but the import rejects around 7,000 of them with incorrect mete data. What can I do to import these?

    I have the same problem.
    Thread here: Import fails - "Unable to get metadata"

  • How do i increase the resolution on my screen in CC, my old CS6 was fine the new CC programme makes everything look like placed low-res files?

    ow do i increase the resolution on my screen in CC, my old CS6 was fine the new CC programme makes everything look like placed low-res files?

    yes doc set to high res, hard to get an example as screenshot is low-res anyway

  • Tips for a new ABAP programmer...

    Hello experts,
    I am a fairly new ABAP programmer that usually modifies existing reports. I am really having a hard time on understanding all those synatx. Can you guys give me tips on how to better understand reports/programs?how do you analyze reports? any tips and suggestions would really helpful to me.Thanks a lot guys!

    Hi,
    No Problem dont worry SDN will help you a lot.
    Actually every one is new for the new technologies.
    Actually here as an ABAPer 1st try to learn DE-BUGGING as much as you can.
    Try to do it from START-OF-SELECTION event 1st line on wards.
    Put a break point on start of selection line event and execute it.
    Here in debugging you need to carefully observe the behaviour of the program, logic etc etc.
    Next understand the FORMS when they are triging and their reusability.
    Under stand the Events sequence.
    Later try to obsorbe the Syntax of the commands as much as you can.
    Thanks.
    If this helps you reward with points.

  • How can I get my photos off the old family album programme without buying a new photoshop programme?

    The pop up to register my adobe photshop starter edition keeps coming up on screen.  I have many family pictures I want to view, copy, print etc.  I cannot get the code to unlock it as it states this programme is no longer available and the links forward me to a page to purchase another family programme - this is not something I want to do.  Does anyone have any suggestions please??

      Download the free trial of Photoshop Elements 10 using the link below. Use the Organizer to convert your catalog:  You can convert catalogs made with previous versions of Photoshop Elements, or with Photoshop Album, so that you can use them in the current version of Photoshop Elements.
    Select File à Catalog
    Click Convert.
    The Convert Catalog dialog box opens and searches the default locations for the catalogs of Photoshop Elements and Photoshop Album.
    (Optional) To browse additional locations for catalogs, click Find More Catalogs, and browse to the locations.
    Select a catalog from the list to convert, and click Convert.
    To close the Convert Catalog dialog box, click Done.
    The free trial Lasts for 30 days but only the Editor program expires. The Organizer is yours to keep.
    http://www.adobe.com/cfusion/tdrc/index.cfm?product=photoshop_elements&loc=en_us

  • Hi.. am a new Netweaver Programmer

    HI all,
          I am Guhapriyan,  I have prior experience in java recently i started as Netweaver programmer any one has netweaver tutorials and also please suggest Some books..
    Thank you in advance
    Regards
    Guhapriyan

    1) a good start is definitely browsing through the SDN. There are tons of materials in weblogs, articles, e-Learning and forums
    2) Another good source for books about SAP and NetWeaver is http://www.sap-press.com/, e.g. with a recently published book about SAP Web Application Server, and others...
    Mario

  • New Game Programmer In Need Of Help Choosing A Laptop!

    hi, im sorry but i really need help with choosing a laptop. not sure where to post this. i just enrolled in game programming. and im currently on the hunt for a laptop that i can use for programming. i know a desktop is better. but sadly i cant carry it to school. after looking at Alienware, Razer, MSI and others. i kinda want to get an MSI laptop. any suggestions? ofcoz not the high end ones. thank you in advance!

    A model with a Steelseries keyboard will by far be the best for you.  What are your requirements - screen size/ storage/CPU/GPU/ screen real estate (4K/3k/1080/)/weight/ material   - those requirements would help to narrow down the choices since there are so many... Also what country are you in and do you prefer to buy from one store or another?

  • Good example games for a very new game programmer

    I would very much like it if some people would post some very very (i mean very) simple games with source code. I just started programming games about two days ago. Any post would be helpful.
    Thanks.

    Well if you know java as in the syntax and stuff then check out http://www.geocities.com/jvp02/BreakOut.html ( you must type into browser) you need 1.4 to run it, and i'm pretty (yes i am) sure that the source is in the jar at: http://www.geocities.com/jvp02/downloads/breakout.jar
    have fun.

  • New AC3 programmer confused over 'packages' -

    Hi everyone,
    So, I've been slowly teaching myself AC3 - largely using examples from online tutorials and a collection of books I've bought. I can get simple exercises to work, but I'm losing my way when things get complicated.
    For example - packages - I am unclear on how these work and interact with my main programming stream. Now I'm getting to the point where this question seems to be coming up all of the time. But, for some reason, I just can't seem to connect the dots.
    Is there anyone out there that could sum up a easy to understand path to enlightenment!
    Much appreciated!
    Have a great day!
    Tekla

    The more you continue to program in as3 you will slowly be introduced to what is known as Object Oriented Programming, or OOP.
    Its the belief to think of code in terms of an object.
    So if you were building a car you might be overwhelmed and say omg where do i start, but if you embrace OOP you can say well lets begin wilth the tires.
    And you can focus strictly on 1 object at a time and then use recursive composition which entails of building increasingly complex elements from simplier ones.
    Now package can be a folder but consider a package to be a repository for like items.  when developing our Tire system, to make up this package we might have sub folders for tread and lug nuts and hub caps.
    But i dont want to mix my tires with hub caps, so i might make sub packages in the tire class.   tires.hubcaps.  and ta-dah!  you have packages of packages.

  • How to get list of logged-in users from Flash Media Server in a Flash programm? (Or login/logout notifications)

    Hi there,
    I'm Very sorry for asking this. I guess it's a very basic problem, but I'm very new to Flash and Flash media Server and I need a very fast answer...
    Currently I'm working on a Director project using a flash program which connects to Flash Media Server (I guess version 3, it's quite old). Unfortunately they forgot to make a flash method to send the actual userlist (or a notification when someone logged in or out) to Director. AND, unfortunately, they lost the source code of that flash programm, so I cannot look into it or alter it *sigh*.
    Now I want to do a new flash programm which covers the old one, letting all known methods "pass trough" and building an additional method to gain the user list (or login/out notification).
    How do I get the login information from Flash Media Server? (Would be good if you could provide an idea already for flash code... as I said I'm a tard at flash till now)
    Thank you so much. And I hope you understand my situation asking here...
    Jana

    hparmar : yes, that's what I feared... I hoped it would be possible to tell the server from which application I do need the login information. What a mess.
    Dimo Hristov: thanks for your offer! I already tried decompiling the flash program with the shareware version of Trillix Decompiler. It only decompiled the UI (in a terrible way) but no source code at all. It was the shareware version where I can decompile 2 or 3 programms to test the software. Are you sure the non-free version of Trilix Flash Decompiler will do..?

  • New ABAP Developer Want Some Guidance.....

    hello to everyone
    i am a new abap programmer. I came from a strong programming background. I just has prepared the certification C_TAW12_70 but give the exam but i failed from 2% only (passing score was 52%). Well i am preparing again and take that exam in 3 months time again. But i need someone who work as a free lancer but i want to work for him to gain some experience. Also, i don't to get paid in return. It is just for the sake of experience i want. As it is always difficult for new starters end especially for independent developers. So, do help me guys.......

    Please note, it is against the Rules of Engagement to post your email address in these forums. You can maintain one in your business card.
    I think asking for a freelancer to mentor is not such a crazy idea. What the freelancer gets is a free resource to do income generating work, while he does something else.
    From my own experience though, it's not that easy. I've just taken onto my company a chap who's a brilliant programmer, used to handling and processing complex data. But he doesn't know ABAP. He's very bright and learning through books, blogs and from me. It still takes quite a lot of my time. And that's the problem. Anyone who takes you on, even for free, is going to have to invest time and effort.
    Another time I did something similar, it didn't work out. The guy really was not cut out to be a developer. Again it was a huge drain on my time. The reason I'm persevering with the new chap is that he knows how to handle complex data forms, which I need.
    Another problem is that of having suitable work. For my employee, I've got a project that should hopefully generate income. But I've not much work that I can pass on to someone else - it's generally specific to my clients, requiring client specific knowledge.
    I wish you all the best, but you've not chosen an easy path.

  • Using a JList

    Hi everyone! Happy new year.
    Okay, I have some work for some keen programmer out there to do. There are 10 duke dollars avaliable to whoever can help me with this problem.
    I am using a JList to display a list of milestones which are required later on in my project. When no item is selected from the list, I want the 'Delete Milestone' button to automatically disable and when an item is selected from the list, I want it to auto enable. If the list is empty, then the button should remain disabled. For this to work I think I need some sort of ListSelectionListener but I am not sure how to do this. At the moment I get an exception whenever I click on the 'Delete Milestone' button and no selection has been made, which is understandable.
    Another thing that I need doing is that if a milestone is added to the list, and the 'Critical Milestone' is selected, then whenever that item is selected from the list, the background colour should be red; whenever a 'Non-critical Milestone' is created, then that should remain with a yellow background whenever selected from the list. At the moment, the background colour changes to whatever the last added milestone happened to be - either red or yellow for all entries that have been added to the list. If anyone can help me with this then that would be really appreciated and very helpful. The 4 files can be found below - just run the 'AddMilestoneTest' class to start the app. Thanks.
    * AddMilestoneTest.java
    * 29/12/02 (Date start)
    * This class is for iteration purposes for
    * the "Add Milestone" wizard
    import javax.swing.*;
    import javax.swing.event.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    public class AddMilestoneTest extends JPanel
    private JButton addMilestoneButton;
    public JFrame addMilestoneFrame;
    static AddMilestoneTest instance;     
    public AddMilestoneTest()
         instance = this;
    // create new button
    addMilestoneButton = new JButton("Add Milestone");
    // create tooltip for every button
    addMilestoneButton.setToolTipText("Add Milestone");
    // add our button to the JPanel
    add(addMilestoneButton);
    // construct button action
    AddMilestoneListener listener1 = new AddMilestoneListener();
    // Add action listener to button
    addMilestoneButton.addActionListener(listener1);
    private class AddMilestoneListener implements ActionListener
    public void actionPerformed(ActionEvent evt)
    addMilestoneFrame = new JFrame("Add Milestone Wizard*");
    MilestoneSplitPanel milestoneSplitPanel = new MilestoneSplitPanel();
    addMilestoneFrame.getContentPane().add(milestoneSplitPanel);
    addMilestoneFrame.setSize(850, 305);
    addMilestoneFrame.setVisible(true);
    // Main entry point into the program
    public static void main(String[] args)
    // Create a frame to hold us and set its title
    JFrame frame = new JFrame("Add Milestone Iteration");
    // Set frame to close after user request
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    // Add our panel to the frame
    AddMilestoneTest amt = new AddMilestoneTest();
    frame.getContentPane().add(amt, BorderLayout.CENTER);
    // Resize the frame
    frame.setSize(680, 480);
    // Make the windows visible
    frame.setVisible(true);
    * MilestoneSplitPanel.java
    * 29/12/02
    * This class creates a split between the
    * AddMilestonePanel and the CurrentMilestonePanel
    import javax.swing.*;
    import javax.swing.event.*;
    import java.awt.*;
    import java.awt.event.*;
    public class MilestoneSplitPanel extends JPanel
    // Declare a split panel
    JSplitPane splitPanel;
    // Declare the panels required here
    AddMilestonePanel addMilestonePanel;
    CurrentMilestonePanel currentMilestonePanel;
    public MilestoneSplitPanel()
    // Create the panels required
    addMilestonePanel = new AddMilestonePanel();
    currentMilestonePanel = new CurrentMilestonePanel();
    // Create the split panel with our two panels
    splitPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, currentMilestonePanel, addMilestonePanel);
    splitPanel.setDividerLocation(200);
    //Provide minimum sizes for the two components in the split pane
    addMilestonePanel.setMinimumSize(new Dimension(350, 200));
    currentMilestonePanel.setMinimumSize(new Dimension(100, 100));
    //Add the split panel to this panel.
    add(splitPanel, BorderLayout.CENTER);
    * AddMilestonePanel.java
    * 29/12/02 (Date start)
    * This class is for iteration purposes for
    * the "Add Milestone" wizard
    import javax.swing.*;
    import javax.swing.border.*;
    import java.awt.*;
    import java.awt.event.*;
    public class AddMilestonePanel extends JPanel
    private JLabel milestoneNameLabel;
    private JLabel milestoneNameMaxChar;
    private JLabel milestoneECDLabel;
    private JLabel forwardSlash1;
    private JLabel forwardSlash2;
    private JLabel dateFormatLabel;
    private JLabel selectOne;
    private JTextField milestoneName;
    private JComboBox theDate;
    private JComboBox theMonth;
    private JComboBox theYear;
    private ButtonGroup group;
    private JRadioButton criticalMilestone;
    private JRadioButton nonCriticalMilestone;
    private JButton addMilestone;
    private JButton deleteMilestone;
    private JButton cancel;
    private JButton finish;
    private JList currentMilestones;
    static AddMilestonePanel instance;
    public String dateSelected;
    public String monthSelected;
    public String yearSelected;
    public AddMilestonePanel()
    instance = this;
    // create additional panels to hold objects
    JPanel topPanel = new JPanel();
    JPanel middlePanel = new JPanel();
    JPanel lowerPanel = new JPanel();
    JPanel buttonPanel = new JPanel();
    // Create a border around the "toppanel"
    Border etched = BorderFactory.createBevelBorder(BevelBorder.RAISED, Color.black, Color.blue);
    Border titled = BorderFactory.createTitledBorder(etched, "Provide a name for the milestone");
    topPanel.setBorder(titled);
    // Create a border around the "middlepanel"
    Border etched1 = BorderFactory.createBevelBorder(BevelBorder.RAISED, Color.black, Color.blue);
    Border titled1 = BorderFactory.createTitledBorder(etched1, "Enter an estimated completion date of the milestone");
    middlePanel.setBorder(titled1);
    // Create a border around the "lowerpanel"
    Border etched2 = BorderFactory.createBevelBorder(BevelBorder.RAISED, Color.black, Color.blue);
    Border titled2 = BorderFactory.createTitledBorder(etched2, "Choose whether the milestone is critical or non-critical");
    lowerPanel.setBorder(titled2);
    // initialise JLabel objects
    milestoneNameLabel = new JLabel("Milestone Name: ");
    milestoneNameMaxChar = new JLabel("(Max 20 chars)");
    milestoneECDLabel = new JLabel("Estimated Completion Date: ");
    forwardSlash1 = new JLabel("/");
    forwardSlash2 = new JLabel("/");
    dateFormatLabel = new JLabel("(Date/Month/Year)");
    selectOne = new JLabel("(Select One)");
    // create textfield for the milestone name
    milestoneName = new JTextField(20);
    milestoneName.setColumns(15);
    topPanel.validate();
    // create the combo boxes for the date
    theDate = new JComboBox(new String[]
    "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16",
    "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31"
    theDate.setEditable(false);
    theMonth = new JComboBox(new String[]
    "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"
    theMonth.setEditable(false);
    theYear = new JComboBox(new String[]
    "2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009", "2010", "2011", "2012"
    theYear.setEditable(false);
    // create the radio buttons and add them to the group
    group = new ButtonGroup();
    criticalMilestone = new JRadioButton("Critical Milestone", true);
    nonCriticalMilestone = new JRadioButton("Non-critical Milestone", false);
    group.add(criticalMilestone);
    group.add(nonCriticalMilestone);
    // create the buttons
    addMilestone = new JButton("Add Milestone", new ImageIcon("D:/My Uni Work/Final Year Project/Graphics/addMilestoneIcon.JPG"));
    deleteMilestone = new JButton("Delete Milestone", new ImageIcon("D:/My Uni Work/Final Year Project/Graphics/deleteMilestone.JPG"));
    cancel = new JButton("Cancel", new ImageIcon("D:/My Uni Work/Final Year Project/Graphics/StopControl.gif"));
    finish = new JButton("Finish", new ImageIcon("D:/My Uni Work/Final Year Project/Graphics/bluearrow.gif"));
    // set tooltips for buttons
    addMilestone.setToolTipText("Add Milestone");
    deleteMilestone.setToolTipText("Delete Milestone");
    cancel.setToolTipText("Cancel");
    finish.setToolTipText("Finish");
    // set the state of the buttons when first run
    deleteMilestone.setEnabled(false);
    finish.setEnabled(false);
    // add objects to panels
    topPanel.add(milestoneNameLabel);
    topPanel.add(milestoneName);
    topPanel.add(milestoneNameMaxChar);
    middlePanel.add(milestoneECDLabel);
    middlePanel.add(theDate);
    middlePanel.add(forwardSlash1);
    middlePanel.add(theMonth);
    middlePanel.add(forwardSlash2);
    middlePanel.add(theYear);
    middlePanel.add(dateFormatLabel);
    lowerPanel.add(criticalMilestone);
    lowerPanel.add(nonCriticalMilestone);
    lowerPanel.add(selectOne);
    buttonPanel.add(addMilestone);
    buttonPanel.add(deleteMilestone);
    buttonPanel.add(cancel);
    buttonPanel.add(finish);
    // use Box layout to arrange panels
    Box hbox1 = Box.createHorizontalBox();
    hbox1.add(topPanel);
    Box hbox2 = Box.createHorizontalBox();
    hbox2.add(middlePanel);
    Box hbox3 = Box.createHorizontalBox();
    hbox3.add(lowerPanel);
    Box hbox4 = Box.createHorizontalBox();
    hbox4.add(buttonPanel);
    Box vbox = Box.createVerticalBox();
    vbox.add(hbox1);
    vbox.add(Box.createGlue());
    vbox.add(hbox2);
    vbox.add(Box.createGlue());
    vbox.add(hbox3);
    vbox.add(Box.createGlue());
    vbox.add(hbox4);
    this.add(vbox, BorderLayout.NORTH);
    // create instance of cancelButtonListener
    CancelButtonListener cancelListen = new CancelButtonListener();
    // create instance of AddMilestoneListener
    AddMilestoneListener milestoneListener = new AddMilestoneListener();
    // create instance of DeleteMilestoneListener
    DeleteMilestoneListener deleteListener = new DeleteMilestoneListener();
    // add actionListener for the buttons
    cancel.addActionListener(cancelListen);
    addMilestone.addActionListener(milestoneListener);
    deleteMilestone.addActionListener(deleteListener);
    private class CancelButtonListener implements ActionListener
    public void actionPerformed(ActionEvent event)
    Object source = event.getSource();
    if(source == cancel)
    AddMilestoneTest.instance.addMilestoneFrame.setVisible(false);
    private class AddMilestoneListener implements ActionListener
    public void actionPerformed(ActionEvent event)
    String milestoneNameText = milestoneName.getText().trim();
    int textSize = milestoneNameText.length();
    dateSelected = (String)theDate.getSelectedItem();
    monthSelected = (String)theMonth.getSelectedItem();
    yearSelected = (String)theYear.getSelectedItem();
    if(textSize > 20)
    //display a JOptionPane
    JOptionPane.showMessageDialog(AddMilestonePanel.instance, "You have entered a title that is greater than 20 characters.",
    "Text too Long", JOptionPane.ERROR_MESSAGE);
    else if(textSize == 0)
    //display a JOptionPane
    JOptionPane.showMessageDialog(AddMilestonePanel.instance, "You have not entered a milestone name. Please do so (Maximum 20 Characters).",
    "No Project Name Entered", JOptionPane.ERROR_MESSAGE);
    else if(dateSelected == "30" && monthSelected == "02" || dateSelected == "31" && monthSelected == "02" || dateSelected == "31" && monthSelected == "04" ||
    dateSelected == "31" && monthSelected == "06" || dateSelected == "31" && monthSelected == "09" || dateSelected == "31" && monthSelected == "11")
    JOptionPane.showMessageDialog(AddMilestonePanel.instance, "You have selected an invalid date. Re-check that the date is valid.",
    "Invalid Date Selected", JOptionPane.ERROR_MESSAGE);
    } // ANOTHER CHECK IS REQUIRED HERE WHEN INTEGRATING - IF DATE ENETERED IS WITHIN THE START DATE AND END DATE OF THE PROJECT
    else
    deleteMilestone.setEnabled(true);
    finish.setEnabled(true);
    if(criticalMilestone.isSelected())
    CurrentMilestonePanel.instance.listModel.addElement(milestoneNameText);
    CurrentMilestonePanel.instance.currentMilestoneList.setSelectionBackground(Color.red);
    else if(nonCriticalMilestone.isSelected())
    CurrentMilestonePanel.instance.listModel.addElement(milestoneNameText);
    CurrentMilestonePanel.instance.currentMilestoneList.setSelectionBackground(Color.yellow);
    private class DeleteMilestoneListener implements ActionListener
    public void actionPerformed(ActionEvent event)
    if(CurrentMilestonePanel.instance.listModel.size() > 0)
    int selectedItemIndex = CurrentMilestonePanel.instance.currentMilestoneList.getSelectedIndex();
    CurrentMilestonePanel.instance.listModel.remove(selectedItemIndex);
    * CurrentMilestonePanel.java
    * 29/12/02 (Date start)
    * This class is for iteration purposes for
    * the "Add Milestone" wizard
    import javax.swing.*;
    import javax.swing.border.*;
    import java.awt.*;
    import java.awt.event.*;
    public class CurrentMilestonePanel extends JPanel
    public JList currentMilestoneList;
    private JLabel currentMilestonesAdded;
    // List Model that will hold the data for the list
    public DefaultListModel listModel;
    // Scroll pane that will contain the list
    private JScrollPane scrollPaneList;
    static CurrentMilestonePanel instance;
    // Constructor
    public CurrentMilestonePanel()
    instance = this;
    // create label
    currentMilestonesAdded = new JLabel("Current Milestones Added");
    listModel = new DefaultListModel();
    //listModel.addElement("No Milestones Added");
    // Create the list
    currentMilestoneList = new JList(listModel);
    // Set single selection, and select the first item
    currentMilestoneList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    currentMilestoneList.setSelectedIndex(0);
    // Create a scroll panel to hold list
    scrollPaneList = new JScrollPane(currentMilestoneList);
    // Set the preferred size
    scrollPaneList.setPreferredSize(new Dimension(130, 200));
    //Add the scroll pane to this panel.
    add(currentMilestonesAdded, BorderLayout.NORTH);
    add(scrollPaneList, BorderLayout.CENTER);

    I suggest that you look into the swing tutorial. There are some samples of how to write ListSelectionListener.
    I quickly scanned your code for the DeleteMilestoneListener. You get an exception here because you don't check if an item is selected in the list.

  • Event Driven Programming is withheld from LabVIEW Base.

    Can anyone give me a good answer why?  Every other programming language in the world has Event Driven Programming (EDP) built in, even free languages.  So when all I wanted was to use LV as a graphical programming language, (hey, that's what the "G" in G-programming stands for) I was disappointed to find that in my undervalued LV Base I can't look for mouse movement, mouse enter, mouse leave, keyboard actions and countless other possibilities that would be standard fare in any other language, unless, I pay over 1200 dollars more for the Full development package.  I know I should have read up on it more before purchasing, and understood what I would be missing out on.  But how was I to know that the fundamental programming function of EDP would be considered on par with Data Acquisition and Signal Processing?  So basically in order to get a complete programming language, I need to spend more than twice the cost of the Base package just to receive the last key component.  And all this because the Evaluation of LV gives you near limitless possibilities, so a new LV programmer gets used to having these tools at his/her disposal, only to yank some of the most critical tools.  So after saying all this, I am pleading for an explanation.  Why isn't there at least some add-on module that would allow a user to install the withheld functionality of EDP to a Base Development package?  Surely making money is the goal of any business, and I won't claim bait and switch here, or any other wrong doing here.  But there is, in my opinion, a marketing misjudgment here.
    -Orion Williams

    Unfortunately to upgrade, it would cost me the difference between the base version and the full version.  What I think is in order is an add-on module that will give customers the functionality of EDP, without having to also pay for signal processing, which is clearly a more robust programming tool, that I don't need.  I am hoping to show NI that by withholding EDP from the base version with no upgrade option except paying for the full version, that their customers who come into LV at the base version are getting an undervalued version, and they know it, and that without at the very least, and add-on module for EDP, isolating smaller business and individuals.  I agree that signal processing, data acquisition and EDP are worth an extra 1300 dollars, but I don't agree that EDP on it's own is worth an extra 1300 dollars, but that's the only option that I have at this moment.  My suggestion is to create an add-on module that includes EDP and sell it for 300 dollars, since I know signal processing is a much more complex feature and is worth more of that upgrade price than EDP.  Of course all versions of LV should include EDP, so if that drives the price of LV base up, so be it.  Just don't let anyone else be fooled into thinking they are buying a Graphical Programming Language unless all the features of a programming language are included at all price points.  Can I get a witness?

  • Mac: cmd+option+e not working

    I recently upgraded from CS4 to CS6. Merging selected layers into a new layer is critical to my workflow. On OS X, this is accomplished using:
    command+option+e
    I found the following reference too:
    http://helpx.adobe.com/content/help/en/photoshop/using/layers.html#merge_and_stamp_layers
    Where it's referred to as "Stamp multiple layers or linked layers". Adobe says the result of this action is "Photoshop creates a new layer containing the merged content".
    However, command+option+e does nothing in CS6.
    Any help is greatly appreciated!

    Noel Carboni wrote:
    I have always thought that key to the right of your alt/option key was considered "command"…
    That is correct, Noel.  The Command key, occasionally referred to as the Apple key or the Clover-leaf key, has always been a part of the Mac.
    The Control key on the left is just an additional modifier key introduced much later (maybe with OS X 10.0.x some ten years ago? I can't remember now).  It is used for things like bringing up contextual menus with a mouse click, or in conjunction with a one-button mouse (like mine) to emulate what in Windows is known as Right-Clicking, but also just to widen the possibilities of modifying other keys for whatever reason the programmer chooses.  It just adds possibilities.  You can also use it when editing keyboard shortcuts, of course.
    Noel Carboni wrote:
    …what three keys do you have to hold down to initiate a preferences reset, station_two?  Just curious…
    That would be Command Option Shift, Noel.
    Complete Apple keyboard:

  • Servlet can't open a download window on IE, but open it on FireFox

    Hello everyone,
    I created a attachment Pdf file by servlet. When I run at simulation, "inline" and “attachment” both worked fine.
    However, web application doesn't work on IE, either for "inline" or "attachment".
    When I tried Firefox, both work fine!
    I am crashed. Is there anyone who have some clues for this situation?
    my code:     public void doPost(HttpServletRequest request, HttpServletResponse resp)
         throws javax.servlet.ServletException, java.io.IOException
              ByteArrayOutputStream baosPDF = null;
              pdfDocPage=new PdfDocPage(request,resp);//get data
              try
                   //get value of parameters from shortcut panel.
                   baosPDF = generatePDFDocumentBytes(request, resp, this.getServletContext());
                   StringBuffer sbFilename = new StringBuffer();
                   sbFilename.append("filename_");
                   sbFilename.append(System.currentTimeMillis());
                   sbFilename.append(".pdf");
                   resp.setHeader("Cache-Control", "must-revalidate");
                   resp.setContentType("application/pdf");
                   StringBuffer sbContentDispValue = new StringBuffer();
                   sbContentDispValue.append("attachment");
                   sbContentDispValue.append("; filename=");
                   sbContentDispValue.append(sbFilename);
                   resp.setHeader("Content-disposition",sbContentDispValue.toString());
                   resp.setContentLength(baosPDF.size());
                   ServletOutputStream sos;
                   sos = resp.getOutputStream();
                   baosPDF.writeTo(sos);
                   sos.flush();
              catch (DocumentException dex)     {...}
                    catch (DbException e) {.....     }
              finally
                   if (baosPDF != null)
                        baosPDF.reset();
         @Override
         public void doGet(HttpServletRequest request, HttpServletResponse resp)
         throws javax.servlet.ServletException, java.io.IOException
              doPost(request,resp);
         } To create pdf servlet window:com.google.gwt.user.client.Window.open( "PdfService?op=" + para1+ "&para2=" +para2, "_self", ""); Thanks in advance,
    Helen
    Edited by: helenhe123 on Mar 30, 2009 7:02 PM

    Hi paul,
    I found out that WSSO blocked the pop-up window first time. if I tried more than one time, it works fine. Now, I putted the application to a different path without WSSO log-in requirement, it works.
    Now, I am striving to the WSSO log-in part. Is there any good idea for that though?
    By the way, I am a pretty brand new Java programmer. I have so many things to learn...
    Thanks for your helps,
    Helen
    Edited by: helenhe123 on Mar 31, 2009 8:39 PM

Maybe you are looking for

  • SAP NWSneakPreviewSP11 INSTALL ON WINDOWS XP FAILS

    jload.log errors any ideas? 28.10.05 07:55 com.sap.inst.jload.Jload dbImport INFO: EP_OBJECTS loaded (19353 rows) 28.10.05 07:55 com.sap.inst.jload.Jload dbImport INFO: trying to create table EP_OBJECT_TYPES 28.10.05 07:55 com.sap.inst.jload.Jload db

  • Weird error message when trying to use migration assistant?

    We gave my mom a Macbook Pro for Mother's Day. While trying to set it up for her using migration assistant pc to mac, her Dell kept coming up with an error message saying msidcrl40.dll is missing?? What the heck does that even mean? Needless to say m

  • What are the BEST Books and Best websites for java biginners?

    Dear All, What are the BEST Books and Best websites for java biginners-Especially for fast learning. Thnaks KMK

  • Dynamic form population

    Hi all, I found a tutorial that has the following: <FORM name="selections"> <table border="0" cellspacing="0" cellpadding="0">   <tr align="center">     <td nowrap height="11">   <select name="example" size="1" onChange="redirect(this.options.selecte

  • Basic Question - Update - Usage of index

    Gurus, I have a basic question. As per my knowledge, an index will speed up the process while we are selecting the data. If we are doing some DML operations (especially Update), do we need the index to speed up the process eventhough the indexed colu