所以我得到 - warning: [options] bootstrap class path not set in conjunction with -source 1.6
我即将问3个问题.我知道我需要设置bootstrap类路径,但我不确定我是怎么理解的.一个快速谷歌只是发送给我从Oracle页面引用的页面,但我读了Oracle页面,并没有觉得我特别理解它.
我目前在Netbeans上运行此代码,所以我要做的就是点击播放按钮进行编译和运行.是否有一个属性指示如何编译,以便我可以添加引导类路径?
另外,对于即将发生的事件,我将仅在Netbeans上运行并从命令行运行它,使用bootstrap类路径编译的正确方法是什么?他们说,$ javac -source 6 HelloWorld.java但只是说明-source 1.6确实是解决方案?
也许是一个更大的问题,我将来如何避免这种类型的警告?如果我理解甚至一点点,我引用一个旧的java源代码,因此引用较旧的方法.我不确定这是怎么发生的.
我有一个近3 GB的文件,我想在顶部添加两行.每次我尝试手动添加这些行时,vim和vi都会冻结保存(我让他们尝试每次保存大约10分钟).我希望有一种方法可以附加到顶部,就像你附加到文件底部一样.到目前为止我唯一看到的东西包括一个临时文件,我觉得由于文件大小会很慢.我希望有类似的东西:
grep -top lineIwant >> fileIwant
Run Code Online (Sandbox Code Playgroud)
有谁知道附加到文件顶部的好方法?
我有一个快速的问题.我只是想知道它是否是有效的格式(使用bash shell脚本)来为文件名中的循环设置一个计数器.我正在思考以下问题:
for((i=1; i <=12; i++))
do
STUFF
make a file(i).txt
Run Code Online (Sandbox Code Playgroud) 我有一个文件,头部有一个令人讨厌的序言.所以它看起来像这样:
Review performed by:
Meeting:
Person:
Number:
Code:
Confirmation
Tab Separated Header Names That I Want To Use
Run Code Online (Sandbox Code Playgroud)
我想跳过所有内容并使用tab sep头名称作为我的代码.这是我到目前为止:
reader = csv.DictReader(CSVFile)
for i in range(14): #trying to skip the first 14 rows
reader.next()
for row in reader:
print(row)
if args.nextCode:
tab = (row["Tab"])
sep = int((row["Separated"]))
Run Code Online (Sandbox Code Playgroud)
此代码出现此错误:
File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/csv.py", line 104, in next
row = self.reader.next()
StopIteration
Run Code Online (Sandbox Code Playgroud)
我试图打印行,看看我在文件中的位置,然后我将"range(14)"更改为5,但是当我打印行时,我得到了这个:
{'Review performed by:': 'Tab/tSeparated/tHeader/tNames/tThat/tI/tWant/tTo/tUse'}
Traceback (most recent call last):
File "program.py", line 396, in <module>
main()
File "program.py", line 234, …Run Code Online (Sandbox Code Playgroud) 我想知道 bash 中是否有一种简单的方法可以将一个大数组分解成几个较小的数组。我目前正在考虑这样的事情:
for ((i = 0; i<= (bigArrayLength/2); i++)) do
bigArray[i] = smallArray[i]
done
for ((i = (bigArrayLength/2); i <=bigArrayLength; i++))
do
bigArray[i] = secondSmallArray[i]
done
Run Code Online (Sandbox Code Playgroud)
但必须有更好的方法来解决它。有什么建议?谢谢!
我正在编写一个程序并试图分解存储在数组中的数据,以使其运行得更快.我试图这样做:
data_to_analyze=(1 2 3 4 5 6 7 8 9 10)
#original array size
dataSize=(${#data_to_analyze[@]})
#half of that size
let samSmall="$dataSize/2"
#the other half
let samSmall2=("$dataSize - $samSmall -1")
#the first half
smallArray=("${data_to_analyze[@]:0:$samSmall}")
#the rest
smallArray2=("${data_to_analyze[@]:$samSmall:$samSmall2}")
#an array of names(which correspond to arrays)
combArray=(smallArray smallArray2)
sizeComb=(${#combArray[@]})
#for the length of the new array
for ((i=0; i<= $sizeComb ; i++)); do
#through first set of data and then loop back around for the second arrays data?
for sample_name in ${combArray[i]}; do …Run Code Online (Sandbox Code Playgroud) 我想要以字符'rs'开头的所有字符串实例(仅来自一个文件)并将完整的字符串输入到新文件中.我设法得到了实例的计数,但我不知道如何将它们放入新文件中:
grep -c rs < /home/Stephanie/this.txt
698572
Run Code Online (Sandbox Code Playgroud)
文件中一行的示例是:
1203823 forward efjdhgv rs124054t8 dhdfhfhs
12045345 back efjdkkjf rs12445368 dhdfhfhs
Run Code Online (Sandbox Code Playgroud)
我只想抓住rs字符串并将其移动到ne文件.有人可以用管道帮助我吗?我读了一下,但我找到的对我来说并不是特别有帮助.谢谢
我试图搜索数组列表以查找值(可能会重新发生)并删除该值的所有实例.我还想从单独的数组列表中删除位于同一位置的值.两个ArrayLists都是ArrayList<String>.
例如,我在ArrayList2中寻找数字5:
ArrayList 1 ArrayList2
cat 1
pig 2
dog 5
chicken 3
wolf 5
Run Code Online (Sandbox Code Playgroud)
一旦我在两个位置找到数字5,我想从ArrayList1中移除狗和狼.我的代码没有错误,但它似乎并没有真正删除我的要求.
//searching for
String s="5";
//for the size of the arraylist
for(int p=0; p<ArrayList2.size(); p++){
//if the arraylist has th value of s
if(ArrayList2.get(p).contains(s)){
//get the one to remove
String removethis=ArrayList2.get(p);
String removetoo=ArrayList1.get(p);
//remove them
ArrayList2.remove(removethis);
ArrayList1.remove(removetoo);
}
}
Run Code Online (Sandbox Code Playgroud)
当我打印数组列表时,它们看起来基本没有变化.有谁看到我做错了什么?
我希望有人可以帮助我解决我在java中遇到的一个小问题.我有一个List和一个ArrayList,我想输出到一个文件,每个文件的第一个元素,彼此相邻打印.这是我到目前为止:
List<String> uniqueList = new ArrayList<String>(dupMap.values());
for(String unique:uniqueList){
out.write(unique + "\r");
}
ArrayList<Integer>subtr=new ArrayList<Integer>();
out.write("The number: " + subtr + "\r");
Run Code Online (Sandbox Code Playgroud)
这导致了这个输出:
A
B
C
D
E
F
The number: [1, 2, 3, 4, 5, 6]
Run Code Online (Sandbox Code Playgroud)
但我宁愿这样:
A The number: 1
B The number: 2
Run Code Online (Sandbox Code Playgroud)
...等等.
我不确定从哪里开始如何获得这样的输出格式.我尝试将两组值都放入数组中,但我最终让自己感到困惑......这就是我最终的结果.任何帮助将非常感激.
我试图解析 List 中元素的值,声明如下:
List<String> uniqueList = new ArrayList<String>(dupMap.values());
Run Code Online (Sandbox Code Playgroud)
这些值是这样的:
a:1-2
b:3-5
Run Code Online (Sandbox Code Playgroud)
但我想要一个带有第一个数字(即 1、3)的 ArrayList 和另一个带有第二个数字(即 2、5)的 ArrayList。我已经解决了... Sorta:
String delims= "\t"; String delim2= ":"; String delim3= "-";
String splits2[]; String splits3[]; String splits4[];
Map<String,String> dupMap = new TreeMap<String, String>();
List<String> uniqueList = new ArrayList<String>(dupMap.values());
ArrayList<String> parsed2 = new ArrayList<String>();
ArrayList<String> parsed3 = new ArrayList<String>();
ArrayList<String> parsed3two= new ArrayList<String>();
double uniques = uniqueList.size();
for(int a=0;a<uniques;a++){
//this doesn't work like it would for an ArrayList
splits2 = uniqueList.split(delim2) ;
parsed2.add(splits2[1]);
for(int q=0; …Run Code Online (Sandbox Code Playgroud)