40 Posted Topics
Re: Hi, > while inserting the data only unique records should be inserted into the database * Unique records based on what field(s)? * Unique records in the csv? You can use [array_unique()](http://www.php.net//manual/en/function.array-unique.php) to remove duplicates from csv, before you send it to bulk upload * Unique records in the DB? … | |
Re: Hi Ryan, - echo the query and check if the final query is correct - you can also try to run the query in phpmyadmin and see if it returns any results. - if you don't have access to phpmyadmin, try removing the suppress error operator '@' when you run … | |
Re: Hi, It seems that you are setting a null model for ComboBox in your `initComponents()` method (which is not listed in the code you've shown us). Check your code at line 292 as shown in the error log. ... and next time please use [code] tags for your code GL | |
Re: Hi, If you read the documentation you'll see that: [B]$_POST[/B] [I]is an associative array of variables passed to the current script via the HTTP POST method.[/I] In your example you get the errors because you are not passing this variables, and the last to lines are executed before you click … | |
Re: Hi, Why don't you try to use SplashScreen class? [url]http://download.oracle.com/javase/7/docs/api/java/awt/SplashScreen.html[/url] and a tutorial [url]http://download.oracle.com/javase/tutorial/uiswing/misc/splashscreen.html[/url] GL! | |
Hello all, I've been searching for a couple of days for this but with no luck, I'm not even sure that my searches are correct, so: Scenario: On a http server (apache, OS Centos), I have a lot of folders located on this path: [I]/var/www/folders/[/I] named: [I]R001, E001, utils,[/I] ... … | |
Hi, I have a printable class that needs to print some text only on 1 page. The thing is that when I hit print the printer prints 3 pages: page 1 - with correct content page 2 - empty page page 3 - page with content translated some how then … | |
Re: you can create a method in your JFrame that changes the content of the JFrame. Something like: [CODE] void changePanels(JPanel component_to_add, JPanel component_to_remove){ contentPane.remove(component_to_remove); contentPane.add(component_to_add); } [/CODE] and then call it from your button action handler. [CODE] // parentFrame is your JFrame parentFrame.changePanel(this, myScrollpane); [/CODE] | |
Re: it means that you can pass variable number of arguments (type int) to the calculate() method, like: [CODE]calculate(1); calculate(2, 5); calculate(4, 6 ,9);[/CODE] | |
Re: Garbage collector does this for you periodically or when it detects that they are no longer being used. Usually the reference to a variable is lost when the variable goes out of scope. If you want to do it explicitly set the value of the variable to null(I guess). | |
Re: Diagonal search (left -> right, top -> bottom): [CODE]//Consider: searchStr; // the string (array) we need to search for 2dArray; // the array in which we are searching // start search for (row = 0; row < (2dArray.length - searchStr.length); row++){ for (col = 0; col < (2dArray.length - searchStr.length); … | |
Re: [CODE] Random r = new Random(); int[][] 2dArray = new int[4][4]; for (int i = 0; i<4; i++){ for (int j = 0; j<4; j++){ 2dArray[i][j] = r.nextInt(8) + 1; // nextInt returns a random int >= 0 and < n } } [/CODE] | |
Re: try to specify the full path to your class file: C:\Program Files\Java\jdk1.6.0_18\bin>java [B]C:\project\class files\[/B]ClassWithManyStaticMethods | |
Re: Hi, [CODE]String reply; char replyChar=; // your char variable needs to be initialized Scanner input = new Scanner(System.in); [/CODE] and you should initialize it with [B]'y'[/B] if you want to get into the while loop at least 1 time | |
Re: Hi, [CODE]public void actionPerformed(ActionEvent event) { if(event.getSource()==room1 && event.getSource==breakfast) { // never reach this part of code } }[/CODE] the event is triggered only by one component, not by 2, in the same time, I don't know what you understand by "source from JButton and JCheckBox", but event.getSource() returns the … | |
Re: [CODE] /** * Calculate age group */ public String calcAge() { if (age >=60) { return "senior"; } else if (age >18) { return "adult"; } else if (age <18) { return "junior"; } } [/CODE] Your function returns nothing if the age == 18 Remove [B]if (age < 18)[/B] … | |
Re: [QUOTE=conspiracy_dawg;255839]I've been having problems with the now deprecated mouseDown and mouseDrag methods, I know the deprecation causes no problem, the program runs fine, but for grading purposes I want my program to be error and warning free, is there any EASY alternative that can solve this deprecation method? I know … | |
Re: Hi, Do you want to know how to save the chart to a PNG file using JFreeChart API or? org.jfree.chart.ChartPanel class has a method called doSaveAs() that [QUOTE=jfreechart API]Opens a file chooser and gives the user an opportunity to save the chart in PNG format.[/QUOTE] Just check the jfreechart API … | |
Re: Hi, Basically you just have to remove the main method from your frame class and your applet should look like this [CODE]public class Scoreclock extends JApplet { // init is for applets same as main is for desktop applications public void init(){ new Stopwatch(); } }[/CODE] Scoreclock class and Stopwatch … | |
Re: No, in java all parameters are passed by value, so changing only x,y values will do nothing, you have to call g.drawString again. | |
Re: what do you mean by [QUOTE]it does not show the prompt in output [/QUOTE]? Do you get any output? | |
Re: Hi, 1. [CODE]else days = 30;[/CODE] runs only if months != 12 2. If you use [B]break[/B] in your code, like: [CODE] if(months == 3) days = 31; break; // the application ends here if(months == 5) days = 31; [/CODE] because break terminates the innermost block of code, which … | |
Re: Hi, If you are using equals() method to compare strings, Java compares the strings correctly. Check again your checkMatch() findMatch() method and make sure that they are correct. Add more brackets in your IF statements, if needed, to make sure the precedence of operators is the one you want. If … | |
Re: Use [B]JProgressBar[/B] [URL="http://java.sun.com/docs/books/tutorial/uiswing/components/progress.html"]Sun Tutorial[/URL] | |
Re: [QUOTE=Nichito;1096064]Hello everyone... I wanna develop a Java Web Applet that will allow me to check a PC's HW configuration (cpu, HDD, and other hardware information), but I don't know what libraries to use, or where to start looking. Anyone can give me a heads up?[/QUOTE] You can't do it directly … | |
Re: Hi, You can convert the [I]infix[/I] expression 5+6*2 to [I]postfix[/I] 5 6 2 * + then compute it. Here are the algorithms for conversion [URL="http://scriptasylum.com/tutorials/infix_postfix/algorithms/infix-postfix/index.htm"]link[/URL] and for evaluation [URL="http://scriptasylum.com/tutorials/infix_postfix/algorithms/postfix-evaluation/index.htm"]link[/URL] GL | |
Re: [CODE] pictures[i][j] = null; [/CODE] | |
Re: Hi Ryujin89, [CODE] private void readRecord(DataInputStream inputFile) { String l_employeeName; Double l_hourlyRate; Integer l_employeeNumber, l_regularHours, l_overtimeHours; boolean endOfFile = false; // try { // remove this line // the endOfFile will always be false because you don't check the end of file anywhere while (!endOfFile) { try { l_employeeName = … | |
Re: Hello shashikant.v, If you what you need is to open the html page from your help menu app, you can use the Desktop API in SE 6... like this: [code] Desktop desktop = null; URI uri = null; if (Desktop.isDesktopSupported()){ desktop = Desktop.getDesktop(); } if (desktop.isSupported(Desktop.Action.BROWSE)){ try { uri = … | |
Re: Hi ngnt4, [CODE] input = days.getText(); day = Double.parseDouble(input); [/CODE] The value returned by getText() method is an empty string(and not a parsable string), this is why you get the exception. You can fix this by initializing the text field before calling the getText() method [CODE]days.setText("0");[/CODE] Anyway I think you … | |
Re: Hi alreem, please next time use the code-tags to enclose your code, public static void main(String[] args) { Scanner read= new Scanner(System.in); int count,i,number; System.out.print("Enter the number: "); number= read.nextInt(); if (number%2==0){ System.out.println(" Plz enter an odd number"); // here you should read the number again until it's odd or … | |
Re: Hi, You can add a mouse listener to your panel and use setToolTip() method for your Panel, like this: [CODE] // in JPanel constructor // ... addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent me){ mouseEnteredHandler(me); } }); // ... constructor ends // ... // private method private void mouseEnteredHandler(MouseEvent me) { … | |
Re: What layout manager are you using? The default layout for JPanel is FlowLayout witch puts components in a row, If you like to set the element position and size you should use another layout like [B]null[/B] (for absolute positioning) | |
Re: Hi, Your constructor does something probably, but sure not what you want. It should be like this: [CODE] public CO2FromWaste(int numPeople, boolean paper, boolean plastic, boolean glass, boolean cans) { // replace // numPeople = numberOfPeople; // with // member = parameter passed to constructor numberOfPeople = numPeople; // like … | |
Re: Hi P00dle, A map cannot contain duplicate keys. If you have duplicate elements you could use a list. | |
Re: I think you are reading the file in your first while [CODE]while ((line = brStream1.readLine())!= null) { NoOfLines++; }[/CODE] and there's nothing to read in the second while because you have reached the end of file Anyway the second while it's a little messed up for what you are trying … | |
Re: From the code provided I can see that the size for p and pane are the same (100, 100) this is why the size of both panels are equal. Then again you are setting the panel background color before initializing it [CODE] pane.setBackground(Color.red); // this line should go after pane … | |
Re: Hi gibson.nathan, In your CO2FootPrintTester [CODE] public class CO2FootPrintTester { public static void main(String[] args){ // remove this, it shouldn't be here CO2Footprint( int numberOfPeople, double gasFootPrint, double averageElectricBill, double averageElectricPrice, boolean paperRecyled, boolean plasticRecyled, boolean glassRecyled, boolean cansRecyled, int numLightsRecyled, double totalReductionsPaper, double totalReductionsPlastic, double totalReductionsGlass, double totalReductionsCans, double … |
The End.