我有这些数据:
roles = [
{roleId: "69801", role: "ADMIN"}
{roleId: "69806", role: "SUPER_ADMIN"}
{roleId: "69805", role: "RB"}
{roleId: "69804", role: "PILOTE"}
{roleId: "69808", role: "VENDEUR"}
{roleId: "69807", role: "SUPER_RB"}
]
Run Code Online (Sandbox Code Playgroud)
我必须过滤我的表,以检查是否有一个对象包含一个特定的角色值.
我的功能应如下所示:
checkRoleExistence(role){
// if role exists on one of the objects return true
// else returne false
}
Run Code Online (Sandbox Code Playgroud)
使用它我会这样做:
let ifExists = this.checkRoleExistence("PILOTE") ;
Run Code Online (Sandbox Code Playgroud)
我想使用Ecmascript的"过滤器"功能.
建议?
在下面的代码中,我只想更改内部字体大小而不是按钮大小。
<html>
<head>
<style>
.sm
{
font-size:x-small;
}
</style>
</head>
<body>
<button class="sm">
submit
</button>
</body>
</html>
Run Code Online (Sandbox Code Playgroud) 我是套接字或网络编程的新手.我只是想创建一个套接字,但python正在给我追溯.我在Ubuntu 12上使用python 2.7
我的代码:
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print 'OK'
Run Code Online (Sandbox Code Playgroud)
追溯是:
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/apport_python_hook.py", line 66, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python2.7/dist-packages/apport/__init__.py", line 1, in <module>
from apport.report import Report
File "/usr/lib/python2.7/dist-packages/apport/report.py", line 12, in <module>
import subprocess, tempfile, os.path, urllib, re, pwd, grp, os
File "/usr/lib/python2.7/urllib.py", line 26, in <module>
import socket
File "/home/ans/Desktop/python_p/socket.py", line 2, in <module>
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
AttributeError: 'module' object has no …Run Code Online (Sandbox Code Playgroud) 我正在使用GSM SIM900和Arduino Uno。我正在为SIM900使用AT命令。我已经成功地从GET请求中获取数据并显示在串行监视器上,但是在AT+HTTPREAD命令之后,我想将数据存储到变量中。我怎样才能做到这一点?我正在从Web服务器获取JSON对象,我想Status从该对象获取属性并将其保存到变量中。
#include <SoftwareSerial.h>
SoftwareSerial gprsSerial(2,3);
void setup() {
gprsSerial.begin(9600);
Serial.begin(9600);
Serial.println("Con");
delay(2000);
Serial.println("Done!...");
gprsSerial.flush();
Serial.flush();
// See if the SIM900 is ready
gprsSerial.println("AT");
delay(1000);
toSerial();
// SIM card inserted and unlocked?
gprsSerial.println("AT+CPIN?");
delay(1000);
toSerial();
// Is the SIM card registered?
gprsSerial.println("AT+CREG?");
delay(1000);
toSerial();
// Is GPRS attached?
gprsSerial.println("AT+CGATT?");
delay(1000);
toSerial();
// Check signal strength
gprsSerial.println("AT+CSQ ");
delay(1000);
toSerial();
// Set connection type to GPRS
gprsSerial.println("AT+SAPBR=3,1,\"Contype\",\"GPRS\"");
delay(2000);
toSerial();
// Set the APN
gprsSerial.println("AT+SAPBR=3,1,\"APN\",\"wap.mobilinkworld.com\"");
delay(2000);
toSerial(); …Run Code Online (Sandbox Code Playgroud) angular ×1
arduino ×1
at-command ×1
css ×1
ecmascript-6 ×1
filtering ×1
font-size ×1
gsm ×1
html ×1
http-get ×1
javascript ×1
python ×1
python-2.7 ×1
sim900 ×1
sockets ×1
typescript ×1