月度归档:2016年11月

Encoding::UndefinedConversionError

arr=line.force_encoding("utf-8").split("\t")

出现:`encode’: “\xAF\xD0” from GBK to UTF-8 (Encoding::UndefinedConversionError)

更改为以下
arr= line.encode('UTF-8',{
:invalid => :replace,
:undef   => :replace,
:replace => '?'
}).split("\t")

Ruby 发送邮件

SMTP(Simple Mail Transfer Protocol)即简单邮件传输协议,它是一组用于由源地址到目的地址传送邮件的规则,由它来控制信件的中转方式。

Ruby提供了 Net::SMTP 来发送邮件,并提供了两个方法 new 和 start:

new 方法有两个参数:

  • server name 默认为 localhost
  • port number 默认为 25

start 方法有以下参数:

  • server – SMTP 服务器 IP, 默认为 localhost
  • port – 端口号,默认为 25
  • domain – 邮件发送者域名,默认为 ENV[“HOSTNAME”]
  • account – 用户名,默认为 nil
  • password – 用户密码,默认为nil
  • authtype – 验证类型,默认为 cram_md5

SMTP 对象实例化方法调用了 sendmail, 参数如下:

  • source – 一个字符串或数组或每个迭代器在任一时间中返回的任何东西。
  • sender -一个字符串,出现在 email 的表单字段。
  • recipients – 一个字符串或字符串数组,表示收件人的地址。

继续阅读

Perform point-in-time table-level restore in Informix Dynamic Server

This article describes how to perform point-in-time table-level restores that extract tables or portions of tables from archives and logical logs. Table-level restore is a new feature for IBM® Informix® Dynamic Server Version 10.0. This feature is useful where portions of a database, a table, a portion of a table, or a set of tables need to be recovered and also useful in situations where tables need to be moved across server versions or platforms.

Introduction

Informix Dynamic Server V10.0 (IDS) provides you with the ability to easily extract data in tables of databases from a 0-level backup to a specified point in time. The extracted data can be loaded in internal, external tables or ASCII files. This feature lets you:

  • Extract a table or a set of tables
  • Filter the retrieved data
  • Retrieve just a subset of columns
  • Repartition the data
  • Place data in the same version of the database, or in a different database version with a different machine architecture.

To use this feature, you use the archecker utility to extract and load data to specific tables.

Overview of the archecker utility

The archecker utility requires the following:

  • The archecker configuration file
  • The schema command file
  • The archecker command, in order to execute

继续阅读

Grafana

Grafana is most commonly used for visualizing time series data for Internet infrastructure and application analytics but many use it in other domains including industrial sensors, home automation, weather, and process control.

Grafana features pluggable panels and data sources allowing easy extensibility and a variety of panels, including fully featured graph panels with rich visualization options. There is built in support for many of the most popular time series data sources. 继续阅读