hi, i was working on the localhost and every thing was just fine, but when i upload to my site it get alot of errors
why is that ?
(sorry for my bad english)
So here's the deal I'm working on a project that requires me to have a 2 dimensional arraylist of 1 dimensional arrays. But every time I try to load in my data I get an error:
Can't do this opperation because of bad input
java.lang.IndexOutOfBoundsException: Index: 1, Size: 0
On some of the inputs. I've got no idea where I'm going wrong on this one. A little help please?
Source Code:
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;
import javax.swing.JOptionPane;
import java.io.InputStream;
public class Facebull
{
public static void main (String[] args) {
if(args.length != 0){
load(args[0]);
}
else{
load("testFile");
}
}
public static void load(String fname) {
int costOfMach = 0;
ArrayList <Integer> finalMach = new ArrayList<Integer>();
ArrayList <ArrayList<int[]>>machines = new ArrayList<ArrayList<int[]>>();
Scanner inputFile = null;
File f = new File(fname);
if (f.exists ())
{
try
{
inputFile = new Scanner (f);
}
catch (FileNotFoundException e)
{
JOptionPane.showMessageDialog(null,"Can't find the file\n" + e);
}
int i = 0;
while (inputFile.hasNext ( ))
{
String str = inputFile.nextLine ( );
String [ ] fields = str.split ("[\t ]");
System.out.println(str);
if (!(fields[0].isEmpty() || fields[0].equals (""))){
fields[0] = fields[0].substring(1);
fields[1] = fields[1].substring(1);
fields[2] = fields[2].substring(1);
try
{
//data to be inputed is 0 and 3 location of data is 1 and 2
int[] item = new int[2];
item[1] = Integer.parseInt(fields[0]);
item[0] = Integer.parseInt(fields[3]);
if(machines.size() < Integer.parseInt(fields[1])){
ArrayList<int[]> column = new ArrayList<int[]>();
machines.add (Integer.parseInt(fields[1])-1, column);
System.out.println("we're in the if");
}
machines.get(Integer.parseInt(fields[1])-1).add(Integer.parseInt(fields[2])-1, item);
}
//catches any exception
catch (Exception e)
{
System.out.println("Can't do this opperation because of bad input \n" + e);
}
}
}
inputFile.close ( );
}
System.out.print(machines);
}//end load
}
hi,
I've set on imagecache a fixed scale for my images (230 x 150).
Upscaling option is unchecked.
Successively, I've uploaded new images (original size 230 x 150) but for some reason they are resized: 80 x 52
Instead, if I check the "Allow upscaling" option, the size is correct, but the quality is very bad.
So basically, it behaves like if my images are very small, but my original images have the correct size.
thanks
I've almost finished my app and I'm thinking about integrating AdMob there. But, in my mind, ads create bad impressions. How much do you earn by adding AdMob to your app? Is adding ads worthy of it?
This is related to question: How to store unlimited characters in Oracle 11g?
If maximum I need is 8000 characters, can I just add 3 more varchar2 columns so that I will have 4 columns with 2000 char each to get 8000 chars. So when the first column is full, values would be spilled over to the next column and so on. Will this design have any bad side effects? Please suggest.
Hello,
Any ideas on how to retain a good quality on converting SWF to FLV?
I use the publish method in CS3, the quality of the movie goes terrible bad when converted to flv.
Can anyone please suggest me some way out?
Thank You
I was happily running my CentOS 5.4 before something bad happened that somehow corrupted the 'nautilus' package. It stopped me from using the default Gnome Desktop.
Then I installed (using yum) the KDE and nautilus later on. Now, KDE is running perfectly with one exception that it takes around 10 minutes before showing up the Login Screen and only a blue screen with mouse pointer keeps showing during those 10 minutes.
Thanks in Anticipation.
Regards, Talal
Which one of the below 2 code pieces is not calling dispose and therefore is bad practice:
...
using(MD5CryptoServiceProvider p = new MD5CryptoServiceProvider())
{
return p.ComputeHash(...);
}
...
or
...
return new MD5CryptoServiceProvider()).ComputeHash(...);
...
?
Hi,
I would like to hear some opinions regarding working in small companies versus large corporations.
So far, my personal experience has been that esp. for junior programmers small companies have given a more solid background, as follow-up is with experienced workers.
In larger corporations on the other hand, the experienced have already worked they way way out of reach.
Is this a general feeling or just my bad experience?
I've got a project with a class log in the global namespace (::log).
So, naturally, after #include <cmath>, the compiler gives an error message each time I try to instantiate an object of my log class, because <cmath> pollutes the global namespace with lots of three-letter methods, one of them being the logarithm function log().
So there are three possible solutions, each having their unique ugly side-effects.
Move the log class to it's own namespace and always access it with it's fully qualified name. I really want to avoid this because the logger should be as convenient as possible to use.
Write a mathwrapper.cpp file which is the only file in the project that includes <cmath>, and makes all the required <cmath> functions available through wrappers in a namespace math. I don't want to use this approach because I have to write a wrapper for every single required math function, and it would add additional call penalty (cancelled out partially by the -flto compiler flag)
The solution I'm currently considering:
Replace
#include <cmath>
by
namespace math {
#include "math.h"
}
and then calculating the logarithm function via math::log().
I have tried it out and it does, indeed, compile, link and run as expected. It does, however, have multiple downsides:
It's (obviously) impossible to use <cmath>, because the <cmath> code accesses the functions by their fully qualified names, and it's deprecated to use in C++.
I've got a really, really bad feeling about it, like I'm gonna get attacked and eaten alive by raptors.
So my question is:
Is there any recommendation/convention/etc that forbid putting include directives in namespaces?
Could anything go wrong with
diferent C standard library implementations (I use glibc),
different compilers (I use g++ 4.7, -std=c++11),
linking?
Have you ever tried doing this?
Are there any alternate ways to banish the math functions from the global namespace?
I've found several similar questions on stackoverflow, but most were about including other C++ headers, which obviously is a bad idea, and those that weren't made contradictory statements about linking behaviour for C libraries. Also, would it be beneficial to additionally put the #include <math.h> inside extern "C" {}?
Hello,
when my user enters data validated as wrong a red circle with a white exclamation mark is shown in the right part of the textbox with the wrong data. The error message is only shown when the user hovers the textbox with wrong data.
Do you think that is a bad User experience ?
I could show the red error message text to the right side of the textboxes if there would still be space...
I'd like to know if listing a set of partner sites/blogs is useful for the pagerank growth.
Does Google see it as an incorrect act? I read somewhere that if people exchange links, google seeks it and marks as a bad technique.
If it doesn't matter, is the content of the linked site relevant?
I have a table row that has the error message in it.
...
Now if someone forgets to enter text or bad text in a textbox, I want this form field to be set to visible.
Can I use a asp.net validator for this or?
Does anyone know an easy way to hide hashtags in the user's address bar? I am using a image gallery plugin and the only way to control the start position is to use a hash tag.
The problem is the hash tag gives away the relative path of the images folder and it looks bad.
Without the hash tag it only loads thumbs and not start image so really it's unavoidable.
Thanks!
I'd like to store additional data if a particular value is chosen in the enumerated or looked-up column in a table. The obvious option is to have an extra column in the table, but this will lead to a mostly empty column and seems to be like bad approach. Is there another option/method of doing this?
Is there any good framework for comparing whole objects?
now i do
assertEquals("[email protected]", obj.email);
assertEquals("5", obj.shop);
if bad email is returned i never get to know if it had the right shop, i would like to get a list of incorrect fields.
Hello,
I'm finding informations about this CSPNRG online. I founded only one article from you on the javamex site, which told about the implementation of this class. So I'm asking you to lead me to some documentation on this. I am expecting a kind of fiable source...
Thank you for eanswering me
Sorry for my bad english, I'm french and not used to write in english
Hi, i have been looking for a javascript code which is like the facebook "like" widget to put in my blogger site.
The examples of the buttons are like in the following website,
http://textsfromlastnight.com/
Where people are able to flag the "Good Nights" or "Bad Nights".
I have no experienced in writing scripts neither do i have any script writing programs, so was wondering if any people can help with the scripts, or maybe tutorials would be of great help!
Thanks!
I'm new to Doctrine and ActiveRecord.
How should I filter a table after it has been loaded? (i suppose this is preferred over sending multiple queries?)
Is this 'good' or 'bad'?
class UserTable extends Doctrine_Table {
function filterByGroup($group) {
$ut = new UserTable();
foreach($this as $u) {
if($u->group = $group) $ut->add($u);
}
return $ut;
}
}
I have a snippet of code that looks like this:
double ?t = lastPollTime - pollTime;
double a = 1 - Math.exp(-?t / t);
average += a * (x - average);
Just how bad an idea is it to use unicode characters in Java identifiers? Or is this perfectly acceptable?
Hi everyone,
I work in a small company and we - as many others = use google analytics to monitor how well/bad our site is doing.
To access this information we put the google account's details (username and pwd) and off we go.
I now want to share this information with one of my clients but I don't want to give him my google account.
can anybody suggest the best way or the best practices to achieve this ?
Many Thanks
Lp
file.each_line do |line|
#skip the first one/not a user
3.times { next } if first == 1
first = 2
end
How can I get the 'next' to well, "next" the iteration of the each_line, instead of the 3.times iteration? Also, how can I write this to look better (ie: first == 1 looks bad)
#!/usr/bin/perl
use strict;
use warnings;
my $s = "sad day
Good day
May be Bad Day
";
$s =~ s/\w+ \w+/_/gm;
print $s;
I am trying to substitute all spaces between words with _, but it is not working. What is wrong with that?