C99标准具有整数类型,字节大小类似于int64_t.我使用以下代码:
#include <stdio.h>
#include <stdint.h>
int64_t my_int = 999999999999999999;
printf("This is my_int: %I64d\n", my_int);
Run Code Online (Sandbox Code Playgroud)
我得到这个编译器警告:
warning: format ‘%I64d’ expects type ‘int’, but argument 2 has type ‘int64_t’
Run Code Online (Sandbox Code Playgroud)
我尝试过:
printf("This is my_int: %lld\n", my_int); // long long decimal
Run Code Online (Sandbox Code Playgroud)
但我得到同样的警告.我正在使用这个编译器:
~/dev/c$ cc -v
Using built-in specs.
Target: i686-apple-darwin10
Configured with: /var/tmp/gcc/gcc-5664~89/src/configure --disable-checking --enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin10 --program-prefix=i686-apple-darwin10- --host=x86_64-apple-darwin10 --target=i686-apple-darwin10 --with-gxx-include-dir=/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Apple Inc. build 5664)
Run Code Online (Sandbox Code Playgroud)
我应该使用哪种格式打印my_int变量而不发出警告?
Ruby中问号运算符的目的是什么?
有时它看起来像这样:
assert !product.valid?
Run Code Online (Sandbox Code Playgroud)
有时它在一个if结构中.
我需要查询一天内发表的评论.该字段是标准时间戳的一部分,是created_at.所选日期来自date_select.我如何使用ActiveRecord来做到这一点?
我需要像这样的东西:
"SELECT * FROM comments WHERE created_at BETWEEN '2010-02-03 00:00:00' AND '2010-02-03 23:59:59'"
Run Code Online (Sandbox Code Playgroud) 我想通过rsync在Solaris服务器上备份Win XP中的目录.我安装了cygwin,但是当我输入rsync时,我得到'命令未找到'.我该如何安装rsync?我该如何安装ssh.我已经将Poderosa安装为ssh客户端(一种腻子).
我可以检查是否在用户类中调用了FeedItem :: populate_from_friend_to_user?
it "should auto populate feed after user.add_friend" do
@user.add_friend(@friend1)
@user.should_receive('FeedItem::populate_from_friend_to_user').with(@friend1, @user)
end
Run Code Online (Sandbox Code Playgroud)
通过上面的代码我得到:
undefined method `populate_from_friend_to_user' for :FeedItem:Symbol
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用Ubuntu 10.04服务器,sphinx,myql2版本0.2.7和percona服务器5.5(Myslql 5.5)运行Rails两个应用程序.irb中的mysql2工作正常,我可以连接到db.这个rails 2应用程序正在另一个带有MySql 5.1的Centos服务器上运行.当我跑:
script/server -e production
Run Code Online (Sandbox Code Playgroud)
我明白了:
mysql2.so:libmysqlclient_r.so.15:无法打开共享对象文件:没有这样的文件或目录
这是我的libs:
# ls -l /usr/lib |grep sql
-rw-r--r-- 1 root root 10581008 2011-11-18 16:51 libmysqlclient.a
lrwxrwxrwx 1 root root 16 2011-12-10 05:48 libmysqlclient_r.a -> libmysqlclient.a
lrwxrwxrwx 1 root root 20 2011-12-10 05:48 libmysqlclient.so -> libmysqlclient.so.16
lrwxrwxrwx 1 root root 29 2011-12-10 06:01 libmysqlclient.so.15 -> /usr/lib/libmysqlclient.so.16
-rw-r--r-- 1 root root 7332 2011-11-18 16:44 libmysqlservices.a
-rw-r--r-- 1 root root 562520 2010-02-08 06:59 libsqlite3.a
-rw-r--r-- 1 root root 973 2010-02-08 06:59 libsqlite3.la
lrwxrwxrwx …Run Code Online (Sandbox Code Playgroud) 我可以使用-i选项通过SSH连接到服务器以指定私钥:
ssh -i ~/.ssh/id_dsa user@hostname
Run Code Online (Sandbox Code Playgroud)
我正在创建一个id_dsa从数据库中获取文本的脚本,但我不确定如何将该字符串提供给SSH.我需要这样的东西:
ssh --option $STRING user@hostname
Run Code Online (Sandbox Code Playgroud)
其中$STRING包含的值id_dsa.我需要知道--option是否有一个.
我需要关闭E_STRICT.我的php.ini中有error_reporting = E_ALL&〜E_STRICT,但似乎被忽略了.我在我的代码中试过这个:
ini_set('error_reporting', E_NOTICE);
Run Code Online (Sandbox Code Playgroud)
没有!
请帮忙.
我在app/assets/javascripts下更改了一个JS文件,但它仍然是相同的.我删除了文件并重新创建,但内容仍然是旧的.这是我的development.rb文件:
App::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
config.serve_static_assets = false
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
# Log error messages when you accidentally call methods on nil.
config.whiny_nils = true
# Show full error reports and disable …Run Code Online (Sandbox Code Playgroud) #!/bin/bash
echo "Testing"
cd "/cygdrive/x/Internal Communications/Riccardo/"
filename=htdocs-`date +%A`.tar.gz
tar cvzf $filename "/cygdrive/c/Program Files/Zend/Apache2/htdocs"
Run Code Online (Sandbox Code Playgroud)
上面的脚本在cygwin控制台内部调用时正常工作,但是当我尝试从批处理文件中调用它时,我得到"命令未找到"的日期和tar命令.我认为bash.exe没有设置PATH.
我需要从该批处理文件中运行该脚本,因为我想将脚本添加到任务调度程序.