我尝试修改AsyncTaks中的Spinner内容,但我不能和Logcat写的"09-19 16:36:11.189:ERROR/ERROR THE(6078):只有创建视图层次结构的原始线程可以触及它观点."
public class GetGroups extends AsyncTask<Void, Void, Void> {
@Override
protected Void doInBackground(Void... params) {
Spinner combo = (Spinner) findViewById(R.id.group_combo);
setGroups(combo);
return null;
}
@Override
protected void onPostExecute(Void unused)
{
super.onPostExecute(unused);
Spinner combo = (Spinner) findViewById(R.id.severity_combo);
combo.setSelection(1);
//updateGroups();
//if (!isFinishing())
//{
/*Spinner combo = (Spinner) findViewById(R.id.group_combo);
ProgressBar pg = (ProgressBar) findViewById(R.id.loading_group);
pg.setVisibility(ProgressBar.GONE);
combo.setVisibility(Spinner.VISIBLE);
combo.setSelection(0);*/
//}
}
}
}
Run Code Online (Sandbox Code Playgroud)
函数setGroups是:
public void setGroups(Spinner combo) {
try {
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(this.object.url);
List<NameValuePair> parameters …Run Code Online (Sandbox Code Playgroud) bash 代码是:
mx=8;my=8;head -c "$((3*mx*my))" /dev/urandom | convert -depth 8 -size "${mx}x${my}" RGB:- /tmp/random.png
Run Code Online (Sandbox Code Playgroud)
以及python3中的代码:
#!/usr/bin/python3
import subprocess
result = subprocess.run(['head', '-c {}'.format(3 * size * size), '/dev/urandom'], stdout=subprocess.PIPE)
print('{}'.format(result))
result = subprocess.run(['convert', '-depth 8', '-size{}x{}'.format(size, size), 'RGB:-', '/tmp/random.png'], stdin=result.stdout, stdout=subprocess.PIPE)
Run Code Online (Sandbox Code Playgroud)
但输出是:
$ python3 create_mosaic_images.py
CompletedProcess(args=['head', '-c 192', '/dev/urandom'], returncode=0, stdout=b"j\xd1U0\x7f\xc0\x11\x9e\xcdJ\x88P\xdc\xe5\xd26\xee\xf3m\xe0\xf9S\xd5%0q\xfb\x01\xd4^\xbd^R\xe4\x9c\x9e\xb5\xaf\x99:B[\xdc4\x80\x1a\x8a>\xeb\x9e\xab\xae/\xa4\xf4\xc3u\xaca\x8efJ\x9fNK\xa2\xb0\x18\x98\x95\xb08\xeb\x07\xf6\x9d2Ko\x11\xa0\x98\xf7\x8b\x04'\xd4;\xe8\xa5SD\xc7\xf8\xe6;\x8b\x880\xb8\x1e~\xee>r\xf0\xc0g\xfb\xce\xd6\xfcq\x1a\x91\xa0t0\x96\xf47\x9cj\xd4\x9ac\x15z\x81\xf35\x8f\x1ay\xa2\x8av\xb5\xe4\x15ox\x00\x00O\xfa\x98\x17\xe1\x04\xd5\x8dx\xdf\x9a.\xce<b\xb2\x16\x15\x94\xbd\x17Z\x14\xba\xc5-?\xbcH\t\x9a~1y\xc5\xe6\xf5\xd2[\xfb\xc0k\x90\xdfB\xafje")
Traceback (most recent call last):
File "create_mosaic_images.py", line 26, in <module>
generate_random_pixels_square()
File "create_mosaic_images.py", line 19, in generate_random_pixels_square
result = subprocess.run(['convert', '-depth 8', '-size{}x{}'.format(size, size), 'RGB:-', '/tmp/random.png'], stdin=result.stdout, stdout=subprocess.PIPE) …Run Code Online (Sandbox Code Playgroud) 昨天,我试图获取 GitHub 中所有公共存储库的列表,但没有找到任何链接。
例如,在 Sourceforge 中,您可以按类别列出所有项目,或者在 Google 代码中,您可以搜索所有项目。
是的,我尝试使用“*”或“%”或空字符串等关键字进行搜索,但您只能看到此页面https://github.com/search?q=&type=Everything&repo=&langOverride=&start_value=1
我有这个HTML:
<select id="id_agents" style="" size="10" multiple="multiple" name="id_agents[]">
<option value="12">adama</option>
<option value="15">artica</option>
<option value="14">localhost</option>
<option value="8">localhost.localdomain</option>
<option value="13">test</option>
</select>
Run Code Online (Sandbox Code Playgroud)
我正在尝试使用黄瓜来选择所有值,但它没有运行.这些是我的尝试:
When /^I select all in "(.*)"/ do |select_id|
options = all(:xpath, "//select[@id='" + select_id + "']/option").click
options.each do |option|
option.click
end
#~ find(:xpath, "//select[@id='" + select_id + "']/option").each do |element|
#~ element.click
#~ end
sleep(10)
end
Run Code Online (Sandbox Code Playgroud) 我是 Rust 新手。我不知道如何将泛型类型转换<T>为原始类型。
有一个小例子,具有泛型类型的函数 sum:
fn sum<T: std::ops::Add<Output = T>, U>(x:T, y: U) -> T {
// is there any line of code similar to:
// x + y as T
x + y as T
// or check the type
// match type(x) {
// i32 => x + y as i32,
// i64 => x + y as i64,
// f32 => x + y as f32,
// _ => 0
// }
}
fn main() …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用此示例代码,但它不正确:
var aaa = ["a","b","c"];
d3.selectAll(".none").data(aaa).enter().call(function(d) {console.log(d);});
Run Code Online (Sandbox Code Playgroud)
或者
var aaa = ["a","b","c"];
d3.selectAll("html").data(aaa).enter().call(function(d) {console.log(d);});
Run Code Online (Sandbox Code Playgroud) github ×2
android ×1
capybara ×1
casting ×1
cucumber ×1
d3.js ×1
debugging ×1
exception ×1
generics ×1
git ×1
javascript ×1
pipe ×1
python-3.x ×1
repository ×1
ruby ×1
rust ×1
subprocess ×1
symlink ×1