Encoding::UndefinedConversionErrorinProductsController#create"\xFF"fromASCII-8BITtoUTF-8在使用ruby1.9.3做上传照片的时候,报这个错误,解决办法是将控制器里的File.open("#{Rails.root}/app/assets/p_w_picpaths/"+new_name,"w"){|file|file.write(img_data)}换为File.o..
分类:
其他好文 时间:
2014-09-07 03:22:55
阅读次数:
199
Sudoku Solver
Total Accepted: 11752 Total
Submissions: 56537My Submissions
Write a program to solve a Sudoku puzzle by filling the empty cells.
Empty cells are indicated by the character...
分类:
其他好文 时间:
2014-09-06 22:37:04
阅读次数:
244
Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:"((...
分类:
其他好文 时间:
2014-09-06 16:05:23
阅读次数:
182
一、准备工作: 运行yum命令查看MongoDB的包信息[root@vm ~]# yum info mongo-10gen(提示没有相关匹配的信息,)说明你的centos系统中的yum源不包含MongoDB的相关资源,所以要在使用yum命令安装MongoDB前需要增加yum源,也就是在 /etc/....
分类:
数据库 时间:
2014-09-06 16:00:43
阅读次数:
556
基于Nodejs和MongoDB,读取数据库中产品的列表var http = require("http"), mongo = require("mongodb"), events = require("events"); http.createServer(function(req, res).....
分类:
数据库 时间:
2014-09-06 00:58:02
阅读次数:
330
linux kernel将关键信息保存到文件做法 很好的调试方法
下面有2个示例:
1:保存机器从开机到结束的VBATT;
2:保存uart接收到的数据到文件;
意义不多说了。
以下是代码:
#include
#include
#include
static struct file *fp =NULL;
int write_to_file...
分类:
系统相关 时间:
2014-09-05 22:28:22
阅读次数:
318
Python打印不换行方法一、可以用print i,即在后面加逗号,但是这还是有一个不好的地方,就是会产生空格,print 1,print 2,则会输出:1 2方法二、import syssys.stdout.write("abc")sys.stdout.write("def")链表:一个链表类,一...
分类:
编程语言 时间:
2014-09-05 22:22:32
阅读次数:
188
1.MongoDB的安装步骤一:下载MongoDB下载安装包:http://fastdl.mongodb.org/linux/mongodb-linux-i686-2.0.4.tgz步骤二:设置MongoDB程序存放目录将其解压到/Apps,再重命名为mongo,路径为/Apps/mongo步骤三:...
分类:
数据库 时间:
2014-09-05 19:45:01
阅读次数:
269
Search a 2D Matrix
Total Accepted: 18506 Total
Submissions: 59402My Submissions
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following pr...
分类:
其他好文 时间:
2014-09-05 18:21:38
阅读次数:
232