【每日进步】June 2012
--------------------------------------------Mon June 4 2012-------------------------------------------------
Perl:
1. 安装Perl额外的库可以使用cpan,也可以自己下载下来安装。
2. 服务器安装的cpan,默认需要root权限(一些配置文件创建),报如下错误:
Your configuration suggests "/root/.cpan" as your
CPAN.pm working directory. I could not create this directory due
to this error: mkdir /root/.cpan: Permission denied at /usr/lib/perl5/5.6.1/CPAN.pm line 499
Please make sure the directory exists and is writable.
在网上查到的解决方案如下:
$ mkdir ~/perl5lib $ mkdir ~/.cpan $ mkdir ~/.cpan/CPAN $ echo "\$CPAN::Config = {}"> ~/.cpan/CPAN/MyConfig.pm $ perl -MCPAN -e shell
之后跟着提示走就可以了。之后设定环境变量:export PERL5LIB=${PERL5LIB}:/your/lib/dir export MANPATH=/your/man/dir
设定库目录时需要注意,库前缀,如Html::TreeBuilder 对应文件为~/path/Html/TreeBuilder.pm,设定路径时应设置为~/path,这一点类似java中的包的概念。
参考: http://www.dcc.fc.up.pt/~pbrandao/aulas/0203/AR/modules_inst_cpan.html
--------------------------------------------Mon June 16 2012-------------------------------------------------
Windows:
1. 学习破解一个crackme程序,很简单的。
- 爆破:运行找到提示字符串,然后使用W32Dasm找到跳转位置:00401595 75 16 JNZ SHORT 004015AD,改成JZ运行就可以了。
- 找到注册码:使用O11yDbg找到00401595,向上寻找,使用的比较函数为lstrcmpA,设置断点,运行,找到注册码为 <BrD-SoB>。
2. 壳:pack unpack. 参考:http://baike.baidu.com/view/528311.htm
--------------------------------------------Mon June 16 2012-------------------------------------------------
1. RenderMan坐标系统:Renderman渲染器初始化的摄像机空间坐标系(Camera Space)是最基本的坐标系。其它所有的坐标系都是相对于摄像机空间的。摄像机空间坐标系是一个左手坐标系,摄像机位于原点(0,0,0),它的+x轴指向摄像机的右侧,+y轴指向摄像机的上方,+z轴指向摄像机的前方。
参考:http://kb.cnblogs.com/a/161878/
--------------------------------------------Mon June 25 2012-------------------------------------------------
1. 使用LWP提交表单:
#!/usr/bin/perl use strict; use warnings; use LWP; use HTTP::Cookies; use HTTP::Response; use Encode
my $url = "地址"; my %form = ( "username" => "namd", "password" => "1111", ); my $browser = LWP::UserAgent->new; my $response = $browser->post($url,\%form); if ($response->is_success) { print encode("GBK", $response->decoded_content); # 这里假设返回文档为gbk编码 print "\n"; } else { die $response->status_line; }
另外一种方式:
use LWP::UserAgent; my $ua = LWP::UserAgent->new; my $req = HTTP::Request->new(POST => 'http://www.example.com/'); $req->content_type('application/x-www-form-urlencoded'); $req->content('key1=value1&key2=value2'); my $res = $ua->request($req); print $res->as_string;
2. 概念
- Shader:Shaders are simple programs that describe the traits of either a vertex or a pixel. Vertex shaders describe the traits (position, texture coordinates, colors, etc.) of a vertex, while pixel shaders describe the traits (color, z-depth and alpha value) of a pixel.
- Three types of shaders: Pixel Shaders, Vertex Shaders, Geometry Shaders.
- The surface shader is used to specify the surface properties of subsequent geometric primitives. Calculate apparent surface opacity and color.
- Displacement shaders alter the smoothness of a surface, however, unlike bump mapping which mimics the appearance of bumpiness by reorientating surface normals, displacement shading genuinly effects the geometry of a surface. In the case of Pixars prman renderer, each object in a 3D scene is sub-divided into a fine mesh of micro-polygons after which, if a displacement shader has been assigned to an object, they are "pushed" or "pulled" in a direction that is parallel to the original surface normal of the micro-polygon. After displacing the micro-polygon the orientation of the local surface normal(
N
) is recalculated.
3. RenderMan Shader: 着色器通过接收一些可以由艺术家调节的变量比如Cs(表面颜色),Os(表面透明度)等,结合RenderMan渲染规范定义的内置变量N(着色点的法线),P(着色点位置)等,依据一定的算法计算出Ci(最终表面颜色),Oi(最终表面透明度)或任意所需信息,从而完成着色过程。
--------------------------------------------Mon June 26 2012-------------------------------------------------
1. cmd for 循环执行命令:for /l %%i in (1,1,1000000) do (这里放命令)
2. cmd中使用ping实现sleep,ping -n 60 -w 1000 0.0.0.1>nul (sleep一分钟)
3. 使用vbs实现bat脚本后台运行(没有窗口),bat中加入@echo off:
Set ws = CreateObject("Wscript.Shell") ws.run "cmd /c run.bat",vbhide
--------------------------------------------Mon June 26 2012-------------------------------------------------
1. PIXIE的运行需要设置PIXIEHOME,这样程序才能找到对应dll和shaders