Question about efficiency, should i use hashmap?

Hi all
i read a csv file and store each line's data into a class MyData.
this class contains a variable of id - unique for object.
i want to store all my MyData object in a collection for later use.
if i want to access them in the fastest way, should i store my objects in a hashmap, and the key value would be their id?
like -
HashMap hashmap = new HashMap();
MyClass mc1 = new MyClass(1); //id =1
MyClass mc2 = new MyClass(4); //id =4
//i add the objects
hashmap.put(mc1.getID(),mc1);
hashmap,put(mc2.getID(),mc2);
//then when i want to get a certain object, where id is 4:
MyClass mc = hashmap.get(4);should i use other collection? or is it fine that way?
Thanks!

jwenting wrote:
don't worry about microoptimisations like selecting a collection class based on how fast it is unless and until you have written evidence that the class you had initially chosen was the sole reason for unacceptably poor performance (which will hardly ever matter, the only time I've ever encountered that was with an ancient web application making extensive use of Vector, where switching to ArrayList made it an order of magnitude faster).Hmmm... I do diagree with that statement, but then again I'm an old f@rt... I cut my teeth on the gory gizzards of all manor of data-structures, and I still believe that selection of the "correct" data structure(s) is a core implementation issue... especially where efficiency is (even occasionally) desirable.
I haven't seen the same big gains when replacing Vector with ArrayList... in fact, I've only seen a very marginal (<10%) increase in "overall" throughput... I have seen a couple of orders of magnitude (or thereabouts) increase when I swapped a Vector<Integer> for an int[], but that was in the inner-loop of an inherently n^2 (I think) spatial algorithm.... and I also made it reuse the int[], instead of creating, growing and throwing away the vector every time through the outer loop. Malloc is expensive ;-)
I'd be interested to hear more details about under the conditions under which ArrayList is 10 times faster than Vector, because I do a lot of work on a 1.3/1.4 era codebase, which is full of Vectors and HashTables... and I would like to be able to make a case for an en mass replacement (and generifying) of the "old school" datastructures... but alas, I see very little bang for our buck, so I just bite my toungue and continue using Vectors, even in new code, because so many existing "helpers" take a (explicitly) Vector parameter.
I heard a "rumor" somewhere (probably a thread here) that there's talk of discontinueing support for non-generic collections in 1.7, because they (the API/VM developers) are having to (sort of) maintain two divergent versions of every collection related thing... and nothing annoys a developer more than that, right... so Please can anyone confirm or repudiate this "rumour".
Cheers. Keith.

Similar Messages

  • Question about running a servelt using HTML form.

    Hi, Im new to Servlets , I have created a servelt with this code :
    package oracle.servlets;
    import java.io.IOException;
    import java.io.PrintWriter;
    import java.sql.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class LoginServlet extends HttpServlet {
        private static final String CONTENT_TYPE = "text/html; charset=windows-1252";
        private static final String DB_URL = "jdbc:oracle:thin:@localhost:1521:ahmaddb";
        private static final String DB_USERNAME = "fundinfo";
        private static final String DB_PASSWORD = "tadapps";
        private static Connection con;
        private String pass;
        private String name;
    /*init() : invoked by the servlet engine before the servicing of client requests
    - Can be used to retrieve initialization parameters
    – Takes a ServletConfig object as a parameter
    – Is invoked when the servlet instance is created
    – Is useful for obtaining database connections from a connection pool*/
        public void init(ServletConfig config) throws ServletException {
            super.init(config);
            //config.getInitParameter(arg0);
        public void doGet(HttpServletRequest request,
                          HttpServletResponse response) throws ServletException,
                                                               IOException {
    response.setContentType(CONTENT_TYPE);
            //PrintWriter : Print formatted representations of objects to a text-output stream.
            //getWriter() : Returns a PrintWriter object that can send character text to the client.
            PrintWriter out = response.getWriter();
            out.println("<html>");
            out.println("<head><title>My First Servlet</title></head>");
            out.println("<body>");
            out.println("<p>The servlet has received a GET. This is the reply.</p>");
            out.println("</body></html>");
            out.close();
        public void doPost(HttpServletRequest request,
                           HttpServletResponse response) throws ServletException,
                                                                IOException {
            response.setContentType(CONTENT_TYPE);
            PrintWriter out = response.getWriter();
            name = request.getParameter("user_name");
            pass = request.getParameter("user_password");
            boolean result = verifyPassword(name, pass);
            out.println("<html>");
            out.println("<head><title>LoginServlet</title></head>");
            out.println("<body>");
            if (result == true){
            out.println ("Hello " + name + ": Your login module is working great!");
            else{
            out.println ("Invalid user name or password");
            out.println ("</body></html>");
            out.close();
            // out.println("<p>The servlet has received a POST. This is the reply.</p>");
            //out.println("</body></html>");
            //out.close();
        public void configureConnection() throws SQLException {
        try{
        Class.forName("oracle.jdbc.OracleDriver");
        con = DriverManager.getConnection(DB_URL, DB_USERNAME,DB_PASSWORD);
        con.setAutoCommit(true);
        catch (Exception e){
        System.out.println("Connection failed: " +e.toString());
        public Connection getConnection() throws SQLException
        configureConnection();
        return con;
        protected boolean verifyPassword(String theuser, String password) {
        String originalPassword = null;
        try {
        con = getConnection();
        Statement stmt = con.createStatement();
        stmt.executeQuery("select password from login where uname='"+theuser+"'");
        ResultSet rs = stmt.getResultSet();
        if(rs.next())
        //>>
        originalPassword = rs.getString(1);
        stmt.close();
        if(originalPassword.equals(password)) {
        return true;
        else {
        return false;
        catch (Exception e){
        System.out.println("Exception in verifyPassword()="+e.toString());
        return false;
    }and created an HTML form to target this servlet
    <form action="/loginservlet" method="post">,
    when I enter the the credintials I get this output in the webpage :
    Error 404--Not Found
    From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:
    10.4.5 404 Not Found
    The server has not found anything matching the Request-URI. No indication is given of whether the condition is temporary or permanent.
    If the server does not wish to make this information available to the client, the status code 403 (Forbidden) can be used instead. The 410 (Gone) status code SHOULD be used if the server knows, through some internally configurable mechanism, that an old resource is permanently unavailable and has no forwarding address.

    Thanks , yes it is added to the web.xml
    <?xml version = '1.0' encoding = 'windows-1252'?>
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5" xmlns="http://java.sun.com/xml/ns/javaee">
        <description>Empty web.xml file for Web Application</description>
        <servlet>
            <servlet-name>LoginServlet</servlet-name>
            <servlet-class>oracle.servlets.LoginServlet</servlet-class>
        </servlet>
        <servlet-mapping>
            <servlet-name>LoginServlet</servlet-name>
            <url-pattern>/loginservlet</url-pattern>
        </servlet-mapping>
        <session-config>
            <session-timeout>35</session-timeout>
        </session-config>
        <mime-mapping>
            <extension>html</extension>
            <mime-type>text/html</mime-type>
        </mime-mapping>
        <mime-mapping>
            <extension>txt</extension>
            <mime-type>text/plain</mime-type>
        </mime-mapping>
    </web-app>Anymore suggestions?

  • Questions about controlling fans.. using programs like smcFan Controll

    I am in Brazil and the high of the day is like in the 80's so my temps on my MacBook Pro jump to 150 F, I was wondering if I should use a program to increase my fan speed. For some reason even if the temps jump to 150 (F) my Mac doesn't up my fan speed. Is that normal? Should I use some program, such as smcFan Control to up my RPM's on the fans?
    Thanks for the responses!

    Yes, from anecdotal reports here that seems to be true, but it's not much sooner — just a little.
    But it isn't the operating system that makes the difference; it's that the hardware itself is tuned a little differently. From the fact that your machine was able to run OS X 10.5.8, I was able to tell that it wasn't one of the newer machines. It may be that the threshold of danger from overheating with the i5 and i7 processors is a bit lower than the 105°C/221°F for your Core 2 Duo; I don't know for sure.

  • Question about file size when using "Export for Web"

    Hi!
    I created a .mov file and worked to get a great balance between file size and quality so that I could deliver it via the web and make it easier for end users to see the video on a slower connection.
    My question: When I use "Export for Web," my .mov file is converted into a very large .m4v file--more than double the size of the original file. I know that this export option is to optimize the file for a wide variety of users/internet speeds. Am I correct in guessing that the end size is not an issue? I would post the .mov file instead, but I really like the option of embedding into a html page along with the "click to play" option.
    Bottom line--is it better to post the smaller .mov file that i originally started with or to go ahead and link to the bigger .m4v file that was created with the "Export for Web" option?

    "Export for Web" is a feature of QuickTime Pro and it makes 4 files and the html page code for easy copy/paste Web page editing.
    The very first file is called a "reference movie" and it links to the other 3 files (56kbps, 900kbps and 1.5Mbps). It, and the page code, "read" the connection speed of the viewing hardware and "serve up" the correct file based on that connection speed.
    In nearly all cases the "Desktop" version would still be smaller in file size than the original source. The times the file would "increase" in file size would be when an already compressed was used as the source file. You can find out more about your source file by opening it in QuickTime Player and viewing the Movie Inspector window information.
    There are dozens of other html "tricks" that could be used if your source file is already compressed but you want a different display size:
    Page code to show "aspect" or scale="tofit". This code allows values "outside" of those found in the actual QuickTime file be used for the Web page display. A 320X240 QuickTime .mov file looks pretty good at double size (640X480) but the file size would still be that of the source file.
    "Poster Movie" is another html trick that loads the Web based file directly in the QuickTime Player application (bypassing Web page layout restrictions). These files are also known as "Presentation Movies".
    Another method is the QuickTime Media Link file (.qtl). These are simple text based files that are used as a "direct link". These use simple XML (Extensible Markup Language) and are easily created in any text editing application. The simple syntax has amazing control over a simple QuickTime .mov file. You can launch (and quit) the QuickTime Player, display at other dimensions and even embed "links" inside the display.
    Some of my files as examples:
    http://homepage.mac.com/kkirkster/Lemon_Trees/ a "Poster Movie" style.
    http://homepage.mac.com/kkirkster/.Public/RedneckTexasChristmas.qtl
    A QuickTime Media Link file. A tiny file should download to the viewing machine, launch QuickTime Player, present the movie and it even includes a "link" to my Web page.
    Edit: It appears you must now double click the .qtl download to launch QuickTime.

  • General question about storage, networking, and using large amounts of data

    I have been using a powermac tower G5 up until now. I bought my daughter a macbook pro 15" i7, talk about a zippy little machine. What a screamer. I can't believe how fast it is with final cut express, Aperture, and Photoshop. I tend to use higher end stuff, video, photos, etc. Hence I need not only a good fast processor, but the storage....need lots of hard disk space.
    oh, did I mention I bought this for my daughter who's about to go off to college? Heh, when I'm home, she loses the machine to me.... *evil grin*
    Anyways, I haven't considered using a laptop before for me personally as I just don't care for the small screen size, no mouse, and things like that.
    Seems I've changed my opinion, esp seeing as the new mouse track pad is a game changer. I still am not crazy about the small screen size, but I can get over it.
    The one thing I can't get around is the small disk storage. I have 4 TB on my big machine. Between my video, photography, and music, I am nearing a full TB of just raw stuff. If I count all the things I've stored, especially finished videos I make of photography projects, well you can image the chomping that occurs on disk storage.
    So what is a man to do about storage?
    I'm really getting hooked on this zippy little machine. The idea of dragging it around is compelling. Having my work not tied to a desk is fun.
    but the lack of storage is sucky, terribly so.
    I have one possible option, taking the G5 and making it a server. I can use it for backup and high speed transfer, working on the transfer part today.
    I thought I'd poll the collective wisdom of the community and see what do you peeps think is the best overall way to handle such a situation?
    What is the absolute fastest best way to use external drives? Firewire 800 is ok, but when working with 400gb aperture database files....
    I'm hoping there is some way to start posturing myself to really use a laptop for my full computing experience.
    Or am I trying to make a small portable machine act like a tower? Is this not a reasonable hope at this point in time?
    I'm open to suggestions. I'm going to purchase something when my daughter takes this laptop with her to college. Either a new mac pro tower or laptop. I love the portability but need speed and massive storage.
    Thanks for opining.

    Storage:
    1. Replace the drive with a larger one. Up to 1 TB is now available for notebook drives.
    2. Get a portable external drive for additional storage needs. See the options at OWC as an example.
    Drive speed:
    1. FW 800 should be fast enough for your work. If the computer has an ExpressCard slot then consider a card supporting full speed eSATA. You may then achieve speeds closer to the internal bus.
    A laptop is not a tower so stop thinking of or comparing to your tower. Besides the laptop's speed compared to your G5 is more like comparing a Ford Focus to a Ferrari F150.
    As for "polling" opinions here: polling is forbidden by the forums' Terms of Use.

  • Question about "Edit Edit Original", and a question about efficiency.

    I have a background image that I have imported (placed) inside my Indesign document. Problem is that I can't tell how the image will look against the other Indesign layers until I actually import "place" the image. I find myself having to keep going back into photoshop to adjust the hue/saturation or use the brush tool for adjustments. I then save, and from Indesign I update the link.
    Having to do this 6 or 7 times in a row until I am satisfied, seems like a huge waste of time. It just seems like it would be SO much easier and less time consuming if I could edit my image in the Indesign image. Is there a workaround?
    Here is an analogy. To me it's like an artist painting, but having to run into another room to dip his brush. He rushes back to his painting only to find that he needed just a little bit more yellow added to his white...so he has to run all the way back into the paint room to dip his brush again. I'm sure there is a reason for this work method in Indesign, but I'm just a little confused with it.
    Question #2: I have tried going to "Edit>Edit original" in InDesign. Problem is, that the "preview" app pops up instead of photoshop, because I like my psd's and jpgs to automatically open in preview for quick viewing purposes. I've read that the work around is to go into Bridge and change the way a program opens a certain type of image. I did this..I changed it so Photoshop and Indesign should open jpgs by default, yet still allow the osx operating system to still open them in "preview". I tried restarting Indesign to see if it was just something that required a restart to take effect. It still opens "Preview" when I go to Edit>Edit Original.

    CS4 adds an edit with feature...other than that sorry, Photoshop is
    where you'll need to do the editing.
    Bob

  • A zillion questions about setting up and using external hard drive

    Hello. I recently purchased a Cavalry 440GB CACE USB/FW800 7200 RPM 3.5 in Mac Formatted hard drive. My Mac is a Power PC G4 using OS X 10.2.8.
    After much back and forth with the Cavalry support desk, I was able to connect it to my Mac. (The USB cable included was not compatible--fortunately, my printer cable was.)
    Through Disk Utility I see that my Mac is detecting the hard drive, but there's no icon on my desktop. My questions are as follows:
    1. How do I get the icon on my desktop?
    2. It was suggested on this board to partition the hard drive. What exactly is partitioning, and is it necessary?
    3. If I do partition the hard drive, into how many partitions should I make it?
    4. Once the number of partitions is set, can that number be changed? In other words, can it be repartioned without erasing anything?
    5. My main purpose for getting the external hard drive is to move all my movies off my Mac. I'm sure I will want to back up other files as well. Should I create one partition for all the movies, and one for photos, one for files, etc.?
    6. Once I get the icon on my desktop, is transferring files as simple as dragging the files onto the icon?
    7. Once I move files to the hard drive, is it simple to move them back to the Mac if I need to use them again?
    OK, that's all for now. I appreciate your patience in dealing with all my questions! Thanks.

    Hello, 
    I'll try my best on the first seven. The remaining zillion minus seven questions will have to wait!
    1. If the drive really is Mac-formatted it should just appear. Firstly check that hard disks are set to appear on the desktop. In the Finder go to Finder > Preferences... >General tab and ensure that the box to show hard disks on the desktop is checked. If that doesn't work go to Macintosh HD > Applications > Utilities >Disk Utility. Select the drive in the left hand pane and then click on the "Erase" tab. Erase the disk and ensure the format is "Mac OS Extended (with Journalling)".
    2. Partitioning is splitting the physically drive into two or more volumes. This will allow you to compartmentalise your data. You will have two or more icons appear on the desktop if you do partition. Although they are on the same physical disk you will be limited on each of the volumes to the size you set at the time of partitioning. If you do partition the drive be sure to use the "Apple Partition Map" not "GUID Partition Map". The latter is for Intel Macs.
    3. Whatever you want. My experience is that too many partitions and you loose flexibility in your storage space. Personally on my external drive I have a partition that is exactly the same size as my internal hard drive. I then use that to do a regular clone backup. I then have a second partition for general use. This means I can put files on the external but still guarantee I have enough spare to backup fully.
    4. No. Not without third party tools.
    5. As I said above, in my opinion the best use is to create a partition for backup and a partition for all other use.
    6. Yes absolutely. However if you plan on moving libraries like iTunes or iPhoto then you'll need to show the applications where the libraries are again.
    7. Yes.
    Some extra pointers:
    A. Use Carbon Copy Cloner to backup your internal drive to the external. Clones are fantastic backups as even if the internal drive bursts into flames you will have an identical copy of all user data and settings: http://www.bombich.com/software/ccc.html (scroll to the very bottom for the version suitable for 10.2.8).
    B. Don't use USB to connect the hard drive it's not very fast. Firewire 400 is significantly faster and will allow the iMac to be booted from the external drive in an emergency (USB will not boot a G4 Mac).
    Hope that helps a little.
    mrtotes

  • Satellite 2410: Question about different ways to use BlueTooth

    Hi,
    I'm having trouble finding somewhere to purchase a bluetooth module for my Toshiba Satellite 2410 - the handbook says I can, and I know there is space on the underside of the laptop to insert it.
    I just can't seem to find one to buy - does anybody know if they actually exist, as I am beginning to think not??!...or is the cheapest way to bluetooth enable the laptop to buy a USB adaptor?
    If so, will a cheap one affect the download rate when using the Internet?? And what is the difference between an SD card and a USB bluetooth adaptor?
    Any help would be much appreciated.

    Well, with the detailed name I mean the full notebook number Satellite 2410-xxx.
    However, you ask what a difference between Wireless Lan and Bluetooth.
    The WLan is technology which allows you using or/and to create a LAN but without the cables.
    ;) The Wlan routers for example allow you to connect to the internet without the cable connection.
    Bluetooth technology:
    If device like (mobile phones, printer, etc) support BT technology and you notebook uses also a BT so it's possible to connect these devices without cables. The devices should be placed in the available range.
    I would recommend searching a little bit in the internet for more information about Wlan and Bluetooth

  • Question about creating new tables using SQL script in WebLogic Server

    Hi,
    I am new to WebLogic and I am following a book Java EE Development with Eclipse published by PACKT Publishing to learn
    Java EE.  I have installed Oracle Enterprise Pack for Eclipse on the PC and I am able to log into the WebLogic Server Administration Console
    and set up a Data Source.  However the next step is to create tables for the database.  The book says that the tables can be created using
    SQL script run from the SQL command line.
    I cannot see any way of inputting SQL script into the WebLogic Server Admistration Console.  Aslo there is no SQL Command line in DOS.
    Thanks  for your help.
    Brian.

    Sounds like you are to run the scripts provided by a tutorial to create the tables, right?  In that case, you may need to install an Oracle client to connect to your database.  The client is automatically installed with the database, so if you have access to the server that hosts the database, you should be able to run SQLplus from there.
    As far as I know, there is no way to run a script from the Admin Console.  I could be wrong, however.

  • Question about implementing a clock using a Timer object

    Hello all, I'm not sure if this is the correct forum to post this question but I think so, as it regards a Swing component. I want to add a timer (a clock that starts at 0:00 and keeps track of how long the app is running) to a frame. I am just curious if using a Timer is the proper way to keep track of time, and just repaint() the clock object every second? (or more frequently if desired)... or is there a better way to do this? Thanks in advance for any comments/feedback/help!
    Brian

    Hello,
    Timer is not accurate. You can use Timer to display your component repeteadly, and System.currentTimeMillis() at each call to deduce the elapsed time.

  • E-recruimtment: Question about landscape standalone with use of MSS view

    Hi ,
    Has anyone already done an implementation of E-recruitment with the use of MSS view ?
    Or have you reliable information about the combination landscape - manager view ?
    For security reasons the choice for the landscape standalone is the best.
    But in documentation of SAP we have read that the Manager view isn't possible in a standalone landscape:
    ERP installation (Recruiting as integral part of the ERP solution)
    - Required for MSS Manager Role integration and ESS integration
    Kind Regards
    Pascale

    Hello Pascale,
    perhaps we mixed up some things according to the manager involvment. There are 2 different solutions.
    There is the "internal" e-recruiting solution for manager involvement. This is delivered in 2 separate roles requester and decision maker but usually joined to one manager or hiring department view / startpage.
    There is an bsp application for requesting requisitions. The manager can create them, fill in the data he knows and then he sends it to his hr clerk respondible for his requests who adds all stuff missing, checks if it's ok with budget / headcount and then publishes it in the jobborads. In Addition there is an application which provides the mangager with a list of candidates he has to check and fill a questionaire for e.g. to decide if he wants the candate for an interview.
    Both applications are parts of the e-recruiting delivery. They have nothing to do with the MSS. They are accessed via a startpage for the amnager and run on the e-recruiting server.
    On the other hand there is nearly the same functionality delivered as part of the MSS. The result is nearly the same just the user interface differs. The requisition request is not done in an bsp application but an Adobe Interactive Form (which requires an ADS Server). The intention of this is to rebuild you old paper requisition request in an interactive form and map the data to the e-recruiting requisition. So you train your managers to use a web version of the old form instad of using e-recruiting. Of course if you already use other mss functions everything will be in the same fancy frontend and you do not need to log in twice if you have no SSO. As far as I heard the ADS license alone costs 50k and then youhave the rollout cost and licence cost for the MSS. You have to decide if it is worth it.
    The candidate list for questionairs to fill is also available in the MSS scenario.
    The MSS solution requires e-recruiting 600 and an hr core system on ECC6.0 (ERP2005) with the newest enhancement package. The MSS is installed and processed on the hr core server no matter if you use an integrated or a standalone installation for e-recruiting.
    Best Regards
    Roman Weise

  • Question about static context when using classes

    hey there.
    i'm pretty new to java an here's my problem:
    public class kreise {
         public static void main (String[] args) {
             //creating the circles
             create a = new create(1,4,3);
             create b = new create(7,2,5);
             System.out.println(a);
             System.out.println(b);
             //diameters...unimportant right now
             getDiameter a_ = new getDiameter(a.radius);
             getDiameter b_ = new getDiameter(b.radius);
             System.out.println(a_);
             System.out.println(b_);
             //moving the circles
             double x = 2;
             double y = 9;
             double z = 3;
             a = create.move();
             System.out.println(a);
    }creating a circle makes use of the class create which looks like this:
    public class create {
        public double k1;
        public double k2;
        public double radius;
        public create(double x,double y,double r) {
            k1 = x;
            k2 = y;
            radius = r;
        public create move() {
            k1 = 1;
            k2 = 1;
            radius = 3;
            return new create (k1,k2,radius);
        public String toString() {
        return "Koordinaten: "+k1+" / "+k2+". Radius: "+radius;
    }now that's all totally fine, but when i try to usw create.move to change the circles coordinates the compiler says that the non-static method move() can't be referenced from a static context. so far i've seen that my main() funktion MUST be static. when declaring the doubles k1, k2, and radius in create() static it works, but then of course when having created the second circle it overwrites the first one.
    i pretty much have the feeling this is very much a standard beginner problem, but searching for the topic never really brought up my problem exactly. thanks in advance!

    You can't access a non-static method from within a static context. So, you have to call move() from outside of the main method. main has to be static because, in short, at least one method has to be static because there haven't been any objects initialized when the program is started. There are more fundamental problems than with just the static context issue.
    I'm confused by your code though. You call create.move(), but this would only be possible if move() was static, and from what I see, it's not. Now that's just one part of it. My second issue is that the logic behind the move() method is very messy. You shouldn't return a newly instantiated object, instead it should just change the fields of the current object. Also as a general rule, instance fields should be private; you have them as public, and this would be problematic because anything can access it.
    Have you heard of getters and setters? That would be what I recommend.
    Now, also, when you are "moving" it, you are basically creating a new circle with completely differently properties; in light of this, I've renamed it change(). Here would be my version of your code:
    public class CircleTester {
        public static void main (String[] args)
             //Bad way to do it, but here's one way around it:
             new CircleTester().moveCircle();
        private void moveCircle()     //really a bad method, but for now, it'll do
            Circle a = new Circle(1,4,3);
            Circle b = new Circle(7,2,5);
            System.out.println(a);
            System.out.println(b);
            //diameters. Don't need to have a new getDiameter class
            double a_ = a.getRadius() * 2;     //Instead of doing * 2 each time, you could have a method that just returns the radius * 2
            double b_ = b.getRadius() * 2;
            System.out.println(a_);
            System.out.println(b_);
            //move the circle
            a.change(2,9,3);
            System.out.println(a);
    public class Circle {
        private double k1;
        private double k2;
        private double radius;
        public Circle(double x,double y,double r)
            k1 = x;
            k2 = y;
            radius = r;
        public void change(int x, int y, int r)
            k1 = x;
            k2 = y;
            radius = r;
        public String toString()
             return "Koordinaten: "+k1+" / "+k2+". Radius: "+radius;
        public double getRadius()
             return radius;
    }On another note, there is already a ellipse class: http://java.sun.com/j2se/1.5.0/docs/api/java/awt/geom/Ellipse2D.html

  • Questions about which codec to use

    At my new job, there is a server full of RAW video files that I will need to use in the future. These were all imported with an iMac through iMovie and are in .mov format with ICOD codec. I have found that PCs can't read ICOD codec, and there is no way around that. I just discovered Compressor on this iMac and was thinking that I could change the codec into something a PC can read.
    What codec would be the best choice for me? This is all high definition video, and I would like to retain the quality of the originals. File size doesn't matter.

    I believe that ICOD is just another descriptor for Apple Intermediate Codec. That's obviously proprietary to APple and is sort of obsolete – used in FCE, for HD material. (I didn't realize it was still used by iMovie.)
    Pro Res is a better codec for editing and is virtually lossless. If the PC folks have (or download) the Pro Res QT
    Decoder they could play it. But PR files are very, very large.
    If you edit these files into something finished in whatever NLE you want to work in, you could always export as AIC and convert in Compressor. I imagine the PC would be perfectly happy playing an h.264 MP4. It should look good and the file sizes will be much more reasonable.
    Try a short test to verify.
    Good luck.
    Russ

  • Question about hard drive space used

    If I run OmniDiskSweeper to sweep my 15" G4 laptop hard drive, the total file size calculated is 31.3 GB. Likewise, if I clone the hard drive to an external drive using SuperDuper!, the total size used on the external drive is 31.3 GB.
    However, if I "Get Info" on the laptop hard drive, the Used size listed is 41.9 GB. Likewise, 41.6 GB is listed as "used" in the OmniDiskSweeper Drive List window, as well as in another utility. I suspect that the 41.6 value is picked up from the Finder.
    What could be the reason that Get Info lists the space used on the hard drive as 10 GB larger than the total size of the files?
    1.5 GHZ PowerPC G4   Mac OS X (10.4.9)  
    Dual 2 GHz G5   Mac OS X (10.4.4)  

    Hmm, I think I have a possible answer. I had to download OmniDiskSweeper and open the help from its Help menu to get this answer.
    It says in the help for OmniDiskSweeper:
    "OmniDiskSweeper only displays files that you have access to from the user account you are logged into. Files in restricted folders are not available and their sizes are not included in the total file sizes you see."
    So, if you have other user accounts, then those files won't necessarily be readable and hence not counted in OmniDiskSweeper. There may also be a few system files and folders that might be unreadable and hence not counted. That should be fine since you probably shouldn't be randomly deleting system files.
    I've also noticed that OmniDiskSweeper shows slight variations of total sizes in its different windows, so it's not too precise. That probably comes from the dynamic nature of hard drive use by the computer, and OmniDiskSweeper trying not to use too many cpu cycles updating incessantly. Just guessing on that part though.
    The 10GB is most likely other user accounts or something else not readable from your own account. The Finder lets you know of course, but OmniDiskSweeper only presents to you what you have permission to access. That doesn't necessarily mean you'll also have permission to delete those things.

  • Question about setting up rdp using a cisco 800 series router

    HI there,
    I am currently in school for networking. One co-op placement I went too handed me a cisco 800 series router to practice my routing skills on. I am trying to setup RDP so I can access my server from outside my internal network. I ran this following acl command to do it.
    ip nat inside source static tcp server IP address port# cable modem IP port # extendable.
    My question here is, my cable modem will occasionally hand out a different IP since it has DCHP. I cannot turn DHCP off in my cable modem. So is there a way I can set this up to use a dynamic IP from my modem so I alwasy have access to it or every time my modem changes the IP address do I have to go in and modify this acl?

    Configure DDNS ( Dynamic DNS ) on the router. For this you need to register with a DDNS provider. Go to
    http://www.no-ip.com/ . they provide free reliable service.
    With DDNS, Once your router gets a DHCP address from your ISP , it will dynamically update the DNS name record. For example if you register you routers name as, "myrouter.no-ip.org",  from there onwards whatever the IP your router gets, you can refer to that by this name.
    So do as what Paolo said regarding using interface instead of ip, and register with the DDNS and you are good to go..
    Hope this helps
    Please rate this post if helpful..
    Thanks
    Shamal

Maybe you are looking for