I am using Xcode 5 in a newly created app and when I just create it I go for the run button e click on it, then the project gets built but it does not show in the iOS Simulator and I get the following message:
Failed to instantiate the default view controller for UIMainStoryboardFile 'Main' -
perhaps the designated entry point is not set?
Run Code Online (Sandbox Code Playgroud)
I've Googled about it of course and everybody points out that this is happening because …
我正在学习Clojure,我正在尝试定义一个函数,该函数接受可变数量的参数(一个可变函数)并将它们相加(是的,就像+过程一样).但是,我不知道如何实现这样的功能
我能做的一切是:
(defn sum [n1, n2] (+ n1 n2))
当然,此功能仅需要两个参数和两个参数.请教我如何接受(和处理)未定义数量的参数.
将AngularJS与其他JavaScript-MVC框架区分开来的一件事是它能够使用绑定将绑定值从JavaScript回显到HTML.当您为$ scope变量赋值时,Angular会"自动"执行此操作.
但这有多自动?有时,Angular不会接受更改,所以我需要调用$ scope.$ apply()或$ scope.$ digest()来通知angular拾取更改.有时,当我运行这些方法中的任何一个时,它会抛出一个错误,并表示摘要已在进行中.
由于绑定({{}}括号或ng-属性内的任何内容)都与eval一起回应,这意味着Angular会不断轮询$ scope对象以查找更改,然后执行eval将这些更改推送到DOM/HTML?或者AngularJS以某种方式找出了使用魔术变量来触发变量值变化或分配时触发的事件?我从来没有听说过所有浏览器都完全支持它,所以我对此表示怀疑.
AngularJS如何跟踪它的绑定和范围变量?
我想以编程方式显示带有文本的活动指示器,如照片应用程序中的那个(编辑并保存图片后).我怎样才能做到这一点?
我有一个UIViewController
在我使用的AVCaptureSession
显示相机和它工作得很好,速度快.我UIButton
在此摄像机视图的顶部放置了一个对象,并IBAction
为该按钮添加了一个对象.
这就是它现在的样子:
现在我想在用户点击按钮时获取当前摄像机视图的图片:
@IBAction func takePicture(sender: AnyObject) {
// omg, what do do?!
}
Run Code Online (Sandbox Code Playgroud)
我不知道如何做到这一点.我想象可能有类似的东西:
let captureSession = AVCaptureSession()
var myDearPicture = captureSession.takePicture() as UIImage // something like it?
Run Code Online (Sandbox Code Playgroud)
控制器代码的完整链接在这里https://gist.github.com/rodrigoalvesvieira/392d683435ee29305059,希望它有帮助
我有一个全新的Rails 4.1.1应用程序,我正在自定义Devise电子邮件.我想让它们显示在新的Rails电子邮件预览功能上,所以我做了以下事情:
1)在我的config/development.rb
文件中添加了以下代码段:
config.action_mailer.preview_path = "#{Rails.root}/lib/mailer_previews"
Run Code Online (Sandbox Code Playgroud)
2)创建我的自定义设计的电子邮件UserMailer
中app/mailers/user_mailer.rb
:
class UserMailer < Devise::Mailer
helper :application # gives access to all helpers defined within `application_helper`.
include Devise::Controllers::UrlHelpers # Optional. eg. `confirmation_url`
layout "notifications_mailer"
end
Run Code Online (Sandbox Code Playgroud)
3)更改config/initializers/devise.rb
为包含以下代码段:
config.mailer = 'UserMailer'
Run Code Online (Sandbox Code Playgroud)
4)添加了类UserMailerPreview
以lib/mailer_previews
用下面的内容:
class UserMailerPreview < ActionMailer::Preview
def confirmation_instructions
UserMailer.confirmation_instructions(User.first, {})
end
def reset_password_instructions
UserMailer.reset_password_instructions(User.first, {})
end
def unlock_instructions
UserMailer.unlock_instructions(User.first, {})
end
end
Run Code Online (Sandbox Code Playgroud)
到现在为止还挺好.看起来我已经做好了一切.但后来我尝试confirmation_instructions
在/ rails/mailers/user_mailer/confirmation_instructions路线上看到电子邮件的预览,我收到以下错误:
undefined method `confirmation_url' for #<#<Class:0x007fa02ab808e0>:0x007fa030fb7e80>
Run Code Online (Sandbox Code Playgroud)
我的confirmation_url.html.erb
模板的代码如下所示: …
我想在Rails 3中与以下字段联系我们:
发布的消息旨在转到我的电子邮件地址,因此我不一定必须将消息存储在数据库中.我必须使用ActionMailer
任何宝石或插件吗?
我有一个全新的iOS应用程序,可以生成图像并让用户将它们保存到Camera SavedPhotosAlbum中.但是,我想做Snapchat和Frontback之类的东西,并将这些图像也保存到自定义专辑中.
所以现在这是我的代码:
let imageToSave = self.currentPreviewImage
let softwareContext = CIContext(options:[kCIContextUseSoftwareRenderer: true])
let cgimg = softwareContext.createCGImage(imageToSave, fromRect:imageToSave.extent())
ALAssetsLibrary().writeImageToSavedPhotosAlbum(cgimg, metadata:imageToSave.properties(), completionBlock:nil)
Run Code Online (Sandbox Code Playgroud)
我已经看过一些人在Objective-C中这样做的例子,但我没有把它翻译成Swift,我检查了writeImageToSavedPhotosAlbum
方法签名,但似乎没有一个允许保存到自定义专辑.
我刚刚在我的Mac上安装了Postgres.app但它无法正常工作.我完成了安装,应用程序图标在菜单栏上,它说它正在侦听端口5432,但是,如果我尝试从命令行运行它会发生什么:
~ $ psql
zsh: correct 'psql' to 'sl' [nyae]? n
zsh: command not found: psql
Run Code Online (Sandbox Code Playgroud)
我之前通过Homebrew安装了PostgreSQL,但在安装Postgres.app之前删除了它.我正在运行Mac OS X Lion.
我感谢任何帮助,我真的希望在我的机器上运行PostgreSQL.