我正在尝试在HAML文件中添加一些内联CSS.我以为
%noscript
:css
.pagecontent {display:none;}
Run Code Online (Sandbox Code Playgroud)
会产生:
<noscript>
<style type="text/css">
/*<![CDATA[*/
.pagecontent {display:none;}
/*]]>*/
</style>
</noscript>
Run Code Online (Sandbox Code Playgroud)
但事实并非如此.因为它遗漏type="text/css"并产生:
<noscript>
<style>
/*<![CDATA[*/
.pagecontent {display:none;}
/*]]>*/
</style>
</noscript>
Run Code Online (Sandbox Code Playgroud)
我可以使用蛮力,%style(type="text/css")但HAML的:css过滤器似乎应该更"优雅"?!?或者,我错过了什么(我很少处理内联CSS)并且type不再需要了?!?
我已经在App Store上拥有付费应用的用户.我想将应用转换为具有可解锁功能的免费应用.有没有办法将现有用户推送到这个允许付费"升级"的新免费版本,以便将现有用户视为已经为此次升级付费?或者,正如我所料,随着应用程序开发的推进,我们必须保持两个独立的代码库 - 而不是通过强迫他们再次购买来激怒现有客户吗?
我知道,由于Apple今天才开始允许在免费应用程序中支持应用内购买,因此最初不会有很多权威性的答案.
新到Rails并试图围绕让我的头的时候/为什么要使用:symbols,@ivars,"strings"的框架内.
我想我从概念上理解它们之间的差异
:symbol每个项目只有一个实例@ivar每个实例一个"strings"- 因为它们是在引用时创建的(?)随意纠正我!
主要的困惑来自于理解Rails期望的规则和惯例 - 在哪里以及为什么?
我确定有一个"啊哈!" 那一刻即将到来,但我还没有...因为它对我来说似乎很随意(来自C/Obj-C).
-谢谢
任何人都知道为什么这个根View Controller's viewDidLoad在发布时被调用了两次?这让我疯了!
这是第一次到第一次的堆栈跟踪viewDidLoad:
#0 0x0000276a in -[RootViewController viewDidLoad] at RootViewController.m:71
#1 0x3097548f in -[UIViewController view]
#2 0x00002734 in -[RootViewController initWithCoder:] at RootViewController.m:39
#3 0x30ab5ce4 in -[UIClassSwapper initWithCoder:]
#4 0x30514636 in _decodeObjectBinary
#5 0x30514035 in _decodeObject
#6 0x30ab5a1d in -[UIRuntimeConnection initWithCoder:]
#7 0x30514636 in _decodeObjectBinary
#8 0x30515f27 in -[NSKeyedUnarchiver _decodeArrayOfObjectsForKey:]
#9 0x305163b0 in -[NSArray(NSArray) initWithCoder:]
#10 0x30514636 in _decodeObjectBinary
#11 0x30514035 in _decodeObject
#12 0x30ab4dde in -[UINib instantiateWithOptions:owner:loadingResourcesFromBundle:]
#13 0x30ab6eb3 in -[NSBundle(NSBundleAdditions) loadNibNamed:owner:options:]
#14 0x308f85f1 in …Run Code Online (Sandbox Code Playgroud) Gemfile说:
gem 'sqlite3', :groups => [:development, :test]
gem 'mysql2', :group => :production
Run Code Online (Sandbox Code Playgroud)
然而,当我bundle install在我的开发机器上打字时,安装了所有宝石.
我的设置有什么问题?
试图测试该页面包含<title>My Title</title>:
# spec/features/reports_spec.rb
require 'spec_helper'
feature "Archive Management" do
subject { page }
describe "Index Page" do
before(:all) { 10.times { FactoryGirl.create(:randomreport) } }
after(:all) { Report.delete_all }
describe "when no search terms present" do
before { visit reports_path }
it { should have_selector('title', text: 'My Title') } # <= Fails w/Capybara 2.0
it { should have_selector('title') } # <= passes
it { should have_text('My Title') } # <= passes
it { should have_selector('h2', text: "Welcome") } …Run Code Online (Sandbox Code Playgroud) 我们有一个Rails 3.1应用程序,允许用户将照片上传到Amazon S3.由于我们在生产中使用S3,我想自动(上cap deploy)将预编译的资产(application.js和application.css&images)上传到我们的S3存储桶中.很简单.
超越设定 config.action_controller.asset_host = "http://assets.example.com"
简而言之,我正在寻找Capistrano工作"配方"的一些例子,但似乎找不到任何现代的(3.1资产管道兼容).我们成功预编制了资产但是如何将它们移到S3?而且,理想情况下,只有那些已经改变的?
当前"食谱"的"肉":
...
after "deploy:update_code", "deploy:pipeline_precompile"
before "deploy:finalize_update", "deploy:copy_database_config"
namespace :deploy do
task :start do ; end
task :stop do ; end
task :restart, :roles => :app, :except => { :no_release => true } do
run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
end
# copy database.yml into project
task :copy_database_config do
production_db_config = "/path_to_config/#{application}.yml"
run "cp #{production_db_config} #{current_release}/config/database.yml"
`puts "replaced database.yml with live copy"`
end
task :pipeline_precompile do
run "cd …Run Code Online (Sandbox Code Playgroud) 我希望我的iPhone应用程序允许使用适当的符号($,€,₤,¥等)为用户输入,显示和存储货币金额.
NSNumberFormatter会做我需要的一切吗?用户切换其区域设置时会发生什么,这些金额(美元,日元等)存储为NSDecimalNumbers.我假设,为了安全起见,有必要以某种方式捕获输入时的区域设置,然后是货币符号并将它们与NSDecimalNumber ivar一起存储在我的实例中,以便在用户更改时可以将它们展开并在路上正确显示自项目创建以来他们的语言环境?
对不起,我没有很少的本地化经验,所以希望在潜入之前提供一些快速指示.最后,考虑到iPhone键盘的限制,有关如何处理这种输入的任何见解?
我怎么能在HAML中做这样的事情(在Rails应用程序中这很重要)?
<li><a href="#" title="Meet the Team"><strong>Team <em>16 members</em></strong></a></li>
Run Code Online (Sandbox Code Playgroud)
编辑:如何使用link_to和路由pages_team?
我刚刚开始使用elasticsearch.我们的要求是我们需要索引数千个PDF文件,而我很难获得其中一个成功编制索引.
安装了Attachment Type插件并获得了响应:Installed mapper-attachments.
按照附件类型操作教程,但该过程挂起,我不知道如何解释错误消息.还尝试了挂在同一个地方的要点.
$ curl -X POST "localhost:9200/test/attachment/" -d json.file
{"error":"ElasticSearchParseException[Failed to derive xcontent from (offset=0, length=9): [106, 115, 111, 110, 46, 102, 105, 108, 101]]","status":400}
Run Code Online (Sandbox Code Playgroud)
更多细节:
该json.file包含一个嵌入式的Base64 PDF文件(按说明).该文件的第一行显示正确(无论如何):{"file":"JVBERi0xLjQNJeLjz9MNCjE1OCAwIG9iaiA8...
我不确定是否可能json.file是无效的,或者是否可能没有设置弹性搜索来正确解析PDF?!?
编码 - 以下是我们如何将PDF编码为json.file(根据教程):
coded=`cat fn6742.pdf | perl -MMIME::Base64 -ne 'print encode_base64($_)'`
json="{\"file\":\"${coded}\"}"
echo "$json" > json.file
Run Code Online (Sandbox Code Playgroud)
还尝试过:
coded=`openssl base64 -in fn6742.pdf
Run Code Online (Sandbox Code Playgroud)
日志:
[2012-06-07 12:32:16,742][DEBUG][action.index ] [Bailey, Paul] [test][0], node[AHLHFKBWSsuPnTIRVhNcuw], [P], …Run Code Online (Sandbox Code Playgroud) iphone ×3
cocoa-touch ×2
haml ×2
apache-tika ×1
base64 ×1
bundler ×1
capistrano ×1
capybara ×1
css ×1
currency ×1
gem ×1
localization ×1
noscript ×1
osx-server ×1
pdf ×1
rspec ×1
ruby ×1
sass ×1
string ×1
symbols ×1
viewdidload ×1