使用动态内存时需要用户自己去申请资源和释放资源。用户可以随时的分配所需空间,根据需要分配空间大小,并在最后释放申请内存。动态内存也存在隐患:在大型的项目当中管理申请的动态内存是很复杂的,以及释放申请的内存有难想起的。在释放动态内存时可能不止一个指针指向了该内存,所以释放的时候是很容易出错的。内存无法释放就会造成内存泄露,这也就是为什么服务器要经常的每个一段时……继续阅读 » 水墨上仙 5年前 (2021-03-20) 3281浏览 151个赞
Linux 实现了请求页面调度,页面调度是说页面从硬盘按需交换进来,当不再需要的时候交换出去。这样做允许系统中每个进程的虚拟地址空间和实际物理内存的总量再没有直接的联系,因为在硬盘上的交换空间能给进程一个物理内存几乎无限大的错觉。交换对进程来说是透明的,应用程序一般都不需要关心(甚至不需要知道)内核页面调度的行为。然而,在下面两种情况下,应用程序可能像影响系……继续阅读 » 水墨上仙 5年前 (2021-03-20) 3157浏览 2375个赞
如果我们把计算机上的操作系统及各种各样的软件看成一系列的有机生命,而不是指令集,那么这就是一个进程的世界,在进程的世界中同样有“道德”和“法制法规”,窥探进程世界,看它的侠肝义胆,风雨江湖路~~~~~linux支持多个进程同时进行,也就是我们常说的现代操作系统中的多道程序设计,所谓同时是linux系统调度各个进程分别占用cpu的时间。由于每个时间片的时间很……继续阅读 » 水墨上仙 5年前 (2021-03-20) 3219浏览 2732个赞
来源:http://blog.csdn.net/muge0913/article/details/7317452#include <sys/types.h>#include <stdio.h>#include <sys/wait.h>void check_exit(int status);main(){ ……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2637浏览 1317个赞
linux c 退出进程来源:http://blog.csdn.net/muge0913/article/details/7317580 linux中常用退出函数:#include<stdlib.h>voidexit(int status);intatexit(vo……继续阅读 » 水墨上仙 5年前 (2021-03-20) 3180浏览 1676个赞
信号处理是linux程序的一个特色。用信号处理来模拟操作系统的中断功能。要想使用信号处理功能,你要做的就是填写一个信号处理函数即可。来源:http://blog.csdn.net/muge0913/article/details/7317621#include <stdio.h> #include <sys/types.h> ……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2548浏览 1693个赞
信号及其简介信号是一种进程通信的方法,他应用于异步事件的处理。信号的实现是一种软中断。它被发送为一个正在运行的进程,已告知进程某个事件发生了。来源:http://blog.csdn.net/muge0913/article/details/7322710 信号及其简介信号是一种进程通信……继续阅读 » 水墨上仙 5年前 (2021-03-20) 3486浏览 2953个赞
C++ 查询硬件与系统配置的API函数 ActivateKeyboardLayout 激活一个新的键盘布局。键盘布局定义了按键在一种物理性键盘上的位置与含义Beep 用于生成简单的声音CharToOem 将一个字串从ANSI字符集转换到OEM字符集ClipCursor 将指针限制到指定区域ConvertDefaultLocale 将一个特殊的地……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2568浏览 1788个赞
要对一个信号进行处理,就需要给出此信号发生时系统所调用的处理函数。可以对一个特定的信号(除去SIGKILL和SIGSTOP信号)注册相应的处理函数。注册某个信号的处理函数后,当进程接收到此信号时,无论进程处于何种状态,就会停下当前的任务去执行此信号的处理函数。来源:http://blog.csdn.net/muge0913/article/details/7……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2396浏览 2704个赞
1、有时候不希望在接到信号时就立即停止当前执行,去处理信号,同时也不希望忽略该信号,而是延时一段时间去调用信号处理函数。这种情况是通过阻塞信号实现的。2、信号阻塞和忽略信号的区别。阻塞的概念和忽略信号是不同的。操作系统在信号被进程解除阻塞之前不会讲信号传递出去,被阻塞的信号也不会影响进程的行为,信号只是暂时被阻止传递。当进程忽略一个信号时,信号会被传递出去……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2123浏览 1533个赞
int sigsuspend(const sigset_t *sigmask);此函数用于进程的挂起,sigmask指向一个信号集。当此函数被调用时,sigmask所指向的信号集中的信号将赋值给信号掩码。之后进程挂起。直到进程捕捉到信号,并调用处理函数返回时,函数sigsuspend返回。信号掩码恢复为信号调用前的值,同时将errno设为EINTR。进程结束……继续阅读 » 水墨上仙 5年前 (2021-03-20) 1958浏览 170个赞
来源:http://www.daytimesoftware.com/blog/2007/10/suicidal-code-redux// Based on original code by Daniel Jakult, based on an idea from Brian Cooke.#ifdef BETA // 4 week expirati……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2361浏览 1812个赞
点击提交按钮后显示loading,防止用户重复提交<style>#loading { position:absolute; width:500px; height:50px; top:50%; left:50%; margin: -25px -150px; background-color:#FFFFFF; bo……继续阅读 » 水墨上仙 5年前 (2021-03-20) 1664浏览 2186个赞
根据unix时间戳返回一个相对当前时间的格式,如:3天前,24秒前等等//###############################//Usage:var myRelativeTime:String = timestampToRelative("Sun Oct 24 20:07:33 +0000 2010");//retu……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2935浏览 2412个赞
AS3实现的3D相册效果代码来源:http://www.adamcoulombe.info/lab/as3/screen-to-screen.htmlimport com.greensock.*;import com.greensock.easing.*;var lastRotX = 0;var lastRotY = 0; for(var i……继续阅读 » 水墨上仙 5年前 (2021-03-20) 3428浏览 2518个赞
创建Flash SharedObject(Flash Cookie)//create SOvar mySharedObject:SharedObject = SharedObject.getLocal("republicofcode");mySharedObject.data.firstName = "John&quo……继续阅读 » 水墨上仙 5年前 (2021-03-20) 3009浏览 2489个赞
C++实现的简单hashtable(哈希表)范例//A simple example of hashtable#include <iostream>#include <cstdlib>#include <cstring>#include <iomanip>#define SIZE_KEY ……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2132浏览 1574个赞
将NtStatus code转换成Win32 Error /* * This is an alternative to the RtlNtStatusToDosError() * function in ntdll.dll. It uses the GetOverlappedResult() * function in kernel32.dll……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2565浏览 598个赞
C++生成标准的ASCII编码表/*The standard ASCII table defines 128 character codes (from 0 to 127), ofwhich, the first 32 are control codes (non-printable), and the remaining 96character……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2232浏览 2536个赞
C++查看 IEEE 754 浮点数格式// A simple and practical way to show the format of the IEEE standardfor binary floating-point numbers (IEEE 754) is to use a union, as shown in the follow……继续阅读 » 水墨上仙 5年前 (2021-03-20) 3175浏览 1902个赞
C++动态多维数组范例//creation of dynamic multidimensional arrays?#include <iostream>#include <iomanip>using namespace std; int main(){ //For creating one dimension……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2444浏览 2690个赞
一个简单的C语言链表实现/* Simple singly linked lists example usage; it is only one of many possible implementations - try your own enchancements.*/ #include <stdio.h>#in……继续阅读 » 水墨上仙 5年前 (2021-03-20) 3352浏览 2129个赞
C语言动态创建4维数组#include <stdio.h>#include <stdlib.h> /********************************************************//* ……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2263浏览 956个赞
本代码演示了如何使用千位分隔符“,”格式化数字输出//Example for using thousand separator (,) for decimal integer numbers#include <iostream>#include <cstdlib> using namespace std; int m……继续阅读 » 水墨上仙 5年前 (2021-03-20) 1837浏览 1337个赞
C++简单交换堆排序/* Can easily be modified to work with other data types */ void heapsort(int *arr, int n){ int start, end; // heapify the array for(start = (n - 2) / ……继续阅读 » 水墨上仙 5年前 (2021-03-20) 1778浏览 1702个赞
C语言初始化多维数组 //one dimensional array int x[5] = {1,2,3,4,5}; //two dimensional array int y[3][4] = {{1,2,3,4},{5,6,7,8},{9,10,11,12}}; //Three dimens……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2937浏览 2814个赞
C++面向对象中的多态代码演示//An example of using overriding techniques to demonstrate function with a polymorphism behaviour. #include <iostream> using namespace std; // abstract……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2728浏览 123个赞
基于面向对象的C++双向链表代码演示//An example of a simple double linked list using OOP techniques#include <iostream>using namespace std; struct Node{ double value; Node *N,*P; ……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2678浏览 364个赞
几个非常有用的C字符串函数#include <string.h>#include <stdlib.h> void remchars(char *str, char c);void remcnks(char *str, char *cnk);void replchars(char *str, char c1, char ……继续阅读 » 水墨上仙 5年前 (2021-03-20) 3039浏览 878个赞
C++异常处理范例代码// Program shows copying one text file from source location// to any other location (destination), plus possibility of changing its name, // and also shows many lan……继续阅读 » 水墨上仙 5年前 (2021-03-20) 1804浏览 217个赞
C++使用key文件进行xor加解密/* The function (en/de)crypts an input data file with an input key file using the XOR method. The use of a key file instead of a plain text key m……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2631浏览 2177个赞
C++按单词换行的函数,按照指定的长度对字符串进行换行,如果指定的长度正好在某个单词中间,就往回查找,直到出现空格再换行/* This function takes a string and an output buffer and a desired width. It then copies the string to the buf……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2479浏览 524个赞
C++演示在不同的范围内不冲突使用同名变量的范例// An example of using the same variable declarations in different scopes in C++ without conflicts #include <iostream> using std::cout;using s……继续阅读 » 水墨上仙 5年前 (2021-03-20) 1552浏览 256个赞
C语言创建pascal三角图形//Procedural Programming technique shows creation of Pascal's Triangl#include <iostream>#include <iomanip>using namespace std;int** comb(int*……继续阅读 » 水墨上仙 5年前 (2021-03-20) 3331浏览 2035个赞
AS3控制键盘的方向键代码package { import flash.display.MovieClip; import flash.events.Event; import flash.events.KeyboardEvent; public class KeyboardController extends MovieClip……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2551浏览 2344个赞
iphone UIActionSheet – pop up list of options// place this code in a UIViewController subclass - (void)debugButtonPressed:(id)sender{ UIActionSheet* action = [[UIActio……继续阅读 » 水墨上仙 5年前 (2021-03-20) 1754浏览 1121个赞
来源: ……继续阅读 » 水墨上仙 5年前 (2021-03-20) 1558浏览 2762个赞
最新HTML5标准的网页设计模板,包含了常用的布局元素<!doctype html><!-- I HTML 5 --><html lang="en"><head> <title>New Document</title> <meta charse……继续阅读 » 水墨上仙 5年前 (2021-03-20) 1822浏览 1425个赞
纯CSS实现支持IE6的min-width.min_width{ min-width: 500px; /* For good browsers */} * html .min_width { padding: 0 250px; } /* This is for the markup that only appears in IE6 t……继续阅读 » 水墨上仙 5年前 (2021-03-20) 3200浏览 2225个赞
AS3快速生成bmpvar bmpData:BitmapData = new BitmapData(800,800, true, 0x00000000);bmpData.draw (myClip);var bmp:Bitmap = new Bitmap(bmpData); this.addChild(bmp);……继续阅读 » 水墨上仙 5年前 (2021-03-20) 1596浏览 243个赞
AS3关闭所有声音的代码import flash.media.SoundMixer; SoundMixer.soundTransform = new SoundTransform(0);……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2946浏览 1462个赞
这段代码利用了函数指针进行自定义排序function CustomSortProc(Item1, Item2: TListItem; ColumnIndex: integer): integer; stdcall;beginif ColumnIndex = 0 thenResult := CompareText(Item1.Caption,Ite……继续阅读 » 水墨上仙 5年前 (2021-03-20) 3314浏览 2126个赞
Delphi ListView 添加新的项目,演示里的ListView包含三栏,第一栏使用caption设置标题,第二栏和第三栏需要使用SubItems对象才操作i := ListView1.Items.Count; with ListView1 do begin ListItem:=Items.Add; ListItem.Caption:= ……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2968浏览 2417个赞
AS3 删除数组里的重复数据代码function removeDuplicate(arr:Array) : void{ var i:int; var j: int; for (i = 0; i < arr.length - 1; i++){ for (j = i + 1; j < arr.length……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2951浏览 1144个赞
AS3对数组进行Push, Pop, Unshift 和 Shift 等操作的代码var myArray:Array = new Array(); // PUSH// Adds one or more elements to the end of an array and returns the new length of the array……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2763浏览 2601个赞