Archive

Archive for the ‘零敲碎打’ Category

[Evidence] Please stop crawling and indexing my website 

August 10th, 2016 No comments

Hello there,

Thanks for your attention on my mail, Something very important needs to let you know.
First, tuicool.com a very useful tool for users to subscribe what they really want, Congrats for the work!

I’m trying to analyze the accesslogs of my blog (https://www.lidaren.com), but i get something strange,
there are too many anonymous spider/crawler accessing, and IPs seems like from similar source hosts.
By tracing those IPs,I found that some of those IPs probably came from your spider/crawler.

And, I found some post contents of my blog were indexed by tuicool.com and can be directly searched out
via Google, eg. http://www.tuicool.com/articles/UVRjmyN
Read more…

Categories: 零敲碎打 Tags: ,

Xcode8 beta版无法输出NSLog问题

August 4th, 2016 No comments

使用Xcode8的Beta版本进行Objective-C/iOS程序调试时,使用NSLog无法输出日志,同时输出以下内容:
subsystem: com.apple.BaseBoard, category: MachPort, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 0, privacy_setting: 0

subsystem: com.apple.FrontBoard, category: Common, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 0, privacy_setting: 0

同样的Objective-C/iOS代码在Xcode7版本输出正常,没有出现。

苹果的官方论坛也有人提了Xcode8 beta的Bug
https://forums.developer.apple.com/thread/49136
Read more…

MT4使用MQL连接Redis的插件

July 25th, 2016 No comments

工作中需要将MT4的数据读取并且存储到Redis数据库中去,同时MT4读取Redis当中的数据用于下单的切换账户。
MT4支持使用MQL进行开发,通过调用标准的系统DLL实现系统调用,因此技术实现并不是太难,只需要按MQL的接口要求编写相应的CPP代码
编译成DLL即可实现所需要的功能。

在Windows平台上,连接Redis的客户端选用Hiredis作为连接客户端lib。

Read more…

Categories: 语言编程, 零敲碎打 Tags: , ,

Fiddler 脚本对HTTP请求进行处理

July 25th, 2016 No comments

Fiddler在HTTP编程过程是不可多得的利器,特别是它使用的是代理方式,能够提供非侵入式的HTTP通信报文编程,在Web接口调试方面很方便。特别是它提供使用JScript .NET方式进行功能拓展,让Web前端调试编程变得很容易

先科普
Fiddler, The free web debugging proxy for any browser, system or platform
百度百科的介绍
Fiddler 是用C#写出来的,它包含一个简单却功能强大的基于JScript .NET 事件脚本子系统,它的灵活性非常棒,可以支持众多的http调试任务,并且能够使用.net框架语言进行扩展。

Fiddler官方地址
http://www.telerik.com/fiddler

Read more…

Categories: 语言编程, 零敲碎打 Tags:

Mesos + Marathon + Deimos + Docker 容器集群组建

July 25th, 2016 No comments

今天用单机试验配置了Mesos + Marathon + Deimos + Docker容器集群环境,目的是为以后的搭建轻量级别PaaS平台

先科普
Mesos,是Apache下的开源分布式资源管理框架,它被称为是分布式系统的内核。Mesos最初是由加州大学伯克利分校的AMPLab开发的,后在Twitter得到广泛使用。
Marathon,是一个mesos框架,能够支持运行长服务,比如web应用等。是集群的分布式Init.d,能够原样运行任何Linux二进制发布版本。
Deimos, 是一个为Mesos准备的Docker插件。使用Docker接口可以让Mesos批量管理Docker容器
Docker,是一个重新定义了程序开发测试、交付和部署过程的开放平台。Docker也是容器技术的一种,它运行于Linux宿主机之上,每个运行的容器都是相互隔离的,也被称为轻量级虚拟技术或容器型虚拟技术。
Read more…

w_char*和char *转换宽窄字符

June 29th, 2016 No comments

w_char*和char*在windows编程过程中进行转换是经常需要的,通常由互联网我们取到都是utf-8编码,到windows应用程序里面却需要用unicode编码。
一开始用stdlib.h 下wcstombs_s和mbstowcs_s的代码实现,发现总是转换失败和出错。
char 转 WCHAR 、wchar_t、LPWSTR ,窄字符转宽字符,C++代码

//+------------------------------------------------------------------+
//| char to WCHAR 、wchar_t、LPWSTR etc                              |
//+------------------------------------------------------------------+
static char* WStr2CStr(const wchar_t* WStr)
  {
             // 长度设置
              size_t len = wcslen(WStr) + 1;
              size_t converted = 0;
              // 准备转换的对象
              char *CStr;
              CStr=(char*)malloc(len*sizeof(char));
              // 转换
              wcstombs_s(&converted, CStr, len, WStr, _TRUNCATE);
              // 返回
              return CStr;
  }

Read more…

Categories: 语言编程, 零敲碎打 Tags: , ,

Windows下实现Deamon守护脚本

June 28th, 2016 No comments

最近需要在Windows服务器上保持程序长期允许,因为程序比较老,无法用srvany.exe 改写成windows服务,只能自己手动编写守护脚本实现,网上找了短比较靠谱的守护脚本,在此mark一下。支持监视进程、端口。

守护脚本定义部分

@echo off
 
::检测时间间隔,单位:秒
set _interval=5
 
::需要守护的进程名称
set _processName=ProcessName
 
::需要守护的进程启动命令
set _processCmd=C:\xxxx.exe
 
::需要守护的进程预估启动完毕所需时间,单位:秒
set _processTimeout=10
 
::需要守护的进程所监听的端口
set _port=8080
 
::进程用户名,一般是Administrator
set _username=Administrator

Read more…

Categories: 零敲碎打 Tags: , ,