现在位置: 首页 > hyena发表的所有文章
  • 08月
  • 26日
综合 ⁄ 共 5323字 评论关闭
XMPP(可扩展消息处理现场协议)是基于可扩展标记语言(XML)的协议,它用于即时消息(IM)以及在线现场探测。XMPP协议采用的是客户端-服务器架构,所有从一个客户端发到另一个客户端的消息和数据都必须经过XMPP服务器转发,而且支持服务器间DNS的路由,也就是说可以构建服务器集群,XMPP的前身是一个开源组织制定的网络通信协议——Jabber,XMPP的核心是在网络上分片段发送XML流的协议,这个协议是XMPP的即时通讯指令的传递手段。  XMPP的基本网络结构 ,xmpp定义了3个角色 Client Server Gateway 通信能够在这三者的任意两个之间......
阅读全文
  • 06月
  • 20日
编程语言 ⁄ 共 1104字 评论关闭
这个标题的内容就简单多了,直接看用例吧,仍然以 helloworld.erl模块为例。函数: %% This is a simple Erlang module % Test ... -module(helloworld). -export([pie/0, print/1]). pie() -> 3.14 . print(Msg) -> io:format("The Message is ~p.~n",[Msg]) %~p 表示以美化的方式打印Erlang项式,~n 表示插入一个换行符, ~w 表示打印Erlang字符串 函数子句: -module(helloworld). -export([area/1, either_or_both/2]). % “_” 表示省略模式 either_or_both(true, _) -> true; e......
阅读全文
  • 06月
  • 07日
综合 ⁄ 共 2890字 评论关闭
1. 在任务栏隐藏对话框       ModifyStyleEx(WS_EX_APPWINDOW, WS_EX_TOOLWINDOW); 2. 使对话框为顶层窗口         SetWindowPos(&this->wndTopMost, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE) 3. 在运行时添加最大化,最小化按钮     SetWindowLong(this->m_hWnd, GWL_STYLE,                   GetWindowLong(this->m_hWnd, GWL_STYLE) |                   WS_MINIMIZEBOX | WS_MAXIMIZEBOX);      UpdateWindow(); 4. 使能对话框右上角关闭按钮     在OnInitDialog中     方法一:        CMenu* menu = GetSy......
阅读全文
  • 05月
  • 03日
综合 ⁄ 共 5051字 评论关闭
给你一个问题,要求将给定的字符串循环移位,(比如abc,变为bca),你怎么办呢?是利用数组来定义一个循环吗?倒也不失为一个方法。这里,我们介绍一种更为简洁的方法来处理它,对于同一类问题,有引玉作用。 Char a[6]=”abc”,b[6]; Char *s; S=a; Sprintf(b,”%s%c”,s+1,*s); Puts(b); 是不是发现很简单?那么,我们这里就重点介绍一下sprintf吧! sprintf 跟printf 在用法上几乎一样,只是打印的目的地不同而已,前者打印到字符串中,后者则直接在命令行上输出。这也导致sprintf 比printf 有用得多。 sprintf 是个变参函数......
阅读全文
  • 05月
  • 01日
综合 ⁄ 共 1304字 评论关闭
一:控制Dialog 的背景方法: 1.定义一个无背景主题主题 <!--去掉背景Dialog--> <style name="NobackDialog" parent="@android:style/Theme.Dialog"> <item name="android:windowBackground">@color/no_back</item> </style> 2.创建Dialog dialog = new Dialog(this,R.style.dialog); dialog.setContentView(R.layout.dialog_loading); or: dialog = new Dialog(this,R.style.NobackDialog); LayoutInflater mInflater = LayoutInflater.from(this); View dialogProcessBar = mInflater.infl......
阅读全文
  • 04月
  • 23日
综合 ⁄ 共 1130字 评论关闭
水题不解释,直接贴以前的代码 code /* ID: yueqiq PROG: numtri LANG: C++ */ #include <set> #include <map> #include <ctime> #include <queue> #include <cmath> #include <stack> #include <limits> #include <vector> #include <bitset> #include <string> #include <cstdio> #include <cstring> #include <fstream> #include <string.h> #include <iostream> #include <algorithm> #define Si set<int> #define LL......
阅读全文
  • 03月
  • 19日
综合 ⁄ 共 4261字 评论关闭
WorkingMessage获取将要发送的短信: 首先刷新收信人,然后创建SmsMessageSender类并调用sendMessage()发送短信。 private void sendSmsWorker(String msgText, String semiSepRecipients, long threadId, int simId) { String[] dests = TextUtils.split(semiSepRecipients, ";"); MessageSender sender = new SmsMessageSender(mActivity, dests, msgText, threadId); // 双卡支持 @{ sender.setSimId(simId); // @} try { sender.sendMessage(th......
阅读全文
  • 02月
  • 23日
综合 ⁄ 共 475字 评论关闭
//斐波那契数列求和的非递归算法 //非递归算法利用栈作工具,栈的数据类型      struct Node {         int n,tag; }; //利用栈作工具,非递归算法 long Fibnacci ( long N )   {          Stack S;   Node w;  long sum = 0;          do {           while ( N > 1 ) {               w.n = N;  w.tag = 1;  S.Push (w);             N--;           }         //向左递归到底, 边走边进栈         sum = sum + N;                          while ( !S.IsEmpty( ) ) {             S.Pop(w);             if ( w.tag == 1 ) ......
阅读全文
  • 01月
  • 13日
综合 ⁄ 共 112字 评论关闭
#include<cstdio> int n,ans=1; int main(){ scanf("%d",&n); for(int i=1;;i++){ ans*=2; if(ans>n){ printf("%d",i); return 0; } } }
阅读全文
  • 12月
  • 08日
综合 ⁄ 共 9365字 评论关闭
  译注:注意,本文仅仅适合于MSVC环境中STL库,对于STLPort有问题 原作者:Taka Muraoka 原出处:http://www.codeproject.com/vcpp/stl/upgradingstlappstounicode.asp 介绍 我最近升级一个想当大的程序,目的是用Unicode代替single-byte 字符。除了少数遗留下来的模块,我忠实地使用t-functions并且用_T()宏包裹我的字符串和字符常量,众所周知这能安全的转换成Unicode,我要做的事情是定义UNICODE 和 _UNICODE,我祈祷所有事情将如我所愿的工作。 天啊,我是多么地错误:(( 因此,我写这篇文章是为了治疗两周工作之痛,并且希望......
阅读全文
  • 11月
  • 22日
综合 ⁄ 共 3328字 评论关闭
  The 3n + 1 problem Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 39115   Accepted: 12294 Description Problems in Computer Science are often classified as belonging to a certain class of problems (e.g., NP, Unsolvable, Recursive). In this problem you will be analyzing a property of an algorithm whose classification is not known for all possible inputs. Consider the following algorithm: 1. input n 2. print n 3. if n = 1 then ST......
阅读全文
  • 11月
  • 10日
综合 ⁄ 共 2153字 评论关闭
对于图来说,邻接矩阵是不错的一种图存储结构,但是我们也发现,对于边数相对顶点较少的图,这种结构是存在对存储空间的极大浪费的。因此我们考虑另外一种存储结构方式:邻接表(Adjacency List),即数组与链表相结合的存储方法。 邻接表的处理方法是这样的。 1、图中顶点用一个一维数组存储,另外,对于顶点数组中,每个数据元素还需要存储指向第一个邻接点的指针,以便于查找该顶点的边信息。 2、图中每个顶点vi的所有邻接点构成一个线性表,由于邻接点的个数不定,所以用单链表存储,无向图称为顶点vi的边表,有向图称为顶......
阅读全文