V2EX checgg
 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 ?
2018-09-15 14:33:10 +08:00
回复了 think2011 创建的主题 程序员 为什么像是王荣耀助手这样的 APP 即使用 Charles + 挂了 https 证书也抓包不了?
@oldbai
哈哈哈哈
2018-08-29 09:48:10 +08:00
回复了 checgg 创建的主题 问与答 请问某些字符撑大 table 的 td 怎么处理?
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。
如果业务需要这个东西打印出来呢。。。。
简单点的丢数据库跑 cron。
优雅点的丢 MQ 或者 swoole 常驻内存实现。
关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     2566 人在线   最高记录 6679       Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 11ms UTC 14:11 PVG 22:11 LAX 07:11 JFK 10:11
Do have faith in what you're doing.
ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86