我有一个类的问题,log cat在运行时返回此错误
12-05 23:19:18.299: E/AndroidRuntime(15460): Caused by: java.lang.IllegalArgumentException: provider==null
12-05 23:19:18.299: E/AndroidRuntime(15460): at android.location.LocationManager.getLastKnownLocation(LocationManager.java:1017)
12-05 23:19:18.299: E/AndroidRuntime(15460): at com.rbrlnx.lugares.editarLugar.onCreate(editarLugar.java:110)
12-05 23:19:18.299: E/AndroidRuntime(15460): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
12-05 23:19:18.299: E/AndroidRuntime(15460): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1722)
Run Code Online (Sandbox Code Playgroud)
代码是
/************************************************************************************
*
* Creamos un location manager, le establecemos unos criterios minimos para encontra
*
***********************************************************************************/
LocationManager locManager = (LocationManager)getSystemService(LOCATION_SERVICE);
Criteria criterio = new Criteria();
criterio.setAccuracy(Criteria.ACCURACY_COARSE);
String mejorProvider = locManager.getBestProvider(criterio, true);
//Obtenemos la última posición conocida
final Location loc = locManager.getLastKnownLocation(mejorProvider);
latitud = loc.getLatitude();
longitud= loc.getLongitude();
//Me centro en el …
Run Code Online (Sandbox Code Playgroud) 我有这样的文件:
{
"_id" : ObjectId("53340d07d6429d27e1284c77"),
"worktypes" : [
{
"name" : "Pompas",
"works" : [
{
"name" : "work 1",
"code" : "0001"
}
]
},
{
"name" : "Pompas "",
"works" : [
{
"name" : "work 2",
"code" : "0002"
}
]
}
]
}
Run Code Online (Sandbox Code Playgroud)
我做了一个查询,只获取本文档的工作类型之一的作品,这是查询:
db.categories.find({$and: [
{ "_id": ObjectId('53340d07d6429d27e1284c77')},
{"worktypes.name": "Pompas"}
]},{"worktypes.works.$":1})
Run Code Online (Sandbox Code Playgroud)
但我得到了
{
"_id" : ObjectId("53340d07d6429d27e1284c77"),
"worktypes" : [
{
"name" : "Pompas",
"works" : [
{
"name" : "work 1",
"code" : "0001"
} …
Run Code Online (Sandbox Code Playgroud) 我有这个代码:
#!/bin/bash
PIDS=$(ls -la /proc | awk '{print $9}' | grep "^[0-9]*$")
PIDLIST=$(echo $PIDS | tr "" "\n")
counter=0
for PID in $PIDLIST; do
KERNEL[$counter]=$(cat "/proc/$PID/stat" | awk '{print $14 }')
counter=$((counter + 1))
done
Run Code Online (Sandbox Code Playgroud)
我试图cat "/proc/$PID/stat" | awk '{print $14 }'
在一个指定的KERNEL数组中保存命令的内容,给出一个计数器的位置.
我有这个错误:
mitop.sh: 8: mitop.sh: KERNEL[0]=26: not found
Run Code Online (Sandbox Code Playgroud)
我做错了什么?
sistemas@DyASO:~$ bash --version
GNU bash, versión 4.2.24(1)-release (i686-pc-linux-gnu)
Copyright (C) 2011 Free Software Foundation, Inc.
Licencia GPLv3+: GPL de GNU versión 3 o posterior <http://gnu.org/licenses/gpl.html>
Run Code Online (Sandbox Code Playgroud) 我,我正在做一个模式正则表达式,以检查一个字符串是否:
digit.digit.digit是这样的:
1.1.1
0.20.2
58.55541.5221
Run Code Online (Sandbox Code Playgroud)
在java中我使用这个:
private static Pattern pattern = Pattern.compile("\\d*.\\d*.\\d*", Pattern.CASE_INSENSITIVE);
Run Code Online (Sandbox Code Playgroud)
但如果我通过20.20.在比赛中给我回报.
什么是grond?