_.bindAll(this, ‘render’);
this.model.bind(’change’, this.render);
以上这两行代码主要为了当model改变时, view执行render, 那_.bindAll有什么用呢?
看这里:http://stackoverflow.com/questions/6079055/why-do-bindall-in-backbone-js-views
其中有一段是这样的:
Without _.bindAll( this, ‘render’ ) when model changes this in render will be pointing to the model, not to the view, so we won’t have neither this.el nor this.$ or any other view’s properties available.
当model被change时, this指向model, 但是我们要执行render, 那么就需要_.bindAll(this, ‘render’), 使model也有这个render的方法?
请达人解答?
*
新版本这样就可以
this.model.bind(’change’, this.render, this);
% mkdir -p ~/Library/Application\ Support/Textmate/Bundles
% cd ~/Library/Application\ Support/Textmate/Bundles
% git clone git://github.com/lautis/ruby-on-rails-tmbundle.git "Ruby on Rails.tmbundle"
% git clone git://github.com/lautis/ruby-tmbundle.git "Ruby.tmbundle"
% osascript -e ‘tell app "TextMate" to reload bundles’
Also filed in
|
|
1. 首先打开多个文件
如:
vim ./*.html
2.使用如下命令,
:argdo %s/2007/2008/g | wq
*如果要单个文件修改, 则使用:
:next
或者使用脚本:
#!/bin/sh
for file in $(grep -l -R ‘Copyright © 2011′ ./)
do
sed -e "s/Copyright © 2011/Copyright © 2011/ig" $file > /tmp/tempfile.tmp
mv /tmp/tempfile.tmp $file
done
参考:
http://www.legend.ws/blog/tips-tricks/replace-text-in-multiple-files/
以下列举自己常用的IOS开发资源(不断更新):
Our resources for other geeks, designers and engineers.(推荐)
iOS高效开发必备的10款Objective-C类库
iPhone SDK Examples
An iOS 4 iPhone Graphics Drawing Tutorial using Quartz 2D (Xcode 4)
iPhone, iOS, iPad SDK Development Tutorial and Programming Tips
Icons for mobile apps
RegexKitLite(正则表达式库)
ASIHttpRequest(HTTP Network库)
MBProgressHUD(进展指示符库)
JSON Framework(JSON支持)
斯坦福iphone开发教程, 附有PDF讲义
UITableViewController by example
如果您有更好的推荐, 也请追加, 非常感谢;-)
遇到这个问题一般是public key权限的问题, 一般修改服务器的.ssh 和 authorized_keys就可以解决问题了, 可以这样试一试:
chmod 700 .ssh
chmod 700 .ssh/authorized_keys
也可以参考之前的文章:
http://weixuhong.com/技术感想/2008/04/26/ssh-不用密码/
Also filed in
|
|
1. 首先从入口脚本:main.m 启动Application.
2. Application加载MainWindow.我们知道MainWindow的file’s Owner是UIApplication, 而且里面有delegate到MainWindow的delegate组件。
这样我们可以想象:
Application拥有了Delegate对象, 为什么要拥有? 因为它要用到Delegate对象的方法,如:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{}
等其他方法, 当然也包括Delegate对象的变量(window, viewController)。
或许图可以这样: Application->Delegate->{window, ViewController[Label, Button])}
从这里我可以想象到:Application,可以引用整个app的对象,包括button,label等。
3. 从图中可以可以看出, Hello world View Controller也被示例, 因为它是Hello_World_View_Controller.xib的File’s Owner, 所以Hello_World_View_Controller.xib里面的东西都要被实例化。
这个Controller就是具体去控制label, button等具体的东西,如显示啊。
*不一定是对的,请高人指点, 谢谢.
1. 我们可以看入口文件index.php
#index.php
// change the following paths if necessary
$yii=dirname(__FILE__).’/../framework/yii.php’;
$config=dirname(__FILE__).’/protected/config/main.php’;
require_once($yii);
Yii::createWebApplication($config)->run();
* Yii::createWebApplication($config)->run(); 这个是我们比较感兴趣的, Yii在哪里? ===> YiiBase.php, createWebApplication这个静态方法也是
*Yii::createWebApplication($config) => 表示创建一个Appcication实例,它做什么?
2. 看看YiiBash.php
#YiiBash.php
public static function createWebApplication($config=null)
{
return self::createApplication(’CWebApplication’,$config);
}
public static function createApplication($class,$config=null)
{
return new $class($config); //==> <strong>new CWebApplication()</strong>
}
*以上表示创建WebAPP实例, 以后的战场就在这里进行咯,这个跟ROR,或者iPhone或者其他框架都相似吧
*但是创建这个实例的时候,初始化做了什么事情呢?我们往下看
3. 到了CApplication.php
#CApplication.php
public function __construct($config=null)
{
Yii::setApplication($this); // 这个作用就是以后你就可以使用 Yii::app()->user //还记得我说app是战场么?
// set basePath at early as possible to avoid trouble
//配置文件的处理
if(is_string($config))
$config=require($config);
if(isset($config[’basePath’]))
{
$this->setBasePath($config[’basePath’]);
unset($config[’basePath’]);
}
else
$this->setBasePath(’protected’);
Yii::setPathOfAlias(’application’,$this->getBasePath());
Yii::setPathOfAlias(’webroot’,dirname($_SERVER[’SCRIPT_FILENAME’]));
Yii::setPathOfAlias(’ext’,$this->getBasePath().DIRECTORY_SEPARATOR.’extensions’);
$this->preinit();
$this->initSystemHandlers();
//注册核心组建
$this->registerCoreComponents();
$this->configure($config);
$this->attachBehaviors($this->behaviors);
$this->preloadComponents();
$this->init();
}
*$this->registerCoreComponents(); 这个很重要,因为要实例的是CWebApplication,所以请回到CWebApplication.php
4. CWebApplication.php
protected function registerCoreComponents()
{
parent::registerCoreComponents();
$components=array(
’session’=>array(
‘class’=>’CHttpSession’,
),
‘assetManager’=>array(
‘class’=>’CAssetManager’,
),
‘user’=>array(
‘class’=>’CWebUser’,
),
‘themeManager’=>array(
‘class’=>’CThemeManager’,
),
‘authManager’=>array(
‘class’=>’CPhpAuthManager’,
),
‘clientScript’=>array(
‘class’=>’CClientScript’,
),
);
$this->setComponents($components);
}
注意$this->setComponents($components); ==> 这个方法在CModule.php
* registerCoreComponents 方法实现了注册Core components, [...]
<!–[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]–>
<video width="320" height="240" controls>
<source src="NewOrleans2006.ogv" type=’video/ogg; codecs="theora, vorbis"’>
<source src="NewOrleans2006.mp4" type=’video/mp4; codecs="avc1.42E01E, mp4a.40.2"’>
</video>
<!–如何使用html5播放flash 开始–>
<video width="640" height="360" id="video" tabindex="0" controls="">
<source type=’video/ogg; codecs="theora, vorbis"’ src="http://videos.mozilla.org/firefox/3.5/meet/meet.ogv"/>
<source type="video/mp4" src="http://videos.mozilla.org/firefox/3.5/meet/meet.mp4"/>
<object data="/includes/flash/playerWithControls.swf?flv=firefox/3.5/meet/meet.mp4&autoplay=false&msg=Play%20Video" style="width: 640px; height: 388px;" type="application/x-shockwave-flash">
[...]
要点:
1. 撑宽目标node的宽度 shift R && L Values
$first = $parent_manual[’node’][’l']+1; //The dst node l value
$delta = $current_manual[’rgt’] – $current_manual[’lft’]+1;
mysql_query(’START TRANSACTION’);
$result_a = mysql_query("UPDATE ".$thandle[’table’]." SET ".$thandle[’lvalname’]."=".$thandle[’lvalname’]."+$delta WHERE ".$thandle[’lvalname’].">=$first ");
$result_b = mysql_query("UPDATE ".$thandle[’table’]." SET ".$thandle[’rvalname’]."=".$thandle[’rvalname’]."+$delta WHERE ".$thandle[’rvalname’].">=$first ");
/*IF UPDATE IS SUCCESS ,THEN DO COMMIT*/
if ($result_a && $result_b) {
mysql_query(’COMMIT’);
} else {
mysql_query(’ROLLBACK’);
}
2. 复制的操作
$delta = [...]
用下面debug_mysql_query这个函数代替mysql_query
if (!function_exists(’debug_mysql_query’)) {
function debug_mysql_query($query)
{
$js_query = str_replace(array(’\\’, "’"), array("\\\\", "\\’"), $query);
$js_query = preg_replace(’#([\x00-\x1F])#e’, ‘"\x" . sprintf("%02x", ord("\1"))’, $js_query);
echo ‘<script>console.log("’.$js_query.’");</script>’."\n";
[...]