原创 匿名信號量

---------------------sem_init()-------------------------------------------------   #include<semaphore.h>   int sem_init

原创 killall 命令, 很有用的(轉)

(轉載) 原文地址:http://361324767.blog.163.com/blog/static/11490252520125412637424/   用途說明 killall命令用於殺死指定名字的進程(kill processes

原创 驗證IP

判斷條件 1.不能出現 .. 2.限制長度 最短爲7,如 *.*.*.*  最長爲15, 如 ***.***.***.*** 3.只能是數字和. 4.開頭不能是. 5.由.分成4段,每段轉化爲整數後,範圍應在[0,255]內 6.不能有多

原创 棧的實現

#include <stdio.h> #include <stdlib.h> struct node { int num; struct node *next; };//棧節點變量//棧變量 struct filo

原创 隊列的實現

#include <stdio.h> #include <stdlib.h> struct node; struct node { int num; struct node *next; };//隊列節點類型 //

原创 把一個字符串中的大寫字母放到後面,小寫字母放到前面,並且相對位置不變

/*°ÑÒ»¸ö×Ö·û´®µÄ´óд×Öĸ·Åµ½×Ö·û´®µÄºóÃ棬¸÷¸ö×Ö·ûµÄÏà¶ÔλÖò»±ä  *  */     #include <stdio.h> #include <string.h>  

原创 知道進程的進程號,或進程名字,給進程發送信號

首先用ps命令查找該進程的 PID,然後使用kill命令停止這個進程: 方法1: kill -s SIGKILL PID 方法2: kill -SIGKILL PID 方法3:(SIGKILL  的前3個字符可以省略) kill -KIL

原创 adb shell 命令行啓動帶參數的應用

am broadcast 啓動廣播 adb shell am broadcast  -a  com.noahedu.noahdict.screenshots.recognition --ei type 5 am start 啓動Acti

原创 android播放幀動畫

import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import

原创 獲得本機ip

#include <winsock2.h> #pragma comment(lib, "ws2_32.lib") struct in_addr g_local_addr; char g_local_ip[32] = ""; WSAD

原创 函數指針

#include <stdio.h> #include <time.h> #include <stdlib.h> typedef void (* pfun)(); void fun() { printf("%s hel

原创 多播

// join_multicast.cpp : 定義控制檯應用程序的入口點。 // #include "stdafx.h" #include <winsock2.h> #pragma comment(lib, "ws2_32.lib"

原创 設計原則-轉載

轉載:http://www.uml.org.cn/sjms/201211023.asp 目錄: 設計模式六大原則(1):單一職責原則 設計模式六大原則(2):里氏替換原則 設計模式六大原則(3):依賴倒置原則 設計模式六大原則(

原创 pthread 隨想

thread_fun() { init(); while(true) { if(getMsg(&msg)) // noblock, 非阻塞 { //dealMsg(&msg); switch

原创 posix 基於共享內存

#include <sys/ipc.h> #include <sys/shm.h> #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include <st