IntentFilter ndef = new IntentFilter(NfcAdapter.ACTION_NDEF_DISCOVERED);
try {
ndef.addDataType("*/*"); /* Handles all MIME based dispatches.
You should specify only the ones that you need. */
}
catch (MalformedMimeTypeException e) {
throw new RuntimeException("fail", e);
}
intentFiltersArray = new IntentFilter[] {ndef, };
Run Code Online (Sandbox Code Playgroud)
所以在这里intentFiltersArray[0] = ndef.怎么样intentFiltersArray[1]?在上面的代码中有什么,后面的ndef意思?
同样,它有另一个代码示例
techListsArray = new String[][] { new String[] { NfcF.class.getName() } };
Run Code Online (Sandbox Code Playgroud)
怎么techListsArray[][]在这里初始化?我猜techListsArray[0][0]=NfcF.class.getName()(应该不NfcF应该这样?)但其他元素呢?或者它只有一个元素?
我正在使用bash shell
$cat test
a --b
$grep '--b' test
grep: option `--b' is ambiguous
Usage: grep [OPTION]... PATTERN [FILE]...
Try `grep --help' for more information.
$grep "--b" test
grep: option `--b' is ambiguous
Usage: grep [OPTION]... PATTERN [FILE]...
Try `grep --help' for more information.
$grep '\-\-b' test
a --b
Run Code Online (Sandbox Code Playgroud)
7.7节"引用"中的第7章"输入和输出,文件和命令评估"中的经典shell脚本
"单引号强制shell按字面意思处理引号之间的所有内容".
那么为什么单引号不起作用呢?
这很简单,但我不能让它工作.我想在ssh bash脚本中做一个简单的if else语句.这是我的代码如下:
#!/bin/sh
echo -n "enter what type of logs. (ie. cpanel, apache) "
read type
if [$type == cpanel]
then
LOGTYPES ="error, access"
else
LOGTYPES ="error, access, suphp, suexec"
fi
echo -n "enter which log to tail (ie. $LOGTYPES) "
read logs
echo -n "enter last number of lines to view. (ie. 10, 5000 etc) "
read lines
tail -$lines /usr/local/$type\/logs/$logs\_log
Run Code Online (Sandbox Code Playgroud)
我已经尝试了一切,我不断收到此错误:
[~]# /apachetail
enter what type of logs. (ie. cpanel, apache) cpanel
/apachetail: line 5: [cpanel: command …Run Code Online (Sandbox Code Playgroud) 我在Java应用程序中使用CallableStatement调用Postgres存储函数时出错.错误如下:
org.postgresql.util.PSQLException: Malformed function or procedure escape syntax at offset 6.
at org.postgresql.jdbc2.AbstractJdbc2Statement.modifyJdbcCall(AbstractJdbc2Statement.java:2390)
at org.postgresql.jdbc2.AbstractJdbc2Statement.<init>(AbstractJdbc2Statement.java:149)
at org.postgresql.jdbc3.AbstractJdbc3Statement.<init>(AbstractJdbc3Statement.java:40)
at org.postgresql.jdbc3g.AbstractJdbc3gStatement.<init>(AbstractJdbc3gStatement.java:26)
at org.postgresql.jdbc3g.Jdbc3gStatement.<init>(Jdbc3gStatement.java:28)
at org.postgresql.jdbc3g.Jdbc3gPreparedStatement.<init>(Jdbc3gPreparedStatement.java:21)
at org.postgresql.jdbc3g.Jdbc3gCallableStatement.<init>(Jdbc3gCallableStatement.java:17)
at org.postgresql.jdbc3g.Jdbc3gConnection.prepareCall(Jdbc3gConnection.java:45)
at org.postgresql.jdbc3.AbstractJdbc3Connection.prepareCall(AbstractJdbc3Connection.java:316)
at org.postgresql.jdbc2.AbstractJdbc2Connection.prepareCall(AbstractJdbc2Connection.java:203)
at com.mchange.v2.c3p0.impl.NewProxyConnection.prepareCall(NewProxyConnection.java:632)
at zm.co.freight.model.user.UserRoleModel.getUserRoleDocumentPermission(UserRoleModel.java:212)
Run Code Online (Sandbox Code Playgroud)
应该注意的是,我使用的是Postgres 9.2,posgresql-9.1-902.jdbc3.jar和c3p0-0.9.2-pre4.jar连接池.
这是我想要调用的存储函数:
CREATE OR REPLACE FUNCTION user_role_document_permission_select_all_per_user_role(userroleidin integer)
RETURNS refcursor AS
$BODY$
declare
mycurs refcursor;
begin
open mycurs for
select document._name,
document_user_role_permission.viewing,
document_user_role_permission.processing,
document_user_role_permission.editing,
document_user_role_permission.updating,
document_user_role_permission.user_role_id,
document_user_role_permission.document_id
from document_user_role_permission, document where document_user_role_permission.document_id = document.id and document_user_role_permission.user_role_id = userroleidin;
return mycurs;
end;
$BODY$
LANGUAGE plpgsql …Run Code Online (Sandbox Code Playgroud) 下面的代码给出了错误:
sketch_jul05a:2: error: variable or field 'func' declared void
Run Code Online (Sandbox Code Playgroud)
所以我的问题是:如何将指针作为函数参数传递给结构?
码:
typedef struct
{ int a,b;
} Struc;
void func(Struc *p) { }
void setup() {
Struc s;
func(&s);
}
void loop()
{
}
Run Code Online (Sandbox Code Playgroud) 我花了最后三个小时试图在"控制台"上写一个"字符串"?
System.in.writeToConsole("\"string\"");
Run Code Online (Sandbox Code Playgroud) 我只是想知道是否可以使用Scanner读取String值,将其转换为大写,并在同一if语句中使用.equals("NO").基本上,如果用户输入'否''否''不''nO',它将把它改为'NO',然后执行.equals("NO")来检查用户是否想要继续该程序.是的,我知道if语句参数的当前语法是不正确的,这是因为我不知道该怎么做.我能在if语句中执行toUpperCase和equals(),还是需要使用单独的toUpperCase语句?
公共课程后2 {
public static String cont="";
public static Scanner in=new Scanner(System.in);
Run Code Online (Sandbox Code Playgroud)
在我的主要();
System.out.print("Continue? Yes/No >> ");
cont=in.nextLine();
if(cont.toUpperCase/equals("NO")
{
System.exit(0);
}
showmenu();
Run Code Online (Sandbox Code Playgroud)
另外,由于我使用的是Syste.out.print()和System.out.println(),如果有一种方法可以清除输出窗口中的所有文本,那将会很有帮助.有没有办法清除输出窗口?
我得到:'
需要意外类型:变量
找到:值'在标记的行(*)
for (int i = 0; i < boardSize; i++) {
for (int j = 0; j < boardSize; j++) {
rows[i].getSquare(j) = matrix[i][j]; // * points to the ( in (j)
columns[j].getSquare(i) = matrix[i][j]; // * points to the ( in
int[] b = getBox(i, j);
int[] boxCord = getBoxCoordinates(i + 1, j + 1);
boxes[b[0]][b[1]].getSquare(boxCord[0], boxCord[1]);
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的Row类:
private Square[] row;
Row(int rowCount) {
this.row = new Square[rowCount];
}
public Square getSquare(int index) {
return …Run Code Online (Sandbox Code Playgroud) 以下代码导致语法错误'else' without 'if'.我也无法从if语句中删除分号,因为它也会给我一个错误,告诉我我错过了分号.
import java.util.Scanner;
class cake {
public static void main(String[] args) {
byte age, height;
Scanner in = new Scanner(System.in);
System.out.println("How old are you?");
age = in.nextByte();
System.out.println("How tall are you?");
height = in.nextByte();
if (age >= 10) && (height >= 48); {
System.out.println("You can ride!");
} else {
System.out.println("You cannot ride!");
}
}
}
Run Code Online (Sandbox Code Playgroud) java ×5
bash ×2
if-statement ×2
android ×1
arduino ×1
arduino-ide ×1
jdbc ×1
linux ×1
pointers ×1
postgresql ×1
scripting ×1
shell ×1
string ×1
unix ×1