somjit{} 60 Junior Poster in Training Featured Poster

so i suppose functionally they are the same ?
what is the advantage of keeping one as an interface and another as a class ? why not just keep one ?

somjit{} 60 Junior Poster in Training Featured Poster

i saw the docs for both .. but found the terms a bit hard to get.
i was hoping to get some simple answers here.

thanks for your time :)

somjit{} 60 Junior Poster in Training Featured Poster

is there some significant performance difference between a 32 bit and 64 bit mint cinnamon ? given my specifications , i was thinking maybe MATE would be a better option ... will it ?

somjit{} 60 Junior Poster in Training Featured Poster

b62b330b33236e12160db60d6c858d9d booted from a flash drive to go into the live cd mode , there , as soon as i double clicked a flash video , the screen went all jumbled up , and my pc hanged up.

later i tried to check it in oracle virtual box , there its giving me the following message

VT-x/AMD-V hardware acceleration has been enabled, but is not operational. Your 64-bit guest will fail to detect a 64-bit CPU and will not be able to boot.
Please ensure that you have enabled VT-x/AMD-V properly in the BIOS of your host computer.

im attaching a speccy screenshot describing my system resources.

thanks in advance for your time. :)

regards
somjit.

somjit{} 60 Junior Poster in Training Featured Poster

please post this in a new thread. it will be easily searchable for all future uses.
its easier for members to answer your query that way.

somjit{} 60 Junior Poster in Training Featured Poster

thanks for the feedback :) ill let him know. :)

somjit{} 60 Junior Poster in Training Featured Poster

one of my good friends wrote this blog here. he asked me for an opinion , however , i havent used linux much... only used centOS for about a semester in college for a networking course. i was hoping the members here could give some opinions about the blog.

thanks a lot :)

somjit{} 60 Junior Poster in Training Featured Poster

provide what ever you have come up with so far... the members will surely help you out.

somjit{} 60 Junior Poster in Training Featured Poster

done! printStackTrace() pointed this out
Can not issue data manipulation statements with executeQuery().
and thats what i was doing wrong.. changed to executeUpdate() and peace is restored! :)
thanks :) problem solved.

somjit{} 60 Junior Poster in Training Featured Poster

ohh yeah!! i forgot that... about a week away from java .. and its having its effects! let me try that out!

somjit{} 60 Junior Poster in Training Featured Poster

this is the problem code :

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.io.IOException;

public class Prepared {
    public static void main(String[] args) {
        try {
            readerHelper r = readerHelper.GET_INSTANCE;
            System.out.print("enter username: ");
            String user = r.is().readLine();
            System.out.print("enter password: ");
            String pass = r.is().readLine();
            Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/testdb",user,pass);
            PreparedStatement selAll = con.prepareStatement("INSERT INTO Authors(name) VALUES(?)");
            selAll.setString(1, "dan brown");
        }catch(IOException e){
            System.out.println("error reading input");
        }catch(SQLException e){
            System.out.println("error finding source"); 
        }
    }
}

this gives me "error finding source" after i put in the username and password. yet , on a nearly similar code

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.io.IOException;

public class Version {
    public static void main(String[] args){
        try{
            readerHelper r = readerHelper.GET_INSTANCE;
            System.out.print("enter username: ");
            String user = r.is().readLine();
            System.out.print("enter password: ");
            String pass = r.is().readLine();
            Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/testdb",user,pass);
            PreparedStatement selAll = con.prepareStatement("select version()");
            ResultSet result = selAll.executeQuery();
            while(result.next()){
                System.out.println(result.getString(1));
            }
        }catch(SQLException e){
            System.out.println("error finding source");
        }catch(IOException e){
            System.out.println("error reading input");
        }

    }
}

im not getting any errors , and its displaying my MySQL version correctly.
what am i doing worng in my first code? the line where the connection is made is same in both codes , yet one works , and the other doesnt...

lastly, my reader class used in the above two codes :

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class readerHelper {

    public static readerHelper GET_INSTANCE = new readerHelper();
    private BufferedReader is;

    private readerHelper() {
        is = new BufferedReader(new …
somjit{} 60 Junior Poster in Training Featured Poster

had some exams going.. sorry for the late reply.

Calls to instance methods are resolved at run time, so when you call addAll or add from an instance of InstrumentedHashSet the JVM looks for versions defined in InstrumentedHashSet, and only looks for them in HashSet if they are not overridden in InstrumentedHashSet (unless you explictly use the super keywod which makes the JVM start looking for the method in the current objects superclass).

thanks for pointing this out. i dont think i read about this anywhere, and even if i did , forgot it completely. ran the code with some debug prints , it makes more sense now. :)

should explain to anyone overriding add that it would be called for each element of any collection given to addAll.

yes! had it not been mentioned in the book , that little one liner on the addAll() documentation about it throwing an UnsupportedOperationException unless add() had an override, would not have been enough for me to understand that addAll() calls add() from inside of it.. it would have been better if the documentations had mentioned these facts more clearly.

somjit{} 60 Junior Poster in Training Featured Poster

the following is taken from joshua bloch's effective java. pg 82:

public class InstrumentedHashSet<E> extends HashSet<E> {
    // The number of attempted element insertions
    private int addCount = 0;
    public InstrumentedHashSet() {
    }
    public InstrumentedHashSet(int initCap, float loadFactor) {
        super(initCap, loadFactor);
    }
    @Override public boolean add(E e) {
        addCount++;
        return super.add(e);
    }
    @Override public boolean addAll(Collection<? extends E> c) {
        addCount += c.size();
        return super.addAll(c);
    }
    public int getAddCount() {
        return addCount;
    }
}

my question is that how come super.addAll() invokes the overridden add() method instead of the add() method of the supeclass? the book says that doing this :

InstrumentedHashSet<String> s = new InstrumentedHashSet<String>();
s.addAll(Arrays.asList("Snap", "Crackle", "Pop"));

would give count result as 6 instead of 3 , as the count is first incremented in the overridden addAll() method , then super.addAll() invokes the overridden add() method where the counts are incremented again. i dont understand why the overridden add() gets invoked like this. also , i read the docs about addAll() , the only info it has about the linked add() method is this

Note that this implementation will throw an UnsupportedOperationException unless add is overridden (assuming the specified collection is non-empty).

this also , i felt was a little tight on info... asleast to less expirienced programmers...

somjit{} 60 Junior Poster in Training Featured Poster

??? Nobody has any such method! There is a toDate(String str) method, and it's obvious where that gets its String.

the static part was troubling me a bit , so i posted. it works im sure , but i felt a little more info would have been more helpful.

somjit{} 60 Junior Poster in Training Featured Poster

godzab : from where will your toDate() method get its string? from a constructor? if that is so , then this will not work. the static will run before the constructor , so it will not know from where to get the string the code mentions.

else , if you wish to do something like

    public static void main(String args[]) {
        String s = "2013/april/27"; // the input string
        Date.toDate(s); // no "new" here , just calling the static directly and calling the constructor from within it
        .
        .
        .

imo , the toString() method becomes redundant , as you no longer can do something like this

System.out.println("output : " + DateObject); // DateObject would be the instance created in main through the "new" keyword

im not saying it wont work , but you provided too little information on how that code should be implemented.

somjit{} 60 Junior Poster in Training Featured Poster

in java , if you dont provide a constructor , java provides one for you , but if you do give one , then java will follow that constructor only. you have a constructor for objectView , but you dont put anything inside it. plus , i dont think i saw any main method in your code, that would have helped in understanding your problem. also , line 45 , whats with the new FileObject ?

somjit{} 60 Junior Poster in Training Featured Poster

you need to make sure that the adapater actually exists on your host (you will see it in the Network Connections appplet.

4bfaeb06e58204916c4a484c2adf4913

on my host's network connections window , it seems to be there , well and connected... im sorry i didnt get the part you said after that...

somjit{} 60 Junior Poster in Training Featured Poster

hmm.. then somethings not right.

somjit{} 60 Junior Poster in Training Featured Poster

i do agree.
gave that link because it was the simplest one (to read an understand) amongst the few that turned up with a quick google. my bad that i didnt explain the protected access modifier's effect/limitations in that second example. however, you did it in a more short-n-sweet way than i could have. thanks :)

somjit{} 60 Junior Poster in Training Featured Poster

this might help you.

somjit{} 60 Junior Poster in Training Featured Poster

DHCP is configured it seems , it has ip , mask n everything. also , ping seems to on the ipv4 address obtained from the adapter page of Virtual Box, but the ip i get from ipconfig on the guest cmd , pinging that from the host results in request time out. is this normal? i dont understand why this is like so..

from the basic networking classes , i think i remember the dhcp being pinged first , and then it provides a dynamic ip from its pool. i thought i try pinging the dhcp server , but it didnt do anything. also pinging my (host) ip from the guest showed destination not reachable , so that i suppose is because the adapter is "host only" and allows host-to-guest link , not the other way round? is that so?

somjit{} 60 Junior Poster in Training Featured Poster

@JorgeM : i did try it , but got a request timeout. i dont need anything for multiple hosts.. just one host. and by windows-windows solution i meant windows host - windows guest solution.

@cimmerianX : it does have a host only adapter listed there... but im not sure what to do further as pinging from host to guest from cmd @ host is giving request timeout.

somjit{} 60 Junior Poster in Training Featured Poster

the compiler will work fine. but it exposes you to a lot of stuff out there you wouldnt want your machine to be visited by.

somjit{} 60 Junior Poster in Training Featured Poster

my host is XP sp2 , and virtual box guest is XP SP3. i want to access the guest from the host. I read and felt that a host-only network is what i want.( ill be using it to use database loaded on guest from the host). i googled it , but found no windows-windows solution... any help please?

somjit{} 60 Junior Poster in Training Featured Poster

downloaded the 5.6 version , and it needs sp3. guess ill just have to go with 5.5.

somjit{} 60 Junior Poster in Training Featured Poster

@pritaeas: thanks for the fast reply :)

im just gonna do this for learning purposes, so if i install 5.5 instead of 5.6 , do you think that would be good idea? the 5.6 version is a big file , and my connection is slowwww... so i just want to make sure whatever i download will work properly...

somjit{} 60 Junior Poster in Training Featured Poster

i basically need mySQL for learning JDBC connections. will be thankful to any information regarding this matter. didnt find anything concrete on the net...

somjit{} 60 Junior Poster in Training Featured Poster

what i felt from the instructions :

  1. create a student class
  2. write the private instance variables
  3. overload the default constructor with social security number and GPA arguments
  4. write the public getters/setters etc , and also , override toString() and equals()
  5. then write a main method ( this is your test client )
  6. create new instances of students inside main, passing in social security number , GPA etc feilds in the constructor itself
  7. print them out in any manner you like.
somjit{} 60 Junior Poster in Training Featured Poster

recently , iv started using both Visual Studio 2010 (to learn C#) and i came across eclipse WindowsBuilder ( and i'm loving it.. ).
so i was wondering how do these two compare against each other ... strengths and weaknesses ?
iv only begun using VS , but i do like how easily (with a mouse clicks) it makes the connection between the database and the code, i suppose that would be an advantage over java?

ps: posted this thread here for i wasnt sure in whether to post this in the java or the C# forums.

somjit{} 60 Junior Poster in Training Featured Poster

though not related to the problem (which IIM solves above) , but , you should update your java version.
A lot of nasty things are roaming all over cyberspace , each new update helps in making the holes a bit smaller for them to enter your system through.

somjit{} 60 Junior Poster in Training Featured Poster

im not quite sure how to do that... i tried clicking on the forms , going to their properties and copy pasting the path , but didnt work..

edit : i was running from inside a virtual xp , and i double clicked on the files without extracting them first. that was causing the problem. its working now. :) thanks for the help.

somjit{} 60 Junior Poster in Training Featured Poster

hi everyone :)

im trying to open this project , but when i double click it , vs2010 opens with error on the forms. double clicking the forms shows that the file doesnt exist at the particular directory , even when its visibly there. its probably a trivial thing , happening coz of some silly mistake on my part , but being new to this , i cant figure out what.
im posting a screenshot below. some help will be great :)

somjit{} 60 Junior Poster in Training Featured Poster

drag-and-drop

eclipse + windowsBuilder also allows that.
regarding the books , did some googling around... in depth C# seems like a good book. thanks for helping.

somjit{} 60 Junior Poster in Training Featured Poster

can the members suggest some books/links that takes advantage of what i already know about oop (the basics , from java) and utilises it to make learning C# a faster process?
perhaps i should have posted this on the C# forums , felt i should keep it here as my reference is java.

somjit{} 60 Junior Poster in Training Featured Poster

@OP : bguild points out the core of your problem, unless you solve that , nothings gonna work out..
also , another part you might wish to take notice of is your use of the this keyword.

public void setDepartment (String dept) { //setter for department
    this.Department = dept;

you dont need to use this here , as the name of the argument passed is different to the name of the instance variable. if they were same , this would have been needed, but since thats not the case , its reduntant to use this here.

ps : a personal opinion : comments are powerful , and is a good practice to follow , however too much of a good thing isnt necessarily better. putting comments on almost every line makes the code look cluttered up. keep 'em where it impacts the most.

somjit{} 60 Junior Poster in Training Featured Poster

if you dont understand the problem yourself... it would be better to first clear it out from your teacher.
As it stand now , its hard for us to help out as the problem itself isnt clear. you can post back here after you clear that part out , or mark it solved , 'cause none of us know what to solve in the first place.

somjit{} 60 Junior Poster in Training Featured Poster

@ vinnitro , stuggie : i like learning from the web , and yes i have heard a lot good things about the site for learning html. However, i kind of share M's idea in that some other posts here in daniweb mentioned that they practised not the best styles , and had errors in a number of places, and that it would better to learn from a recent book updated with modern practises. so i got the 2nd edition (released middle of last year) head first HTML n CSS book, and i love it. (as with all the other books of their series.)

@EvolutionFallen , jorgeM : its great to learn from experience of those who have been there and done that. Thanks for clearing my ideas. i now know the path im hoing to move ahead in. :)

thanks a lot everyone for helping me out :)

somjit{} 60 Junior Poster in Training Featured Poster

i ran your code , seems to work...

perhaps i didnt get your problem. by the way ,

The largest row index : 2
The largest column index : 2,3

i know i didnt understand that part...

somjit{} 60 Junior Poster in Training Featured Poster

no problem :)

let me just talk a bit about objects and comparisons and sorting a bit , since that was a part the problem in your post.

in the original code you posted , you mentioned comparing instances of objects , using comparing methods (your compareMoney method ) but as you see , those are not needed , as you only have one feild to compare : money , which , being an integer ,( and not some abstract stuff like potatoes , eggs , basketball etc etc .. ) makes life easy as java has in built methods for them.

such object comparisons with methods for comparions are required for more abstract data types . an example could be sorting a list of schools based on different parameters at different times. you may want to sort them by the color of their uniforms , to the size of their football feilds to the number of students in each school. so in this case , to compare and sort based on the integer value of student population , you can use a method called compareTo() which is from the comparable() interface . it sorts stuff on natural ordering , which , integer happens to follow. on the other hand , if you want to compare abstact stuff , probably a comparator is a better bet. i did post a link in one of my earlier posts. go through them if you feel these things will be useful to you …

somjit{} 60 Junior Poster in Training Featured Poster

thankyou :)

somjit{} 60 Junior Poster in Training Featured Poster

i was thinking of downloading some database software that would help me learn sql. so far i have only read sql , ie havent done any practical sort of thing. i made a post earlier in this forum , where i was told that sql server express will be a good option. but when i went to this download page , there are so many options and im not sure which one to download... can anyone help me in this regard?

somjit{} 60 Junior Poster in Training Featured Poster

i saw a few videos on installing apache web server , but they talked about making the webserver visible to all by port forwarding port 80. do i have to do that? since im doing this just to learn , i guess ill be fine without forwarding?

somjit{} 60 Junior Poster in Training Featured Poster

this is just a simple bare bones code , no comparators , comparables , any of that stuff. simple code that takes in any number of money values , and prints out the biggest one. it should give you some ideas , and help you extend it further if and when you choose to.

import java.util.*;

public class MoneyDriver {
    public static void main(String[] args) {
        Money greens = new Money();
        int biggest = greens.biggest();
        int cents = biggest % 100;
        int dollars = biggest / 100;
        System.out.format("the highest money value entered is : %d:%d cents",
                dollars, cents);
    }
}

class Money {

    private Integer value;
    Scanner is = new Scanner(System.in);
    ArrayList<Integer> valueArray = new ArrayList<Integer>();

    public Money() {
        System.out.println("number of moneyObjects you want to make : ");
        int num = is.nextInt();
        for (int i = 0; i < num; i++) {
            System.out.println("enter dollars and cents : ");
            int dollars = is.nextInt();
            int cents = is.nextInt();
            value = dollars * 100 + cents;
            valueArray.add(value);
        }

    }

    public int biggest() {
        Collections.sort(valueArray);
        return valueArray.get(valueArray.size() - 1);
    }

    public String toString() {
        return String.format("money class last modified with %d entries",
                valueArray.size());

    }

}
somjit{} 60 Junior Poster in Training Featured Poster

i see , so i guess im good for now. but for when i decide to create my own websites (free or not) , can you guys suggest some good links? i guess that would wrap it all up. :)

somjit{} 60 Junior Poster in Training Featured Poster

your doing the same thing as before

        dollars = dollars;
        cents = dollars;

but im not gonna talk about code now, lets move away from the code , lets think of the algorithm , when i dont get my codes to do what i want , iv found that explaining the algorithm to myself , in detail , often with a pen and paper , helps see errors i was jumping over before. try it , and explain in detail steps what you want your code to do.

ill give you a starting hint , related to the error above :

1 > get input from the user;
2 > put the value to the instance of the class

these are the basic stuff you want to do , but you see , your overlooking the "instance of the class" part (for starters) . first create an instance , like

Money greens = new Money(); // green is the reference to this brand new instance of the Money class your giving birth to here
.
// take user input , play with mr.scanner
.
.
greens.setValue(dollars , cents);

this code needs a few things , a refernce , thats the greens thingy , and then the code will take user input and put it into dollars and cents variable of the main method (emphasis on : main method) . these values will be passed to a setter , the setValue(int dollars ,int cents)

somjit{} 60 Junior Poster in Training Featured Poster

i have notepad++ , does that count?

somjit{} 60 Junior Poster in Training Featured Poster

have you made changes to your code? if so .. post 'em here , code is always better than words :)

somjit{} 60 Junior Poster in Training Featured Poster

Once you've got to grips with the basics of HTML and CSS, have a go at installing a web server locally. That way you can create your own websites locally, for free. As many as you like :-)
Two popular web servers are IIS and Apache, both of which are available for free.

that sounds great! thanks :)
any links / tutorials for when i decide to do them? ( as iv just started , and its probably gonna be a little while since i get upto that point)

@JorgeM :

Now, back to learning HTML and CSS. You dont need anything. All you need is a text editor on your computer and a browser. For HTML and CSS, no web server, no web site is needed. Just your .HTML files and a browser.

yaaayyyy!!! :D

its getting clearer now, sorry iv i was a bit thick , yeah i am going the notepad++ + chrome way , just stuff gets confusing once in a while , and thats when i post on daniweb :)

somjit{} 60 Junior Poster in Training Featured Poster

JorgeM : i want to avoid having to buy a domain , because i dont understand much of it now . i just only started a few days ago , and i made the post to ask if not having a website will slow down , or hamper learning proper html or css. im not learning java script at present , maybe in the near future, after getting these done. :)

but if i do have to buy one ... is there any affordable option you can suggest ? ill only be doing it for the learning part. nothing else , so perhaps i dont need anything fancy...

@stuggie :

If you are a student then learn everything you can about html, css, and even javascript

yes , i want to learn as much as i can , and from the examples you gave , im thinking getting a website will help. but i really dont have a clue about which hosting company to choose. being a student whose aim for buying a domain is just to learn html n css , i would like the most cost effective / less expensive (cheap sounds like a bad word) domain plan.... some suggestions on that will be great :)

thanks for the fast replies :)

somjit{} 60 Junior Poster in Training Featured Poster

I don't think you should be referencing a book where you already need a website

sorry , im afraid i didnt get you there...
i dont know if i need a website or not , and regarding the book , im only on the early chapters..