Mysql5.7 start mysqld.service失败的问题

Posted in Mysql on December 18th, 2014 by Adam

根据日志的错误提示:
innoDB pthread_create returned 13

这里给出了mysqld无法启动的相似描述:

http://community.sitepoint.com/t/cannot-set-up-innodb-support-in-mysql-due-to-pthread-create-returned-11-error/44560

系统是centos7。

PHP5.4.35的php_curl.dll问题

Posted in PHP on December 16th, 2014 by Adam

php_curl出现curl_init错误。

Windows下64位可以看这里:

http://www.anindya.com/php-5-4-3-and-php-5-3-13-x64-64-bit-for-windows/

XP 32位下:
可以下载PHP5.4.34的php_curl.dll,直接替换即可。

Tags:

Mysql错误:mysql Illegal mix of collations for operation like

Posted in 杂项 on November 5th, 2014 by Adam

原因是datetime和autoincrement id不能用like。就是这样。

论程序员的幸福感

Posted in Coding on October 8th, 2014 by Adam

程序员的幸福感是什么?你想一辈子写程序,却没有幸福感,那么你是很难一直写下去的。

所谓程序员的幸福感就是:

  • 写程序有自由感
  • 写程序很享受、有惬意感
  • 写程序有灵感、才思泉涌感
  • 写程序有成就感、荣誉感
  • 写程序足够养家,可以体面地活下去

如果满足上述条件,我就觉得可以一辈子写程序,写一辈子程序。

$.parseJSON Unexpected token t错误

Posted in javascript on September 12th, 2014 by Adam

常见的原因是:双引号内的引号需要双重释义。例如:”description”:”Created for \\”zhaiduo.com\\””

验证json格式是否有问题,可以看这里:http://jsonlint.com/

Tags:

ImageMagic把pdf转成jpg出现黑色块的问题

Posted in Linux/Unix on August 28th, 2014 by Adam

今天发现有些pdf转成img后出现黑色块,根据这里的解释,很有可能是pdf用的是透明背景,而不是白色背景。所以,解决办法就是:

命令行增加: -background white -alpha remove

问题解决。

现代浏览器工作原理

Posted in webapp, 浏览器 on August 28th, 2014 by Adam

翻译自:adobe博客

Modern browsers typically have two important threads of execution. These threads work together to render a web page:
现代浏览器渲染网页的两个重要线程:主线程和合成线程

The main thread
The compositor thread
Typically, the main thread is responsible for:
主线程主要负责:

Running your JavaScript.
执行js脚本
Calculating your HTML elements’ CSS styles.
计算页内元素样式
Laying out your page.
装载网页
Painting your elements into one or more bitmaps.
把元素画进一个或多个位图
Handing these bitmaps over to the compositor thread.
把这些位图移交给合成线程
Typically, the compositor thread is responsible for:
合成线程主要负责:

Drawing bitmaps to the screen via the GPU.
用GPU把位图渲染到屏幕
Asking the main thread to update bitmaps for visible or soon-to-be-visible parts of the page.
通知主线程更新可见位图,或者准备位图
Figuring out which parts of the page are visible.
画出位图的可见部分
Figuring out which parts are soon-to-be-visible when you’re scrolling.
准备即将可见的位图部分
Moving parts of the page when you scroll.
屏幕滚动式,渲染对应部分到屏幕
The main thread can be busy for long periods of time running your JavaScript or painting a large element.
这个时候主线程可能忙得不亦乐乎,由于你调用js脚本,或者渲染大型页内元素
While it’s busy, it’s not responsive to user input.
所以,对用户的事件毫无响应

On the other hand, the compositor thread tries to stay extremely responsive to user input.
另一方面,合成线程却对用户的事件有求必应
The compositor tries to redraw the page 60 times per second when the page is changing, even if the page is incomplete.
当网页发生变化时,合成线程尽力做到每秒渲染页面60次,甚至在页面还没有被准备好时。

For example, when the user scrolls a page, the compositor thread asks the main thread to update the bitmaps for newly visible parts of the page.
例如:用户滑动网页,合成线程就会要求主线程为新的页面生成新的位图
However, if the main thread doesn’t respond quickly enough, the compositor doesn’t wait.
然而,主线程并不能立即响应,合成线程也不会等下去
The compositor draws the parts of the page it has so far and draws white elsewhere.
合成线程依然把页面画出来,没有完成的页面部分就被填充成白色(常见这种情况google chrome)

The GPU
I mentioned the compositor thread draws bitmaps to the screen using the GPU. Let’s quickly go over the GPU.
下面讲讲GPU的处理部分

The GPU is a chip found in most phones, tablets, and computers today. It’s extremely specialized,
现代手机、平板已经完全支持GPU芯片
meaning it’s really good at certain things, and it’s not that great at others.
它非常擅长做一些事

GPUs are really fast at:
它的强项有:

Drawing to the screen.
画图到屏幕
Drawing the same bitmap over and over again.
不断的重复画图
Drawing the same bitmap in a different position, rotation, or scale.
根据不同位置、旋转度、缩放画同一幅图

GPUs are relatively slow at:
当然,它也有不擅长

Loading bitmaps into their memory.
把位图装载进内存。

Tags:

前端打包压缩合并工具Fis

Posted in webapp on August 18th, 2014 by Adam

由百度开发的前端打包压缩合并工具Fis,为你解决前端资源的打包压缩问题,赞~!。

首先,把npm切换成国内镜像,加快模块下载速度。感谢淘宝npm
$ npm install -g cnpm –registry=https://registry.npm.taobao.org
以后通过cnpm来下载模块。

然后,安装fis: cnpm install -g fis

然后启动:fis server start

下载fis demo,cd到demo目录,开始测试。

通过修改fis-conf.js配置,运行fis release -omp进行各种压缩合并和优化操作。

fis server open可以打开输出目录,查看生成的合并文件。

RSS Feed