我有一个小型的网络应用程序,它使用了一堆宝石.其中一些仅用于test和development环境.现在,当我尝试使用以下命令在生产服务器上启动unicorn时,它会失败.
unicorn_rails -E production -D -c config/unicorn.rb
Run Code Online (Sandbox Code Playgroud)
我在日志文件中看到的错误是:
Refreshing Gem list
Could not find gem 'spork (>= 0.9.0.rc2, runtime)' in any of the gem sources listed in your Gemfile.
Try running `bundle install`.
Run Code Online (Sandbox Code Playgroud)
我在下面粘贴了我的gemfile:
source 'http://rubygems.org'
gem 'rails', '3.0.1'
gem 'unicorn'
gem 'mongoid', '>= 2.0.0.beta.19'
gem 'devise'
gem 'cancan'
gem 'haml', '>= 3.0.0'
gem 'bson'
gem 'bson_ext'
gem 'formtastic'
gem 'bluecloth'
group :production do
gem 'capistrano'
end
group :development do
gem 'haml-rails'
gem 'hpricot', '0.8.2'
gem …Run Code Online (Sandbox Code Playgroud) 这是我的代码不起作用:
//以这种方式发送包:
String topUser = String.valueOf(scores.get(arg2));
Bundle data = new Bundle();
data.putString("userprofile", topUser);
FragmentTransaction t = getActivity().getSupportFragmentManager()
.beginTransaction();
SherlockListFragment mFrag = new ProfileFragment();
mFrag.setArguments(data);
t.replace(R.id.main_frag, mFrag);
t.commit();
Run Code Online (Sandbox Code Playgroud)
//检索这种方式:
Bundle extras = getActivity().getIntent().getExtras();
userName = extras.getString("userprofile");
Run Code Online (Sandbox Code Playgroud)
基本上,没有收到数据.我是在正确的轨道上还是有更好的方法来做到这一点?
我正在使用ASP.net MVC 4.就像问题所述,如果我将一堆JS文件(或CSS,就此而言)放入一个包中,它会自动缩小吗?例如,我的包应该是:
bundles.Add(new ScriptBundle("~/bundles/exampleBundle").Include(
"~/Scripts/jquery-masked.js"
"~/Scripts/jquery.idletimer.js"
));
Run Code Online (Sandbox Code Playgroud)
或者它应该最初包括缩小的文件:
bundles.Add(new ScriptBundle("~/bundles/exampleBundle").Include(
"~/Scripts/jquery-masked.min.js"
"~/Scripts/jquery.idletimer.min.js"
));
Run Code Online (Sandbox Code Playgroud)
??
编辑:现在我想知道捆绑.min文件是否会添加任何优化.它是否会提高性能,包括捆绑包中的.min文件而不是基本文件?(也许"minifier函数"需要一些时间?)
基本上我想在我的配置中允许任意(但不是空)数量的键值对,在billings节点下,定义一个关联数组.
我在我的Configurator.php(部分)中有这个:
->arrayNode('billings')
->isRequired()
->requiresAtLeastOneElement()
->prototype('scalar')
->end()
->end()
Run Code Online (Sandbox Code Playgroud)
然后,在我的config.yml:
my_bundle:
billings:
monthly : Monthly
bimonthly : Bimonthly
Run Code Online (Sandbox Code Playgroud)
但是,输出$config:
class MyBundleExtension extends Extension
{
/**
* {@inheritDoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
$loader = new Loader\YamlFileLoader($container,
new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services.yml');
$processor = new Processor();
$configuration = new Configuration();
$config = $processor->processConfiguration($configuration, $configs);
$container->setParameter('my_bundle.billings', $config['billings']);
var_dump($config);
die();
}
}
Run Code Online (Sandbox Code Playgroud)
...我得到的是数字索引,而不是关联索引:
'billings' => …Run Code Online (Sandbox Code Playgroud) 我已经竭尽全力让我的Android游戏的所有数据都适合saveInstanceState Bundle.共有很多数据,包括许多Parcelable对象.这可确保当应用程序暂停或方向更改时,重新创建的活动不会丢失任何数据.
但是,我刚刚发现savedInstanceState包显然不适合长期存储.所以我正在寻找一种方法,我可以调整我现有的保存方法作为长期解决方案,以便始终可以恢复游戏状态.
到目前为止,我听说过2个解决方案:
1)使用savedInstanceState包进行方向更改,但在应用程序需要完全关闭时还要包含SharedPrefs.
这看起来非常适得其反,因为它使用2种不同的完全方法来做同样的事情.此外,由于我的savedInstanceState Bundle使用Parcelable对象,因此我必须为这些对象中的每一个提供另一种方法,以使它们能够写入SharedPrefs.基本上很多重复和难以管理的代码.
2)序列化savedInstanceState Bundle并将其直接写入文件.
我对此持开放态度,但我实际上并不知道如何去做.但是,我仍然希望可能有更好的解决方案,因为我听说Android中的序列化"可笑/非常慢".
如果有人能为我提供解决方案,我将非常感激.
我刚刚用Heroku Toolbelt安装了ruby,探测器就是当我这样做bundle install时给了我这个错误:
sh.exe": /c/Program Files (x86)/ruby-1.9.3/bin/bundle: "c:/Program: bad interpreter: No such file or directory
Run Code Online (Sandbox Code Playgroud)
根据这个问题找不到Bundle命令.坏解释我应该改变PATH,但我不知道怎么做,我已经改变了windows PATH环境变量,甚至改为C:\ ruby-1.9.2\bin我得到了一个类似的错误:
sh.exe": /c/ruby-1.9.3/bin/bundle: "c:/Program: bad interpreter: No such file or directory
Run Code Online (Sandbox Code Playgroud)
当我尝试重新安装Toolbelt时,我将install direcotry更改为c:\但仍然向导在Program Files(x86)目录中安装git和ruby文件夹.
有什么建议?
我正在尝试捆绑在ASP.NET MVC 4中工作.我从为捆绑的CSS生成的链接中收到404错误.我做了以下事情:
通过NuGet安装"Microsoft ASP.NET Web Optimization Framework"软件包(v4.0.20710.0)
在App_Start目录中创建了一个BundleConfig类,其中包含以下内容:
using System.Web.Optimization;
namespace BsdAppTemplate.Web_Nancy.App_Start
{
public class BundleConfig
{
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new StyleBundle("~/bundles/styles/cvi").Include(
"~/mainstyles.css"
));
}
}
}
Run Code Online (Sandbox Code Playgroud)在站点根目录的Web.config中添加了以下内容:
<system.web>
<compilation debug="false" targetFramework="4.5" />
<pages>
<namespaces>
<add namespace="System.Web.Optimization"/>
...
</namespaces>
</pages>
</system.web>
Run Code Online (Sandbox Code Playgroud)将以下内容添加到我的MVC布局文件的head元素中:
@Styles.Render("~/bundles/styles/cvi")
Run Code Online (Sandbox Code Playgroud)将BundleConfig("mainstyles.css")中引用的CSS文件复制到我的Web项目的根目录中.
当我查看渲染文件的来源时,我可以看到链接显示为:
<link href="/bundles/styles/cvi" rel="stylesheet"/>
Run Code Online (Sandbox Code Playgroud)
此链接在浏览时会生成404,或在Chrome的网络标签中查看页面请求.
我也尝试过Web表单上的等价物,但是从添加时生成的链接中得到了相同的结果(404):
<%: Styles.Render("~/bundles/styles/cvi") %>
Run Code Online (Sandbox Code Playgroud) 有时 Xcode 无法确定moduleBundle 中的参数。
类型“捆绑”没有成员“模块”
我的调查表明,SPM 会在名为的文件中自动为该属性生成模块扩展(有时)resource_bundle_accessor:
import class Foundation.Bundle
private class BundleFinder {}
extension Foundation.Bundle {
/// Returns the resource bundle associated with the current Swift module.
static var module: Bundle = {
let bundleName = "ABUIKit_ABStyleKit"
let candidates = [
// Bundle should be present here when the package is linked into an App.
Bundle.main.resourceURL,
// Bundle should be present here when the package is linked into a framework.
Bundle(for: BundleFinder.self).resourceURL,
// For command-line …Run Code Online (Sandbox Code Playgroud) 你会如何为asp.net mvc区域进行资源捆绑?这是否受ASP.NET MVC框架的限制,就像AreaRegistrationfor routes一样?
我可以做一个BundleConfig类区域内,并从全球称之为BundleConfig内部App_Start文件夹,但这种感觉好好尝试一下对我好.
我找不到有关此主题的任何信息.任何帮助我们的意见表示赞赏.
我有一个单独的资源包随我的框架一起提供.我想在该捆绑中放置和使用资产目录.然而UIImage imageNamed:说它使用当前的应用程序主包.如何从另一个捆绑包中的资产目录加载图像?
使用[bundle pathForResource:name ofType:@"png"]的技巧不适用于已编译的资产目录.我已经验证了Assets.car文件确实在包中,它包含我的图像.