我想删除Ruby,所以我试试这个.我该如何删除?
sudo apt-get autoremove ruby
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'ruby' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 534 not upgraded.
here@jaskaran:/$ whereis ruby
ruby: /usr/bin/ruby /usr/lib/ruby /usr/bin/X11/ruby /usr/share/man/man1/ruby.1.gz
here@jaskaran:/$ ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [i686-linux]
Run Code Online (Sandbox Code Playgroud) 在登录模型中,我与图片表有实现关系
function picture () {
return $this->hasOne('App\Picture');
}
Run Code Online (Sandbox Code Playgroud)
现在我想要 Picture.picture_status = 1 和 User.user_status = 1 的数据
Login::with('picture')->where('picture_status', 1)->where('user_status',1);
Run Code Online (Sandbox Code Playgroud)
但是如果条件不适用于图片表,我如何在两个表上实施和条件
我有问题表,存储了这么多问题.与question_topics相关的问题因此创建与问题有很多关系.现在它看起来像这样:
$this->Question->bindModel(
array(
'hasMany' => array(
'QuestionTopic'=>array(
'className' => 'QuestionTopic',
'foreignKey' => 'question_id',
'dependent' => true,
'conditions' => array('QuestionTopic.areas_id' => 165),
'type' => 'left'
)
)
)
);
print_r($this->Question->find('all'));
die;
Run Code Online (Sandbox Code Playgroud)
当我看到结果时,它看起来像这样
Array
(
[0] => Array
(
[Question] => Array
(
[id] => 89
[user_id] => 1
[question_group_id] => 0
[question] => jQuery function here
[target_id] => 1
[type] => 1
[order] => 1
[description] => additional info here
[privacy_friend_id] =>
[channel_id] => 1
[status] => 0
[location] => Chandigarh, …Run Code Online (Sandbox Code Playgroud) 我有一个字段country_id和country_name,我想在Django rest Framework中更改这两个字段的名称
现在写我正在收到这些数据
{
"data": [
{
"country_id": 1,
"country_name": "Afghanistan"
},
{
"country_id": 2,
"country_name": "Aland Islands"
}
]
}
Run Code Online (Sandbox Code Playgroud)
我在serializers.py文件中有变化,但对我不起作用
serializers.py
class CountrySerializer(serializers.ModelSerializer):
name = serializers.SerializerMethodField('country_name')
class Meta:
model = Country
fields = ('country_id', 'name')
Run Code Online (Sandbox Code Playgroud)
在模型中
class Country(models.Model):
country_id = models.AutoField(primary_key = True)
country_name = models.CharField(max_length = 128)
class Meta:
db_table = 'countries'
Run Code Online (Sandbox Code Playgroud)
我想要这些数据
{
"data": [
{
"id": 1,
"name": "Afghanistan"
},
{
"id": 2,
"name": "Aland Islands"
}
]
}
Run Code Online (Sandbox Code Playgroud)
得到此错误:/ v1/location/countries /上的AttributeError'CountrySerializer'对象没有属性'country_name'
我有查询相关的jquery.我的设计师用户制服,我想在运行时使用帮助jquery将其从一个元素中删除.制服:http://uniformjs.com/ 喜欢
<input type="checkbox" class="abc">
Run Code Online (Sandbox Code Playgroud)
我知道如何申请但不知道如何删除
申请:
jQuery(".interactionClassNow").uniform();
Run Code Online (Sandbox Code Playgroud)
去掉 ?
我已经浏览了laravel文档,我没有得到With或Load in queries 之间的不同,在哪种情况下我们需要使用With或Load?请描述一下
Model::find(1)->with('firstModel','SecondModel');
Model::find(1)->load('firstModel','SecondModel');
Run Code Online (Sandbox Code Playgroud) 我正在学习有关学习WebRTC的书,并创建了一个演示4章。我在控制台中出现错误:
ReferenceError: webkitRTCPeerConnection is not defined
Run Code Online (Sandbox Code Playgroud)
并且不明白我可以配置“ iceServers”:
这是我的JavaScript代码
function hasUserMedia(){
navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia;
return !!navigator.getUserMedia;
}
function hasRTCPeerConnection() {
window.RTCPeerConnection = window.RTCPeerConnection || window.webkitRTCPeerConnection || window.mozRTCPeerConnection;
return !!window.RTCPeerConnection;
}
//This function will create our RTCPeerConnection objects, set up the SDP offer and response, and find the ICE candidates for both peers. page 48
function startPeerConnection(stream) {
var configuration = {
// Uncomment this code to add custom iceServers
"iceServers": [{ "url": "stun:stun.1.google.com:19302" }] …Run Code Online (Sandbox Code Playgroud) 我想在ubuntu中安装RVM,我正在完成这些步骤
root@jaskaran-Vostro-1550:/home/user_name# sudo apt-get install curl
Run Code Online (Sandbox Code Playgroud)
成功完成了这个
root@jaskaran-Vostro-1550:/home/user_name# curl -L https://get.rvm.io | bash -s stable
Run Code Online (Sandbox Code Playgroud)
成功完成了这个
但是当我运行这个命令
root@jaskaran-Vostro-1550:/home/user_name# source ~/.rvm/scripts/rvm
Run Code Online (Sandbox Code Playgroud)
这样的结果
bash: /root/.rvm/scripts/rvm: No such file or directory
Run Code Online (Sandbox Code Playgroud)
这有什么不妥
首先我运行了这个命令
rails generate model FeedbackComment type:smallint reply:text
Run Code Online (Sandbox Code Playgroud)
然后
rake db:migrate
Run Code Online (Sandbox Code Playgroud)
我收到了这个错误
StandardError: An error has occurred, this and all later migrations canceled:
undefined method `smallint' for #<ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::TableDefinition:0x9d1a318>/var/www/blog/db/migrate/20140712064127_create_feedback_comments.rb:4:in `block in change'
Run Code Online (Sandbox Code Playgroud)
如何在postgreSQL中通过命令创建smallint?
请帮帮我
我是python的初学者.我想在控制台中运行这个程序员,但它告诉我错误是什么错误.
>>> def fib(n):
... a, b = 0, 1
... while a < n:
... print (a, end=' ')
File "<stdin>", line 4
print (a, end=' ')
^
SyntaxError: invalid syntax
Run Code Online (Sandbox Code Playgroud)
我的实际程序,我想运行:
>>> def fib(n):
... a, b = 0, 1
... while a < n:
... print(a, end=' ')
... a, b = b, a+b
... print()
>>> fib(1000)
Run Code Online (Sandbox Code Playgroud)