- 博客(24)
- 收藏
- 关注
原创 [Perl]继承SUPER,-norequire,use parent
parentpackage Baz;use parent qw(Foo Bar);is equivalent to:package Baz;BEGIN { require Foo; require Bar; push @ISA, qw(Foo Bar);}-norequirepackage Foo;sub exclaim { "I CAN HAS PERL" }package
2016-10-13 10:06:30
1301
原创 [Python]Compare __repr__ & __str__
__repr__, callsed by built-inrepr(), return string representation of a set __str__, called by built-instr() Phython Set - unordered - makes the elements uniqure>>> list = [1,1,2,2,3,3]>>> s
2016-08-05 13:46:49
623
原创 ARP spoofing 实验与分析
定义 ARP spoofing, ARP cache poisoning, or ARP poison routing, is a technique by which an attacker sends (spoofed) Address Resolution Protocol (ARP) messages onto a local area network. Generally, the a
2016-07-07 13:39:54
1179
原创 [Reaver] crack wireless AP
About WPSWhat WIKI says: Created by the Wi-Fi Alliance and introduced in 2006, the goal of the protocol is to allow home users who know little of wireless security and may be intimidated by the avail
2016-06-21 15:59:19
596
原创 [Python]BS4 与 一个KDS 美图爬虫
BS4BeautifulSoup是用来从HTML or XML中提取数据的Python lib。BeautifulSoup将文档转化为树形结构(DOM),每个节点都是下述四种类型的Python对象:BeautifulSoup <class 'bs4.BeatifulSoup'>Tag <class 'bs4.element.Tag'>NavigableString <class 'bs4.el
2016-06-05 00:56:44
2102
原创 HTTP header
HTTP基于TCP协议之上的应用层协议,服务于Web浏览器和Web服务器的通信。是通用的、无状态的面向对象的协议。PS: 无状态指的是同一个客户端的多次请求没有对应关系。HTTP headerHTTP headers主要可分为:Request header & Response headerThe header fields are transmitted after the request or
2016-06-03 00:50:15
662
原创 [Python note] Namespaces & scope
NamespacesEverything in Python is an object. A name helps Python to invoke the object that it refer to. A namespace is a space that holds a bunch of names. Imagine it a ‘namespace table’ or a ‘namespa
2016-05-26 17:08:30
474
原创 [Perl] 常见signals解析
介绍系统实现 中断机制 依赖于Signals,而其存在是为了当一个程序(Process)运行时,响应“用户请求” or 系统强制介入。 Signals are software interrupts sent to a program to indicate that an important event has occurred. The events can vary from user r
2016-04-24 23:12:02
938
原创 [Perl] $SIG{HUP}
Scenarios: 为daemon process重新加载配置 Solution: 可通过接收SIGHUP,并定义操作。如下实现了向 a daemon process 发送SIGHUP,并restart该process。当然,也可以是加载配置。#!/usr/bin/perluse strict;use warnings;use POSIX ();use FindBin ();use F
2016-04-24 22:59:32
1080
原创 [Perl]$SIG{INT}
Scenarios: 在程序运行过程中,受到外界终端干扰,如Ctrl+C,导致意外中断 Solution: 可通过 $SIG{INT} 接受 SIGINT 并处理中断,如回收临时文件[root@localhost tmp]# perl /test_sigint.pl$SIG{'INT'} = 'my_int_handler';my $temp_directory = "/tmp/myprog.
2016-04-24 15:08:50
1997
原创 [Perl] $SIG{ALRM}
Scenarios: 可能出现hang的操作,如 connect remote server… Solution: 设置alarm,并通过SIGALRM终止操作 local $@;eval { local $SIG{ALRM} = sub { print "Got SIGALRM\n"; die "alarm clock restart" };
2016-04-24 02:18:49
2234
原创 [Perl]REAPER
场景在程序中遇到耗时较长的操作(如等待用户响应,连接remote server),通常会想到创建 Child process 去处理。在Perl 中 使用fork()## fork a child processdie "$@" unless defined( my $child_pid = fork());if ($child_pid) { # If I have a child PID,
2016-04-22 02:14:43
816
原创 [Platform]Phantom -- Programmable Security Controller
简介2016 RSA conference 明星产品,可以将其认为是一个整合企业内部所使用的安全工具或产品的管理平台。初次使用,总结如下:主要功能Phantom platform (Programmable Security Controller) 集成&管理安全工具 获取&处理事件 通知责任人(Oweners)响应(Actions)WorkflowThe below diagram des
2016-04-21 01:33:49
735
原创 Ruby notes #1 Environment setup on Win32 platform
正式学习Ruby on Rails之前,首先在 Windows 7 平台上进行环境搭建。以下会按照搭建顺序进行展开,当然在安装过程中碰到的 issues 也一并附上。需要下载的安装文件如下:rubyinstaller 1.9.3DevKit 4.5.2rails 3.2.13 #后续gem install 获取netbeans 6.9.1 #当然也可以使用其他,注意6.9.1支持Ruby,
2016-04-14 22:55:46
1030
原创 Static block(class initializer)
static block static {}The code inside static block is executed only once: the first time you make an object of that class or the first time you access a static member of that class (even if you never m
2016-04-10 21:41:33
666
原创 [Android]java.lang.OutOfMemoryError
Description: Run APP and get runtime error, OOMImageView imageView1 = new ImageView(this);imageView1.setImageResource(R.drawable.welcome_guilde_1);guideList.add(imageView1);ImageView imageView2 = n
2016-04-07 14:11:20
576
原创 [Android]INSTALL_FAILED_NO_MATCHING_ABIS when installing apk
Description: [INSTALL_FAILED_NO_MATCHING_ABIS] when install apk on Genymotion.Reason: reason on stackoverflow,由于Genymotion模拟的CPU架构与用户预期不同导致(点击link)Resolution: 下载genymotion-arm-translation_v1.1.zip 并dr
2016-03-29 02:45:20
987
原创 Perl 5 中的三大OO特性
Encapsulation首先,将代码段进行封装,成函数。使用中可以优化,并降低代码冗余度,将先前的函数泛化。再次,总结所处理对象特性,提取重构成类。 code block —–> subroutine —–> generalization —–> rarefaction (Class) Inheritance继承是 OO 呈上启后的特性。在Perl 5 中使用 use parent xxx;
2016-03-20 23:42:39
784
原创 OO in Perl5
OO说起 OO 首先跳出“Object”与“Class”这个两个概念。Perl也不例外,在 Perl5 中对 OO programming进行了设计与支持。如下图所示: Perl 5 中设计了一个Base class UNIVERSAL, 它是所有Class的最终父类。如下所述: All classes inherit from the UNIVERSAL class implicitly.T
2016-03-20 22:29:07
509
原创 @EXPORT and @EXPORT_OK
@EXPORTExport souroutines with no need to initialize an object.use File::Basename; ## likeBEGIN { require File::Basename; File::Basename->import }其中的import没有传入list,并不意味着import nothing,而是将 @EXPORT 里所有
2016-03-20 21:11:58
808
原创 How a Perl5 program works
运行一个Perl5 程序分为两个阶段:Complication time & Run time 。Complication time由Source code最终解析成特定的数据结构 optree 。中间可以利用 BEGIN block 触发Complication time 过程中的 Run time 即中断编译,执行代码(其实是数据结构中的内容)Run time
2016-03-16 20:31:38
510
原创 use vs require in Perl5
Perl5 的程序执行分为两个阶段:compilation time & run time。而 use 与 require 依次发生在这两个不同的阶段。 值得注意的是:Parser对use的处理等同如下:use strict;likeBEGIN{ require 'strict.pm'; strict->import();}NOTE:BEGIN block是在compilatio
2016-03-16 17:58:31
761
原创 Layout
LinearLayout 线型顺序布局(垂直的 水平的) RelativeLayout 灵活,每个Child Layout or View需指定相对位置 FrameLayout 里面的View 层层覆盖,非线性排布 TableLayout GridView替代,不常用 AbsoluteLayout 不建议使用Note: 隐含顺序按照
2016-03-07 17:42:46
340
原创 px in pt dp(dip) sp in Android
pxPixels - corresponds to actual pixels on the screen.inInches - based on the physical size of the screen. 1 Inch = 2.54 centimetersmmMillimeters - based on the physical size of the screen.ptPoints -
2016-03-06 23:58:05
414
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人