我有默认的python 2.7,我尝试安装python3.3并安装pip3和Django.now当我尝试使用yum安装其他时我得到了这个错误.例如yum update
导入运行yum所需的Python模块之一时出现问题.导致此问题的错误是:没有名为yum的模块请安装提供此模块的软件包,或验证模块是否已正确安装.上述模块可能与当前版本的Python不匹配,即:2.7.5(默认,2013年11月12日,16:18:42)[GCC 4.8.2 20131017(Red Hat 4.8.2-1) ]如果你自己无法解决这个问题,请访问yum faq:http: //yum.baseurl.org/wiki/Faq
我该如何解决这个错误?
我需要使用ObjectIdHex获取值并进行更新并查看结果.我正在使用mongodb和golang.But以下代码无法按预期工作
package main
import (
"fmt"
"gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
)
type Person struct {
Id bson.ObjectId `json:"id" bson:"_id,omitempty"`
Name string
Phone string
}
func checkError(err error) {
if err != nil {
panic(err)
}
}
const (
DB_NAME = "gotest"
DB_COLLECTION = "pepole_new1"
)
func main() {
session, err := mgo.Dial("localhost")
checkError(err)
defer session.Close()
session.SetMode(mgo.Monotonic, true)
c := session.DB(DB_NAME).C(DB_COLLECTION)
err = c.DropCollection()
checkError(err)
ale := Person{Name:"Ale", Phone:"555-5555"}
cla := Person{Name:"Cla", Phone:"555-1234-2222"}
kasaun := Person{Name:"kasaun", Phone:"533-12554-2222"}
chamila := Person{Name:"chamila", Phone:"533-545-6784"}
fmt.Println("Inserting")
err …Run Code Online (Sandbox Code Playgroud) 我需要将默认值文本"选择你的设备"值设置为我的微调器下拉列表,我把它作为列表项,所以它作为一个下拉列表项,我隐藏下拉列表,因为这我的下拉列表中有一个空白区域.
我该怎么做?
这是我用过的代码
mToolbar = (Toolbar) findViewById(R.id.toolbar_actionbar);
setSupportActionBar(mToolbar);
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setDisplayShowTitleEnabled(false);
/*Setup a Spinner*/
mToolbarSpinner = (Spinner) findViewById(R.id.spinner_toolbar);
/*Manage the spinner*/
mToolbarSpinnerNavigationItems = new ArrayList<SpinnerNavItem>();
mToolbarSpinnerNavigationItems.add(new SpinnerNavItem("Select your Seebo", R.drawable.deviceonline));
/*setting the mToolbarSpinnerNavigationItems to list_item_title_navigation.xml*/
mArrayAdapter = new ArrayAdapter(this, R.layout.list_item_title_navigation,mToolbarSpinnerNavigationItems){
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// remember to inflate custom layout for spinner item
// then set anything you want here
// remember to use convertView.findViewById(), not just findViewById()
// this is an example …Run Code Online (Sandbox Code Playgroud) 我需要将图像上传到我的电影收藏应用程序我使用carrierwave来执行此操作(按照railscasts步骤)
步骤1我将gem'carrierwave','〜> 0.9'添加到我的Gemfile然后运行bundle步骤2 rails g uploader image然后rails g scaffold filmes name moviestype rake db step 3 rails g migration add_image_to_filmes image:string然后rake db
其他步骤与railscast相同
在我的电影模型中
attr_accessible :name, :moviestype, :image
mount_uploader :image, ImageUploader
Run Code Online (Sandbox Code Playgroud)
在我的_form.html.erb中
<%= form_for @filme, :html => {:multipart => true} do |f| %>
<% if @filme.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@filme.errors.count, "error") %> prohibited this filme from being saved:</h2>
<ul>
<% @filme.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="field"> …Run Code Online (Sandbox Code Playgroud)