书签应用是一种通过在书签中嵌入可以运行的 Javascript 代码,通过调用远程资源文件,对正在浏览的网页进行入侵式修改的应用。

书签应用的安装,一般是把一个链接拖到收藏夹,有的个人应用可能需要注册之后操作。

Cc2Me 是结合 Gmail 使用的网页笔记应用。可以收藏当前浏览 URL ,并且可以在当前 URL 记笔记,还支持 Tag ,通过 Gmail 的 Filter 管理。

YumTab 是一个自动收藏所浏览网页的应用,特点是可以自动提取图片和摘要,以便以后查阅。

Mobile Pref 是移动客户端的网页辅助开发工具,集成了 Firebug Lite DOM Monster Storager YSlow SpriteMe CSSess Zoompf 等工具。

PrintWhatYouLike 可以让你随意修改所浏览网页,添加删除内容,手工修改成所需要的打印版本。

Delicious 鼎鼎大名的网址收藏网站。

Twitter 一键分享内容到 Twitter

ReaditLater 网页收藏工具

CiteBite 在线注释和网址收藏工具。

Readability 网页内容提取工具,可以自动移除广告和其他无关内容。

AddThis 很流行嵌入式的兴趣分享按钮的Bookmarklet

Posterous 博客类应用,通过 Bookmarklet 快捷的发布博客。

长期维护生产环境的数据库,恐怕很多人会犯这样的错误:

update tableA set field1value = VVVV (where …);

忘记了加括号中的约束条件,等反应过来,Shell 中显示已经更新了几万条数据。

如何挽救这样的失误呢?

  1. 每天进行数据备份,我们的方案是每天 dump 整库,保存在 S3 中,服务器上只保存昨天的数据
  2. 假如有前一天的备份数据,可以选择性恢复除了今天以外的数据。Shell 中命令行失误往往被损坏的数据都涉及一张表的一个字段或者几个字段。
  3. Drupal 中可以利用其支持多库的特性,新建一个旧数据的库,从旧数据库中读取数据,覆盖到新库上。以下是恢复数据的脚本例子

假如不是 Drupal 系统,也可以直接用 PHP 连接2个数据库,进行类似操作。

Drupal 7 profile menu

There 2 methods to add a menu in Drupal, hookmenu or hookmenu_alert

We can define a menu like this:

  $items['user/%user/facebook'] = array(
    'title' => 'Facebook',
    'description' => 'Facebook Profile',
    'page callback' => 'facebook_user_settings',
    'file' => 'facebook.pages.inc',
    'page arguments' => array(1),
    'access callback' => 'facebook_user_access', //access arguments don't support multiple arguments, so create our access handler
    'access arguments' => array(1),
    'type' => MENU_LOCAL_TASK,
  );

Because the menu type is MENULOCALTASK, this will add a new tab “Facebook” right after the “edit” tab. 

But how to add the “facebook” tab in secondary level, after “Account”, just do as the “Linkedin” tab?

The following code is NOT right:

  $items['user/%user/edit/facebook'] = array(
    'title' => 'Facebook',
    'description' => 'Facebook Profile',
    'page callback' => 'facebook_user_settings',
    'file' => 'facebook.pages.inc',
    'page arguments' => array(1),
    'access callback' => 'facebook_user_access', //access arguments don't support multiple arguments, so create our access handler
    'access arguments' => array(1),
    'type' => MENU_LOCAL_TASK,
  );

 

This will lead some errors. You should do as the following steps, (Linkedin codes):

Step 1, show a tab menu after “Account”:

function linkedin_user_categories() {
  return array(
    array(
      'name' => 'linkedin',
      'title' => 'Linkedin',
      'weight' => 3,
    ),
  );
}

Step 2, define the menu callback functions:

function linkedin_menu_alter(&$callbacks) {
  $callbacks['user/%user_category/edit/linkedin']['page callback'] = 'linkedin_user_settings';
  $callbacks['user/%user_category/edit/linkedin']['module'] = 'linkedin';
  $callbacks['user/%user_category/edit/linkedin']['page arguments'] = array(1);
  $callbacks['user/%user_category/edit/linkedin']['file'] = 'linkedin.pages.inc';
}

There is no document about hookusercategories for Drupal 7, so this article shows How to use it.

Hope to help you.