我已经定义了这样的东西
<ribbon:RibbonGroup Header="Size at Control Level">
<ribbon:RibbonControlGroup>
<ribbon:RibbonButton SmallImageSource="Images\wizard-icon16.png" LargeImageSource="Images\wizard-icon32.png" Label="Button 1">
<ribbon:RibbonButton.ControlSizeDefinition>
<ribbon:RibbonControlSizeDefinition ImageSize="Large" IsLabelVisible="True"></ribbon:RibbonControlSizeDefinition>
</ribbon:RibbonButton.ControlSizeDefinition>
</ribbon:RibbonButton>
<ribbon:RibbonButton SmallImageSource="Images\wizard-icon16.png" LargeImageSource="Images\wizard-icon32.png" Label="Button 2">
<ribbon:RibbonButton.ControlSizeDefinition>
<ribbon:RibbonControlSizeDefinition ImageSize="Small" IsLabelVisible="True"></ribbon:RibbonControlSizeDefinition>
</ribbon:RibbonButton.ControlSizeDefinition>
</ribbon:RibbonButton>
<ribbon:RibbonButton SmallImageSource="Images\wizard-icon16.png" LargeImageSource="Images\wizard-icon32.png" Label="Button 3"></ribbon:RibbonButton>
<ribbon:RibbonButton SmallImageSource="Images\wizard-icon16.png" LargeImageSource="Images\wizard-icon32.png" Label="Button 4"></ribbon:RibbonButton>
</ribbon:RibbonControlGroup>
</ribbon:RibbonGroup>
Run Code Online (Sandbox Code Playgroud)
但是所有按钮都很大.即使我为所有控件设置了一个带有Small的ControlSizeDefinition属性,它们仍然很大.我究竟做错了什么?
谢谢!
我写了科学研究代码,特别是生物信息学.当然,在科学中,结果应该是可重复的.那些没有定期参与项目并且不详细了解基础设施的人可能合法地希望看到我的代码来重现结果.问题在于,使代码自足以容易地给这样的人提供/解释似乎严重限制了可能的重用量.
将几个相关项目中使用的功能分解为个人库通常很方便,但是将这些库转储5000行(不可否认的文档很少,因为它不是生产/发布质量)代码没有任何帮助是不方便的.处理那些想要快速重现结果的人手头的问题.
在您的系统上安装一组几个密钥库并且可以随时使用而不必考虑两次通常很方便,但向主要是科学家的人解释并不方便,而不是程序员如何设置所有这些东西.如果您自己不记得某些细节,尤其如此.(注意,虽然有问题的细节是与科学无关的技术细节.)
将研究项目的几个相关方面的所有代码保存在一个大型程序中通常很方便,而不是为您尝试的每个轻微变化/事物编写完全自包含的代码,但同样,转储所有代码并不方便这个,或解释所有这些,只是想要重现结果的人.
有哪些方法可以解决这些问题,以便我可以重用代码,但是仍然允许想要重现我的结果的人以合理的努力来启动和运行代码?请注意,我的问题的核心是创建可重用的代码库的可能性,这些代码库不是很成熟.
maintenance readability scientific-computing self-contained libraries
我正在阅读一个文本文件,其中包含:
Mary 55334422 24.90 56.6 45.68
Run Code Online (Sandbox Code Playgroud)
我正在读它:
....char name[20]; int num; double worked; double rate; double total;....
fscanf(fp, "%s %d %f %f %f\n", name, &num, &worked, &rate, &total);
Run Code Online (Sandbox Code Playgroud)
我得到的名称和整数很好,但浮点数出现像-95229999900000000000000000000000.00
我在这里做错了吗?
我无法获得一个简单的JSONObject的android POST,以显示在服务器上的$ _POST数据中.服务器是PHP 5.3.4,android端是SDK 8模拟器.我可以像往常一样发布一个简单的NameValuePair,但是当我切换到你在下面看到的JSONObject + StringEntity时,$ _POST数组显示{}.继续在我的测试php页面上运行下面的代码.它有一个$ _POST和$ _SERVER的var_dump,以及搜索其中一个预期的键('email').你会看到我尝试了很多'ContentType',看看是不是问题.我甚至使用WireShark来验证客户端和服务器之间的TCP会话是否正常.POST数据在那里,但它没有显示在服务器的变量中.我被困了...感谢您提供的任何帮助.
import java.io.InputStream;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.params.HttpConnectionParams;
import org.json.JSONObject;
import android.util.Log;
public class TestPOST {
protected static void sendJson (final String email, final String pwd) {
HttpClient client = new DefaultHttpClient();
HttpConnectionParams.setConnectionTimeout(client.getParams(), 10000); //Timeout Limit
HttpResponse response;
String URL = "http://web-billings.com/testPost.php";
try{
HttpPost post = new HttpPost(URL);
// NameValuePair That is working fine...
//List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
//nameValuePairs.add(new BasicNameValuePair("email", email));
//nameValuePairs.add(new BasicNameValuePair("password", …Run Code Online (Sandbox Code Playgroud) 当我在PostgreSQL中创建一个表时,我使用的SQL如下所示:
CREATE TABLE domain (
id serial,
domain character varying(60) NOT NULL,
banned boolean,
created timestamp NOT NULL
);
Run Code Online (Sandbox Code Playgroud)
但是,当我导出模式时,我会获得一个完整的,未压缩的版本,其中包含拥有该表和完整序列的垃圾.无论如何在没有至少所有者部分的情况下获得出口?
CREATE TABLE domain (
id integer NOT NULL,
domain character varying(60) NOT NULL,
banned boolean,
created timestamp without time zone NOT NULL
);
ALTER TABLE public.domain OWNER TO postgres;
CREATE SEQUENCE domain_id_seq
START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
ALTER TABLE public.domain_id_seq OWNER TO postgres;
ALTER SEQUENCE domain_id_seq OWNED BY domain.id;
SELECT pg_catalog.setval('domain_id_seq', 3, true); …Run Code Online (Sandbox Code Playgroud) 我无法在任何地方找到答案,而且我今天没有留下脑力来想办法自己确认一下.
我有这样的命名范围......
named_scope :fresh, :conditions => ['updated_at > ?', 4.hours.ago]
Run Code Online (Sandbox Code Playgroud)
我不知道这是否会按照我想要的方式运作.我的一部分认为4.hours.ago将在加载类文件时解析,而另一部分认为4.hours.ago将在使用时展开.
谢谢您的帮助!
我正在尝试将Flurry Analytics用于Android上的程序,但我无法从服务器获取xml文件.
我已经接近了,因为在Log Cat System.out标签中我可以出于某种原因得到它的一半,它说"XML传递异常= java.net.MalformedURLException:未找到协议:?xml version = 1.0 encoding ="UTF -8"等等......直到我的xml代码大约一半.不知道我做错了什么,我发送一个带有头的HTTP get请求接受application/xml并且它无法正常工作.任何帮助非常感谢!
try {
//HttpResponse response = client.execute(post);
//HttpEntity r_entity = response.getEntity();
//String xmlString = EntityUtils.toString(r_entity);
HttpClient client = new DefaultHttpClient();
String URL = "http://api.flurry.com/eventMetrics/Event?apiAccessCode=????&apiKey=??????&startDate=2011-2-28&endDate=2011-3-1&eventName=Tip%20Calculated";
HttpGet get = new HttpGet(URL);
get.addHeader("Accept", "application/xml");
get.addHeader("Content-Type", "application/xml");
HttpResponse responsePost = client.execute(get);
HttpEntity resEntity = responsePost.getEntity();
if (resEntity != null)
{
System.out.println("Not null!");
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
String responseXml = EntityUtils.toString(responsePost.getEntity());
Document doc = db.parse(responseXml);
doc.getDocumentElement().normalize();
NodeList nodeList = …Run Code Online (Sandbox Code Playgroud) 我有几个numpy矩阵(确切地说是3维)存储在元组中
(a1,b1,c1)
(a2,b2,c2)
...
(an,bn,cn)
Run Code Online (Sandbox Code Playgroud)
我想将每个元组序列化为一个文件,可以在另一台机器上读回Python(Linux => Windows,两者都是x86-64).什么是pythonic方法来实现这一目标?
我成功地用Devise和CanCan建立了登录系统,我有3种类型的用户.管理员,内部和全球用户.我创建了控制器和索引操作:管理员,Cpanel,报告和状态,我想限制某些用户对此控制器的访问.
管理员用户应具有访问权限:报告(全部),状态(读取),管理员(全部)
全局用户应具有访问权限:报告(仅读取),状态(读取),Cpanel(全部)
内部用户应具有访问权限:报告(全部),状态(读取)
我尝试使用ability.rs中的以下代码执行此操作:
class Ability
include CanCan::Ability
def initialize(user)
user ||= User.new # guest user (not logged in)
if user.role? :admin
can :manage, [Report, Admin]
can :read, State
elsif user.role? :global_user
can :read, [Report, State]
can :manage, Cpanel
elsif user.role? :internal_user
can :manage, Report
can :read, State
end
end
end
Run Code Online (Sandbox Code Playgroud)
这时我在这个控制器中只有索引操作,当我用内部用户登录app时,我可以访问/ admin,例如,这不是我想要的行为.我想限制访问所有控制器而不是capability.rb类中列出的控制器.
我试图以这种方式连接Symfony 2和MongoDB:
AppKernel::registerBundlesdoctrine_mongo_db'配置(见下文config.yml)doctrine.odm.mongodb.document_manager从容器"
HelloController行动当我尝试运行应用程序时抛出MongoConnectionException.
任何人都可以帮我解决这个问题吗?
AppKernel.php
public function registerBundles()
{
$bundles = array(
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\DoctrineMongoDBBundle\DoctrineMongoDBBundle(),
new Sensio\HelloBundle\HelloBundle()
);
return $bundles;
}
Run Code Online (Sandbox Code Playgroud)
config.yml
framework:
charset: UTF-8
router: { resource: "%kernel.root_dir%/config/routing.yml" }
templating: { engines: ['twig'] }
## Doctrine Configuration
doctrine_mongo_db:
server: mongodb://root:root@192.168.0.111:27017
default_database: test
options: { connect: true }
mappings:
HelloBundle: { type: annotation, dir: Document }
# Twig Configuration
twig:
debug: …Run Code Online (Sandbox Code Playgroud) android ×2
activerecord ×1
c ×1
cancan ×1
doctrine-orm ×1
java ×1
json ×1
libraries ×1
maintenance ×1
mongodb ×1
named-scope ×1
numpy ×1
php ×1
post ×1
postgresql ×1
python ×1
readability ×1
ribbon ×1
scanf ×1
scipy ×1
sql ×1
symfony ×1
wpf ×1
xml ×1