Tag: 捆绑

savedInstanceState从还原堆栈中恢复片段时

我可以使用savedInstanceState()来保存删除一个片段时的状态,然后恢复当我从后面堆栈popup片段的状态? 当我从后端堆栈恢复片段时,savedInstanceState bundle始终为空。 现在,应用程序stream是:片段创build – >片段删除(添加到后面的堆栈) – >从后面的堆栈(savedInstanceState包是空的)恢复的片段。 这是相关的代码: public void onActivityCreated(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle bundle = getArguments(); Long playlistId = bundle.getLong(Constants.PLAYLIST_ID); int playlistItemId = bundle.getInt(Constants.PLAYLISTITEM_ID); if (savedInstanceState == null) { selectedVideoNumber = playlistItemId; } else { selectedVideoNumber = savedInstanceState.getInt("SELECTED_VIDEO"); } } public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putInt(Constants.SELECTED_VIDEO, selectedVideoNumber); } 我认为这个问题是, onSavedInstanceState()在被移除并被添加到后端堆栈时从不被调用。 如果我不能使用onsavedInstanceState(),是否有另一种方法来解决这个问题?

如何在bundler上下文中运行ruby脚本?

我有一个名为foo.rb的Ruby脚本,我想在bundler环境的上下文中运行它。 怎么样? bundle exec foo.rb不起作用,因为exec需要一个shell脚本。

捆绑安装和rbx-require-relative

以下railstutorial.org后,我试图运行bundle install 。 它列出使用gem像: Using railties (3.0.7) Using rails (3.0.7) Using sass (3.1.3) 而这个错误: Installing rbx-require-relative (0.0.5) /home/canard/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:364:in `ensure_required_ruby_version_met': rbx-require-relative requires Ruby version ~> 1.8.7. (Gem::InstallError) from /home/canard/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:135:in `install' … 我明白ruby 1.9.2需要rbx-require-relative,但是为什么它不想安装它。 它要求rubyruby1.8.7。 我有点迷路。 进一步更多的这个错误后,它停止,我的Gemfile中的gem从来没有读取或安装… 我使用ruby1.9.2p180和轨道3.0.7 谢谢你的帮助

从JUnittesting用例中找不到资源文件

概要 我的JUnittesting没有在执行过程中find他们需要的文件。 我正在使用Maven进行依赖pipe理和编译。 细节 testing用例所需的所有文件位于: src/test/resources 。 例如, src/test/resources/resourceFile.txt 。 要访问资源我使用下面的代码: URL url = getClass().getResource("/resourceFile.txt").getFile(); File file = new File(url); 但是,然后file.exists()返回false 。 而我得到的错误是: Tests in error: myJUnitTestCase(tests.MyJUnitTestClass): /home/me/workspace/Project%20Name/target/test-classes/resourceFile.txt (No such file or directory) 请注意,以下给出了相同的错误(注意删除/前缀): URL url = getClass().getClassLoader().getResource("resourceFile.txt").getFile(); File file = new File(url); 似乎来自src/test/resources的文件没有被复制到target/test-classes 。 有任何想法吗? 以下问题没有帮助 为什么我无法在Maven中使用Junittesting来访问src / test / resources? 在JUnit @BeforeClass中加载属性文件 如何处理Junit中的testing数据? […]

iOS应用程序中的子目录

有没有办法在.app有目录? 目前,如果我将文件添加到Xcode ,无论它在哪个组层次结构,文件总是落在我的应用程序包中的一个平面文件系统。

如何制作iOS资产套件?

我在我评估的iOS项目中看到了一个自定义资产包,所以至less我知道这是可能的。 我的问题是,我使用的CATiledLayer与一个给定的图像大约22000瓷砖,它需要很长时间来编译(半小时干净的build设,5-10分钟的常规build设)。 所以,我想把所有的图像,并制作一个自定义的包,使其可移植,并希望每次不希望重新编译到应用程序包。 我如何去做这件事? 我检查了文档,但没有看到如何实际创build捆绑的解释。

MVC4减去捆绑@import目录

我试图使用MVC4捆绑将我的一些less文件,但它看起来像我使用的导入path是closures的。 我的目录结构是: static/ less/ mixins.less admin/ user.less 在user.less,我试图导入mixins.less使用这个: @import "../mixins.less"; 之前用这种方法为我工作时,无聊的啁啾,但现在我注意到ELMAH正在生我的气,说: System.IO.FileNotFoundException: You are importing a file ending in .less that cannot be found. File name: '../mixins.less' 我应该使用MVC4不同的@import吗? 一些额外的信息 下面是我用来尝试这个的less class和global.asax.cs代码: LessMinify.cs … public class LessMinify : CssMinify { public LessMinify() {} public override void Process(BundleContext context, BundleResponse response) { response.Content = Less.Parse(response.Content); base.Process(context, response); […]

如何以智能的方式将Java.util.Map编写成包?

我有一个string(键,值)的通用映射,这个字段是一个Bean的一部分,我需要可以parcelable。 所以,我可以使用Parcel#writeMap方法。 API Doc说: 请使用writeBundle(Bundle)。 在当前dataPosition()中将Map平铺到包中,如果需要,则增加dataCapacity()。 Map键必须是String对象。 Map值是使用writeValue(Object)写入的,并且必须遵循这个规范。 强烈build议使用writeBundle(Bundle)而不是此方法,因为Bundle类提供了一个types安全的API,可以避免编组时的神秘types错误。 所以,我可以迭代Map中的每一个条目,把它放到Bundle中,但是我仍然在寻找一个更聪明的方法。 我缺lessAndroid SDK中的任何方法吗? 目前我这样做: final Bundle bundle = new Bundle(); final Iterator<Entry<String, String>> iter = links.entrySet().iterator(); while(iter.hasNext()) { final Entry<String, String> entry =iter.next(); bundle.putString(entry.getKey(), entry.getValue()); } parcel.writeBundle(bundle);

ASP.NET Bundling – 在包含的文件已经改变之后Bundle不更新(返回304没有修改)

我正在尝试使用ASP.NET MVC 4应用程序的ASP.NET绑定。 这种情况是我想要制作一个CDN风格的服务,它有JS和CSS文件,你可以通过这个types的地址从其他站点寻址到: http : //www.mycdn.com/scripts/plugin/js ,它捆绑并缩小所有包含的.js文件。 我的一个文件的configuration文件如下所示: bundles.Add(new ScriptBundle("~/Scripts/plugin/pluginjs").Include("~/Scripts/plugin/jquery.plugin.js")); 但是,当我这样做时,即使在更改原始js文件后,捆绑包也没有得到更新。 当我刷新我的浏览器,并且缩小的文件的内容不更新时,我一直在获取304未修改。 如何更新捆绑包,因为捆绑旧的内容是没用的? 我尝试了各种方式,但无法找出解决scheme。 提前致谢!

Nokogiri'运行软件包安装时无法构buildgem原生扩展'

我正在运行bundle install ,我得到这个错误: Building nokogiri using system libraries. Gem::Ext::BuildError: ERROR: Failed to build gem native extension. /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb –use-system-libraries Building nokogiri using system libraries. libxml2 version 2.6.21 or later is required! *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for […]