nestable在点击的时候,有一个拖动的状态被触发,会导致你给nestable上加的链接都会无效。
膘叔的简单人生
nestable在点击的时候,有一个拖动的状态被触发,会导致你给nestable上加的链接都会无效。
一个很简单的laravel代码:
User::where('id',1)->update(['last_login'=>time()]);
/**
* Update a record in the database.
*
* @param array $values
* @return int
*/
public function update(array $values)
{
return $this->toBase()->update($this->addUpdatedAtColumn($values));
}
When issuing a mass update via Eloquent, the saved and updated model events will not be fired for the updated models. This is because the models are never actually retrieved when issuing a mass update.
You need to retrieve the user from the database and then save that user in order to fire the event. For example:
This will NOT fire the update event:
User::where('id', $id)->update(['username' => $newUsername]);
This will fire the update event:
User::find($id)->update(['username' => $newUsername]);
/**
* Log a query in the connection's query log.
*
* @param string $query
* @param array $bindings
* @param float|null $time
* @return void
*/
public function logQuery($query, $bindings, $time = null)
{
if (isset($this->events)) {
$this->events->fire(new Events\QueryExecuted(
$query, $bindings, $time, $this
));
}
if ($this->loggingQueries) {
$this->queryLog[] = compact('query', 'bindings', 'time');
}
}
/**
* Register a database query listener with the connection.
*
* @param \Closure $callback
* @return void
*/
public function listen(Closure $callback)
{
if (isset($this->events)) {
$this->events->listen(Events\QueryExecuted::class, $callback);
}
}
/**
* Fire an event for this connection.
*
* @param string $event
* @return void
*/
protected function fireConnectionEvent($event)
{
if (! isset($this->events)) {
return;
}
switch ($event) {
case 'beganTransaction':
return $this->events->fire(new Events\TransactionBeginning($this));
case 'committed':
return $this->events->fire(new Events\TransactionCommitted($this));
case 'rollingBack':
return $this->events->fire(new Events\TransactionRolledBack($this));
}
}
记录一下,真机编译的时候没问题,用模拟器的时候报:INSTALL_FAILED_NO_MATCHING_ABIS,查了一下原因。就是因为为了提速用了、x86的模拟,所以。。。
还好stackoverflow有人解决了这些问题:
1、http://stackoverflow.com/questions/24572052/install-failed-no-matching-abis-when-install-apk
2、http://stackoverflow.com/questions/24751350/install-failed-no-matching-abis-how-to-overcome
解决起来还是比较简单的,在app/build.grade的android节点下增加:
abi {
enable true
reset()
include 'x86', 'armeabi-v7a'
universalApk true
}
}
一切就OK了,再编译的时候就:
居然切成了10个apk.....01/14 09:36:59: Launching app
$ adb install-multiple -r /xxxxx/app/build/outputs/apk/app-x86-debug.apk /xxxxx/app/build/intermediates/split-apk/debug/slices/slice_5.apk /xxxxx/app/build/intermediates/split-apk/debug/slices/slice_6.apk /xxxxx/app/build/intermediates/split-apk/debug/slices/slice_9.apk /xxxxx/app/build/intermediates/split-apk/debug/slices/slice_2.apk /xxxxx/app/build/intermediates/split-apk/debug/dep/dependencies.apk /xxxxx/app/build/intermediates/split-apk/debug/slices/slice_8.apk /xxxxx/app/build/intermediates/split-apk/debug/slices/slice_7.apk /xxxxx/app/build/intermediates/split-apk/debug/slices/slice_3.apk /xxxxx/app/build/intermediates/split-apk/debug/slices/slice_4.apk /xxxxx/app/build/intermediates/split-apk/debug/slices/slice_0.apk /xxxxx/app/build/intermediates/split-apk/debug/slices/slice_1.apk
Split APKs installed
$ adb shell am start -n "com.xxxxx.app/com.xxxxx.app.activity.StartActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
$ adb shell am startservice com.xxxxxx.app/com.android.tools.fd.runtime.InstantRunService
Connected to process 3689 on device emulator-5554
这个标题可不是标题党,主要是我的macbook已经开启了双重认证,即我在任何一台设备上登录我的appleid,都会在手机上弹出:是否允许登录。然后输入系统给我的安全码,输进去就OK了。
然而问题发生在yosemate上,我登录apple store,结果没有弹出任何窗口来让我输入安全码。这怎么破?开始的时候一直无解。我以为把密码改成安全码就行了,然而直接告诉我密码错误。然后我又去官网后台生成一个所谓的专用密码来登录,也是告诉我密码错误。。。崩溃 !
最后google了一下,原来在官网上还真有介绍 :
如果我在运行旧版软件的设备上使用双重认证,会怎样?
如果您在运行旧版操作系统的设备上使用双重认证,系统可能会要求您在登录时将六位验证码添加至密码末尾。从运行 iOS 9 及更高版本或 OS X El Capitan 及更高版本的受信任设备中获取验证码,或者将其发送至受信任的电话号码。然后直接在密码栏位中键入密码,后跟六位验证码。
于是我登录apple store时,先输入密码,点击登录。然后在手机上弹出授权,点击允许,再将手机上的6位安全码,输到刚才 旧版机器 的密码框里(跟在最后),即:原密码+安全码,再点击登录。成功!
好吧。看起来不复杂,搞定就好
迁移的时候发现,后台的fck编辑器出不来。以前是用firefox的所以没问题,后来也是在使用chrome的时候才有注意(新版的fckEditor早就没有这个问题了,新版已经叫CKEditor了)
1、修改admin/editor/fckeditor_php5.php ,现在应该没有人用4了,直接改5,
function IsCompatible()
{
global $HTTP_USER_AGENT;
if(isset($HTTP_USER_AGENT)){
$sAgent = $HTTP_USER_AGENT;
} else{
$sAgent = $_SERVER['HTTP_USER_AGENT'];
}
if(strpos($sAgent, 'MSIE') !== false && strpos($sAgent, 'mac') === false && strpos($sAgent, 'Opera') === false){
$iVersion = (float) substr($sAgent, strpos($sAgent, 'MSIE') + 5, 3);
return ($iVersion >= 5.5);
} else{
if(strpos($sAgent, 'Gecko/') !== false){
$iVersion = (int) substr($sAgent, strpos($sAgent, 'Gecko/') + 6, 8);
return ($iVersion >= 20030210);
} else{
if(strpos($sAgent, 'Opera/') !== false){
$fVersion = (float) substr($sAgent, strpos($sAgent, 'Opera/') + 6, 4);
return ($fVersion >= 9.5);
} else{
if(preg_match("|AppleWebKit/(\d+)|i", $sAgent, $matches)){
$iVersion = $matches[1];
return ($matches[1] >= 522);
} else{
return false;
}
}
}
}
}
2、修改fckeditor.js,将两个配置的False改为true即可:
this.EnableSafari = true ; // This is a temporary property, while Safari support is under development.
this.EnableOpera = true ;
这两个默认是false,改为true即可。
再打开sablog的后台,就OK了。
--------纯记录,下次再手贱的时候就不需要折腾N久了
折腾了两个小时左右,sablog基本迁移成功(不过我是在全新代码下的,我线上的代码有过一部分改动,估计到时候还要折腾一下)
主要是几个地方:
1、db_mysql类。目前我凡是用到的地方,都已经判断过了。可能还有坑
2、preg_replace_callback,点了很多页面,目前也基本上都已经OK了。
原程序用的是error_reporting(0),所以一些notice,warning都不会显示 。所以极大的可能是一出错就白屏。我改成error_reporting(7),大部分问题都解决了。
准备什么时候迁移的时候再试一下。(服务器上还有不少站点。还要备份数据库,太累了,升还是不升,这是个问题!)
本来想将当前的服务器升级到PHP7的,在临最后动手的一霎那,突然想起,sablog用的是mysql_*的函数,在PHP7已经彻底没有了。
之所以提起这个功能,是因为在windows下面太方便了,进入cmd窗口:ipconfig /flushdns ,轻轻松松处理
sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponder
在使用Lumen进行开发的时候。如果你使用:./artisan的时候报错:Cannot declare class Event, because the name is already in use。检查一下LOG发现是:
[2016-12-07 15:27:37] lumen.ERROR: ErrorException: Cannot declare class Event, because the name is already in use in /home/web/vendor/laravel/lumen-framework/src/Application.php:661
Stack trace:
#0 [internal function]: Laravel\Lumen\Application->Laravel\Lumen\Concerns\{closure}(2, 'Cannot declare ...', '/Volumes/docume...', 661, Array)
#1 /home/web/vendor/laravel/lumen-framework/src/Application.php(661): class_alias('Illuminate\\Supp...', 'Event')
#2 /home/web/vendor/laravel/lumen-framework/src/Application.php(631): Laravel\Lumen\Application->withAliases(Array)
#3 /home/web/vendor/laravel/lumen-framework/src/Application.php(766): Laravel\Lumen\Application->withFacades(true)
#4 /home/web/vendor/laravel/lumen-framework/src/Console/Kernel.php(54): Laravel\Lumen\Application->prepareForConsoleCommand(true)
#5 [internal function]: Laravel\Lumen\Console\Kernel->__construct(Object(Laravel\Lumen\Application))
#6 /home/web/vendor/illuminate/container/Container.php(794): ReflectionClass->newInstanceArgs(Array)
#7 /home/web/vendor/illuminate/container/Container.php(644): Illuminate\Container\Container->build('App\\Console\\Ker...', Array)
#8 /home/web/vendor/laravel/lumen-framework/src/Application.php(211): Illuminate\Container\Container->make('App\\Console\\Ker...', Array)
#9 /home/web/vendor/illuminate/container/Container.php(231): Laravel\Lumen\Application->make('App\\Console\\Ker...', Array)
#10 /home/web/vendor/illuminate/container/Container.php(746): Illuminate\Container\Container->Illuminate\Container\{closure}(Object(Laravel\Lumen\Application), Array)
#11 /home/web/vendor/illuminate/container/Container.php(644): Illuminate\Container\Container->build(Object(Closure), Array)
#12 /home/web/vendor/laravel/lumen-framework/src/Application.php(211): Illuminate\Container\Container->make('Illuminate\\Cont...', Array)
#13 /home/web/artisan(32): Laravel\Lumen\Application->make('Illuminate\\Cont...')
#14 {main}
看了一下,Application.php的第661行对应的方法,我靠。
/**
* Register the aliases for the application.
*
* @param array $userAliases
* @return void
*/
public function withAliases($userAliases = [])
{
$defaults = [
'Illuminate\Support\Facades\Auth' => 'Auth',
'Illuminate\Support\Facades\Cache' => 'Cache',
'Illuminate\Support\Facades\DB' => 'DB',
'Illuminate\Support\Facades\Event' => 'Events',
'Illuminate\Support\Facades\Gate' => 'Gate',
'Illuminate\Support\Facades\Log' => 'Log',
'Illuminate\Support\Facades\Queue' => 'Queue',
'Illuminate\Support\Facades\Schema' => 'Schema',
'Illuminate\Support\Facades\URL' => 'URL',
'Illuminate\Support\Facades\Validator' => 'Validator',
];
if (! static::$aliasesRegistered) {
static::$aliasesRegistered = true;
$merged = array_merge($defaults, $userAliases);
foreach ($merged as $original => $alias) {
class_alias($original, $alias);
}
}
}
。。。。。怎么可以这样写呢?也不担心代码会不会冲突。就直接这样了??怪不得很多代码识别不了。更痛苦的是,前段时间为了测试命令行下的多线程,加载了:brew install php70-event,直接就冲突了。
不得已,brew remove php70-event。反正这个我也几乎用不到。哎~
所幸,搞定