我正在尝试使用 AVR + ESP8266 构建一个 HTTP 服务器。
我可以通过 telnet 来回发送命令,但现在我想实现一个 Web 界面。
作为起点,我尝试设置一个输出“文本”的网站,但是浏览器显示一个空页面。有人可以告诉我将页面解释为 HTML 的最低要求吗?
telnet 192.168.2.26 81
Trying 192.168.2.26...
Connected to 192.168.2.26.
Escape character is '^]'.
GET / HTTP/1.1
Run Code Online (Sandbox Code Playgroud)
AVR 答案:
HTTP/1.1 200 OK
Content-Type: text/html
<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
<title>Zeitschaltuhr</title></head>
<body>
Text
</body></html>
Connection closed by foreign host.
Run Code Online (Sandbox Code Playgroud) 嗨,我想建立我的第一个Android项目.我是一个优秀的程序员,微控制器,php,bash等.
但是这个java语法正在想要爆炸.
package com.example.test;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.TextView;
public class MainActivity extends Activity {
TextView tv1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
TextView tv1 = (TextView) findViewById(R.id.textView1);
tv1.setText("Text2");
}
Run Code Online (Sandbox Code Playgroud)
和
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:editable = …Run Code Online (Sandbox Code Playgroud) 我试图解析一个巨大的文本文件,比如200mb.
文本文件包含一些字符串
123
1234
12345
12345
Run Code Online (Sandbox Code Playgroud)
所以我的剧本看起来像
while read line ; do
echo "$line"
done <textfile
Run Code Online (Sandbox Code Playgroud)
但是使用上面的方法,我的字符串" 12345"被截断为"12345"
我试过用
sed -n "$i"p textfile
Run Code Online (Sandbox Code Playgroud)
但吞吐量从每秒27线减少到0.2线,这是不可接受的;-)
任何想法如何解决这个问题?