You’ve defined the image at the top as having 5% height, but the image itself is 150 pixels. So you define a smaller space for the image than the image can handle (depending on resolution), which causes the rest of the website to act funky. Namely your text spacing gets all wonky. Deleting the image from the html fixes the text problems. Resizing the image div to a height of 150 pixels also fixes the issue, but both cause problems with your menu on the left.
Problems I see:
you define a menu div, but don’t nest the other elements inside of the div. This means that you get highly variable results depending on screen size. Use nesting properly here so that all the elements are contained within the image. Also define this height as an explicit value since your image you are using has a set height, don’t rely on % here unless everything else can stretch dynamic as well.
Don’t put your Contact Me embedded in the menu background image, while all the other images/links are seperate objects. It’s weird. Wouldn’t be noticeable if you had everything else working correctly, but when I stretch/shrink the window size it’s very apparent : )
Not too proficient in html stuff like this. it’s always a bitch to get things to work cross browser. For reference I was using chrome to inspect/alter the html/css on the fly, so that’s what I was seeing from that browser
edit:
Just looked at the site in IE, hot damn it’s an unusable mess! so different haha
Looking at the page, I see some weird things happening with the text when I select it, which I think is causing the horizontal scrollbar to appear when it shouldn’t. I don’t know if it’s related to the problem you mentioned. I tried messing with the properties but I’m not having much luck. Actually, selecting the entire page looks strange.
Have you tried using the 3D view in Firefox when you inspect the page? It looks like you can use it to check for page layout errors (I’m guessing that’s what it’s for, besides looking cool).
I feel really dumb for having this problem, my current assignment is to work with backtracking to get chess pieces across a board. Starting at the bottom and as you capture pieces you gain their abilities and lose your last, and if it doesn’t work you go back to where you were and check your other spots. I want to get that part on my own.
My problem is I can’t read the fucking input from the file. It looks like this:
The 1 at the top is the number of boards to follow. What I can’t get is the board. The white spaces plus the fact Java’s Scanner doesn’t have a .nextChar() and it has been driving me nuts all day. What is the best way to deal with this? I’m sure I can look at my text from last year and figure it out once I get back to the apartment but if one of you guys could give me an idea that would be awesome. Thanks either way.
Java is one of the worst languages ever for reading and writing to input/output.
That said, your best bet is to use Scanner.nextLine(), read it into a string variable, and parse it using indexing or delimiters. If you’re guaranteed the board will always look like that and don’t have to test for bad input, you can just get the pieces directly with string line = scanner.nextLine(); and then line[n] where n = 0, 2, 4, 6, 8, 10, 12, or 14 (skipping for spaces). Alternatively you can delimit the string on the space character but that’s slower and more annoying to code for a simple problem like this.
I’d use a combination of ReadLine and a string split
try{
FileInputStream fstream = new FileInputStream("textfile.txt");
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String currentRow;
//Read File Line By Line
while ((currentRow = br.readLine()) != null) {
String [] spaces = currentRow.split(" ");
for(int i = 0; i < spaces.length; i++)
{
String currentSpace = spaces*
//process the current space here
}
}
in.close();
}catch (Exception e){//Catch exception if any
System.err.println("Error: " + e.getMessage());
}
}
Thanks guys, I got it working. Now I just need to get my loops in order, I was getting runtime errors I had never seen before trying to get input and switching from Strings to char[]. Infuriating lol.
I thought the contents of an array without a value defaults to zero. The loop should end since there is a zero, but my output comes out as garbage until the array is filled.
yeah the default contents of any variable is compiler specific, and since arrays are technically pointers to data there’s a good chance it’s random garbage. Initialize everything always unless the first thing you do is set it.
quick question about inheritance in java. When a non-static method cannot be referenced from a static context, the simplest way to bypass this is? I’m basically trying to call a method that is within another class into a different class’s run() so it can be printed out. Problem is that it’s either not being recognized or it can’t be referenced.
I’m confused about your situation; the class in question has a non static function, and you want to access it? Then you’d just create an instance of the object and then call the function.
public class Printer{
void print(){
system.out.println("Hello World");
}
}
public class MainClass{
public static void main(){
Printer printObject = new Printer();
printObject.print();
}
}
I get the same problem, but if you go to any other page from the site, it’ll open properly. It seems the problem occurs when you access the page from outside.