473,785 Members | 2,297 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Integer Field in JList ... renumbering

38 New Member
I do not even know how to correctly ask this question.
I have an item field in the code I am about to post. Simple intger meant to be an item number for a cd. The user enters this number.
Over the last week I have played with Add buttons, Del buttons, Modify and everything else and it brought to light a problem I want to address today.
I have always just used 1 for the first item, 2 for the second and so on ...
well after I am done will all the button nonsence the item numbers are all over the place.
How could I make it so that the item number field would be restructured and stay in ascending order no matter what was added or deleted?
If I delete cd number 4, then make 5 number 4, 6 number 5 and so on ... the next cd added should just take the next highest number ...
Does that make sense?
Here is my primary class. I can post the others if needed.

Expand|Select|Wrap|Line Numbers
  1. import java.util.*;
  2. import java.awt.*;
  3. import java.awt.event.*;
  4. import javax.swing.*;
  5. import javax.swing.event.*;
  6. import java.text.*;
  7. import java.lang.*;
  8. import javax.swing.JFrame;
  9.  
  10. public class Inventory2 extends JFrame
  11. {
  12.     private JLabel cdNameLabel; // name label 
  13.     private JLabel artistLabel; // item number label 
  14.     private JLabel nstockLabel; // units in stock label 
  15.     private JLabel priceLabel; // price each label 
  16.     private JLabel itemLabel; // item number label 
  17.     private JTextField cdNameField; // name display 
  18.     private JTextField artistField; // artist display 
  19.     private JFormattedTextField nstockField; // units in stock display 
  20.     private JFormattedTextField priceField; // price each display 
  21.     private JTextField itemField; // item number display 
  22.     private NumberFormat nstockFormat; // format field and parse numbers 
  23.     private NumberFormat priceFormat; // format field and parse numbers 
  24.     private JButton btnAdd; // first button 
  25.     private JButton btnPrev; // previous button 
  26.     private JButton btnNext; // next button 
  27.     private JButton btnDel; // last button 
  28.     private JButton btnFirst; // first button
  29.     private JButton btnLast; // last button
  30.     private JButton btnModify; // modify button
  31.     private JButton btnSave; // save button
  32.     private JButton btnSearch; // search button
  33.     private JPanel buttonJPanel; // JPanle to hold buttons 
  34.     private JPanel fieldJPanel; // JPanel to hold labels and displays 
  35.     private JPanel fontJPanel; // JPanel to display logo 
  36.     private int currCD; 
  37.     private double total = 0; // variable for total inventory 
  38.     private JList Inventorylist; // JList to take place of old array
  39.     private DefaultListModel listModel;
  40.     private JScrollPane jScrollPanel;  
  41.     private float Invtotal = .00f;
  42.  
  43.      DecimalFormat formatter = new DecimalFormat("0.00");
  44.  
  45.     public Inventory2() // create class and method to perform GUI build 
  46.     { 
  47.         initComponents(); 
  48.     } 
  49.  
  50.     private void initComponents() 
  51.     { 
  52.  
  53.         // create label names 
  54.         cdNameLabel = new JLabel("CD Name:"); 
  55.         artistLabel = new JLabel("Artist:");
  56.         nstockLabel = new JLabel("In Stock:"); 
  57.         priceLabel = new JLabel("Each Item Cost:$"); 
  58.         itemLabel = new JLabel("Item Number:"); 
  59.  
  60.  
  61.         // initial fields
  62.         cdNameField = new JTextField(25);
  63.         cdNameField.setEditable(true);
  64.         artistField = new JTextField(15);
  65.         artistField.setEditable(true);
  66.         nstockField = new JFormattedTextField(nstockFormat);
  67.         nstockField.setEditable(true);
  68.         nstockField.setColumns(5);
  69.         priceField = new JFormattedTextField(priceFormat);
  70.         priceField.setEditable(true);
  71.         priceField.setColumns(5);
  72.         itemField = new JTextField(4);
  73.         itemField.setEditable(true);
  74.  
  75.         // JList
  76.         jScrollPanel = new JScrollPane();
  77.         Inventorylist = new JList(); 
  78.         currCD = 0;
  79.  
  80.  
  81.         // buttons 
  82.         btnAdd = new JButton(); 
  83.         btnNext = new JButton(); 
  84.         btnPrev = new JButton(); 
  85.         btnDel = new JButton();
  86.         btnLast = new JButton();
  87.         btnFirst = new JButton();
  88.         btnModify = new JButton(); 
  89.         btnSave = new JButton();
  90.         btnSearch = new JButton();
  91.  
  92.         getContentPane().setLayout(new FlowLayout());
  93.         setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
  94.  
  95.         // add shapesJPanel to frame    
  96.         ShapesJPanel logo = new ShapesJPanel();
  97.         logo.setPreferredSize(new Dimension(200,200));
  98.         getContentPane().add( logo );
  99.  
  100.         // place textFields and labels
  101.  
  102.         //artist
  103.         artistLabel.setText("Artist"); 
  104.         getContentPane().add(artistLabel); 
  105.  
  106.         artistField.setMinimumSize(new Dimension(70,20)); 
  107.         artistField.setPreferredSize(new Dimension(70,20));
  108.         getContentPane().add(artistField); 
  109.  
  110.         // cd name
  111.         cdNameLabel.setText("CD Name"); 
  112.         getContentPane().add(cdNameLabel); 
  113.  
  114.         cdNameField.setMinimumSize(new Dimension(70,20)); 
  115.         cdNameField.setPreferredSize(new Dimension(70,20));
  116.         getContentPane().add(cdNameField);
  117.  
  118.         // copies in stock
  119.         nstockLabel.setText("Copies In Stock"); 
  120.         getContentPane().add(nstockLabel); 
  121.  
  122.         nstockField.setMinimumSize(new Dimension(5,20)); 
  123.         nstockField.setPreferredSize(new Dimension(5,20));
  124.         getContentPane().add(nstockField); 
  125.  
  126.         //price of cd
  127.         priceLabel.setText("Price: $"); 
  128.         getContentPane().add(priceLabel); 
  129.  
  130.         priceField.setMinimumSize(new Dimension(20,20)); 
  131.         priceField.setPreferredSize(new Dimension(20,20));
  132.         getContentPane().add(priceField); 
  133.  
  134.         //item number of cd
  135.         itemLabel.setText("Item Number"); 
  136.         getContentPane().add(itemLabel); 
  137.  
  138.         itemField.setMinimumSize(new Dimension(5,20)); 
  139.         itemField.setPreferredSize(new Dimension(5,20));
  140.         getContentPane().add(itemField); 
  141.  
  142.  
  143.  
  144.         // add listeners
  145.  
  146.         btnAdd.setText("Add");
  147.         btnAdd.addActionListener(new ActionListener()
  148.         {
  149.             public void actionPerformed(ActionEvent evt)
  150.             {
  151.                 btnAddActionPerformed(evt);
  152.             }
  153.         });
  154.         getContentPane().add(btnAdd);
  155.  
  156.         // PREVIOUS
  157.         btnPrev.setText("Previous");
  158.         btnPrev.addActionListener(new ActionListener()
  159.         {
  160.             public void actionPerformed(ActionEvent evt)
  161.             {
  162.                 btnPrevActionPerformed(evt);
  163.             }
  164.         });
  165.         getContentPane().add(btnPrev);
  166.  
  167.         // NEXT
  168.         btnNext.setText("Next");
  169.         btnNext.addActionListener(new ActionListener()
  170.         {
  171.             public void actionPerformed(ActionEvent evt)
  172.             {
  173.                 btnNextActionPerformed(evt);
  174.             }
  175.         });
  176.         getContentPane().add(btnNext);
  177.  
  178.         // SEARCH
  179.         btnSearch.setText("Search");
  180.         btnSearch.addActionListener(new ActionListener()
  181.         {
  182.             public void actionPerformed(ActionEvent evt)
  183.             {
  184.                 btnAddActionPerformed(evt);
  185.             }
  186.         });
  187.         getContentPane().add(btnSearch);
  188.  
  189.         // FIRST
  190.         btnFirst.setText("First");
  191.         btnFirst.addActionListener(new ActionListener()
  192.         {
  193.             public void actionPerformed(ActionEvent evt)
  194.             {
  195.                 btnFirstActionPerformed(evt);
  196.             }
  197.         });
  198.         getContentPane().add(btnFirst);
  199.  
  200.         // LAST
  201.         btnLast.setText("Last");
  202.         btnLast.addActionListener(new ActionListener()
  203.         {
  204.             public void actionPerformed(ActionEvent evt)
  205.             {
  206.                 btnLastActionPerformed(evt);
  207.             }
  208.         });
  209.         getContentPane().add(btnLast);
  210.  
  211.         // MODIFY
  212.         btnModify.setText("Modify");
  213.         btnModify.addActionListener(new ActionListener()
  214.         {
  215.             public void actionPerformed(ActionEvent evt)
  216.             {
  217.                 btnModifyActionPerformed(evt);
  218.             }
  219.         });
  220.         getContentPane().add(btnModify);
  221.  
  222.         // SAVE
  223.         btnSave.setText("Save");
  224.         btnSave.addActionListener(new ActionListener()
  225.         {
  226.             public void actionPerformed(ActionEvent evt)
  227.             {
  228.                 btnAddActionPerformed(evt);
  229.             }
  230.         });
  231.         getContentPane().add(btnSave);
  232.  
  233.         // DELETE
  234.         btnDel.setText("Delete");
  235.         btnDel.addActionListener(new ActionListener()
  236.         {
  237.             public void actionPerformed(ActionEvent evt)
  238.             {
  239.                 btnDeleteActionPerformed(evt);
  240.             }
  241.         });
  242.         getContentPane().add(btnDel);
  243.  
  244.  
  245.         // new Jlist model
  246.         listModel = new DefaultListModel();
  247.         Inventorylist.setModel(listModel);
  248.  
  249.         jScrollPanel.setViewportView(Inventorylist);
  250.  
  251.         getContentPane().add(jScrollPanel);
  252.  
  253.         pack();
  254.     }// close
  255.  
  256.  
  257.         private void btnAddActionPerformed(ActionEvent evt)
  258.         {
  259.             // Create cd to add
  260.             CdwArtist newCD = new CdwArtist();
  261.             newCD.setArtist(artistField.getText());
  262.             newCD.setName(cdNameField.getText());    
  263.             newCD.setItemno(Integer.parseInt(itemField.getText()));
  264.             newCD.setNstock(Integer.parseInt(nstockField.getText()));
  265.             newCD.setPrice(Float.parseFloat(priceField.getText()));
  266.  
  267.             // Add cd to list
  268.             listModel.addElement(newCD);
  269.             currCD = listModel.size()-1;  // sets currCD to added index
  270.  
  271.  
  272.             // Clear the text fields after add
  273.             artistField.setText(null);
  274.             cdNameField.setText(null);    
  275.             itemField.setText(null);
  276.             nstockField.setText(null);
  277.          priceField.setText(null);
  278.  
  279.             }// end ADD
  280.  
  281.         private void btnPrevActionPerformed(ActionEvent evt)
  282.         {
  283.             // Grab Previous cd 
  284.             if (--currCD<0) currCD = listModel.size()-1;
  285.             CdwArtist newCD = (CdwArtist) listModel.get( currCD );
  286.  
  287.  
  288.             artistField.setText(newCD.getArtist());
  289.             cdNameField.setText(newCD.getName());    
  290.             itemField.setText(String.valueOf(newCD.getItemno()));
  291.             nstockField.setText(String.valueOf(newCD.getNstock()));
  292.             priceField.setText(formatter.format(newCD.getPrice()));
  293.  
  294.  
  295.             }// end PREV
  296.  
  297.                 private void btnNextActionPerformed(ActionEvent evt)
  298.             {
  299.             // Grab Next cd 
  300.             if (++currCD >= listModel.size()) currCD= 0;
  301.             CdwArtist newCD = (CdwArtist) listModel.get( currCD );
  302.  
  303.  
  304.             artistField.setText(newCD.getArtist());
  305.             cdNameField.setText(newCD.getName());    
  306.             itemField.setText(String.valueOf(newCD.getItemno()));
  307.             nstockField.setText(String.valueOf(newCD.getNstock()));
  308.             priceField.setText(formatter.format(newCD.getPrice()));
  309.  
  310.  
  311.             }// end NEXT
  312.  
  313.  
  314.                 private void btnFirstActionPerformed(ActionEvent evt)
  315.             {
  316.             // Grab First cd 
  317.             CdwArtist newCD = (CdwArtist) listModel.get(0);
  318.             currCD = 0;
  319.  
  320.             artistField.setText(newCD.getArtist());
  321.             cdNameField.setText(newCD.getName());    
  322.             itemField.setText(String.valueOf(newCD.getItemno()));
  323.             nstockField.setText(String.valueOf(newCD.getNstock()));
  324.             priceField.setText(formatter.format(newCD.getPrice()));
  325.  
  326.  
  327.             }// end FIRST
  328.  
  329.  
  330.                 private void btnLastActionPerformed(ActionEvent evt)
  331.             {
  332.             // Grab Last cd 
  333.             CdwArtist newCD = (CdwArtist) listModel.lastElement();
  334.             currCD = listModel.size()-1;
  335.  
  336.  
  337.             artistField.setText(newCD.getArtist());
  338.             cdNameField.setText(newCD.getName());    
  339.             itemField.setText(String.valueOf(newCD.getItemno()));
  340.             nstockField.setText(String.valueOf(newCD.getNstock()));
  341.             priceField.setText(formatter.format(newCD.getPrice()));
  342.  
  343.  
  344.             }// end LAST
  345.  
  346.                 private void btnDeleteActionPerformed(ActionEvent evt)
  347.             {
  348.             // Delete cd 
  349.             listModel.remove(currCD);
  350.  
  351.  
  352.             // Clear the text fields after delete
  353.             artistField.setText(null);
  354.             cdNameField.setText(null);    
  355.             itemField.setText(null);
  356.             nstockField.setText(null);
  357.          priceField.setText(null);
  358.  
  359.  
  360.             }// end DELETE
  361.  
  362.                 private void btnModifyActionPerformed(ActionEvent evt)
  363.             {
  364.             // Modify cd
  365.             listModel.remove(currCD);
  366.  
  367.             // Create cd to add
  368.             CdwArtist newCD = new CdwArtist();
  369.             newCD.setArtist(artistField.getText());
  370.             newCD.setName(cdNameField.getText());    
  371.             newCD.setItemno(Integer.parseInt(itemField.getText()));
  372.             newCD.setNstock(Integer.parseInt(nstockField.getText()));
  373.             newCD.setPrice(Float.parseFloat(priceField.getText()));
  374.  
  375.             // Add cd to list
  376.             listModel.addElement(newCD);
  377.             currCD = listModel.size()-1;  // sets currCD to added index
  378.  
  379.  
  380.             // Clear the text fields after add
  381.             artistField.setText(null);
  382.             cdNameField.setText(null);    
  383.             itemField.setText(null);
  384.             nstockField.setText(null);
  385.          priceField.setText(null);
  386.  
  387.  
  388.             }// end Modify
  389.  
  390.             // Search the Name Field
  391.             cdNameField.addCaretListener(new CaretListener()
  392.             {
  393.             public void caretUpdate(CaretEvent e)
  394.                 {
  395.                 JTextField f = (JtextField)e.getSource();
  396.                 final String s = f.getText();
  397.  
  398.  
  399.         // run it
  400.         public static void main(String args[])
  401.         {
  402.         JFrame frame = new JFrame( "CD Inventory Logo" );
  403.       frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
  404.  
  405.          java.awt.EventQueue.invokeLater(new Runnable()
  406.             {
  407.             public void run()
  408.                 {
  409.                 new Inventory2().setVisible(true);
  410.                }
  411.             });
  412.         }
  413.  
  414. } // close class
Aug 1 '07 #1
21 2924
JosAH
11,448 Recognized Expert MVP
Don't allow the user to enter that (integer) key him/herself. Users are stupid
beings that make mistakes all the time. Have you had a look at the Bitset
class yet? I might come in handy.

kind regards,

Jos
Aug 1 '07 #2
no1zson
38 New Member
I did. It is what I thought of useing, but the API just confuses me.
I do not yet understand how to use the API properly, so I have been scanning the internet for code examples of one that is actually being used, but I cannot find a model to try and use to set mine up.
Aug 1 '07 #3
JosAH
11,448 Recognized Expert MVP
I did. It is what I thought of useing, but the API just confuses me.
It just allows you to set bits or reset them; either single bits or a range of them.
You can also go fancy and 'or', 'and', 'xor' and whatever with two entire bit sets.
You just need the simple stuff: get the first bit that wasn't set to true and set
a bit to true or false. Compare it with a boolean[] array except that a BitSet is
more clever than that.

kind regards,

Jos
Aug 1 '07 #4
no1zson
38 New Member
wow. Now I feel dumb. I know nothing about arrays, and boolean is just a term to me at this point for true or false.

I understand the basic concept, but have no idea how to code it.

Am I reformatting the field? Am I creating a whole new field? Am I creating this bit and then applying it to my itemno field?

I am lost.
Aug 1 '07 #5
JosAH
11,448 Recognized Expert MVP
wow. Now I feel dumb. I know nothing about arrays, and boolean is just a term to me at this point for true or false.

I understand the basic concept, but have no idea how to code it.

Am I reformatting the field? Am I creating a whole new field? Am I creating this bit and then applying it to my itemno field?

I am lost.
Read all about that BitSet class and judge for yourself whether you can use it
or not; maybe my suggestion was all wrong. You won't know until you've understood
what that set is all about ;-)

kind regards,

Jos
Aug 1 '07 #6
no1zson
38 New Member
I have read it, and I do think it will help, but reading about it does not show me how to code it in to my existing program. That is what I do not understand.

I understand that you do not wish to just hand out code,

but could you show code examples of what I might try? I have never seen this implemented anywhere, it is hard for me to see how I would put it in action with what I already have.
Aug 1 '07 #7
JosAH
11,448 Recognized Expert MVP
I have read it, and I do think it will help, but reading about it does not show me how to code it in to my existing program. That is what I do not understand.

I understand that you do not wish to just hand out code,

but could you show code examples of what I might try? I have never seen this implemented anywhere, it is hard for me to see how I would put it in action with what I already have.
There's a saying: "code to the interface, not to the implementation" . You want a
'thing' that gives you a unique integer number when you ask for it and you can
return a number (previously given to you by that 'thing') telling it that it can be
used again in the future if you ask for another number again.

Those numbers are your primary keys for your CD collection.

Here goes:

Expand|Select|Wrap|Line Numbers
  1. public interface PrimaryKeyGenerator {
  2.    public int give();
  3.    public void take();
  4. }
  5.  
If you pass a PrimaryKeyGener ator (an interface!) to your CD collection at
construction time (store it as a member variable), you can use it all over the
place, i.e. when you insert a new CD you ask it to give() you a number; when
you delete a CD you let that object take() it back.

You should be able to program and compile your CD collection class using this
interface; of course it won't run (yet) because there is no implementation of this
interface yet.

Here's a stupid implementation: i.e. it generates the numbers 0, 1, 2 ... and
it doesn't do anything when you make it take() a number back again. You
obviously don't want this implementation as a final implementation but it is
enough to get you started. We'll implement a clever PrimaryKeyGener ator
later when you understand that BitSet API. Here's the stupid interface implementation:

Expand|Select|Wrap|Line Numbers
  1. public class StupidPrimaryKeyGenerator implements PrimaryKeyGenerator {
  2.    private int key;
  3.    public synchronized int give() { return key++; }
  4.    public void take() { }
  5.  
kind regards,

Jos
Aug 2 '07 #8
no1zson
38 New Member
OK, that is an explaination I THINK I understand.

So, I do not want the user entering anything in to my itemField, I should probably just set editable to false and be done with it right off the bat.

I should then impliment the public int give(); every time a cd is added, which stupidkeygenera tor will give the next available number?

Is that about the long and short of it, or am I twisted?

If all that is right, my only remaining question (at the moment) would be how does int give() know to give its number to itemField?
should I not also have to change the way the field is built and initialize?

currently I have this:

Expand|Select|Wrap|Line Numbers
  1. private JTextField itemField;
  2. and
  3. itemField = new JTextField(4);
  4. itemField.setEditable(true);
  5. and
  6. newCD.setItemno(Integer.parseInt(itemField.getText()));
  7. when a cd is added
If I am to code the interface, and not the implementation, will not most of that need to change also?
Aug 2 '07 #9
r035198x
13,262 MVP
OK, that is an explaination I THINK I understand.

So, I do not want the user entering anything in to my itemField, I should probably just set editable to false and be done with it right off the bat.

I should then impliment the public int give(); every time a cd is added, which stupidkeygenera tor will give the next available number?

Is that about the long and short of it, or am I twisted?

If all that is right, my only remaining question (at the moment) would be how does int give() know to give its number to itemField?
should I not also have to change the way the field is built and initialize?

currently I have this:

Expand|Select|Wrap|Line Numbers
  1. private JTextField itemField;
  2. and
  3. itemField = new JTextField(4);
  4. itemField.setEditable(true);
  5. and
  6. newCD.setItemno(Integer.parseInt(itemField.getText()));
  7. when a cd is added
If I am to code the interface, and not the implementation, will not most of that need to change also?
But now in that class you have a KeyGenerator object, so instead of setting itemNo with value entered by the user, you simply call the give method and use the number that it has generated as the itemNo
Aug 2 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

1
5451
by: Roman Thurnherr | last post by:
Hi all I'm using two JLists with the same MouseListener in a JFrame. How can I find out on which JList the MouseEvent was released? Is it generally possible or should I use a MouseListener for each JList? Thanx for your help Roman
20
2069
by: Prakash | last post by:
Hi ! I have a field "sub_tran_no" in my form in continuous view. When the user presses a button "Re-Number", I'd like to: 1) Save the current record pointer position 2) Save the current field which has focus 3) go to the top of the recordset & start re-numbering the "sub_tran_no" field with the values 1,2,3, until eof.
1
2413
by: Salha | last post by:
Hello there, Can you help me in following problem: Am working on a chemistry dictionary. I want to have all the chemistry terms in a JList and whenever i select a term from a JList, it displays the meaning in a text area (as any encyclopedia) and the term in a textfield. My questions: 1. How can i load the chemistry terms in to the JList and meanings in the textarea and store them? 2. How can i select a term and diplays it in the...
0
1390
by: paoparaopao | last post by:
Hi, I want to drag rows up/down in a JList; for example, drag 3rd row to 1st row. I have setDragEnabled(true) for JList, but it doesn't work! How do I drag rows in JList? Thanks!
4
2069
Nepomuk
by: Nepomuk | last post by:
Hi! I'm trying to use a JList. Here's the code: String languages = { "deutsch", // german "english", // english "castellano", // castilian "français", // french "italiano", // italian "日本語", // japanese
8
3170
by: sukatoa | last post by:
I came from List in awt.... Im currently having an experiment about JList.... say like 140,280 ( h,w ) i have 4 values that have been set on JList using addElement from DefaultListModel....
2
1960
by: wishbone34 | last post by:
Hi, here is some of my code public class ControlIL extends JFrame implements ActionListener, ListSelectionListener { private JList Items; //builds the UI public ControlIL(){ DefaultListModel model = new DefaultListModel();
2
2893
by: Gangreen | last post by:
Hi all, I've bumped into an odd problem creating a GUI in swing. As you will see in the screenshots, I have a tabbed layout. Each tab is a Jpanel. On this panel I have put a JList, containing a series of objects. My intention is to have a single column of objects in the list, and have it to scroll when the objects exceed the vertical space. My code is this: private JComponent createListBox() { Object test = {"Thingy 1","Thingy...
2
6298
by: Gangreen | last post by:
hi, I have an arrayList in my program that I want to display in a Jlist. I need the JList to update his contents when the elements in the arraylist change/ an element is added/deleted/... I'm lost on how to do this. Passing the arrayList as an array into the Jlistconstructor will just display the elements, but no updates will be made according to the API. Apparently ListDataListeners should be used, and I don't seem to be able to find a...
0
9647
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10356
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9959
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8988
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7509
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6744
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5396
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5528
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3665
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.