xiaoguozi's Blog
Pay it forword - 我并不觉的自豪,我所尝试的事情都失败了······习惯原本生活的人不容易改变,就算现状很糟,他们也很难改变,在过程中,他们还是放弃了······他们一放弃,大家就都是输家······让爱传出去,很困难,也无法预料,人们需要更细心的观察别人,要随时注意才能保护别人,因为他们未必知道自己要什么·····
     摘要: 关于 本书致力于教会你如何用Node.js来开发应用,过程中会传授你所有所需的“高级”JavaScript知识。本书绝不是一本“Hello World”的教程。 状态 你正在阅读的已经是本书的最终版。因此,只...  阅读全文
posted @ 2012-07-17 00:17 小果子 阅读(1436) | 评论 (0)编辑 收藏
android的布局分两个阶段,先measure()后requestLayout(),
一个MeasureSpec封装了父布局传给子布局的布局要求。每个MeasureSpec代表了一个宽度或高度的要求。一个MeasureSpec包含一个尺寸和模式。
MeasureSpec的三种模式:
UNSPECIFIED:父布局没有给子布局任何限制,子布局可以任意大小。
EXACTLY:父布局决定子布局的确切大小。不论子布局多大,它都必须限制在这个界限里。
AT_MOST:子布局可以根据自己的大小选择任意大小。
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int measuredHeight = measureHeight(heightMeasureSpec);
int measuredWidth = measureWidth(widthMeasureSpec);
setMeasuredDimension(measuredHeight, measuredWidth);
//final DisplayMetrics metrics = getResources().getDisplayMetrics();
//setMeasuredDimension(mBitmap.getScaledWidth(metrics),mBitmap.getScaledHeight(metrics));
}
private int measureHeight(int measureSpec) {
int specMode = MeasureSpec.getMode(measureSpec);
int specSize = MeasureSpec.getSize(measureSpec);
int result = 500;
if (specMode == MeasureSpec.AT_MOST)
{
result = specSize;
}
else if (specMode == MeasureSpec.EXACTLY)
{
result = specSize;
}
return result;
}
private int measureWidth(int measureSpec) {
int specMode = MeasureSpec.getMode(measureSpec);
int specSize = MeasureSpec.getSize(measureSpec);
int result = 500;
if (specMode == MeasureSpec.AT_MOST)
{
result = specSize;
}
else if (specMode == MeasureSpec.EXACTLY)
{
result = specSize;
}
return result;
}
Creation
Constructors
onFinishInflate() 当View和它的所有子对象从XML中导入之后,调用此方法
Layout
onMeasure(int, int) View会调用此方法,来确认自己及所有子对象的大小
onLayout(boolean, int, int, int, int, int, int) 当View要为所有子对象分配大小和位置时,调用此方法
onSizeChanged(int, int, int, int) 当View大小改变时,调用此方法
Drawing
onDraw(Canvas) 当View要绘制它的内容时,调用此方法
Event processing
onKeyDown(int, KeyEvent) 当一个新的按键事件发生时,调用此方法
onKeyUp(int, KeyEvent) 当一个按键释放事件发生时,调用此方法
onMotionEvent(MotionEvent) 当一个动作事件(如触摸)发生时,调用此方法
Focus
onFocusChanged(boolean, int) 当View获得或失去焦点时,调用此方法
Attaching
onAttachedToWindow() 当View附加到一个窗体上时,调用此方法
onDetachedFromWindow() 当View离开它的窗体时,调用此方法
当你为一个 activty 添加一个可见的 view, 并且运行这个activty时,android通常情况下会自动按照下列顺序来触发view的相关事件
onAttachedToWindow
onMeasure
onSizeChanged
onLayout
onDraw
posted @ 2012-07-03 19:12 小果子 阅读(218) | 评论 (0)编辑 收藏
停止操作
停止操作是通过向nginx进程发送信号(什么是信号请参阅linux文 章)来进行的
步骤1:查询nginx主进程号
ps -ef | grep nginx
在进程列表里 面找master进程,它的编号就是主进程号了。
步骤2:发送信号
从容停止Nginx:
kill -QUIT 主进程号
快速停止Nginx:
kill -TERM 主进程号
强制停止Nginx:
pkill -9 nginx

另外, 若在nginx.conf配置了pid文件存放路径则该文件存放的就是Nginx主进程号,如果没指定则放在nginx的logs目录下。有了pid文 件,我们就不用先查询Nginx的主进程号,而直接向Nginx发送信号了,命令如下:
kill -信号类型 '/usr/nginx/logs/nginx.pid'

平滑重启
如果更改了配置就要重启Nginx,要先关闭Nginx再打开?不是的,可以向Nginx 发送信号,平滑重启。
平滑重启命令:
kill -HUP 住进称号或进程号文件路径

或者使用

/usr/nginx/sbin/nginx -s reload

注意,修改了配置文件后最好先检查一下修改过的配置文件是否正 确,以免重启后Nginx出现错误影响服务器稳定运行。判断Nginx配置是否正确命令如下:
nginx -t -c /usr/nginx/conf/nginx.conf

或者

/usr/nginx/sbin/nginx -t


平滑升级
如果服务器正在运行的Nginx要进行升级、添加或删除模块时,我们需 要停掉服务器并做相应修改,这样服务器就要在一段时间内停止服务,Nginx可以在不停机的情况下进行各种升级动作而不影响服务器运行。
步骤1:
如 果升级Nginx程序,先用新程序替换旧程序文件,编译安装的话新程序直接编译到Nginx安装目录中。
步 骤2:执行命令
kill -USR2 旧版程序的主进程号或进程文件名
此时旧的Nginx主进程将会把自己的进程文件改名为.oldbin,然后执行新版 Nginx。新旧Nginx会同市运行,共同处理请求。
这时要逐步停止旧版 Nginx,输入命令:
kill -WINCH 旧版主进程号
慢慢旧的工作进程就都会随着任务执行完毕而退出,新版的Nginx的工作进程会逐渐取代旧版 工作进程。

此 时,我们可以决定使用新版还是恢复到旧版。
不重载配置启动新/旧工作进程
kill -HUP 旧/新版主进程号
从容关闭旧/新进程
kill -QUIT 旧/新主进程号
如果此时报错,提示还有进程没有结束就用下面命令先关闭旧/新工作进程,再关闭主进程号:
kill -TERM 旧/新工作进程号

这样下来,如果要恢复到旧版本,只需要上面的几个步 骤都是操作新版主进程号,如果要用新版本就上面的几个步骤都操作旧版主进程号就行了。

上面就是Nginx的一些基本的操作,希望以后Nginx能有更好的方法来处理这些操作, 最好是Nginx的命令而不是向Nginx进程发送系统信号。
posted @ 2012-06-28 11:15 小果子 阅读(885) | 评论 (0)编辑 收藏

基本的操作方法:
本文假设你的apahce安装目录为/usr/local/apache2,这些方法适合任何情况

apahce启动命令:
推荐/usr/local/apache2/bin/apachectl start apaceh启动

apache停止命令
/usr/local/apache2/bin/apachectl stop   停止

apache重新启动命令:
/usr/local/apache2/bin/apachectl restart 重启

要在重启 Apache 服务器时不中断当前的连接,则应运行:

/usr/local/sbin/apachectl graceful

如果apache安装成为linux的服务的话,可以用以下命令操作:

service httpd start 启动

service httpd restart 重新启动

service httpd stop 停止服务

posted @ 2012-06-28 11:15 小果子 阅读(289) | 评论 (0)编辑 收藏
Share

C++ is a multi paradigm, free form complied, general purpose and thus a very powerful language used basically forthe purpose of programming. This language is regarded as an intermediatelevel language .The main reason for this is that it consists of both high level as well aslow level features.

It is one of the most popularprogramming languages due to many reasons. It has application domains which include system software, device drivers, application software and many other including client applications and entertainment software of which the best example is a video game.

In this list we introduces some highly useful C++ graphics and game libraries. These libraries has provides a great interface to add these functionality to their project or application easily. C++ users would love to use these libraries for their next project.

Today we are going to share C++ graphic and games Libraries for developers, i hope these libraries would help developers a lot in their next project to make impressive and attractive layout for theirnest applications. Visit this list and share your thought in our comment section below.

1) Antigrain

Anti-Grain Geometry (AGG) is an Open Source, free of charge graphic library, written in industrially standard C++. The terms and conditions of use AGG are described on The License page. AGG doesn’t depend on any graphic API or technology. Basically, you can think of AGG as of a rendering engine that produces pixel images in memory from some vectorial data.

2) Amanith

AmanithVG SRE is a pure software solution that grants a superlative vector graphics quality without to sacrifice performance on any kind of architecture / platform. Thanks to its original polygon rasterization algorithm and dedicated optimized scanline fillers, this engine constitues the fastest OpenVG software rendering solution available on the market.

3) Codehead

4) Oscilloscope Lib

5) Lib SDL

Simple DirectMedia Layer is a cross-platform multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, and 2D video framebuffer. It is used by MPEG playback software, emulators, and many popular games, including the award winning Linux port of “Civilization: Call To Power.”

6) Ogre 3d

OGRE (Object-Oriented Graphics Rendering Engine) is a scene-oriented, flexible 3D engine written in C++ designed to make it easier and more intuitive for developers to produce applications utilising hardware-accelerated 3D graphics. The class library abstracts all the details of using the underlying system libraries like Direct3D and OpenGL and provides an interface based on world objects and other intuitive classes.

转自:

http://zoomzum.com/6-free-c-graphics-and-game-libraries/

posted @ 2012-06-15 14:29 小果子 阅读(806) | 评论 (0)编辑 收藏
仅列出标题
共58页: First 11 12 13 14 15 16 17 18 19 Last