我正在使用Ruby on Rails 3.1预发行版.我喜欢使用PostgreSQL,但问题是安装pggem.它给了我以下错误:
$ gem install pg
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/home/u/.rvm/rubies/ruby-1.9.2-p0/bin/ruby extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
--with-pg-config=/path/to/pg_config
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for …Run Code Online (Sandbox Code Playgroud) postgresql ruby-on-rails pg ruby-on-rails-3 rails-postgresql
我想WHILE在SQL Server 2005中使用无限循环,并BREAK在某些条件下使用关键字退出.
while true不起作用,所以我必须使用while 1=1.有没有更好的方法来组织无限循环?
我知道我可以使用goto,但在while 1=1 begin ... end结构上看起来更好.
我正在将原始JSON插入到集合中,并发现存储在数据库中的内容缺少值.例如,我的集合是BsonDocuments的集合:
_products = database.GetCollection<BsonDocument>("products");
Run Code Online (Sandbox Code Playgroud)
将JSON插入集合的代码:
public int AddProductDetails(JObject json)
{
var doc = json.ToBsonDocument(DictionarySerializationOptions.Document);
_products.Insert(doc);
}
Run Code Online (Sandbox Code Playgroud)
传入的JSON如下所示:
{"Id":1,"Tags":["book","database"],"Name":"Book Name","Price":12.12}
但是,集合中持久存在的只是没有值的属性.
{
"Id": 1,
"Tags": [
"book",
"database"
],
"Name": "Book Name",
"Price": 12.12
}
Run Code Online (Sandbox Code Playgroud)
为什么值被删除?
突然,当我p4 info在终端中运行时,我注意到客户端root没有设置(不确定为什么它突然被取消设置.以下是输出显示"客户端未知"代替客户端root.通过什么命令通过我可以设置相同吗?我尝试过p4 client,p4 set但可能是错误的语法.
BANL121b92746:Applications bagarwal2$ p4 info
User name: bagarwal2
Client name: BANL121b92746
Client host: BANL121b92746.local
Client unknown.
Current directory: /Applications
Run Code Online (Sandbox Code Playgroud)
此客户端根目录的值与我在连接 - >编辑工作区下的P4V客户端中设置的"工作空间根"相同.我的P4V客户端工作正常.p4 info当我的Intellij IDEA开始在P4中显示连接问题时,我发现了这个问题.在IDEA中测试连接时,下面是错误屏幕截图,与我p4 info在终端中的操作相同.
关于我的p4settings.txt配置,下面是几个月来一直工作的配置:
P4HOST=<hidden hostname>:2500
P4CLIENT=bagarwal2_BANL121b92746_trunk
P4USER=bagarwal2
P4POST=<hidden hostname>:2500
Run Code Online (Sandbox Code Playgroud)
我的P4V连接(工作正常),使用上面提到的相同的细节/配置,我仍然在终端找到这个问题,因此在Intellij IDEA中.
我试图更新json结构中的"image_id"值.使用下面的命令,我怎么改ami-d8cf5cab到ami-a4df7gah现在为止,我已经试过这
cat cog.test.tfstate | jq -r '.modules[].resources[] | select(.type == "aws_launch_configuration") | select(.primary.attributes.name_prefix == "pmsadmin-lc-")'
Run Code Online (Sandbox Code Playgroud)
JSON数据是
{
"type": "aws_launch_configuration",
"primary": {
"id": "pmsadmin-lc-v47thk6rcrdgza6dujfzjatmju",
"attributes": {
"associate_public_ip_address": "false",
"ebs_block_device.#": "0",
"ebs_optimized": "false",
"enable_monitoring": "true",
"ephemeral_block_device.#": "0",
"iam_instance_profile": "cog-test-pmsadmin",
"id": "pmsadmin-lc-v47thk6rcrdgza6dujfzjatmju",
"image_id": "ami-d8cf5cab",
"instance_type": "t2.small",
"key_name": "cog-test-internal",
"name": "pmsadmin-lc-v47thk6rcrdgza6dujfzjatmju",
"name_prefix": "pmsadmin-lc-",
"root_block_device.#": "0",
"security_groups.#": "4",
"security_groups.1893851868": "sg-7ee7bf1a",
"security_groups.2774384192": "sg-e2e7bf86",
"security_groups.2825850029": "sg-86e6bee2",
"security_groups.3095009517": "sg-f4e7bf90",
"spot_price": "",
"user_data": "ed03ac6642af8c97562b065c0b37f211b58ad0a2"
}
}
}
Run Code Online (Sandbox Code Playgroud)