王筝的博客
ruby学习

*新服务器安装步骤

1. 下载python2.7.6 wget http://www.python.org/ftp/python/2.7.6/Python-2.7.6.tgz
2. 解压缩 tar -xf Python2.7.6
3. 安装 1. cd Python2.7.6; ./configure ; make; make install
4. 替换系统自带python mv /usr/local/bin/python /usr/local/bin/python_bak; ln -s /usr/local/bin/python2.7 /usr/local/bin/python


2. 安装django1.5.4

0. wget https://www.djangoproject.com/m/releases/1.5/Django-1.5.4.tar.gz
1.解压缩 tar zxvf Django-1.5.4.tar.gz
2.安装 cd Django-1.5.4/ ; python setup.py install
3.测试 python; import django; django.VERSION

3. 安装mongoDB
0.wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.4.8.tgz
1.解压缩 tar zxvf mongodb-linux-x86_64-2.4.8.tgz 
2.安装 mkdir -p /opt/soft/mongo ; cp -R -n mongodb-linux-x86_64-2.4.8/ /opt/soft/mongo; ln -s /opt/soft/mongo/mongodb-linux-x86_64-2.4.8/bin/mongo  /usr/local/bin/
3.配置 :
sudo chown $USER /data/db
	vim ~/.bash_profile
	add :
		export PATH=$PATH:/opt/mongodb-linux-i686-2.4.5/bin
	source ~/.bash_profile

4. 安装nginx

1. 在安装nginx前,需要确保系统安装了g++、gcc、openssl-devel、pcre-devel和zlib-devel软件。安装必须软件
	yum install gcc-c++; 
	yum -y install zlib zlib-devel openssl openssl--devel pcre pcre-devel 
2. 下载安装 ngxin --ver : 1.5.6
	wget http://nginx.org/download/nginx-1.5.6.tar.gz
	tar zxvf nginx-1.5.6.tar.gz
	./configure ; make ; make install ; 
3. 安装好之后的位置:
	/usr/local/nginx/sbin/nginx
	/usr/local/nginx/conf/nginx.conf
	/usr/local/nginx/logs
4. source :
	export PATH=$PATH:/opt/mongodb-linux-i686-2.4.5/bin:/usr/local/nginx/sbin

5.安装easy_install

wget https://pypi.python.org/packages/source/d/distribute/distribute-0.6.49.tar.gz
tar xf distribute-0.6.49.tar.gz
cd distribute-0.6.49
python setup.py install
easy_install --version

6. 安装pip

1.下载pip
2. easy_install pip

7. 安装python-memcached

$ wget https://pypi.python.org/packages/source/p/python-memcached/python-memcached-1.53.tar.gz --no-check-certificate
$ tar zxvf python-memcached-1.53.tar.gz
$ cd python-memcached-1.53/
$ python setup.py install

8. 安装uwsgi

1.pip install uwsgi
2.测试 uwsgi -- version

9. 安装MySQL-Python

0. get http://softlayer-ams.dl.sourceforge.net/project/mysql-python/mysql-python-test/1.2.4b4/MySQL-python-1.2.4b4.tar.gz
1. tar zxvf MySQL-python-1.2.4b4.tar.gz
2. cd MySQL-python-1.2.4b4.tar.gz ; python setup.py install

10 .安装django-cas2

0. https://github.com/KTHse/django-cas2/archive/master.zip
1. unzip django-cas2-master.zip
2. cd django-cas2-master; python setup.py install
11.安装pymongo

http://api.mongodb.org/python/current/installation.html

If you’d rather install directly from the source (i.e. to stay on the bleeding edge), install the C extension dependencies then check out the latest source from github and install the driver from the resulting tree:

$ git clone git://github.com/mongodb/mongo-python-driver.git pymongo
$ cd pymongo/
$ python setup.py install
还可以直接用pip和 easy_install

[root@localhost mongodb]# ./bin/mongod -f mongodb.conf all output going to: log/mongodb.log

 


					
						
			
	
				
					
				
					

运行新做的计算器App的时候有个小问题,点击文本框不能在模拟器下方自动弹出来键盘,只能通过电脑的键盘输入数字

解决方法如下:

打开模拟器,在最上面的菜单栏中,选择hardware,然后选择keyboards,有三个选项, 依次都勾选就行了。(注意:第三个选项在点击之后,实际已勾上了,但显示未勾上,但实际已经奏效了,这可能是xcode6的一个显示上的bug)

 

最近楼主在swift的自学中痛并快乐着,这个最简单的天气预报功能遇到了好多小坑, 吐血记录下代码.

/  ViewController.swift

//  Weather

//  Created by angela on 14/11/6.

//  Copyright (c) 2014年 angela. All rights reserved.

import UIKit

class ViewController: UIViewController {

@IBOutlet var tv:UITextView?

@IBAction func btnPressed(sender:Anyobject){

println(“button clicked”)

loadWeather()

}

override func viewDidLoad() {

super.viewDidLoad()

// Do any additional setup after loading the view typically from a nib.

loadWeather()

}

override func didReceiveMemoryWarning() {

super.didReceiveMemoryWarning()

// Dispose of any resources that can be recreated.

}

func loadWeather(){

var url = NSURL(string: “http://www.weather.com.cn/data/sk/101010100.html“)

println(“\(url)”)

var data = NSData(contentsOfURL: url!)

println(“\(data)”)

var json : Anyobject? = NSJSONSerialization.JSONobjectWithData(data! options:NSJSONReadingOptions.AllowFragments error: nil)

var weatherInfo : Anyobject! = json?.objectForKey(“weatherinfo”)

var city : Anyobject! = weatherInfo?.objectForKey(“city”)

var temp : Anyobject! = weatherInfo?.objectForKey(“temp”)

 

var wind : Anyobject! = weatherInfo?.objectForKey(“WD”)

var ws : Anyobject! = weatherInfo?.objectForKey(“WS”)

tv?.text = “城市:\(city)\n温度: \(temp)\n风: \(wind)\n风级:\(ws)”

}

}

 

 

<%= hidden_field_tag :version,@version %>
<%= hidden_field_tag :module_id,@video.parent_module_id%>

{“utf8″=>”✓”, “authenticity_token”=>”fixQgc0R4wHIn6fbE+Kkf+JC7oQP/WuNBBCDID6Q5Fw=”, “version”=>”1″, “module_id”=>”1″, “video”=>{“video_id”=>””, “show_id”=>””, “title”=>””, “res_desc”=>””, “large_horizontal_image”=>””, “middle_horizontal_image”=>””, “large_vertical_image”=>””, “middle_vertical_image”=>””}, “commit”=>”保存”}

==========================================

<%= v.hidden_field :version %>
<%= v.hidden_field :parent_module_id %>

Parameters: {“utf8″=>”✓”, “authenticity_token”=>”fixQgc0R4wHIn6fbE+Kkf+JC7oQP/WuNBBCDID6Q5Fw=”, “video”=>{“version”=>”1″, “parent_module_id”=>”1″, “video_id”=>”qq”, “show_id”=>”qq”, “title”=>”q”, “res_desc”=>”qq”, “large_horizontal_image”=>””, “middle_horizontal_image”=>””, “large_vertical_image”=>””, “middle_vertical_image”=>””}, “commit”=>”保存”}