- 博客(34)
- 资源 (5)
- 收藏
- 关注
原创 Ruby meta programming 4(eval/class_eval/module_eval/instance_eval)
之所以有不同的eval方法,只是因为在不同的上下文中;你也可以使用eval+bind参数完全替换class_eval/module_eval/instance_eval的# "#{exp}" evaluates it as a string and not as an expression, whereas eval( exp ) evaluates a string as an expressi
2016-08-18 13:04:54 388
原创 Ruby meta programming 3(closure)
# closure10.times{ |i| print("=")}puts("closure")x = "hello world"ablock = Proc.new { puts( x ) }def aMethod( aBlockArg ) x = "goodbye" aBlockArg.callendputs( x )ablock.call#this will out
2016-08-18 12:55:24 487
转载 Ruby meta programming 2(define_method/attr_accessor)
下面是使用四种方式来完成同一个类的方法。 第一种是直接定义get和set方法; 第二种是通过define_method来动态的定义; 第三种是通过attr_accessor来动态的定义; 第四种也是通过attr_accessor来动态的定义,只是去除了冗余;10.times{ |i| print("=")}puts("Writing Code That Writes Code")clas
2016-08-18 12:47:56 501
原创 Ruby meta programming 1(binding/send/freeze/remove_method)
#binding#like Dependency Injection in java 10.times{ |i| print("=")}puts("binding")class Demo def initialize(n) @secret = n end def get_binding return binding() endendk1 = Demo.new
2016-08-18 12:42:08 464
原创 Ruby的method_missing可以定义client调用不存在的方法时的行为
class X def method_missing( methodname, *args ) puts( "Class #{self.class} does not understand: #{methodname}( #{args.inspect} )" ) end endclass Y < X def aaa puts( "aaa me
2016-08-18 11:30:53 601
原创 Ruby的Block
一般来说,用花括号括起来的代码段,称之为blockSome codes segmetn in “The Book for Ruby” can’t run successful in Ruby 2.3 like below code: a = “hello world”.split(//).each{ |x| newstr << x.capitalize } will throw undefi
2016-08-18 11:28:16 389
原创 Ruby中的 class method, instance method, singleton method/class
singleton method/class 从效果来说,两者没有什么区别# class method10.times{ |i| print("=")}puts("class/instance method")class MyClass def MyClass.classMethod puts( "This is a class method" ) end
2016-08-18 11:17:35 975
原创 Ruby中的Symbol
A symbol is an identifier whose first character is a colon ( : ), so :this is a symbol and so is :that. symbol是以:开头的。 A symbol is not: it is not a string, it is not a constant and it is not a variab
2016-08-18 11:12:48 393
原创 Ruby 中的各种变量(local/instance/class/global variable and assignment method)
从注释中可以看出每段代码中使用的变量类型# local variable10.times{ |i| print("=")}puts("local variable")1.times do a = 1 b = "a" puts "local variables in the block: #{local_variables.join ", "}"endputs "no local
2016-08-18 11:06:17 590
原创 PHP post combine
if you post as below, PHP will parse below post as array[0] == Country, Country has three propertyCountry%5Bcode%5D=1&Country%5Bname%5D=2&Country%5Bpopulation%5D=1Country[code]:1Country[name]:2Count
2016-08-12 08:26:03 247
原创 attention when you debug bootstrap's form layout
debug bootstrap’s form layout, need close developer’s view, or the bootstrap’s layout will difference with full screen layout, because it’s responsive layout
2016-08-12 08:25:03 166
原创 PHP self:: vs static::
PHP self:: vs static:: self just means current method’s container class’s context static means the caller’s context, it will set when you real call it with get_called_class method
2016-08-12 08:24:25 208 1
原创 553 Requested action not taken: Local user only
553 Requested action not taken: Local user only SMTP类型的机器只允许发信人是本站用户; For example: the sender must be xxx@126.com if you use 126’s smtp
2016-08-12 08:23:42 2612
原创 fop's font
what’s fop: http://xmlgraphics.apache.org/fop/ 1. using TTF reader to generate metric xml file and let fop using itcd to fop's main directory,java -cp "build/*;lib/*" org.apache.fop.fonts.apps.TTFRe
2016-08-12 08:22:05 935
原创 mpdf export chinese character
mpdf export chinese char: vendor/mpdf/mpdf/config.php, change below two line to true, for v6$this->autoScriptToLang = true;$this->autoLangToFont = true;autoScriptToLang is variable to indicate whethe
2016-08-11 15:51:24 778
原创 some method in PHP
php is_null: use === intstead of is_null isset($var) and is_null($var) 是相反的;is_null只有在变量是NULL或者变量声明了但是没有赋值时返回true is_callable: if the application could call a method on the object, from the curren
2016-08-11 15:49:06 240
原创 debug codeception in Eclipse
config eclipse’s php cli’s debug to using xdebugcopy file to codeceptioncp vendor\codeception\codeception\codecept to vendor\codeception\codeception\codecept.phpthen add this file to eclipse’s cli ru
2016-08-11 15:48:01 269
原创 Yii2 UT
run below command to instanll codeception:composer require "codeception/codeception=2.1.*"composer require "codeception/specify=*"composer require "codeception/verify=*"add project/vendor/bin to you
2016-08-11 15:44:52 231
原创 change composer's repo to china's mirror
change composer’s repo to china’s mirror project config: composer config repo.packagist composer https://packagist.phpcomposer.com global config: composer config -g repo.packagist composer https://
2016-08-11 15:42:57 235
原创 how to solve git detached HEAD
how to solve git detached HEAD 1. checkout to other branch 2. or create a new branch with : git checkout -b branch_name 3. or prevent to use git checkout commit_id, this will cause detac
2016-08-11 15:42:36 263
原创 .htaccess file not work
.htaccess file not work 1. check AllowOverride option; 2. or just add the rewrite content to httpd.conf file to prevent use .htaccess file
2016-08-11 15:42:00 195
原创 Change Yii2 language
you can using request header/cookie to change Yii’s language dynamic or using below code:// change target language to Chinese\Yii::$app->language = 'zh-CN';
2016-08-11 15:41:24 245
原创 change MySQL's config file and let it use utf-8 by default
change MySQL’s config file and let it use utf-8 by default for xampp, the config file is under bin\my.ini[mysqld]character-set-server=utf8collation-server=utf8_general_ci
2016-08-11 15:40:23 220
原创 change charset of existed MySQL db
change charset of existed dbALTER/CREATE DATABASE `yii2basic` DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
2016-08-11 15:39:46 364
原创 using yii command extract message which need i18n
using yii command extract message which need i18n first you should create a config file for yii command:.\yii message/config-template path/to/config.php`such as messages/config.php made some modify t
2016-08-11 15:39:13 351
原创 change eclipse default text encoding to UTF-8 to support php i18n
change eclipse default text encoding to UTF-8 to support php i18n Window -> Preferences -> General -> Workspace : Text file encoding
2016-08-11 15:37:46 343
原创 install Composer fail from xampp in windows
you should change below config in php.ini to absolute path for you xampp:extension_dir = "E:\xampp\php\ext"browscap = "E:\xampp\php\extras\browscap.ini"
2016-08-11 15:37:13 313
原创 some valuable Yii2 extension
Yii2 extension http://codemix.github.io/yii2-bs3activeform/horizontal.html http://demos.krajee.com/
2016-08-11 15:36:18 248
原创 xampp can't start MySQL
xampp can’t start MySQL, using xampp_stop.bat clear env, then retry
2016-08-11 15:35:38 264
原创 php xdebug php5.dll missing
php xdebug php5.dll missing make sure your xdebug is nts or ts version dlldisplay static variable in Eclipse’s variable view self::$aliases
2016-08-11 15:34:34 631
原创 Yii2 alias
Alias You can find below default alias in yii2\BaseYii.php’s $alias:$aliases variable's init:@yii D:\xampp\htdocs\basic\vendor\yiisoft\yii2basic\vendor\yiisoft\extensions.php file add extension path
2016-08-11 15:28:23 673
原创 Yii2 use spl_autoload_register to create autoload feature
Yii2 use spl_autoload_register to create autoload feature yii2\Yii.php:spl_autoload_register(['Yii', 'autoload'], true, true);Yii::$classMap = require(__DIR__ . '/classes.php');Yii::$container = ne
2016-08-11 15:27:17 537
原创 Yii2 componet list and where init it
yii2\base\Application.php:[ 'log' => ['class' => 'yii\log\Dispatcher'], 'view' => ['class' => 'yii\web\View'], 'formatter' => ['class' => 'yii\i18n\Formatter'], 'i18n' => ['class' => 'y
2016-08-11 15:26:19 205
原创 yii2 mail config
change web.php file to support php send file'useFileTransport' => true,'fileTransportPath' => '@app/mail',send with transport'transport' => [ 'class' => 'Swift_SmtpTransport', 'host'
2016-08-11 15:25:08 234
Soft-Test.zip
2021-01-20
SEMI E37-0298 HIGH-SPEED SECS MESSAGE SERVICES (HSMS) GENERIC.pdf
2021-01-20
RF engineering basic concepts the Smith chart.pdf
2020-05-05
Waveform Generation Language from Fluence Technology, Inc
2020-04-29
Standard Test Interface Language (STIL) for Digital Test Vectors原版
2020-04-27
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人