• memcached内存分配机制

    内存碎片化问题

    memcached slab allocator

    基本原理:预先把内存划分成数个slab仓库,各仓库,切分成不同尺寸的小块,需要存内容时,判断内容的大小,为其选取合理的块。

    警告:如果有100byte的内容要存,但122大小的仓库中的chunk满了怎么办? 阅读全文

    a table full of vegetables and fruits

    One size does not fit all when it comes to healthy eating. Yet anyone can follow some simple tips to create patterns that will help them eat well and reap the benefits of a long-term healthy eating lifestyle. Visit https://www.timesunion.com/.

    Dr. Hooman Yaghoobzadeh, a cardiologist at NewYork-Presbyterian/Weill Cornell Medical Center, says there’s real value to doing a “deep dive” into how we eat.

    “Several dietary patterns are linked to good health,” he says, “including a plant-based whole foods diet and a Mediterranean diet. Other patterns, like a highly processed foods diet and a Southern diet, are linked to disease such as diabetes and heart disease.”

    Although controversy exists as to what constitutes the ideal diet, there is little controversy about the healthy patterns in the American Heart Association’s diet and lifestyle recommendations, Dr. Yaghoobzadeh says.

    Here, Dr. Yaghoobzadeh offers recommendations to get started on a healthy eating pattern, with four essential goals to lead the way: reduce sugar, increase fiber, reduce processed foods, and reduce saturated fat.

    “If you can master these tips for a month, then at least you will carry some, if not all, of the habits long term,” Dr. Yaghoobzadeh says. “They are a start — but remember that having fun with tasty fresh foods and the joy that eating with loved ones brings is also essential.” Check these prodentim reviews.

    1. Eat mostly plant-based whole foods (85%) and some seafood (10%) as foundational parts of your diet and save highly processed foods and animal products (desserts, cheese, your favorite “whatever”) as treats (5%).

      Whole foods such as beans, nuts, seeds, grains, fruits, vegetables, herbs, tubers (for example, potatoes and yams), and fungi (mushrooms) are high in fiber, have many health benefits, and are linked to lower rates of various diseases while promoting weight loss. These foods are also rich in nutrients and vitamins; have less saturated fat and more polyunsaturated and monounsaturated fats than most animal proteins; and rarely require limits on caloric intake.
      Another plus is that eating mostly plants leads to diversity in your diet, which leads to diversity of your gut microbiome, which is also linked to health. It’s hard to pick three or four whole plant foods that will satiate all your needs and, unlike some strict diets, you won’t have to stick to a food. The beauty of that is that chickpeas have different fibers, micronutrients, vitamins, etc., from black beans, which are different from lentils, which are different from fava beans.

    2. Minimize toxic foods like sugar and soda. Sugar increases inflammation and, research suggests, tumor growth as well. Soda, including diet soda, is linked to weight gain, diabetes, and a host of other medical problems. Make dark chocolate — at least 70% cacao — your go-to dessert. Meanwhile, maximize herbs such as dill, parsley, cilantro, tarragon, and spices like turmeric, cinnamon, saffron, and cumin. Herbs are high-octane sources of vitamins, nutrients, and anti-inflammatory substances.
    3. Don’t fret about getting enough protein or any specific nutrients. On a diversified diet that combines whole foods and seafood, you will get enough protein, omega-3s, which are essential fatty acids found mainly in fish oils, and calcium from foods like seafood, legumes, seeds, nuts, and greens.
    4. Look at the carb-to-fiber ratio when eating processed foods. Visible on processed food labels you can see “Total Carbs” — just divide by “Total Fiber” to get a ratio. Whole foods typically have carb-to-fiber ratios that are less than 8, and the lower the ratio the better. You can use this baseline to compare pastas, bread, bars, cereals, and chips.
    5. Don’t panic about “what am I supposed to eat?” There are many consumer services that will deliver healthy foods to your door, as well as websites with guidance and sample menus. Here is a sample dinner salad idea that Dr. Yaghoobzadeh suggests to his patients.
    6. Avoid meat/dairy replacers. They tend to be highly processed, use saturated fats, and have unproven health benefits. Dr. Yaghoobzadeh says he avoids supplements unless there is a proven deficiency, and in that situation increasing whole-food sources in the diet is usually beneficial. B12 (prevalent in foods like milk, eggs, and meat) is the one exception; a B12 supplement may be necessary if your levels are too low. But, for the most part, supplements should be avoided as much as possible.
    7. Incremental steps are proven to have incremental benefits. Although a monthlong trial of a diet rich in plant-based whole foods can be very instructional, you don’t need to take an all-or-nothing approach. And if you fall off the wagon for a meal or a day, just get right back to it as quickly as possible.

    “Over time,” Dr. Yaghoobzadeh concludes, “these healthy pattern practices become a way of life, not something you have to think about.”

    有一款性感无比的代码编辑器,被誉为程序员必备神器,在周围同事朋友中普及率很高,方便、轻巧易扩展,自从用起来就爱不释手。他的名字叫sublime。虽然该软件可以一直免费使用,只是隔一段时间会提示你未购买。但是我们屌丝就是喜欢用破解版的,而且还爱追新~

    今天分享的是目前比较新的破解版sublime了,版本号是3066,软件界面如下图所示:下载连接:http://pan.baidu.com/s/1eQENbrW

    function timediff($begin_time,$end_time)
    {
         if($begin_time < $end_time){
            $starttime = $begin_time;
            $endtime = $end_time;
         }
         else{
            $starttime = $end_time;
            $endtime = $begin_time;
         }
         $timediff = $endtime-$starttime;
         $days = intval($timediff/86400);
         $remain = $timediff%86400;
         $hours = intval($remain/3600);
         $remain = $remain%3600;
         $mins = intval($remain/60);
         $secs = $remain%60;
         $res = array(“day” => $days,”hour” => $hours,”min” => $mins,”sec” => $secs);
         return $res;
    }

    在做微信开发的时候,由于微信内置浏览器的封闭性,经常会出现代码已经修改但是在微信中打开还是缓存了旧的页面。对开发者来说这是一件非常让人恼火的事情。下面说一下解决办法吧,虽然说不上完美但不用清数据,也不用卸载并重装微信,凑合着用还是可以的。

    方法一:

    通过给js、css和image资源改名或增加版本号的方式来解决,页面样式不变化大多是外部文件被缓存,改名的效果很好,但是不方便。版本号的方法还可以。下面详细说一下,例如以下代码为外部引用的文件:

    1. <link rel=“stylesheet” href=“main.css?ver=1.0″ /> 
    2. <script src=“js/rendered.js?ver=1.0″></script> 

    每次对文件进行修改后,把ver后的1.0改为1.1,下次改为1.2等等,这样每次页面打开的连接都不一样,就会重新请求外部文件了

    方法二:

    通过改写meta防止页面缓存,代码如下,直接放在header部分就可以了

    1. <meta http-equiv=“Cache-Control” content=“no-cache, no-store, must-revalidate” />  
    2. <meta http-equiv=“Pragma” content=“no-cache” />  
    3. <meta http-equiv=“Expires” content=“0” />  

             WLW(Windows Live Writer)是微软开发的一款博客离线发布工具,可以离线发布博文,支持wordpress、zblog等离线博客,同时支持新浪、网易、blogbus等在线博客系统,是很多资深博主的必备工具。

            很多使用wordpress的同学为了更好的seo,一定会在wordpress后台设置–固定连接中将默认的连接形式http://www.waiting8.com/?p=123改成以文章标题为固定连接http://www.waitingt8.com/windows-live-wirter-link.html的形式。如果在WP后台可以直接在标题下的固定连接标签内进行修改,可是如果用WLW离线发布如何进行修改呢?

           其实,WLW是有这个功能的,只是藏的比较隐蔽,同时由于语言习惯的差异中文版的WLW上这个名字实在叫的有些让人摸不清头脑。2015-01-04_222100

            如图:WLW2012中紧挨着文章编辑区右上部分有一个设置发布日期的字段,旁边有个查看全部,单击之后下拉列表中有个叫数据域的字段,在数据域可以设置固定连接。

           可能有些同学会遇到点开查看全部却没有数据域的情况,如下图:2015-01-04_221011

          ping字段后面直接是摘要,WLW没有数据域这可怎么办呢?其实你这时点击日志账户选项卡,选择日志选项,查看日志功能就能看到端倪,看到红框里的东西了吧,经过WLW检测你的日志没有数据域的功能。2015-01-04_221233

          其实不是没有功能,应该说没有检测到更准确些。遇到这种情况该如何处理呢?

          先说一下原因,其实这不能怪WLW,错误出在第一次使用WLW时配置有问题。在配置帐户信息时输入完博客地址、账号和密码后,有一个选项是选择由谁提供了博客服务,列出了很多博客服务提供商和独立博客的名字,对于wordpress分别有一个WordPress和WordPress2.2+,如果选择了Wordpress就有可能出现没有数据域无法设置固定链接的情况。2015-01-04_221716

           解决办法也很简单,重新配置一下日志账户即可,选择博客提供者的时候选WordPress2.2+,配置完成进入博客编辑页面,点击查看全部数据域回来了。此时再去查看日志功能,作者、数据域和密码都检测到了。2015-01-04_221955

    这个函数是先用php自带的strip_tag函数过滤掉html代码,在用正则表达式匹配空格并替换

    1. public function html_remove($str){  
    2.       $htmlstr=strip_tags(htmlspecialchars_decode($str));  //这里是对实体符号进行了转义,如果你不需要可以去掉htmlspecialchars_decode函数  
    3.       return preg_replace(“/(\s|\&nbsp\;| |\xc2\xa0)/”,“”,$htmlstr);  
    4.   } 

    这个函数可以过滤掉传入参数中的Html代码、Javascript代码、css代码、回车、换行、制表位以及空格

    1. function remove_html_tag($str){  //清除HTML代码、空格、回车换行符  
    2.         $str = trim($str); //trim 去掉字串两端的空格  
    3.         $str = @preg_replace(‘/<script[^>]*?>(.*?)<\/script>/si’, , $str);  //去除js代码  
    4.         $str = @preg_replace(‘/<style[^>]*?>(.*?)<\/style>/si’, , $str);  //去除css代码  
    5.         $str = @strip_tags($str,“”);       //strip_tags 删除HTML元素  
    6.         $str = @ereg_replace(“\t”,“”,$str);   //删除制表位  
    7.         $str = @ereg_replace(“\r\n”,“”,$str);   //删除回车换行  
    8.         $str = @ereg_replace(“\r”,“”,$str);   //删除回车  
    9.         $str = @ereg_replace(“\n”,“”,$str);   //删除换行  
    10.         $str = @ereg_replace(” “,“”,$str);  //把连接的多个空格替换成单空格  
    11.         $str = @ereg_replace(“&nbsp;”,“”,$str);  //替换空格  
    12.         return trim($str);  
    13.     }  

    相信大家都见过在微信朋友圈或者和好友聊天时看到别人分享的内容,有自定义标题、自定义图标、自定义描述和自定义的跳转地址。

    以前都是通过微信内置API——WeixinJSBridge中部分未完全被腾讯官方屏蔽的接口来实现的,本站前面也有过介绍http://www.waiting8.com/app-sharing-to-friends-to-send-to-a-friend-code.html

    2015年元旦发现前几天做的项目设置好的微信分享代码没效果,分享时默认拉取了网页中的第一张图片,描述信息的地方显示是当前网页的地址,仔细检查了一下发现代码没有报错。然后找了其他几个微信网页测试出现了同样的问题,初步怀疑是接口禁用了(当然这个是除了腾讯自家和他家的战略合作伙伴之外的)。

    今天去公司和同事找了好几台手机测试,效果一样,除了部门老大分享正常,后来发现跟微信版本号有关,没有测试IOS,安卓手机微信6.0.2版本存在这个问题,以下分享正常。
    去网上搜了下,这个情况应该是从2014年12月30或者31号就开始了,可能与12月30日微信公众平台发布的系统公告微信公众平台关于整顿诱导分享及诱导关注行为的公告有关,目前没有太完美的解决办法,影响面也比较大。

    目前网传的这几个情况貌似比较可信:
    1、有网友给出咨询腾讯在线客服客服给出的解释:

    相关情况是由于我司升级系统导致,现在工作人员正在抢修。请耐心等待。还说是刚刚技术那边过来通知才知道这个情况。

    2、QQ群内官方人员给出的解释:
    关于自定义分享功能失效的申明
    旧版的获取分享状态及设置分享内容的JS接口一直用于内部业务,并未对外开放,在微信公开的开放文档里面并没有此接口。某些第三方借助微信客户端漏洞在未获得权限的情况下使用接口,微信6.0.2版本对此漏洞做了修复以确保用户分享内容的准确性,避免诱导分享。另外,此接口不久将会公布开放规则向公众号开放。
    3、网友猜测:

    微信未应对微信公众平台关于整顿诱导分享及诱导关注的行为,建立了一个白名单,只有白名单内的域名可以正常调用该接口。后期或许会公开相关接口和接入规则,但目前先把接口给封了。(这做法有点操蛋)

    可以确定的是是腾讯官方禁用了微信分享API接口

    目前的影响范围:

    1、微信分享设置的描述信息失效

    2、微信分享设置的描述信息失效

    3、分享缩略图设置会失效

    4、无法自定义分享后点击的连接

    5、微信分享成功后的触发器失效

    6、微信客户端6.0.2以上版本受影响

    临时的解决办法:
    1、博主Alien通过反编译微信安卓客户端获取asserts/jsapi/wxjs.js分析研究后给出了新的hack方法,可以直接去WeixinApi项目主页获取最新源码

    传送门

    2、可间接设置分享的标题和缩略图,描述信息无解

    在body开始时,隐藏一个 300X300的图片,微信会首选这个图片作为分享缩略图

    例如:

    <div style=”display:none ”>

    <img src=””>

    </div>

    分享标题直接修改头部title标签中的标题

    软件简介

    SQLyog是业界著名的Webyog公司出品的一款简洁高效、功能强大的图形化MySQL数据库管理工具。使用SQLyog可以快速直观地让您从世界的任何角落通过网络来维护远端的MySQL数据库。
    SQLyog相比其它类似的MySQL数据库管理工具其有如下特点:
    1、基于C++和MySQLAPI编程;
    2、方便快捷的数据库同步与数据库结构同步工具;
    3、易用的数据库、数据表备份与还原功能;
    4、支持导入与导出XML、HTML、CSV等多种格式的数据;
    5、直接运行批量SQL脚本文件,速度极快;
    6、新版本更是增加了强大的数据迁移
    ps:
    据说该软件在批量执行插入语句时,相对navcat更快速
    包含X64和X86版本
    内置多国语言

    基本功能

    1. 快速备份和恢复数据。
    2. 以GRID/TEXT格式显示结果。
    3. 支持客户端挑选、过滤数据。
    4. 批量执行很大的SQL脚本文件。
    5. 快速执行多重查询并能够返回每页超过1000条的记录集,而这种操作是直接生成在内存中的。
    6. 程序本身非常短小精悍!压缩后只有348 KB。
    7. 完全使用MySQL C APIs程序接口。
    8. 以直观的表格界面建立或编辑数据表。
    9. 以直观的表格界面编辑数据。
    10. 进行索引管理。
    11. 创建或删除数据库。
    12. 操纵数据库的各种权限:库、表、字段。
    13. 编辑BLOB类型的字段,支持Bitmap/GIF/JPEG格式。
    14. 输出数据表结构/数据为SQL脚本。
    15. 支持输入/输出数据为CSV文件。
    16. 可以输出数据库清单为HTML文件。
    17. 为所有操作建立日志。
    18. 个人收藏管理操作语句。
    19. 支持语法加亮显示。
    20. 可以保存记录集为CSV、HTML、XML格式的文件。
    21. 99%的操作都可以通过快捷键完成。
    22. 支持对数据表的各种高级属性的修改。
    23. 查看数据服务器的各种状态、参数等。
    24. 支持更改数据表类型为ISAM、MYISAM、MERGE、HEAP、InnoDB、BDB。
    25. 刷新数据服务器、日志、权限、表格等。
    26. 诊断数据表–检查、压缩、修补、分析。

    链接: http://pan.baidu.com/s/1qWpzFKo 密码: szww

    软件简介

    Navicat Premium 是一套数据库管理工具,让你以单一程序同時连接到 MySQL、MariaDB、SQL Server、SQLite、Oracle 和 PostgreSQL 数据库。

    结合了其他 Navicat 成员的功能,Navicat Premium 支持大部份在现今数据库管理系统中使用的功能,包括存储过程、事件、触发器、函数、视图等。

    Navicat Premium 能使你快速地在各种数据库系统间传输数据,或传输到一份指定 SQL 格式和编码的纯文本文件。计划不同数据库的批处理作业并在指定的时间运行。其他功能包括导入向导、导出向导、查询创建工具、报表创建工具、数据同步、备份、工作计划及更多。

    Navicat 的功能足以符合专业开发人员的所有需求,但是对数据库服务器的新手来说又相当容易学习。

    下面是“Navicat”一些主要特点:

    安全连接
    对象设计
    表查看器
    SQL生成器/编辑
    数据库设计
    PL/ SQL代码调试器
    报表生成器/浏览器

    数据处理工具:
    导入/导出向导
    数据传输
    数据/结构同步
    备份/还原
    附表

    有用的工具:
    ER图
    连接的着色/虚拟分组
    树/对象过滤
    加入收藏

    下载地址

    链接: http://pan.baidu.com/s/1kTkQeEz 密码: adig