2010年11月24日

摘要: 一开始用Integer 怎么都超时,发现用int 才能过。Equilibrium index of a sequence is an index such that the sum of elements at lower indexes is equal to the sum of elements at higher indexes.For example, in a sequence A:A[0]=-7 A[1]=1 A[2]=5 A[3]=2 A[4]=-4 A[5]=3 A[6]=0 3 is an equilibrium index, because:A[0]+A[1]+A[2]= 阅读全文

posted @ 2010-11-24 11:04 Teddy Yan 阅读(248) 评论(0) 推荐(0) 编辑


2010年11月23日

摘要: 今天玩topcoder, 发现“两次减法操作”竟然比“一次2倍乘法和一次加法”要慢一秒。下面是例程。package practice;import java.util.Calendar;public class GuessinNextElement { public int guessSlow(int[] A) { boolean flag=true; if ((A[1]-A[0])==(A[2]-A[1])) flag=false; if (flag) return A[A.length-1]*(A[2]/A[1]); else return A[A.length-1... 阅读全文

posted @ 2010-11-23 14:45 Teddy Yan 阅读(179) 评论(0) 推荐(0) 编辑


2010年5月17日

摘要: UsersOpt.cs 介绍: readyLogin() 入口 private void DataArrival(byte[] Data, System.Net.IPAddress Ip, int Port) 这是收到消息的处理函数,里面有个一个大的switch ServiceMain.cs FormAccess.cs newSendMsgForm() 产生新用户发送消息窗口 (其中有打洞代码) if (user.State != 0 && !user.isWANConnected)//如果用户在线且与对方未连接,则向服务器请求获得对方IP与端口,并请求服务器通知对方UDP打洞 阅读全文

posted @ 2010-05-17 16:00 Teddy Yan 阅读(201) 评论(0) 推荐(0) 编辑

摘要: 先转载一部分:昨天被人问及epoll和select的差别,吞吞吐吐说了个大概,囧,基础不牢害死人啊再次查找了资料,内容如下select和poll:int select(int n, fd_set *rd_fds, fd_set *wr_fds, fd_set *ex_fds, struct timeval *timeout);select用到了fd_set结构,此处有一个FD_SETSIZE决定fd_set的容量,FD_SETSIZE默认1024,可以通过ulimit -n或者setrlimit函数修改之。int poll(struct pollfd *ufds, unsigned int n 阅读全文

posted @ 2010-05-17 15:36 Teddy Yan 阅读(506) 评论(0) 推荐(0) 编辑


2010年3月4日

摘要: 一、整体流程。 1. Web界面 | // 2. Extjs | // 3. Java method call (with parameter object) | // 4. JNI call 自己写的map2dll.dll,这个dll调用TopMap的控件并传入数据,生成一个等值线图的文件。 | // 5. 使用ArcGIS 按照一个新图层的方式,导入这个等值线图。等值线图和其他的图层叠加在... 阅读全文

posted @ 2010-03-04 14:44 Teddy Yan 阅读(569) 评论(0) 推荐(0) 编辑


2010年2月25日

摘要: 1. Code base is Windows The code originally could be compile and build in Microsoft Visual Studio 7.0 2. Compile and build on MingGW and MSYS Because I want to compile with FFMpeg code together, move the code to MinGW compiler. MingGW is compiler to build Linux like code on Windows platform. It... 阅读全文

posted @ 2010-02-25 22:30 Teddy Yan 阅读(146) 评论(0) 推荐(0) 编辑

摘要: I learned some experience while Nanjing found 0x03 error. At begining, we don't know why our GSRM(a linux process) hang in a short time 5 seconds sometimes. It didn't handle any message at that time and the interruption is not regularly. So we assume we have Linux OS problem. We did followin 阅读全文

posted @ 2010-02-25 22:29 Teddy Yan 阅读(290) 评论(0) 推荐(0) 编辑


2010年1月14日

摘要: tutorial05 是要把音频可以同步到视频,也为下一步快进,快退做准备。因为是音频所以不是简单的delay,需要进行音频缓冲的管理,synchronize_audio 返回的是一个同步好的缓冲区。tutorial06.c 是要用一些API,实现快进或者快退。注意我们要清空我们自己的缓存。 if(is->seek_req) { int stream_index= -1; int64_t seek_target = is->seek_pos; if (is->videoStream >= 0) stream_index = is->videoStream; els 阅读全文

posted @ 2010-01-14 16:06 Teddy Yan 阅读(512) 评论(0) 推荐(0) 编辑


2010年1月13日

摘要: Tutorial 04: Spawning Threads 没什么大问题,就是新建了一个数据VideoState数据结构,然后生成两个新的Thread分别,把音视频从文件取出,和一个专门视频解码的线程。用SDL的一个自动刷新功能,把视频帧送到屏幕上。下面的代码,就是需要tutorial5来解决的同步问题。vp = &is->pictq[is->pictq_rindex]; /* Now, normally here goes a ton of code about timing, etc. we're just going to guess at a delay f 阅读全文

posted @ 2010-01-13 15:14 Teddy Yan 阅读(332) 评论(0) 推荐(0) 编辑

摘要: FFMpeg的向导对于学习FFMpeg有很大的帮助,出处:原始:http://www.dranger.com/ffmpeg/tutorial01.html翻译:http://home.chinavideo.org/space.php?do=mtag&tagid=2tutorial01 和 tutorial02很简单,按照做就可以:大致FFMpeg API的使用流程是用av_open_input_file() 打开文件,可以得到AVFormatContext 结构。这样,文件的格式信息就可以全部取出。遍历stream得到相应的音视频流的编号,可以找出解码器的ID和AVCodecConte 阅读全文

posted @ 2010-01-13 14:42 Teddy Yan 阅读(609) 评论(0) 推荐(0) 编辑


Copyright © 2024 Teddy Yan
Powered by .NET 8.0 on Kubernetes