小编hil*_*llz的帖子

如何创建并排textareas?

我想在一行中创建4个textareas,每个都有自己的标题,这是我想要做的例证:

在此输入图像描述

我试过这个:

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
</head>

<body>
<div style="float:left;">
    <p>
        title1<br />
        <textarea cols="15" rows="15">
        textarea1
        </textarea><br />
        title2<br />
        <textarea cols="15" rows="15">textarea2</textarea>
    </p>
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

相反,它在2行中创建2个textareas,我想在一行中有4个textareas,并且每个textarea都有一个标题.我怎么做?

html css alignment

8
推荐指数
1
解决办法
7036
查看次数

如何使用wget发布html表单?

我有一个这样的表格,位于http://www.sms-online.web.id:

<!DOCTYPE html>
<html>
<head>
</head>
<body>
<body>

    <form method="post" enctype="multipart-form-data" name="my_form" onsubmit="clearTextBoxCounter()" action="http://www.sms-online.web.id/kirim" >

      <input type=hidden name=teks value=><center><b>KIRIM SMS GRATIS</b></center><br><br>
    Nomer:<br />
      <input type="text" maxlength="20" name="Phonenumbers" value="08888888"/>
      <br />

    <br />
    Isi:<br />
    <textarea rows="5" cols="50" onKeyPress=check_length(this.form); onKeyDown=check_length(this.form); name=Text >
    Content of my sms
    </textarea>
    <br />

    <input id="saveForm" class="btTxt" type="submit" value="KIRIM" name="TOMBOL" />

    </body>
    </html>
Run Code Online (Sandbox Code Playgroud)

我想发布到那个表单然后提交它,我如何使用wget来完成这项工作?我已经阅读了wget --post-data xxx但是我仍然不知道我应该在终端输入什么,基于该html文件,我应该这样输入吗?(我真的不确定它会起作用)wget --post-data value=08585858 textarea="Content of my sms" http://www.sms-online.web.id

html wget

5
推荐指数
1
解决办法
1万
查看次数

Python串行-尝试使用未打开的端口

我仍然是python的新手,所以请多多包涵,所以我试图用编写脚本,python2-pyserial但是我一直收到错误消息。Attempting to use a port that is not open这是脚本:

#!/usr/bin/python

import serial, time
#initialization and open the port
#possible timeout values:
#    1. None: wait forever, block call
#    2. 0: non-blocking mode, return immediately
#    3. x, x is bigger than 0, float allowed, timeout block call
ser = serial.Serial()
ser.port = "/dev/ttyUSB2"
ser.baudrate = 115200
ser.bytesize = serial.EIGHTBITS #number of bits per bytes
ser.parity = serial.PARITY_NONE #set parity check: no parity
ser.stopbits = serial.STOPBITS_ONE …
Run Code Online (Sandbox Code Playgroud)

python pyserial

5
推荐指数
1
解决办法
7599
查看次数

Python - TypeError:“NoneType”类型的参数不可迭代

我是Python新手,所以请耐心等待。我编写了一个脚本来检查 3G 加密狗上的运营商名称,python-pyserial基本上如下所示:

def get_operator():   
    ID_OPSEL=('51011:XL-Axiata','51010:Telkomsel','51089:Three','51001:Indosat','INDOSAT:Indosat','51008:Axis','TELKOMSEL:Telkomsel')
    if TYPE=="ZTE":
        resp=send_at_wait('AT+COPS?','+COPS:',3)
        if resp<>"TIMEOUT":
            resp=get_value(resp,'+COPS:')
            return resp.spilt('"')[1]
    else:    
        resp= send_at_wait("AT+COPS?; +COPS?\r","+COPS:",3)
        if resp<>"TIMEOUT":
            resp=get_value(resp,'+COPS:')
            resp=resp.split(',')
            if len(resp)>2: 
                resp=resp[2].replace('"','')
                for ln in ID_OPSEL:
                    if ln.find(resp)<>-1:
                        return ln.split(':')[1]
            else:
                return "Not Registered"

op=get_operator()
if "Not Registered" in op:
    print "No Signal"
else:
    print "Operator Name: " + op
Run Code Online (Sandbox Code Playgroud)

当有接待时,一切正常,但当没有接待时,脚本返回:

Traceback (most recent call last):
  File "/usr/bin/gsm", line 639, in <module>
    if "Not Registered" in op:
TypeError: argument of type 'NoneType' is not iterable …
Run Code Online (Sandbox Code Playgroud)

python nonetype

4
推荐指数
1
解决办法
3万
查看次数

php 中等效的“grep”命令是什么?

请耐心等待,因为我对 PHP 还是很陌生。所以我有一个config这样的文件:

profile 'axisssh2'
server '110.251.223.161'
source_update 'http://myweb.com:81/profile'
file_config 'udp.group-1194-exp11nov.ovpn'
use_config 'yes'
ssh_account 'sgdo.ssh'
Run Code Online (Sandbox Code Playgroud)

我想创建一个名为PHP变量$currentprofile有值axisssh2该值不断变化。随着grep在bash我可以做

currentprofile=$(cat config | grep ^profile | awk -F "'" '{print $2}')
Run Code Online (Sandbox Code Playgroud)

但我不知道如何用 PHP 做到这一点。请高手帮我如何做到这一点,谢谢。

更新:所以我尝试preg_match这样,但它只显示值1

$config=file_get_contents('/root/config');
$currentprofile=preg_match('/^profile /', $config);
echo "Current Profile: ".$currentprofile;
Run Code Online (Sandbox Code Playgroud)

请告诉我怎么了。

php bash awk

1
推荐指数
1
解决办法
1万
查看次数

C程序 - 警告:字符数组的初始化字符串太长

因为我是C编程新手所以请耐心等待,所以这是我的代码:

#include <stdio.h>
#include <sys/stat.h>
#include <string.h>
#include <stdlib.h>

int main(int argc, char* argv[])
{
    char name[0] = "/tmp/crt/client.conf";
    char name[1] = "/tmp/crt/haha";
    char name[2] = "/tmp/crt/Router.ovpn";
    char name[3] = "/tmp/crt/Router.txt";
    char name[4] = "/tmp/crt/sgdo11-tcpvpn.com-443.ovpn";
    char name[5] = "/tmp/crt/sgdo1-tcpvpn.com-443.ovpn";
    char name[6] = "/tmp/crt/sshdropbear.net-2016-10-22.ovpn";
    char name[7] = "/tmp/crt/sshdropbear.net.txt";
    char name[8] = "/tmp/crt/tcpvpn.txt";
    char name[9] = "/tmp/crt/test15.ovpn";
    char name[10] = "/tmp/crt/test15.txt";
    char name[11] = "/tmp/crt/UDP-1197.ovpn";
    char name[12] = "/tmp/crt/udp.group-1194-exp11nov.ovpn";
    char name[13] = "/tmp/crt/udp.group-1194.txt";

    int def_size[0] = 5874; // FILE: /tmp/crt/client.conf
    int def_size[1] …
Run Code Online (Sandbox Code Playgroud)

c arrays

0
推荐指数
1
解决办法
415
查看次数

如何在C程序中的“ ctime”之后删除换行符?

因为我还是C编程的新手,所以请多多包涵。当我运行此代码时:

#include <time.h>
#include <stdio.h>
#include <unistd.h>

int main(void)
{
    while (1) {
        time_t mytime;
        mytime = time(NULL);
        printf("%s Hello world\n", ctime(&mytime));
        sleep(1);
    }
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

输出总是看起来像这样:

Wed Jan 18 02:32:32 2017
 Hello world
Wed Jan 18 02:32:33 2017
 Hello world
Wed Jan 18 02:32:34 2017
 Hello world
Run Code Online (Sandbox Code Playgroud)

我想要的是这样的:

Wed Jan 18 02:32:32 2017 Hello world
Wed Jan 18 02:32:33 2017 Hello world
Wed Jan 18 02:32:34 2017 Hello world
Run Code Online (Sandbox Code Playgroud)

我怎样才能做到这一点 ?

注意:如果我将其删除\nprintf("%s Hello world\n", ctime(&mytime)); …

c

-1
推荐指数
1
解决办法
1190
查看次数

标签 统计

c ×2

html ×2

python ×2

alignment ×1

arrays ×1

awk ×1

bash ×1

css ×1

nonetype ×1

php ×1

pyserial ×1

wget ×1