When I leave a comment (vote with comment ) under someone post , it will increase 2 points for vote up and 0 point for vote down. After I leave the comment and click the vote up button, the user earn 2 points. But after I vote down again, the comment get removed but the user still earning 2 points. The two points should be deducted too, no ? Thanks.

Member Avatar
Member Avatar
+2 forum 5

Are there any differencies between these two code ? if (!a.equals("")) { editDate.setText(a) } and if (a!="") { editDate.setText(a) }

Member Avatar
Member Avatar
+0 forum 3

Parents please be aware and very cautious of what your child watches on YouTube and KIDS YOUTUBE. There is a thing called ‘Momo’ that’s instructing kids to kill themselves, turn stoves on while everyone is sleep and even threatening to kill the children if they tell their parents!!! ![download.jpeg](/attachments/large/4/dc1303529642573b46b66ccb1a2992ce.jpeg)

Member Avatar
Member Avatar
-3 forum 10

Recently I realized that I not receive any email notification from DaniWeb. When I check on the User Settings, I saw this alert message > We have been having problems emailing you. Has your email address changed? Please update your email address to begin receiving email from us again. After I re-write my email, this message changed to > An email to verify your account has been sent to xxx@hotmail.com. Please click the link in the email to confirm your email address. But when I check my mail, I don't receive any email from DaniWeb.

Member Avatar
Member Avatar
+1 forum 11

When posting code, I get error > begin a line with 4 spaces in a row (or one tab), preceded by a blank line. 4+ spaces or tabs may not be used anywhere else.

Member Avatar
Member Avatar
+0 forum 7

There are **Complementary Goals** in profile page. Where can I find the list of goals and what does this used for ?

Member Avatar
Member Avatar
+1 forum 8

First of all, I would like to say that the interface is nice, amazing, and user friendly!! Thanks Dani and those who work hard on this !!! But one thing I would like to comment is about the **vote and comment**. It seems like only users with high reputation allow to use this feature because I get this message when I click the vote up button > Oops! > You do not have the permissions required to access this page. > Would you like to go back? Since this feature is not available to all users, why not just make …

Member Avatar
Member Avatar
+1 forum 28

The API docs are now found at [ Java Development Kit Version 11 API Specification](https://docs.oracle.com/en/java/javase/11/docs/api/)

Member Avatar
Member Avatar
+0 forum 3

Question from codility test Write a function: class Solution { public int solution(int[] A); } that, given an array A of N integers, returns the smallest positive integer (greater than 0) that does not occur in A. For example, given A = [1, 3, 6, 4, 1, 2], the function should return 5. Given A = [1, 2, 3], the function should return 4. Given A = [−1, −3], the function should return 1. Write an efficient algorithm for the following assumptions: > > N is an integer within the range [1..100,000]; > each element of array A is an …

Member Avatar
Member Avatar
+0 forum 8

Hey guys, I have a little bit confused on below code and output **Main ** public class Main { public static void main(String[] args) { ClassA classA = new ClassA(); System.out.println("====== Before ====="); classA.checking(); System.out.println("===== After ====="); classA.checking(); } } ** Class A** public class ClassA { boolean b = true; public String checking() { System.out.println("B value is " + b); if (b = true) { System.out.println("B is true"); b = false; } else { System.out.println("B is false"); } return null; } } ** Output** ====== Before ===== B value is true B is true ===== After ===== B value …

Member Avatar
Member Avatar
+0 forum 4

I trying to write a `spring batch` using `SpringBoot`. At first the program will read data from database, then write it to `.csv` file format. This is the code I have tried **Reader** @Bean public ItemReader<A> Reader() throws Exception { List list = new ArrayList<>(); JdbcCursorItemReader<A> reader = new JdbcCursorItemReader<A>(); JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); String sql = "SELECT ID AS id FROM TABLE_A "; list = jdbcTemplate.query(sql, new Mapper()); // store all retrieved data to list reader.setSql(sql); reader.setDataSource(dataSource); reader.setRowMapper(new Mapper()); if (list != null) { for (A c : (List<A>) list) { c.setId("123"); // overwrite the id c.setState("Active"); } …

Member Avatar
Member Avatar
+0 forum 1

I feel hard to understand how the LayoutManager work even the GUI is quite simple. I trying to make the button place below the Tel No JTextField, but it placed beside Address JTextField , not below TelNo JTextField. package gui; import java.awt.BorderLayout; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.SpringLayout; import javax.swing.SwingUtilities; public class OrderPage extends JPanel { public static void main(String[] args) { OrderPage order = new OrderPage(); order.createAndShowGUI(); JFrame frame = new JFrame(); frame = new JFrame(); frame.setTitle("Details"); frame.getContentPane().add(order); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } public …

Member Avatar
Member Avatar
+0 forum 7

Hi guys , is me again ! I get stucked on this question Write a program that read an integer and display its smallest prime factors in ascending order. For example, if the input is 60, the output should be 2,3,5... I came out with below code, but I get 2 2 3 5.How to have only one 2 ? package chapter4; import java.util.Scanner; public class Exercise4_16 { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Enter an integer: "); Exercise4_16 exe = new Exercise4_16(); int value = input.nextInt(); exe.primeFactors(value); } public void primeFactors(int value) { while …

Member Avatar
Member Avatar
+0 forum 2

Use a **for** loop to find the smallest integer n such that n^3 is greater than 1000 So I came out with below code public class Chapter4 { static int n = 0; public static void main(String[] args) { for (int i = 1; Math.pow(i, 3) <= 1000; i++) { n = i; } System.out.println("Smallest i is " + n); } } I get value answer 21 which looked like not the smallest integer. What is wrong with my logic ? I thought the value n should be 10 ?

Member Avatar
Member Avatar
+0 forum 8

Write a program that displays all numbers divisible by 3 and 4 within a range entered by user. Display five numbers per line. Numbers are separated by exactly two spaces. This is my code public class Chapter4 { public static void main(String[] args) { Scanner input = new Scanner(System.in); final int NUMBER_OF_PRIMES_PER_LINE = 5; int count = 0; int[] vars = new int[10]; for (int i = 0; i < vars.length; i++) { System.out.println("Enter " + (i + 1) + " numbers: "); vars[i] = input.nextInt(); if ((vars[i] % 3 == 0) && (vars[i] % 4 == 0)) { count++; …

Member Avatar
Member Avatar
+0 forum 25

I have multiple JSpinner which have items 1-10 , and one JTable. When the JSpinner is clicked, the value will be added to JTable. I want to get the row number so I can use it at setValueAt. But I get error when the JSpinner clicked more than once times. **Code** public void stateChanged(ChangeEvent e) { // when JSpinner clicked int quantity = (int) ((JSpinner) e.getSource()).getValue(); int rows = table.getRowCount(); for (int i = 0; i < ELEMENTS; i++) { if (numspinner[i] == e.getSource()) { if (quantity == 1) { System.out.println("Row"+rows); dtm.addRow(new Object[] { foodLabel[i].getText(), quantity, price[i] * quantity }); …

Member Avatar
Member Avatar
+0 forum 7

In my Food Tab, I wanted to achieve this [Click Here](https://sfault-image.b0.upaiyun.com/358/064/3580648794-597611aa1f701) But I only able to get this [Click Here](https://sfault-image.b0.upaiyun.com/779/111/779111227-5976120f6955a) How can I increase the width of the JTextField which are in Food Tab ? Below is my code public class FoodOrdering { static private JFrame frame; static private JTextField textField; static private GridBagConstraints gbc; static private JLabel[] foodLabel; static private JLabel[] labels; static private JTextField[] qtyField; static private JLabel[] foodImage; static private File[] file; private static final int ELEMENTS = 9; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() …

Member Avatar
Member Avatar
+0 forum 3

I wonder how to handle exception in `ResponsesEntity`. When it receive wrong url, it supposes to go to the `catch` block and display the `log`. But I keep getting error message in console. The `try-catch` not working as it not display log message. @GetMapping("abc/{Id}") public ResponseEntity info(@PathVariable("Id") String id) { HttpEntity httpEntity = new HttpEntity(buildHttpHeaders()); String theUrl = url + "/revenue_harvest/transactions/" +id; ResponseEntity<TDto> responseEntity = restTemplate.exchange(theUrl, HttpMethod.GET, httpEntity, TDto.class); TDto tdto = responseEntity.getBody(); Tran tran = new Tran(); try { tran.setDate(new Date()); tran.saveAndFlush(tran); // save to database }catch(Exception e) { log.info("Log: "+e); } return responseEntity; } Error org.springframework.web.client.HttpClientErrorException: 404 Not …

Member Avatar
Member Avatar
+0 forum 3

A guy come from Malaysia, just want to say hi with you all :)

Member Avatar
Member Avatar
+0 forum 6

The End.