Relocate to http://www.leetcode.cn so goodbye my friends:)

Posted on 2017年3月31日 23:20

RT

git syncing a fork

Posted on 2015年11月05日 11:20
git remote -v git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git git remote -v git fetch upstream git checkout master git merge upstream/master

infinite loop

Posted on 2015年10月26日 16:46

For example, A can have a neighbor called B. Therefore, we may traverse from A to B. An undirected graph implies that B can always traverse back to A. Is it true here? No, because whether B could traverse back to A depends if one of B’s neighbor is A.

The fact that B can traverse back to A implies that the graph may contain a cycle. You must take extra care to handle this case. Imagine that you finished implementing without considering this case, and later being pointed out by your interviewer that your code has an infinite loop, yuck!

qCDebug

Posted on 2015年10月14日 10:17

https://community.kde.org/Frameworks/Porting_To_qCDebug

http://doc.qt.io/qt-5/qloggingcategory.html#logging-rules

创建patch

Posted on 2015年10月10日 13:46

git真是好东东,直接git diff commitid1 commitid2 > patch.txt

但没有git的情况下 diff -Naur standard_moodle my_moodle > patch.txt

打patch -Np1 -i 0001-fixme.patch

mac kernel and user space communication

Posted on 2015年9月29日 16:19

Boundary Crossings https://developer.apple.com/library/mac/documentation/Darwin/Conceptual/KernelProgramming/boundaries/boundaries.html

kext https://developer.apple.com/library/mac/documentation/Darwin/Conceptual/KEXTConcept/KEXTConceptIntro/introduction.html

nsSCM::Install 多个依赖之间用什么隔开

Posted on 2010年5月21日 16:57

 nsSCM这个NSIS的插件提供了windows服务注册、启动、停止、卸除的功能,但是官方文档里木有提供nsSCM::Install中关于多个依赖之间用什么隔开,只好查看其源代码了:

 

 

// 7
  char* Depend = STRNEW ();

  if (popstring (Depend))
   {
    STRDEL (Depend);
    STRDEL (LoadGroup);
    STRDEL (ServiceFile);
    STRDEL (ServiceDisplay);
    STRDEL (ServiceName);
    RET_DWORD (rc, Tag);
   }

  /* fixup end of multistring */
  DWORD len = strlen (Depend);
  Depend [len + 1] = 0;

  /* replace comma separator on null separator */
  for (DWORD i = 0; i < len; i++) if (',' == Depend [i]) Depend [i] = 0;

 

可以用逗号隔开 bingo

 

 

iPhone 3.0 jialbreak dev

Posted on 2009年12月06日 20:19

 

cd ~/Desktop

vi script

#!/bin/bash
cd /Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Plug-ins/iPhoneOS\ Build\ System\ Support.xcplugin/Contents/MacOS/
dd if=iPhoneOS\ Build\ System\ Support of=working bs=500 count=255
printf "\x8f\x2a\x00\x00" >> working
dd if=iPhoneOS\ Build\ System\ Support of=working bs=1 skip=127504 seek=127504
/bin/mv -n iPhoneOS\ Build\ System\ Support iPhoneOS\ Build\ System\ Support.original
/bin/mv working iPhoneOS\ Build\ System\ Support
chmod a+x iPhoneOS\ Build\ System\ Support

 

 

wayland 依赖

Posted on 2009年9月24日 16:50

dev-libs/libffi

eagle

libpng

cairo

gdk-pixbuf-2.0

libudev >= 136

libdrm

rm_eo 在 Linux、UNIX下居然不同,不解

Posted on 2009年9月02日 16:51

man regex中有Byte Offsets这样的一段,介绍遍历满足正则表达式条件的所有子串的rm_so(起始位置)和rm_eo(终止位置);

用到了regmatch_t结构:

typedef struct {
    regoff_t rm_so;
    regoff_t rm_eo;
} regmatch_t;
有这样的字符串"xzhai=\"Unix/Linux geek\";legendren=\"GOD\";"

想寻找="xxx";里的xxx内容;

 

while (!regexec(&m_reg, tmp, 1, &m_match, 0)) 
{
    // FIXME: Unix regex`s rm_eo is often 0 test under Mac OS X Leopard;
    // But Linux POSIX regex`s rm_eo is normal test under Gentoo Linux
    printf("%d - %d\n", m_match.rm_so, m_match.rm_eo);
    tmp += m_match.rm_eo;
}

Linux下rm_eo的值是正确的,而UNIX下rm_eo始终为0,不解