小编Dr1*_*1Ku的帖子

在Controller或其他地方将部分渲染为字符串

所以基本上我有一个局部视图,可以为我建立一个很好的表.我想每周通过电子邮件发送给我的用户.而不必再次基本上复制的模板,我想我的模型转发到控制器并接收相应产生HTMLString.

是否可以在Controller中执行此操作,我觉得它应该是一个非常简单的过程.

asp.net-mvc partial-views

6
推荐指数
3
解决办法
5400
查看次数

如何为所有分辨率创建Android应用程序?

嗨,

我是Android开发的初学者.我想创建一个可以在不同屏幕分辨率下运行的应用程序.这个应用程序应该在Android手机和Android平板电脑上运行.

可能吗?如果是这样,我该如何处理UI设计?只需设置不同的可绘制文件夹?

android android-layout

6
推荐指数
1
解决办法
2599
查看次数

在CI环境中执行Bower,例如Jenkins

我的詹金斯在运行上CentOS 6node.js 0.10.15bower 1.0.3.

我有一个执行以下任务的shell任务:

npm install
bower install
grunt clean package
Run Code Online (Sandbox Code Playgroud)

在构建时,凉亭安装失败:

+ bower install

path.js:360
        throw new TypeError('Arguments to path.join must be strings');
              ^
TypeError: Arguments to path.join must be strings
    at path.js:360:15
    at Array.filter (native)
    at Object.exports.join (path.js:358:36)
    at Object.<anonymous> (/usr/lib/node_modules/bower/node_modules/
                           update-notifier/node_modules/configstore/configstore.js:9:7)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)

Build step 'Execute shell' marked build as failure
Run Code Online (Sandbox Code Playgroud)

当我bower install …

continuous-integration build-process jenkins bower

5
推荐指数
1
解决办法
5492
查看次数

量角器无法使用directConnect运行

我试图通过直接连接Chrome而不运行Selenium来运行量角器.正如文档所说,这可以通过在配置文件中设置directConnectto true来实现.

当我运行量角器时directConnect: true,我得到:

直接使用ChromeDriver ...
[launcher]运行WebDriver的1个实例错误:在Process.ChildProcess._handle.onexit(child_process.js:792:34)的errnoException(child_process.js:1001:11)处生成ENOENT [launcher]进程退出时显示错误代码1

如果我没有运行量角器directConnect而是指定我的selenium url,一切运行正常.

我正在运行Protractor版本1.6.1,Chrome版本41.0.2272.35 beta-m(64位)和Chromedriver版本2.13.0.

selenium google-chrome selenium-chromedriver angularjs protractor

5
推荐指数
1
解决办法
4704
查看次数

什么线导致这个Protractor错误?

Protractor有没有办法在控制台日志中显示错误发生在哪一行?我刚收到这种消息:

Message:
    Failed: Cannot call method 'click' of undefined
  Stack:
    Error: Failed: Cannot call method 'click' of undefined
        at /usr/local/lib/node_modules/protractor/node_modules/jasminewd2/index.js:104:16
        at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:1582:15
        at [object Object].webdriver.promise.ControlFlow.runInNewFrame_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1654:20)
        at notify (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:465:12)

1 spec, 1 failure
Run Code Online (Sandbox Code Playgroud)

我很难弄清楚我是否有这么多点击命令.我正在运行Protractor 1.8.0.

这是我的protractor.conf.js:

exports.config = {
  framework: 'jasmine2',

  seleniumAddress: 'http://11.111.1.11:4444/wd/hub',

  multiCapabilities: [{
    'browserName': 'chrome',
    'chromeOptions': {
        args: ['--test-type']
    }
  }],

  specs: ['./tests/my_test/*_spec.js'],

  onPrepare: function(){

      global.EC = protractor.ExpectedConditions;

      browser.manage().window().maximize();

      var jasmineReporters = require('jasmine-reporters');

      jasmine.getEnv().addReporter(new jasmineReporters.JUnitXmlReporter({
        consolidateAll: true,
        filePrefix: 'tests_xmloutput',
        savePath: './test_results_report'
      }));
  },

  jasmineNodeOpts: {
    showColors: …
Run Code Online (Sandbox Code Playgroud)

error-handling webdriver end-to-end jasmine protractor

5
推荐指数
1
解决办法
1365
查看次数

阻止ItemContainerStyle覆盖已设置的Style

有没有办法阻止ItemContainerStyle覆盖已设置的Style(via <Style TargetType="{x:Type MenuItem}">)?

a的样式MenuItem已在ResourceDictionaryXAML文件中定义,该文件在App启动时加载:

<ResourceDictionary>
  <Style TargetType="{x:Type MenuItem}">
    <Setter Property="Foreground" Value="{DynamicResource TextForeground}"/>
    .. and so on
  </Style>
</ResourceDictionary>
Run Code Online (Sandbox Code Playgroud)

我有以下MenuItemXAML定义.该MenuItem包裹内ContextMenu的通用TextBlock(只是值得一提的我猜的).菜单本身一切顺利,但它的孩子(Enum的实际值)得到了不同的风格,因为ItemContainerStyle它覆盖了它:

<MenuItem Header="DisplayType" 
          Name="DisplayTypeMenu"
          ItemsSource="{Binding Source={StaticResource DisplayTypeValues}}">

  <MenuItem.ItemContainerStyle>
    <Style TargetType="MenuItem">
      <Setter Property="MenuItem.IsCheckable" Value="True" />

      <Style.Triggers>
        <Trigger Property="MenuItem.Header" 
                 Value="{x:Static enums:DisplayType.Description}" >
            <Setter Property="MenuItem.IsChecked" Value="True" />
        </Trigger>
      </Style.Triggers>

    </Style>
  </MenuItem.ItemContainerStyle>

</MenuItem>
Run Code Online (Sandbox Code Playgroud)

ItemContainerStyle源于我的另一个问题.

MenuItem位于其他图层中,顶层是自定义ContentControl:

public class SomeGradientPanel : ContentControl
{
    public SomeGradientPanel ()
    {
        DefaultStyleKey = typeof(SomeGradientPanel …
Run Code Online (Sandbox Code Playgroud)

c# wpf xaml wpf-controls

4
推荐指数
1
解决办法
3132
查看次数

带有文本和图标的微调器

在我的应用程序中,我有一个Spinner, 可以用两个Arrays填充Strings,存储在我的values/strings.xml资源中。根据两个 RadioButton 的状态,选择正确数组中的值并填充我的 Spinner。

对于每个字符串数组,我有一个大小相同的图标数组。我所有的图标都以“A”开头,后跟一个数字。我无法更改它,它像那样存储在数据库中。我在 Strings.xml 中有一个数组,其中包含绘制图标所需的所有数字。所有实际的图标都可以在drawable资源文件夹中找到。

现在我想在 Spinner 选择的列表中的字符串旁边显示相应的项目。当一个项目被选中时,我只需要看到文本。

我在互联网上搜索了一个很好的教程,但是根据我的发现,我没有成功地做到这一点。我刚刚开始使用 Android 编程,所以我想我需要一些帮助。我希望有人可以指导我朝着正确的方向前进。

我将字符串数组放在实际数组中,例如:

// Arrays with each function in text
arbeiderjobs = getResources().getStringArray(R.array.arbeiders);
bediendejobs = getResources().getStringArray(R.array.bediende);

// Arrays with each function ID
arbeiderjobsid = getResources().getIntArray(R.array.arbeidersid);
bediendejobsid = getResources().getIntArray(R.array.bediendeid);
Run Code Online (Sandbox Code Playgroud)

When one of the RadioButtons gets selected, I use the following event handler code:

// RadioButton 'Arbeider': If a value gets chosen in this list, 
// the corresponding ID is …
Run Code Online (Sandbox Code Playgroud)

icons android text spinner

3
推荐指数
1
解决办法
1万
查看次数

Ruby上的文本中的站点地图生成器

我有一些网站,例如http://example.com
我想生成一个站点地图作为URI列表,例如:

  • http://example.com/main
  • http://example.com/tags
  • http://example.com/tags/foo
  • http://example.com/tags/bar

我找到了一个很好的应用程序:iGooMap
iGooMap可以生成所需的URI列表作为文本文件(而不是XML文件).
这是我想要实现的目标的直观表示:

这就是我想要的

我希望在Ruby(而不是 Rails)中生成这种类型的站点地图.
我找到了SiteMapGenerator,但它只生成一个.XML文件,但是如上所述,我需要一个文本文件.

是否有Ruby的解决方案为给定的站点创建链接列表?

ruby sitemap gem

3
推荐指数
1
解决办法
1532
查看次数

Java XML输出 - 子项的正确缩进

我想将一些简单的数据模型序列化为xml,我一直在使用标准的java.org.w3c相关代码(见下文),缩进比没有"OutputKeys.INDENT"好,但还有一点点剩下的东西 - 适合儿童元素的缩进.

我知道之前已经在stackoverflow上询问过,但是这个配置对我来说不起作用,这是我正在使用的代码:

        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        DocumentBuilder builder = factory.newDocumentBuilder();
        Document doc = builder.newDocument();

        doc = addItemsToDocument(doc);
        // The addItemsToDocument method adds childElements to the document.

        TransformerFactory transformerFactory = TransformerFactory.newInstance();
        transformerFactory.setAttribute("indent-number", new Integer(4));
        // switching to setAttribute("indent-number", 4); doesn't help

        Transformer transformer = transformerFactory.newTransformer();
        transformer.setOutputProperty(OutputKeys.METHOD, "xml");
        transformer.setOutputProperty(OutputKeys.INDENT, "yes");

         DOMSource source = new DOMSource(doc);
       StreamResult result = new StreamResult(outFile);
        // outFile is a regular File outFile = new File("some/path/foo.xml");

        transformer.transform(source, result);
Run Code Online (Sandbox Code Playgroud)

产生的输出是:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<stuffcontainer> …
Run Code Online (Sandbox Code Playgroud)

java xml indentation

2
推荐指数
1
解决办法
2万
查看次数

下面的TextView在同一行上的EditText和Button?

我试图在EditTexta旁边有一个小部件Button,也有一个TextView底部.本EditText应该调整,并相应地填满屏幕,而按钮的宽度应该永远只有它所需要的是(我通过设置宽度这样做wrap_content).

我想要完成的布局应该是相对的.下面是我到目前为止的代码(其中一些在StackOverflow上找到).删除TextView为EditText和Button提供了所需的外观,但是当添加TextView时,视图非常糟糕.

任何见解都会有帮助!

<?xml version="1.0" encoding="utf-8"?>
  <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                android:layout_height="wrap_content" 
                android:orientation="horizontal"
                android:layout_width="fill_parent"
  >
    <EditText android:text="@+id/EditText01" 
              android:id="@+id/EditText01"
              android:layout_height="wrap_content" 
              android:layout_weight="1"
              android:layout_width="fill_parent"
    />

    <Button android:text="@+id/Button01" 
            android:id="@+id/Button01"
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content"
    />

    <TextView android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:text="@string/hello"
    />

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

android android-layout

2
推荐指数
1
解决办法
1万
查看次数

Ruby on Rails Win7 x64?

我刚刚升级到Win7 x64 Professional并想重新开发我的Rails应用程序,但是我收到以下错误:

=> Booting Mongrel
=> Rails 2.3.5 application starting on http://127.0.0.1:3344
D:/nu codes/R/ruby-1.8.7-p174-i386-mswin32/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:271:in `require_frameworks': 193: %1 is not a valid Win32 application.   - D:/nu codes/R/ruby-1.8.7-p174-i386-mswin32/lib/ruby/1.8/i386-mswin32/openssl.so (RuntimeError)
from D:/nu codes/R/ruby-1.8.7-p174-i386-mswin32/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:134:in `process'
from D:/nu codes/R/ruby-1.8.7-p174-i386-mswin32/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `send'
from D:/nu codes/R/ruby-1.8.7-p174-i386-mswin32/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `run'
from D:/nu codes/R/Aptana/tempproj/config/environment.rb:9
from D:/nu codes/R/ruby-1.8.7-p174-i386-mswin32/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from D:/nu codes/R/ruby-1.8.7-p174-i386-mswin32/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from D:/nu codes/R/ruby-1.8.7-p174-i386-mswin32/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
from D:/nu codes/R/ruby-1.8.7-p174-i386-mswin32/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in'
from D:/nu codes/R/ruby-1.8.7-p174-i386-mswin32/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
from D:/nu codes/R/ruby-1.8.7-p174-i386-mswin32/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/commands/server.rb:84
from D:/nu codes/R/ruby-1.8.7-p174-i386-mswin32/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from D:/nu codes/R/ruby-1.8.7-p174-i386-mswin32/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from D:/nu codes/R/Aptana/tempproj/script/server:3
from -e:1:in `load' …
Run Code Online (Sandbox Code Playgroud)

ruby rubygems ruby-on-rails ruby-on-rails-plugins windows-7-x64

1
推荐指数
1
解决办法
3736
查看次数

非常简单的Android应用程序保持FC'ing

嘿,我刚刚开始涉足android编程,从我短暂的时间开始,我有点沮丧.我可以在eclipse中没有错误,但是当我启动我的应用程序时它会立即强行关闭.我正在逐字地阅读一本安卓教程,但我仍然遇到错误.我的目标是在相对布局中创建列表视图.此外,由于某种原因,当我分配p.firstName或p.lastName时,它也会强制关闭,但无论如何这里是我的代码.我正在使用API​​级别15(即Android 4.0.3),如果这有所不同.

 package matthews.zack.test;
 import android.app.Activity;
 import android.os.Bundle;
 import android.view.View;
 import android.widget.Button;
 import android.widget.EditText;
   public class _testActivity extends Activity {

Button save;
People p = new People();
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    //onInitialize();
}

private void onInitialize()
{
     save = (Button)findViewById(android.R.id.button1);
     save.setOnClickListener(new View.OnClickListener() {


        public void onClick(View v) {
            // TODO Auto-generated method stub
            EditText firstName = (EditText)findViewById(android.R.id.text1);
            EditText lastName = (EditText)findViewById(android.R.id.text2);
            p.setFirstName("Hai");//firstName.getText().toString());
            p.setLastName("Hi");//lastName.getText().toString());
            //((EditText)findViewById(android.R.id.text1)).setText("This the tune bada …
Run Code Online (Sandbox Code Playgroud)

android forceclose

0
推荐指数
2
解决办法
249
查看次数