我在fscanf()的帮助下通过文件读取矩阵.我怎样才能找到EOF?即使我试图在arr []中捕获的每个字符串后找到EOF,那么我也无法找到它.
在计数的帮助下,我正在读取输入文件
-12 23 3
1 2 4
int main()
{
char arr[10],len;
int count=0;
FILE *input= fopen("input.txt", "r");
while(count!=7)
{
fscanf(input,"%s",arr);
//storing the value of arr in some array.
len=strlen(arr);
count++;
if(arr[len+1]==EOF)
printf("\ni caught it\n");//here we have to exit.
}
return 0;
}
Run Code Online (Sandbox Code Playgroud)
而不是计数我想通过EOF退出循环.怎么解决?
我正在使用ubuntu 12.04.我做了它在网站上说的但是我收到了这个错误:
import urllib2,os; pf='Package Control.sublime-package'; ipp=sublime.installed_packages_path(); os.makedirs(ipp) if not os.path.exists(ipp) else None; urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler()));
open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read()); print 'Please restart Sublime Text to finish installation'
Traceback (most recent call last):
File "<string>", line 1, in <module>
IOError: [Errno 13] Permiso denegado: u'/home/housepc/.config/sublime-text-2/Installed Packages/Package Control.sublime-package'
permiso denegado : "permission denied"
Run Code Online (Sandbox Code Playgroud)
我该怎么做才能安装它?
我正在从PNG文件中将24位RGB图像加载到我的OpenCV应用程序中.
然而,直接使用灰度图像加载图像imread会产生非常差的结果.
Mat src1 = imread(inputImageFilename1.c_str(), 0);
Run Code Online (Sandbox Code Playgroud)
将RGB图像加载为RGB并将其转换为灰度可以获得更好的效果.
Mat src1 = imread(inputImageFilename1.c_str(), 1);
cvtColor(src1, src1Gray, CV_RGB2GRAY);
Run Code Online (Sandbox Code Playgroud)
我想知道我imread是否正确使用我的图像类型.有谁经历过类似的行为?
使用转换为灰度的图像imread如下所示:

使用转换为灰度的图像cvtColor如下所示:

我是Android应用程序开发和使用Java语言的新手.我的问题是每次我制作TextView或Button时都会有一个带有感叹号的三角形.当我点击它时,我看到一条消息说:
硬编码字符串"Button",应该使用@string资源
我有两个活动,在我的主要活动中有一个按钮,当你点击它时你会进入第二个活动.但是当我去为我main.java的按钮编写代码时.始终存在以上显示的错误.我认为eclipse无法找到我的按钮的id,并且对于我的TextView,它们具有相同的错误消息.
这是我制作的代码:
Button b = FindViewById(R.id.button1);
Run Code Online (Sandbox Code Playgroud)
我还补充说:
Button b = (Button) FindViewById(R.id.button1);
Run Code Online (Sandbox Code Playgroud)
我正在使用最新的eclipse classic和ADT august问题.该平台是Android 4.1 API 16.
我一直在尝试实现这里描述的算法,然后在同一篇论文中描述的"大动作任务"上测试它.
算法概述:

简而言之,该算法使用下面所示形式的RBM通过改变其权重来解决强化学习问题,使得网络配置的自由能等于为该状态动作对给出的奖励信号.
为了选择动作,算法在保持状态变量固定的同时执行gibbs采样.有足够的时间,这会产生具有最低自由能的动作,因此是给定状态的最高奖励.
大型行动任务概述:

作者的实施指南概述:
具有13个隐藏变量的受限Boltzmann机器在具有12位状态空间和40位动作空间的大动作任务的实例化上被训练.随机选择了13个关键状态.该网络运行了12000次,学习率从0.1到0.01,在整个培训过程中,温度从1.0到0.1呈指数级增长.每个迭代都以随机状态初始化.每个动作选择包括100次Gibbs采样迭代.
重要的遗漏细节:
我的实施:
我最初假设作者没有使用指南中描述的机制,所以我尝试在没有偏置单元的情况下训练网络.这导致了近乎机会的表现,这是我的第一个线索,即使用的某些机制必须被作者视为"显而易见",因此被省略.
我玩了上面提到的各种省略机制,并通过使用以下方式获得了我最好的结果:
但即使进行了所有这些修改,我在任务上的表现通常在12000次迭代后的平均奖励为28.
每次迭代的代码:
%%%%%%%%% START POSITIVE PHASE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
data = [batchdata(:,:,(batch)) rand(1,numactiondims)>.5];
poshidprobs = softmax(data*vishid + hidbiases);
%%%%%%%%% END OF POSITIVE PHASE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
hidstates = softmax_sample(poshidprobs);
%%%%%%%%% START ACTION SELECTION PHASE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if test
[negaction poshidprobs] = choose_factored_action(data(1:numdims),hidstates,vishid,hidbiases,visbiases,cdsteps,0);
else
[negaction poshidprobs] = choose_factored_action(data(1:numdims),hidstates,vishid,hidbiases,visbiases,cdsteps,temp);
end
data(numdims+1:end) = negaction > rand(numcases,numactiondims);
if mod(batch,100) == 1
disp(poshidprobs);
disp(min(~xor(repmat(correct_action(:,(batch)),1,size(key_actions,2)), key_actions(:,:))));
end
posprods …Run Code Online (Sandbox Code Playgroud) matlab artificial-intelligence machine-learning bayesian-networks reinforcement-learning
我有一个System.Windows.Forms.DataVisualization.Charting.chart,当你将鼠标悬停在图表上时,我想显示一些关于图表上栏的信息.但我看不到在哪里设置工具提示.
我可以设置这个 chart3.Series[0].ToolTip = "hello world";
但是我如何获取我为了修改文本而悬停的值x或y值?
我安装了EPD 7.3.1(现在称为Enthought Canopy),它带有scikit-learn v 0.11.我正在运行Ubuntu 12.04.我需要安装v 0.12的scikit-learn.
scikit-learn doc说克隆存储库,将scikit-learn目录添加到PYTHONPATH,然后构建扩展:python setup.py build_ext --inplace
问题是EPD是它自己封闭的世界(有多个scikit dirs):
./lib/python2.7/site-packages/scikits/
./lib/python2.7/site-packages/sklearn
然后是:
./EGG-INFO/scikit_learn/
我真的不想尝试,因为花了很长时间才把事情调到这一点.在这种情况下,我应该遵循scikit-learn的指示吗?
我使用的是Visual Studio 2012 C Sharp(C#)和SQL Server Express.我正在尝试通过MSDN演练:在DataGrid控件中显示来自SQL Server数据库的数据.我添加了推荐的AdventureWorksLT2008示例数据库.以下是我遵循的说明:
AdventureWorksModel.edmx,然后单击"添加".(出现实体数据模型向导.)App.Config选中" 在实例中保存实体连接设置"复选框,然后单击"下一步".要检索和显示数据:
MainWindow.xaml文件.<Grid>和标记之间添加以下DataGrid标记</Grid>以添加名为的DataGrid dataGrid1.Window_Loaded为Loaded事件命名的Window创建事件处理程序.MainWindow.xaml.vb或MainWindow.xaml.cs).添加以下代码以仅从联接表中检索特定值ItemsSource,并将DataGrid 的属性设置为查询结果:
using System;
using System.Collections.Generic;
using System.Data.Objects;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents; …Run Code Online (Sandbox Code Playgroud)通过IP地址访问受Kerberos保护的站点时出现问题.例如:
http:/10.10.1.x:3001/ 给失败.
http:/my-host:3001/ sso成功完成.
Apache错误日志说:
src/mod_auth_kerb.c(1261):[client 10.10.1.x]获取HTTP@10.10.1.x [client 10.10.1.x] gss_acquire_cred()的信用失败:未指定的GSS失败.次代码可能会提供更多信息(未找到密钥表条目)
src/mod_auth_kerb.c(1261):[client 10.10.1.x获取HTTP @ my-host的信任[debug] src/mod_auth_kerb.c(1407):[client 10.10.1.x]使用KRB5 GSS验证客户端数据-API [debug] src/mod_auth_kerb.c(1423):[client 10.10.1.x] Verification返回代码0
正如您所见,Kerberos尝试查找HTTP@10.10.1.x或HTTP@my-host主要内容.两个主体都在ActiveDirectory中创建了虚拟帐户.在keytab文件中还包括它们:
KVNO Timestamp Principal
---- ----------------- -----------------------------------------------------
5 01/01/70 03:00:00 HTTP/10.10.1.x@MY_DOMAIN.LAN (ArcFour with HMAC/md5)
11 09/04/12 12:03:01 HTTP/my-host@MY_DOMAIN.LAN (ArcFour with HMAC/md5)
Run Code Online (Sandbox Code Playgroud)
Kinit适用于他们两个.
服务器上的Kerberos配置:
Krb5Keytab /etc/krb5.keytab
AuthType Kerberos
KrbMethodNegotiate On
AuthName "Kerberos Login"
KrbAuthRealms MY_DOMAIN.LAN
KrbVerifyKDC Off
KrbMethodK5Passwd On
Require valid-user
Run Code Online (Sandbox Code Playgroud)
有人可以猜到问题出在哪里了吗?是否可以在Kerberos SSO中使用IP地址?
c ×1
c# ×1
canopy ×1
charts ×1
database ×1
enthought ×1
kerberos ×1
matlab ×1
opencv ×1
packages ×1
python ×1
pythonpath ×1
scanf ×1
scikit-learn ×1
sql ×1
sublimetext2 ×1
tooltip ×1
tortoisehg ×1
ubuntu ×1
ubuntu-10.04 ×1