ITeye博客

xinlanzero

xinlanzero · 共 144 篇文章

图片上传插件Acts As Attachment

开始也是下载 在项目目录下面运行 Ruby代码 script/plugin source http://svn.techno-weenie.net/projects/plugins 然后是安装 Ruby代码 script/plugin install acts_as_attachment 创建dvd_cover模型 Ruby代码 script/generate attachment_model dvd_cover create_table :dvd_covers do |t| t.column "dvd_id", :integer t.column "content_type", :stri…

2011-08-03 12:39 · Ruby · 评论(0)

windows实战Git环境配置msysGit+TortoiseGit

Git是一个分布式源代码版本管理控制程序. “Git 是一个由林纳斯·托瓦兹为了更好地管理linux内核开发而创立的分布式版本控制/软件配置管理软件。”- 维基百科中文。 http://zh.wikipedia.org/zh-cn/Git msysgit和TortoiseGit的开发进展很快,我们在windows平台上使用的git,越来越强大了。虽然相比Linux下面的GIT还有很大差距,但相比其它版本控制系统,git 还是可以 笑傲江湖。 它有如下优点: 1. 它足够稳定,linux的核心就是用它来托管的。数G大的源码仓库,依然稳定如山。 2. 它足够快,是所有版本控制程序中最快的一个。 …

2011-08-02 10:17 · 版本管理 · 评论(0)

TortoiseGit + msysgit + CopSSH + WindowsXP as server

Introduction This guide will show you how to set up a centralized Git repository, which offers an option similar to a conventional subversion work-flow, with a centralized server. This is not a difficult process; it is only a long sequence of simple steps. Software Requirements Software requirement…

2011-08-02 10:16 · 版本管理 · 评论(0)

Rails应用中连接Mysql数据库的字符集引起中文乱码问题的解决

一、在Rails中在database.yml中设置如下,一定要指定字符集为utf8 development: adapter: mysql database: demo_development username: root password: host: localhost encoding: utf8 二、在Mysql中 1、建立数据库时要指定字符集为utf8 create database demo_development default charset=utf8 或create database demo_development character set utf8 collate u…

2011-07-28 12:49 · Ruby · 评论(0)

Ruby on Rails 学习:解决中文乱码问题 .

初学Rails,简单的做了一个例子,发现存在中文问题。 大致中文问题归类如下: 1、页面无法显示中文,产生中文乱码 2、Mysql数据库采用utf8后,页面采用utf8,数据库保存是乱码,但页面显示正常。 3、时间格式在页面上的中文显示产生乱码。 打开:application.rb:修改代码如下显示: 1 class ApplicationController < ActionController::Base 2 before_filter :set_charset 3 def set_charset 4 @headers = "text/html; charset=utf-8" 5 end…

2011-07-28 12:27 · Ruby · 评论(0)

cocoa 如何发音?

apple 自带字典的解释: cocoa |ˈkōkō| noun 1 a chocolate powder made from roasted and ground cacao seeds. • a hot drink made from such a powder mixed with sugar and milk or water. 2 variant spelling of coco , usu. regarded as a misspelling. ORIGIN early 18th cent. (denoting cacao seed): alteration of cacao …

2011-07-25 13:06 · iPhone · 评论(0)

关于NSAutoreleasePool的release和drain的区别

苹果官方文档的翻译 In a garbage collected environment, release is a no-op. NSAutoreleasePool therefore provides a drain method that in a reference-counted environment behaves the same as calling release, but which in a garbage collected environment triggers garbage collection (if the memory allocated since …

2011-07-24 07:53 · iPhone · 评论(0)

Collections.sort list排序

newList是个Value对象的List,orderId是Value对象的一个属性,现在要求根据orderId把List里的记录降序排序。使用 Collections.sort方法可实现此要求,需要自己写类实现Comparator的 compare接口,这里采用的内部类的方式,当然也可使用其他方式。 Collections.sort(newList, new Comparator<PropertyValue>(){ public int compare(Value p1, Value p2) { final int count1 = p1.getOrderId(); final int c…

2011-07-23 13:40 · J2EE · 评论(0)

Download, Create and Display an Image from URL

Posted on November 4, 2009 by John Muchow in Cocoa Tweet <script src="http://platform.twitter.com/widgets.js" type="text/javascript"></script><!-- <a target="_blank" href="http://iPhoneDeveloperTips.com?wp_ct=10"><img border="0" src="/images/ads/SnowLeopard.jpg"></a><img src="http://www.assoc-amazo…

2011-07-22 13:39 · iPhone · 评论(0)

Creating an UIImage from a URL

A question came up over the weekend as to download an image off the internet and add it to a UIImage object on the iPhone. The answer is to create an NSData object that grabs the contents of the URL and then initialize the image with that data, as such: id path = @"http://merrimusings.mu.nu/archive…

2011-07-22 13:36 · iPhone · 评论(0)

查看/修改Linux时区和时间

查看/修改Linux时区和时间 一、时区 1. 查看当前时区 date -R 2. 修改设置时区 方法(1) tzselect 方法(2) 仅限于RedHat Linux 和 CentOS timeconfig 方法(3) 适用于Debian dpkg-reconfigure tzdata 3. 复制相应的时区文件,替换系统时区文件;或者创建链接文件 cp /usr/share/zoneinfo/$主时区/$次时区 /etc/localtime 在中国可以使用: cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime 二、时间 1、查看时间和日…

2011-07-21 22:56 · Linux · 评论(0)

修改mysql的root密码的几种方法

作者: 肖建彬 | 可以转载, 转载时务必以超链接形式标明文章 原始出处 和作者信息及版权声明 网址: http://www.xiaojb.com/archives/it/mysqlroot.shtml Method 1: 在/usr/local/mysql/bin/下: ./mysqladmin -u root password ‘new_password’ 一般安装时用此方法设置。 Method 2: 在mysql状态下: mysql>UPDATE user SET password=PASSWORD(‘new_password’) WHERE user=’root’; mysql>FL…

2011-07-21 17:10 · 数据库 · 评论(0)

MySQL ERROR 1045 (28000): Access denied for user 'root'@'localhost'

Ubuntu 8.04刚装了mysql sudo apt-get install mysql 安装成功了,安装最后要求输入了密码,也输入了,OK mysql -uroot -p 输入设置的密码 竟然报错了! ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YSE) 问朋友,他说初始密码是空的,可我命名设置了密码的阿。 密码留空 还是错误! ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using pass…

2011-07-21 15:07 · 数据库 · 评论(0)

MySQL修改root密码的各种方法整理

整理了以下四种在MySQL中修改root密码的方法,可能对大家有所帮助! 方法1: 用SET PASSWORD命令 mysql -u root mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpass'); 方法2:用mysqladmin mysqladmin -u root password "newpass" 如果root已经设置过密码,采用如下方法 mysqladmin -u root password oldpass "newpass" 方法3: 用UPDATE直接编辑user表 mysql -u root mysq…

2011-07-21 15:02 · 数据库 · 评论(0)

开发进阶:如何提高云中应用程序的可靠性

摘要 : 本文主要探究如何通过采用一个负载均衡器和永久性磁盘使您的应用程序更为健壮。您将使用多个服务器并了解如何安全地备份您的数据。 ... <!--[diy=diysummarybottom]--><!--[/diy]--> <!--[diy=diycontenttop]--><!--[/diy]--> 本系列的 开发教程:如何将Linux应用程序迁移到Amazon云 介绍了如何将一个物理服务器迁移到一个物理云服务器中。尽管所有的工作都已完成,但是,应用程序并没有明显的改善,这主要是因为引入了更多的单点故障。 甚至在单个物理服务器上,您都有冗余电源、错误纠正 RAM、冗余磁盘和丰富的故障前…

2011-07-21 09:50 · 云计算 · 评论(0)