Archive

Archive for the ‘语言编程’ Category

让WeCenter支持Github第三方登录功能

February 27th, 2017 1 comment

WeCenter 是一款知识型的社交化问答社区程序,专注于社区内容的整理、归类和检索,并通过连接微信公众平台,移动APP进行内容分发。

因为网站是一个技术支持社区,需要用到Github的第三方登录功能,WeCenter官方不支持Github的第三方登录,干脆自己写了一个。
基于Google的Oauth代码简单实现了Github 第三方登录功能,支持用github账户登录到WeCenter问答系统。

测试网址:http://faq.android-charts.com/
实现功能和演示效果请参考附件图片
Read more…

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:

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: , ,

[iOS] 实现IIF功能和DECODE函数功能

January 12th, 2016 No comments

iOS开发过程中需要处理大量分支判断代码,需要大量使用if、switch等进行分支处理。代码编写和查看都可能出现潜在问题,使用Objective-c语言的自身特点,可以通过以下转换,优化分支判断处理的代码写法。关键是可以一行代码搞定各种分支判断。实现代码简化。

使用宏定义将三目运算改为IIF函数运算,类似于EXCEL的IF公式

#if !defined(IIF)
#define IIF_IMPL(condition,true_,false_) (condition)?true_:false_
#define IIF(condition,true_,false_) IIF_IMPL(condition,true_,false_)
#endif

Read more…

MAC OS编译Android版Linphone SDK和APP

October 28th, 2015 No comments

之前在MAC OS折腾编译iOS版linphone-iphone SDK和APP成功,下一步继续编译Android版的linphone-android。Android版的文档更简单,一个README.TXT就结束,然后各种调查。

简单说明一下linphone
Linphone is an open source SIP Phone, available on mobile and desktop environments (iOS, Android, Windows Phone 8, Linux, Windows Desktop, MAC OSX) and on web browsers.
Linphone has inside a separation between the user interfaces and the core engine, allowing to create various kinds of user interface on top of the same functionalities.

Read more…

Categories: 移动互联, 语言编程 Tags: ,