checgg 最近的时间轴更新
checgg

checgg

V2EX 第 115469 号会员,加入于 2015-05-06 13:47:13 +08:00
根据 checgg 的设置,主题列表被隐藏
二手交易 相关的信息,包括已关闭的交易,不会被隐藏
checgg 最近回复了
2019-06-03 10:26:00 +08:00
回复了 checgg 创建的主题 程序员 当我们在谈论高并发的时候究竟在谈什么?
@Aruforce @zhuyichen1017

https://github.com/netty/netty/tree/4.1/example/src/main/java/io/netty/example/http/helloworld

65-69 行:

```
/*
* Copyright 2013 The Netty Project
*
* The Netty Project licenses this file to you under the Apache License,
* version 2.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.example.http.helloworld;

import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.handler.codec.http.DefaultFullHttpResponse;
import io.netty.handler.codec.http.FullHttpResponse;
import io.netty.handler.codec.http.HttpObject;
import io.netty.handler.codec.http.HttpRequest;
import io.netty.handler.codec.http.HttpUtil;

import static io.netty.handler.codec.http.HttpHeaderNames.CONNECTION;
import static io.netty.handler.codec.http.HttpHeaderNames.CONTENT_LENGTH;
import static io.netty.handler.codec.http.HttpHeaderNames.CONTENT_TYPE;
import static io.netty.handler.codec.http.HttpHeaderValues.CLOSE;
import static io.netty.handler.codec.http.HttpHeaderValues.KEEP_ALIVE;
import static io.netty.handler.codec.http.HttpHeaderValues.TEXT_PLAIN;
import static io.netty.handler.codec.http.HttpResponseStatus.OK;

public class HttpHelloWorldServerHandler extends SimpleChannelInboundHandler<HttpObject> {
private static final byte[] CONTENT = { 'H', 'e', 'l', 'l', 'o', ' ', 'W', 'o', 'r', 'l', 'd' };

@Override
public void channelReadComplete(ChannelHandlerContext ctx) {
ctx.flush();
}

@Override
public void channelRead0(ChannelHandlerContext ctx, HttpObject msg) {
if (msg instanceof HttpRequest) {
HttpRequest req = (HttpRequest) msg;

boolean keepAlive = HttpUtil.isKeepAlive(req);
FullHttpResponse response = new DefaultFullHttpResponse(req.protocolVersion(), OK,
Unpooled.wrappedBuffer(CONTENT));
response.headers()
.set(CONTENT_TYPE, TEXT_PLAIN)
.setInt(CONTENT_LENGTH, response.content().readableBytes());

if (keepAlive) {
if (!req.protocolVersion().isKeepAliveDefault()) {
response.headers().set(CONNECTION, KEEP_ALIVE);
}
} else {
// Tell the client we're going to close the connection.
response.headers().set(CONNECTION, CLOSE);
}
try {
Thread.sleep(10);
} catch (InterruptedException e) {
e.printStackTrace();
}
ChannelFuture f = ctx.write(response);

if (!keepAlive) {
f.addListener(ChannelFutureListener.CLOSE);
}
}
}

@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
cause.printStackTrace();
ctx.close();
}
}

```
2019-06-01 20:57:04 +08:00
回复了 checgg 创建的主题 程序员 当我们在谈论高并发的时候究竟在谈什么?
一位常年潜水的个人开发者,没有任何广告哈~~
写了一些本人的一点沉淀和思考。
2018-11-25 13:06:28 +08:00
回复了 wleexi 创建的主题 程序员 服务端防止重复提交
这个问题的实际需求是什么?
1 防止提交两次?
这只能客户端去解决。

2 防止数据入库两次?
那么重复提交的定义是什么?
两个客户端,提交同一份数据,算重复提交吗?
如果算,设置数据库唯一索引就好,写入相同数据会失败。
如果不算,服务端没法验证。因为客户端请求都可以伪造。
这是啥问题?
并行和并发的定义是啥,不理解,能否补充一下英文关键词或者具体业务场景?
大量 IO 是指的磁盘 IO 还是网络 IO ?
@oldbai
哈哈哈哈
2018-08-29 09:48:10 +08:00
回复了 checgg 创建的主题 问与答 请问某些字符撑大 table 的 td 怎么处理?
@azh7138m 👍
2018-08-28 17:00:03 +08:00
回复了 checgg 创建的主题 问与答 请问某些字符撑大 table 的 td 怎么处理?
@gzf6
@Sparetire
fixed '。。。。' 会到表格外面去。
2018-08-28 10:54:23 +08:00
回复了 checgg 创建的主题 问与答 请问某些字符撑大 table 的 td 怎么处理?
@TomatoYuyuko 不能 hidden。
如果业务需要这个东西打印出来呢。。。。
2018-08-22 09:28:09 +08:00
回复了 PHPer233 创建的主题 PHP 如何实现在 Web 页面中点一下按钮就能启动一个 PHP 进程?
简单点的丢数据库跑 cron。
优雅点的丢 MQ 或者 swoole 常驻内存实现。
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   951 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 11ms · UTC 21:04 · PVG 05:04 · LAX 14:04 · JFK 17:04
Developed with CodeLauncher
♥ Do have faith in what you're doing.