Simple I/O question....I think

I was trying to read a text file, and I keep getting spaces between my characters, anyone know why this is? It looks like the compiler adds a space when doing a char cast. I've also tried the readLine() from BufferedReader and that puts spaces in my words too...
example of text.txt file I'm using:
here is some text
the output looks like this:
h e r e i s s o m e t e x t
Here is the code I was trying to read a text file, and I keep getting spaces between my characters, anyone know why this is?
example of text.txt file I'm using:
here is some text
the output looks like this:
h e r e i s s o m e t e x t
Here is the code (from this website even):
import java.io.*;
// Displays contents of a file
//(e.g. java Type app.ini)
public class exp {
public static void main(
String args[]) throws Exception
// Open input/output and setup variables
FileReader fr = new FileReader(args[0]);
PrintWriter pw = new PrintWriter(System.out, true);
char c[] = new char[4096];
int read = 0;
// Read (and print) till end of file
while ((read = fr.read(c)) != -1)
pw.write(c, 0, read);
// Close shop
fr.close();
pw.close();

I did try this, but the same problem occurs
public static void main(String[] args) {
try {
file = new File(args[0]);
outFile = new File("StoredProcstemp.txt");
fr = new FileReader(file);
in = new BufferedReader(fr);
fw = new FileWriter(outFile);
pw = new PrintWriter(fw);
// x=0;
while ((holder = in.readLine())!=null) {
System.out.println("myholder"+holder);
System.out.println(holder);
pw.write(holder);
// pw.print(holder);
} // end while
in.close();
fr.close();
fw.close();
pw.close();
catch (IOException e) {

Similar Messages

  • A simple Spry Accordion Question (I think)

    Hi all:
    I've searched but can't find, but I think this is a simple one.
    I've created a basic Spry accordion menu with DW/CS3 - Insert/Spry/Spry Accordion. How do I get the first "Content 1" to be hidden/not visible upon page load. Right now, the "Lable 2" must be clicked to hide the "Content 1" which of course shows the "Content 2"? Guessing it's in the JS, but I'm not sure. TIA for any help. HTML and JS Code below.
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Untitled Document</title>
    <script src="SpryAssets/SpryAccordion.js" type="text/javascript"></script>
    <link href="SpryAssets/SpryAccordion.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
    <div id="Accordion1" class="Accordion" tabindex="0">
      <div class="AccordionPanel">
        <div class="AccordionPanelTab">Label 1</div>
        <div class="AccordionPanelContent">Content 1</div>
      </div>
      <div class="AccordionPanel">
        <div class="AccordionPanelTab">Label 2</div>
        <div class="AccordionPanelContent">Content 2</div>
      </div>
    </div>
    <script type="text/javascript">
    <!--
    var Accordion1 = new Spry.Widget.Accordion("Accordion1");
    //-->
    </script>
    </body>
    </html>
    JAVASCRIPT
    var Spry;
    if (!Spry) Spry = {};
    if (!Spry.Widget) Spry.Widget = {};
    Spry.Widget.Accordion = function(element, opts)
        this.element = this.getElement(element);
        this.defaultPanel = 0;
        this.hoverClass = "AccordionPanelTabHover";
        this.openClass = "AccordionPanelOpen";
        this.closedClass = "AccordionPanelClosed";
        this.focusedClass = "AccordionFocused";
        this.enableAnimation = true;
        this.enableKeyboardNavigation = true;
        this.currentPanel = null;
        this.animator = null;
        this.hasFocus = null;
        this.duration = 500;
        this.previousPanelKeyCode = Spry.Widget.Accordion.KEY_UP;
        this.nextPanelKeyCode = Spry.Widget.Accordion.KEY_DOWN;
        this.useFixedPanelHeights = true;
        this.fixedPanelHeight = 0;
        Spry.Widget.Accordion.setOptions(this, opts, true);
        // Unfortunately in some browsers like Safari, the Stylesheets our
        // page depends on may not have been loaded at the time we are called.
        // This means we have to defer attaching our behaviors until after the
        // onload event fires, since some of our behaviors rely on dimensions
        // specified in the CSS.
        if (Spry.Widget.Accordion.onloadDidFire)
            this.attachBehaviors();
        else
            Spry.Widget.Accordion.loadQueue.push(this);
    Spry.Widget.Accordion.onloadDidFire = false;
    Spry.Widget.Accordion.loadQueue = [];
    Spry.Widget.Accordion.addLoadListener = function(handler)
        if (typeof window.addEventListener != 'undefined')
            window.addEventListener('load', handler, false);
        else if (typeof document.addEventListener != 'undefined')
            document.addEventListener('load', handler, false);
        else if (typeof window.attachEvent != 'undefined')
            window.attachEvent('onload', handler);
    Spry.Widget.Accordion.processLoadQueue = function(handler)
        Spry.Widget.Accordion.onloadDidFire = true;
        var q = Spry.Widget.Accordion.loadQueue;
        var qlen = q.length;
        for (var i = 0; i < qlen; i++)
            q[i].attachBehaviors();
    Spry.Widget.Accordion.addLoadListener(Spry.Widget.Accordion.processLoadQueue);
    Spry.Widget.Accordion.prototype.getElement = function(ele)
        if (ele && typeof ele == "string")
            return document.getElementById(ele);
        return ele;
    Spry.Widget.Accordion.prototype.addClassName = function(ele, className)
        if (!ele || !className || (ele.className && ele.className.search(new RegExp("\\b" + className + "\\b")) != -1))
            return;
        ele.className += (ele.className ? " " : "") + className;
    Spry.Widget.Accordion.prototype.removeClassName = function(ele, className)
        if (!ele || !className || (ele.className && ele.className.search(new RegExp("\\b" + className + "\\b")) == -1))
            return;
        ele.className = ele.className.replace(new RegExp("\\s*\\b" + className + "\\b", "g"), "");
    Spry.Widget.Accordion.setOptions = function(obj, optionsObj, ignoreUndefinedProps)
        if (!optionsObj)
            return;
        for (var optionName in optionsObj)
            if (ignoreUndefinedProps && optionsObj[optionName] == undefined)
                continue;
            obj[optionName] = optionsObj[optionName];
    Spry.Widget.Accordion.prototype.onPanelTabMouseOver = function(panel)
        if (panel)
            this.addClassName(this.getPanelTab(panel), this.hoverClass);
    Spry.Widget.Accordion.prototype.onPanelTabMouseOut = function(panel)
        if (panel)
            this.removeClassName(this.getPanelTab(panel), this.hoverClass);
    Spry.Widget.Accordion.prototype.openPanel = function(panel)
        var panelA = this.currentPanel;
        var panelB = panel;
        if (!panelB || panelA == panelB)   
            return;
        var contentA;
        if( panelA )
            contentA = this.getPanelContent(panelA);
        var contentB = this.getPanelContent(panelB);
        if (! contentB)
            return;
        if (this.useFixedPanelHeights && !this.fixedPanelHeight)
            this.fixedPanelHeight = (contentA.offsetHeight) ? contentA.offsetHeight : contentA.scrollHeight;
        if (this.enableAnimation)
            if (this.animator)
                this.animator.stop();
            this.animator = new Spry.Widget.Accordion.PanelAnimator(this, panelB, { duration: this.duration });
            this.animator.start();
        else
            if(contentA)
                contentA.style.height = "0px";
            contentB.style.height = (this.useFixedPanelHeights ? this.fixedPanelHeight : contentB.scrollHeight) + "px";
        if(panelA)
            this.removeClassName(panelA, this.openClass);
            this.addClassName(panelA, this.closedClass);
        this.removeClassName(panelB, this.closedClass);
        this.addClassName(panelB, this.openClass);
        this.currentPanel = panelB;
    Spry.Widget.Accordion.prototype.openNextPanel = function()
        var panels = this.getPanels();
        var curPanelIndex = this.getCurrentPanelIndex();
        if( panels && curPanelIndex >= 0 && (curPanelIndex+1) < panels.length )
            this.openPanel(panels[curPanelIndex+1]);
    Spry.Widget.Accordion.prototype.openPreviousPanel = function()
        var panels = this.getPanels();
        var curPanelIndex = this.getCurrentPanelIndex();
        if( panels && curPanelIndex > 0 && curPanelIndex < panels.length )
            this.openPanel(panels[curPanelIndex-1]);
    Spry.Widget.Accordion.prototype.openFirstPanel = function()
        var panels = this.getPanels();
        if( panels )
            this.openPanel(panels[0]);
    Spry.Widget.Accordion.prototype.openLastPanel = function()
        var panels = this.getPanels();
        if( panels )
            this.openPanel(panels[panels.length-1]);
    Spry.Widget.Accordion.prototype.onPanelClick = function(panel)
        // if (this.enableKeyboardNavigation)
        //     this.element.focus();
        if (panel != this.currentPanel)
            this.openPanel(panel);
        this.focus();
    Spry.Widget.Accordion.prototype.onFocus = function(e)
        // this.element.focus();
        this.hasFocus = true;
        this.addClassName(this.element, this.focusedClass);
    Spry.Widget.Accordion.prototype.onBlur = function(e)
        // this.element.blur();
        this.hasFocus = false;
        this.removeClassName(this.element, this.focusedClass);
    Spry.Widget.Accordion.KEY_UP = 38;
    Spry.Widget.Accordion.KEY_DOWN = 40;
    Spry.Widget.Accordion.prototype.onKeyDown = function(e)
        var key = e.keyCode;
        if (!this.hasFocus || (key != this.previousPanelKeyCode && key != this.nextPanelKeyCode))
            return true;
        var panels = this.getPanels();
        if (!panels || panels.length < 1)
            return false;
        var currentPanel = this.currentPanel ? this.currentPanel : panels[0];
        var nextPanel = (key == this.nextPanelKeyCode) ? currentPanel.nextSibling : currentPanel.previousSibling;
        while (nextPanel)
            if (nextPanel.nodeType == 1 /* Node.ELEMENT_NODE */)
                break;
            nextPanel = (key == this.nextPanelKeyCode) ? nextPanel.nextSibling : nextPanel.previousSibling;
        if (nextPanel && currentPanel != nextPanel)
            this.openPanel(nextPanel);
        if (e.stopPropagation)
            e.stopPropagation();
        if (e.preventDefault)
            e.preventDefault();
        return false;
    Spry.Widget.Accordion.prototype.attachPanelHandlers = function(panel)
        if (!panel)
            return;
        var tab = this.getPanelTab(panel);
        if (tab)
            var self = this;
            Spry.Widget.Accordion.addEventListener(tab, "click", function(e) { return self.onPanelClick(panel); }, false);
            Spry.Widget.Accordion.addEventListener(tab, "mouseover", function(e) { return self.onPanelTabMouseOver(panel); }, false);
            Spry.Widget.Accordion.addEventListener(tab, "mouseout", function(e) { return self.onPanelTabMouseOut(panel); }, false);
    Spry.Widget.Accordion.addEventListener = function(element, eventType, handler, capture)
        try
            if (element.addEventListener)
                element.addEventListener(eventType, handler, capture);
            else if (element.attachEvent)
                element.attachEvent("on" + eventType, handler);
        catch (e) {}
    Spry.Widget.Accordion.prototype.initPanel = function(panel, isDefault)
        var content = this.getPanelContent(panel);
        if (isDefault)
            this.currentPanel = panel;
            this.removeClassName(panel, this.closedClass);
            this.addClassName(panel, this.openClass);
        else
            this.removeClassName(panel, this.openClass);
            this.addClassName(panel, this.closedClass);
            content.style.height = "0px";
        this.attachPanelHandlers(panel);
    Spry.Widget.Accordion.prototype.attachBehaviors = function()
        var panels = this.getPanels();
        for (var i = 0; i < panels.length; i++)
            this.initPanel(panels[i], i == this.defaultPanel);
        if (this.enableKeyboardNavigation)
            // XXX: IE doesn't allow the setting of tabindex dynamically. This means we can't
            // rely on adding the tabindex attribute if it is missing to enable keyboard navigation
            // by default.
            var tabIndexAttr = this.element.attributes.getNamedItem("tabindex");
            // if (!tabIndexAttr) this.element.tabindex = 0;
            if (tabIndexAttr)
                var self = this;
                Spry.Widget.Accordion.addEventListener(this.element, "focus", function(e) { return self.onFocus(e); }, false);
                Spry.Widget.Accordion.addEventListener(this.element, "blur", function(e) { return self.onBlur(e); }, false);
                Spry.Widget.Accordion.addEventListener(this.element, "keydown", function(e) { return self.onKeyDown(e); }, false);
    Spry.Widget.Accordion.prototype.getPanels = function()
        return this.getElementChildren(this.element);
    Spry.Widget.Accordion.prototype.getCurrentPanel = function()
        return this.currentPanel;
    Spry.Widget.Accordion.prototype.getCurrentPanelIndex = function()
        var panels = this.getPanels();
        for( var i = 0 ; i < panels.length; i++ )
            if( this.currentPanel == panels[i] )
                return i;
        return 0;
    Spry.Widget.Accordion.prototype.getPanelTab = function(panel)
        if (!panel)
            return null;
        return this.getElementChildren(panel)[0];
    Spry.Widget.Accordion.prototype.getPanelContent = function(panel)
        if (!panel)
            return null;
        return this.getElementChildren(panel)[1];
    Spry.Widget.Accordion.prototype.getElementChildren = function(element)
        var children = [];
        var child = element.firstChild;
        while (child)
            if (child.nodeType == 1 /* Node.ELEMENT_NODE */)
                children.push(child);
            child = child.nextSibling;
        return children;
    Spry.Widget.Accordion.prototype.focus = function()
        if (this.element && this.element.focus)
            this.element.focus();
    Spry.Widget.Accordion.PanelAnimator = function(accordion, panel, opts)
        this.timer = null;
        this.interval = 0;
        this.stepCount = 0;
        this.fps = 0;
        this.steps = 10;
        this.duration = 500;
        this.onComplete = null;
        this.panel = panel;
        this.panelToOpen = accordion.getElement(panel);
        this.panelData = [];
        Spry.Widget.Accordion.setOptions(this, opts, true);
        // If caller specified speed in terms of frames per second,
        // convert them into steps.
        if (this.fps > 0)
            this.interval = Math.floor(1000 / this.fps);
            this.steps = parseInt((this.duration + (this.interval - 1)) / this.interval);
        else if (this.steps > 0)
            this.interval = this.duration / this.steps;
        // Set up the array of panels we want to animate.
        var panels = accordion.getPanels();
        for (var i = 0; i < panels.length; i++)
            var p = panels[i];
            var c = accordion.getPanelContent(p);
            if (c)
                var h = c.offsetHeight;
                if (h == undefined)
                    h = 0;
                if (p == panel || h > 0)
                    var obj = new Object;
                    obj.panel = p;
                    obj.content = c;
                    obj.fromHeight = h;
                    obj.toHeight = (p == panel) ? (accordion.useFixedPanelHeights ? accordion.fixedPanelHeight : c.scrollHeight) : 0;
                    obj.increment = (obj.toHeight - obj.fromHeight) / this.steps;
                    obj.overflow = c.style.overflow;
                    this.panelData.push(obj);
                    c.style.overflow = "hidden";
                    c.style.height = h + "px";
    Spry.Widget.Accordion.PanelAnimator.prototype.start = function()
        var self = this;
        this.timer = setTimeout(function() { self.stepAnimation(); }, this.interval);
    Spry.Widget.Accordion.PanelAnimator.prototype.stop = function()
        if (this.timer)
            clearTimeout(this.timer);
            // If we're killing the timer, restore the overflow
            // properties on the panels we were animating!
            if (this.stepCount < this.steps)
                for (i = 0; i < this.panelData.length; i++)
                    obj = this.panelData[i];
                    obj.content.style.overflow = obj.overflow;
        this.timer = null;
    Spry.Widget.Accordion.PanelAnimator.prototype.stepAnimation = function()
        ++this.stepCount;
        this.animate();
        if (this.stepCount < this.steps)
            this.start();
        else if (this.onComplete)
            this.onComplete();
    Spry.Widget.Accordion.PanelAnimator.prototype.animate = function()
        var i, obj;
        if (this.stepCount >= this.steps)
            for (i = 0; i < this.panelData.length; i++)
                obj = this.panelData[i];
                if (obj.panel != this.panel)
                    obj.content.style.height = "0px";
                obj.content.style.overflow = obj.overflow;
                obj.content.style.height = obj.toHeight + "px";
        else
            for (i = 0; i < this.panelData.length; i++)
                obj = this.panelData[i];
                obj.fromHeight += obj.increment;
                obj.content.style.height = obj.fromHeight + "px";

    On the bottom of yourpage you have this:
    var Accordion1 = new Spry.Widget.Accordion("Accordion1");
    Change it to this:
    var Accordion1 = new Spry.Widget.Accordion("Accordion1", { useFixedPanelHeights: false, defaultPanel: -1 });
    Ken Ford

  • Simple X-fi Question, Please Help

    !Simple X-fi Question, Please HelpL I've been looking for an external sound card that is similar to the 2002 Creative Extigy and think I may found it in the Creative X-Fi. I have some questions about the X-fi though. Can the X-fi:
    1. Input sound from an optical port
    2. Output that sound to 5. surround- Front, surround, center/sub
    3. Is the X-Fi stand-alone, external, and powered by a USB or a wall outlet (you do not need a computer hooked up to it)
    Basically I want to connect a TosLink optical cable from my Xbox to the X-Fi. That will deli'ver the sound to the X-Fi. Then I want that sound to go to a 5. headset that is connected to the X-fi via 5. front, surround, and center/sub wires. The X-Fi has to be stand-alone and cannot be connected to a PC to do this.
    Thank you for your help.

    The connector must match, and the connector polarity (plus and minus voltage) must match.  Sorry, I don't know if the positive voltage goes on the inside of the connector or the outside.    Any wattage of 12 or more should be adequate.
    Message Edited by toomanydonuts on 01-10-2008 01:29 AM

  • Question: I think I made mistakes using several different id apple. How can I cancel all of them except the one I would like to maintain ?

    Question: I think I made mistakes using several different id apple. How can I cancel all of them except the one I would like to maintain ?

    From Here   http://support.apple.com/kb/HE37
    I have multiple Apple IDs. Is there a way for me to merge them into a single Apple ID?
    Apple IDs cannot be merged. You should use your preferred Apple ID from now on, but you can still access your purchased items such as music, movies, or software using your other Apple IDs.

  • Quick Easy Question- I think...

    If you have 15 expressions, concatenated by Boolean OR's, how many of the expressions must be true for the entire thing to be true? My friend and I are arguing whether the answer is...
    a. at least 1
    b. all of them
    c. cannot be determined
    Thank you so much for your input. We are studying for an exam, trying to finish the practice questions. I appreciate any input and your time!! :-)

    Hi,
    Programming languages are created by humans, and therefore it is usually pretty easy to answer such questions. Think about the human language..
    Do you have a car or a house or a space ship?
    Any one who owns a car or a house would answer yes, even if they didn't own a space ship. That is, the whole expression evaluates to true if one of the statements is true.
    /Kaj

  • Simple Crop tool question... how do I save the crop section?

    Hi,
    I have a very simple crop tool question. I'm a photoshop girl usually... so Illustrator is new to me. When I select the crop section I want... how do I save it?... if I select another tool in the tool panel, the crop section disappears and I can't get it back when I re-select Crop tool. If I select Save as... it saves the whole document...and not just my crop section.
    Like I said, simple question...but I just don't know the secret to the Illustrator crop tool.
    Thanks!
    Yzza

    Either press the Tab key or F key.

  • A Simpler, More Direct Question About Merge Joins

    This thread is related to Merge Joins Should Be Faster and Merge Join but asks a simpler, more direct question:
    Why does merge sort join choose to sort data that is already sorted? Here are some Explain query plans to illustrate my point.
    SQL> EXPLAIN PLAN FOR
      2  SELECT * FROM spoTriples ORDER BY s;
    PLAN_TABLE_OUTPUT
    |   0 | SELECT STATEMENT |              |   998K|    35M|  5311   (1)| 00:01:04|
    |   1 |  INDEX FULL SCAN | PKSPOTRIPLES |   998K|    35M|  5311   (1)| 00:01:04|
    ---------------------------------------------------------------------------------Notice that the plan does not involve a SORT operation. This is because spoTriples is an Index-Organized Table on the primary key index of (s,p,o), which contains all of the columns in the table. This means the table is already sorted on s, which is the column in the ORDER BY clause. The optimizer is taking advantage of the fact that the table is already sorted, which it should.
    Now look at this plan:
    SQL> EXPLAIN PLAN FOR
      2  SELECT /*+ USE_MERGE(t1 t2) */ t1.s, t2.s
      3  FROM spoTriples t1, spoTriples t2
      4  WHERE t1.s = t2.s;
    Explained.
    PLAN_TABLE_OUTPUT
    |   0 | SELECT STATEMENT       |              |    11M|   297M|       | 13019 (6)| 00:02:37 |
    |   1 |  MERGE JOIN            |              |    11M|   297M|       | 13019 (6)| 00:02:37 |
    |   2 |   SORT JOIN            |              |   998K|    12M|    38M|  6389 (4)| 00:01:17 |
    |   3 |    INDEX FAST FULL SCAN| PKSPOTRIPLES |   998K|    12M|       |  1460 (3)| 00:00:18 |
    |*  4 |   SORT JOIN            |              |   998K|    12M|    38M|  6389 (4)| 00:01:17 |
    |   5 |    INDEX FAST FULL SCAN| PKSPOTRIPLES |   998K|    12M|       |  1460 (3)| 00:00:18 |
    Predicate Information (identified by operation id):
       4 - access("T1"."S"="T2"."S")
           filter("T1"."S"="T2"."S")I'm doing a self join on the column by which the table is sorted. I'm using a hint to force a merge join, but despite the data already being sorted, the optimizer insists on sorting each instance of spoTriples before doing the merge join. The sort should be unnecessary for the same reason that it is unnecessary in the case with the ORDER BY above.
    Is there anyway to make Oracle be aware of and take advantage of the fact that it doesn't have to sort this data before merge joining it?

    Licensing questions are best addressed by visiting the Oracle store, or contacting a salesrep in your area
    But I doubt you can redistribute the product if you aren't licensed yourself.
    Question 3 and 4 have obvious answers
    3: Even if you could this is illegal
    4: if tnsping is not included in the client, tnsping is not included in the client, and there will be no replacement.
    Tnsping only establishes whether a listener is running and shouldn't be called from an application
    Sybrand Bakker
    Senior Oracle DBA

  • Simple audio question (I think)

    Thanks everyone for answering this question which I think is fairly simple. I have a new TV that I use as the monitor for my computer and connect my Itv to. Currently I have both the cable, my computer and ITV hooked up through HDMI. Whenever I switch between the different HDMI inputs I obviously do not continue getting the sound out from my ITV. The question is I would like to be able to leave my ITV running while it is playing music to my stereo and surf the internet with my computer output on the screen. I know I could obviously play Itunes on my computer however the ITV seems to have much better output quality. Anyone has a solution for this?
    I look forward to your answers. Have a great day and thanks again.
    Message was edited by: mameares

    Welcome to the  Discussion Forums.
    Not without some other device to feed audio through. Your tv will only play from one input at a time, when you switch to the input from your mac/pc, it will always cut off the audio from other inputs.

  • A relatively simple question ( I think)

    I'm pretty new to java. I've read a few books and been practicing the basics, and now I'm attempting to learn a bit more through the creation of a simple game. I've been able to get a lot of the groundwork down, however, I'm having trouble figuring out just how to do one of the simple things that I need.
    This game is grid based, and each time a sprite moves it moves a uniform distance of one tile (around 20 pixels). I need to set it up, however, so that the characters don't just "pop" to each location, but that they actually use their walk animation to travel one square's worth of distance.
    I'll post the simple code I tried, along with my thoughts on why it doesn't work, and then I'd like to know if I'm just going about it all wrong, and I should try another method, or there is an error in my code. My comments in the code explain what's going on (or supossed to be).
    public void moveLeft() { //this method is called when the left arrow is pressed
        moving(); //this is a method that simply sets the sprite's animation to a walk loop and changes a couple status variables
        int x = getXPosn(); //get the current x position
        int y = getYPosn(); //get the current y position
        int newx = x - 20; //newx is where I want the sprite to end up
        for (int n = x; n > newx; n--) { 
            setPosition(n, y);
        stopLooping(); //stops the looping animation
    }Now that seems pretty straightforward to me. I set the sprite to its walking animation. I get the current position, and tell it to go 20 pixels to the left, by decrementing 1 pixel at a time. Then, when it gets there, stop looping the animation.
    However, what I end up with is the same as if the for loop is nonexistant and I just used setPosition() to "warp" the character to the new spot. The animation never takes place, and the sprite doesn't "slide" along the screen like I want. Is this because the for loop just processes so quickly from x to (x-20) that its unnoticable? And if so, how do I slow it down so that I can see this animation?
    Perhaps I'm going about it all the wrong way, and there is a better method for getting at what I want. Any help would be greatly appreciated. For what its worth, I do know the moving() method,looping, stopLooping(), setPosition(), and all of that works. When I set it so that holding down an arrow key moves the sprite, it works fine. The sprite moves around, with the walk animation as long as the key is being pressed. That's just not what I need to do here. I just want it to walk a fixed distance, with its animation, from a key press.

    well, it may have bloated my code a bit, but it works. I believe that once I get more of the game elements in place, I'll be able to simplifiy it, but I'm trying to take my time and get each part working solidly before adding more.
    //I have a method that updates my sprite's x,y position each time through the gameloop by simply doing
    locx += mx
    locy += my
    //where locx, locy is the current location and mx, my is the amount of movement (either positive or negative);
    //Then, I needed 2 methods to get it to stop when I wanted.
    public void stepLeft() {
           int x = getXPosn(); //returns the value of the current x position
           moving();
           setStep(-1,0); //this method sets the movement amount each update- (-1,0) means move left 1 pixel on the x axis each update
           moveLeft((x - 20)); //sends the value of where I want the sprite to end up when I'm finished to the other method I created
    public void moveLeft(int x) {
           while (getXPosn() > x) { //this loop runs while the x location of the sprite is greater than the location I want it to end up at.
               isStill = false; //this is just a boolean identifier
           stopMove(); //A method that just stops the looping animation and resets the movement to (0,0)
    }I tried to get it all in one method, but was having trouble, with using getXPosn() in the same method that I needed to check getXPosn() later. It kept creating infinite loops, because (getXPosn() - 20) would change based on the sprite's movement. So my workaround was to send it to another method for the loop.
    As I said, I think this is a little bloated for what the code will be when I'm finished. I need to turn my background into a grid and I'm going to define each tile at some point. Then, I can go back and alter this code so that it just checks if its going into the boundaries of a new tile, rather than needing to use so many methods.

  • First time computer builder - simple question(I think)

    Im putting together my first computer so far without much problem
    This is hardware I have
    380W Antec Power
    865 neo2 board
    2.8 p4 processor
    2x512 mb corsair memory
    lite on cd-rw
    plextor dvd-rw
    200gb western digital special additon hard drive.
    (which came with ata ultra controller card)
    My question is this:
    How should I set up my two optical drives and the hard drive on my available ide connections. Of course I have the two regular ide ports 1&2 and I have the ide3 next to the serial ata ports. I also have the ata ultra controller card plugged into one of the pci ports which gives me two more ide ports. I ve read through the forum listings and have not came across a simple description of how I should configure my hard drive and optical drives. How should I hook up these drives and what settings should I use (master/slave). Any help would be appreciated If it seems like I'm asking dumb questions it's just because I'm real new at this and want every thing to be perfects. thanks

    IMHO
    I would take out ata controller card. Your MB has enough....
    Primary IDE - master  - your WD harddrive
    Primary or Secondary IDE - slave - you lite on cd-rw
    Secondary IDE - master - plextor dvd-rw
    If you will install XP + service pack 1 your harddrive should be OK.
    PS - Just finish to build  about the same config....
    But I made my dvd-rw - external
    added later AFAIK Your 3rd IDE will not support optical drives.
    It is possible to put bootable harddrive on third IDE, but I it is not very simple
    and have no big advantages

  • Simple question I think, add JPanel to JScrollPane

    I would imagine that for anyone with experience with Java this will be a simple problem. Why can't I add a JPanel to a JScrollPane using myScrollPane.Add(myPanel); ?? it seems to get hidden...
    This works correctly:
         //Create a panel
         JPanel panel = new JPanel(new FlowLayout());
         //Make it pink
         panel.setBackground(Color.pink);
         //Make it 400,400
         panel.setPreferredSize(new Dimension(400,400));
         //Create a Scrollpane
         JScrollPane scrollPane = new JScrollPane(panel);
         //Make it 300,300
         scrollPane.setPreferredSize(new Dimension(300,300));
         //Create a JFrame
         JFrame frame = new JFrame("Test Scrollpane");
         frame.setLayout(new FlowLayout());
         //Set close operation
         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         //Set its size
         frame.setSize(600,600);
         //Add Scrollpane to JFrame
         frame.add(scrollPane);
         //Show it
         frame.setVisible(true);
    This doesnt:
         //Create a panel
         JPanel panel = new JPanel(new FlowLayout());
         //Make it pink
         panel.setBackground(Color.pink);
         //Make it 400,400
         panel.setPreferredSize(new Dimension(400,400));
         //Create a Scrollpane
         JScrollPane scrollPane = new JScrollPane();
         scrollPane.add(panel);
         //Make it 300,300
         scrollPane.setPreferredSize(new Dimension(300,300));
         //Create a JFrame
         JFrame frame = new JFrame("Test Scrollpane");
         frame.setLayout(new FlowLayout());
         //Set close operation
         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         //Set its size
         frame.setSize(600,600);
         //Add Scrollpane to JFrame
         frame.add(scrollPane);
         //Show it
         frame.setVisible(true);

    rcfearn wrote:
    I would appreciate it you could read the sample code, I am asking the question as to why I have to do this? For structural reasons I don't want to have to add the JPanel during instatiation of the JScrollPane...Please read the [jscrollpane api.|http://java.sun.com/javase/6/docs/api/javax/swing/JScrollPane.html] To display something in a scroll pane you need to add it not to the scroll pane but to its viewport. If you add the component in the scroll pane's constructor, then it will be automatically added to the viewport. if you don't and add the component later, then you must go out of your way to be sure that it is added to the viewport with:
    JScrollPane myScrollPane = new JScrollPane();
    myScrollPane.getViewport().add(myComponent);

  • Simple folder permission question...I think

    I have 5 folders for each network user. They are all under one main folder. I'm finding that if Dick drops a file in Jane's folder the file is still owned by Dick while the group is "users". But Jane (being part of "users" group) can't modify Dick's file (who is also in "users" group), but can only read it. I ran a "chmod 774" on Jane's folder but it only changes what's currently in the folder and not to something new that is dropped in or modified afterwards. Keeping ownership is fine, but everyone in the group should be able to read and write everything in everyone's folder that is under "users" group.
    What am I missing here? I know it's something simple.

    I'm in the office and just ran a bunch of tests with my MBP and other XP machines. Turns out, my user account, for some strange reason, is causing everyone else to be locked out of files if "I" edit them or create them. I'm in the same groups as everyone else, users. There doesn't appear to be anything special about my account as compared to others, same UID range 1000. Thinking it might be something on my MBP, I connected to the share as another user....everything worked fine.
    Also, as an aside, I noticed that when I use Get Info on a file, is shows the Master as the owner, and group/everyone as read only....BUT everyone else CAN read/write/save the file. Strange, strange, strange.

  • OAM 10g - Simple question (I think)

    Hey guys, I want to run something by you to see if I'm missing something critical. What I'm trying to do is fairly simple...
    I want 2 login forms for the same webpage, depending on which hostname is used.
    internal.mydomain.com
    external.mydomain.com
    both of these point to an IIS box, which is configured to receive on *:80.. no hostheaders defined.
    Originally, there was only the internal.mydomain.com and that is all setup and working. Accessing http://internal.mydomain.com/secret brings up my "Custom Internal Form".
    I want to add the ability so that when http://external.mydomain.com/secret is acccessed, it brings up my "Custom External Form".
    I have set up a new Host Identifier with external.mydomain.com
    I have copied the policy domain to "My Policy - External" and set it to the new Host Identifier, and specified to use Basic Over LDAP (as a quick test, will create the actual form later)
    When I access external.mydomain.com/secret I keep getting the "Custom Internal Form".
    When I perform an Access Test within oam to the same URL, it shows the correct ("My Policy - External" ) policy domain in the evaluation result, aka.
    This tells me that OAM is configured correctly, but the WebGate isn't reporting properly the host header used.
    Any ideas? I would very much appreciate any insight or suggestions.
    Thanks very much

    Hi Alex,
    Couple of things:
    1. Please check if there is any proxy configured in external.domain.com to route requests to internal.domain.com
    2. Is Login page residing in same webserver as protected page? If so, it will be different for internal and external domains as it will be seperated by a firewall. I would configure a single authentication scheme without specifying anything in challenge redirect field so that Login page will be thrown from the webserver where it is called for secured page.
    3. Please check whether you are able to access login pages of both external and internal domains directly and check for any errors in webserver logs.
    Please post the results.
    Hope this helps!
    -Mahendra

  • A very simple question (I think)

    My school has purchased some mac minis to use in our science lab, and now I want to get some very cheap monitors as we have a limited budget. I have some very basic questions that some experienced users could help me with:
    1. Could I use a TV monitor and connect via the HDMI input?
    2. What are the drawbacks when connecting a VGA monitor via the HDMI or mini connector?
    3. Would spending a bit more and getting a DVI capable monitor connected by the supplied "dongle" be best?
    4. What are the best brands of monitor?
    Many thanks,
    Geoff

    Well...
    1. If the TV has HDMI input, absolutely. Your main concern is the level of compatibility with a 'computer type' HDMI input, to avoid overscan/underscan issues.
    2. You can not connect VGA to HDMI without a device converting the signal from digital to analog, and such would cost much more than its worth. The only way to connect VGA avoiding compatibility issues is via the Mini Displayport with the correct dongle from Apple.
    3. I don't see any special advantage to getting a DVI capable computer monitor, over using an HDTV with HDMI or a computer monitor with HDMI. Basically you just need to find whatever display supports the input best as you need, at the best price.
    I won't really answer 4 because there's a lot of opinion in that.

  • Simple OAM questions (I think):  Possible to delete users and groups?

    Hi,
    I was wondering if, using the OAM admin, is it possible to delete a user?
    Same question regarding a group?
    For users, it seems like I can deactivate a user, but can't delete using the OAM admin?
    Thanks,
    Jim

    Deleting User:
    1. Create a "Deactivate User" work flow to deactivate the user account.
    2. Locate the deactivated user account from "Deactivated User Identity" link in User Manager.
    3. Select the user account you want to delete, click the Delete button to delete.
    Deleting Group:
    1. Create a "Delete Group" workflow in the workflow definition. Step1: Initial - Specifiy who can initialize the process; Step 2: Commit - commit the action.
    2. In the group information panel, click the Delete button to delete the group.

  • Context help (please help, simple question i think)

    Hi, on my webserver, I have a nested tag that goes:
    <Host name="www.mydomain.com">
    <Alias>domain.com</Alias>
    <Context docBase="/home/domainacct/public_html/jsp" path="/jsp" reloadable="true">
    </Context>
    </Host>
    When I use this setup, JSP works! I can access any http://www.mydomain.com/jsp/*.jsp
    But I don't want JSP files to be loadable only from the /jsp directory, as I would like
    to be able to do:
    <Host name="www.mydomain.com">
    <Alias>domain.com</Alias>
    <Context docBase="/home/domainacct/public_html" path="" reloadable="true">
    </Context>
    </Host>
    so that I can access jsp files like: http://www.mydomain.com/test.jsp
    But when I try that setup it doesn't work.
    Do you guys know how I can do this? Thanks.

    nope u can't do that i far as i know.
    the context docBase should be the actual path to the folder. so if your webapp is in C:\TOOLS\webapps\Development than ur docBase is Development....like the root directory for example.
    the context tag as far as i know cannot be used for what u want 2 do. i don't think u can in Java.

Maybe you are looking for

  • IE mysteriously not running Flash?

    I'm experiencing an odd issue related to Adobe Flash Player.  I haven't changed anything on my system that I am aware of that would have caused this either.  Here's the story: I've been hapily using Adobe Captivate to publish courses.  When I go to d

  • Fullview RAW/JPG Images in Aperture appear fractured and/or solid black

    Hey guys, I'm very close to throw something out of the window. I changed from iPhoto to Aperture 3.5.1 a few month ago and imports from my 400D Canon and iPhone/iPad worked finde until recently, when Aperture decided not to show thefull view anymore.

  • Mail Signature Size

    Hi I add a signature from a jpeg or gif to my mail and always change the size to 800k and makes all my mails to send slower than If it has a lower size how can I lower the size of the signature when it pastes in Apple Mail. Size before I paste it is

  • ALV Enevts

    Hi I have one double click event defination and event implementation. But two event handler one for top alv and one for bottom alv on a single report. Now from the event implementation I want to know which (top or bottom alv) alv is double clicked(to

  • Presenter 7 for the MAC??

    Does anyone know if Adobe will make Presenter available for the MAC? Thanks!