我很难让我的域名正确地指向我的EC2.我在网上搜索了一些第三方指南,并在官方的AWS文档中略微淹没,但尽管如此,我仍然无法让它工作.
我已经设置了Route 53,如下所示:
Type: A
Value: ??.??.??.?? (IP address)
Type: NS
Value: ns-1403.awsdns-47.org.
ns-1696.awsdns-20.co.uk.
ns-632.awsdns-15.net.
ns-431.awsdns-53.com.
Type: SOA
Value: ns-431.awsdns-53.com.
awsdns-hostmaster.amazon.com
Run Code Online (Sandbox Code Playgroud)
在我的域名托管服务器上,我设置了DNS记录,如下所示:
Hostname: www
Type: NS
Value: ns-1403.awsdns-47.org
ns-1696.awsdns-20.co.uk
ns-632.awsdns-15.net
ns-431.awsdns-53.com
Run Code Online (Sandbox Code Playgroud)
我认为我做的事情从根本上说是错误的.首先我不确定我的DNS记录是否正确的主机名部分.在网站上,它.domain
在主机名的输入框后面说,这让我认为它是一个子域说明符.我是否正确地认为该@
符号适用于无子域?(即domain.com
代替www.domain.com
)
其次,我应该删除NS
路由53 中的记录集,因为它已经在域主机上的DNS记录中指定了吗?
非常感谢
我有以下快速代码
let urlPath="..." // dont worry, there is an actual valid URL in there
let url=NSURL(strong: urlPath)
let session=NSURLSession.sharedSession()
let task=session.dataTaskWithURL(url!,completionHandler:{data,response,error -> Void in
println("Task Completed")
})
println(task)
Run Code Online (Sandbox Code Playgroud)
当我运行此代码时,控制台永远不会显示该行"Task Completed"
,而是显示以下内容:
<__NSCFLocalDataTask: 0x7c923180>{ taskIdentifier: 1 } { suspended }
Run Code Online (Sandbox Code Playgroud)
为什么我的任务被暂停,我该怎么做才能修复它?
在TableViewController中我有这个代码:
override func viewDidLoad(){
super.viewDidLoad()
self.tab = UITableView(frame: CGRectMake(8, 80, 584, 512), style: UITableViewStyle.Plain)
self.tab?.delegate = self
self.tab?.dataSource = self
self.tab?.registerClass(CustomCell.self, forCellReuseIdentifier: "cell")
self.tab?.reloadData()
self.view.addSubview(tab!)
}
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if let count = self.data.count {
return count
}
return 0
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
var cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as? CustomCell
if cell == nil {
cell = CustomCell(style: UITableViewCellStyle.Value1, reuseIdentifier: "cell")
}
if let item = …
Run Code Online (Sandbox Code Playgroud) 在Magento 1
我可以local.xml
像这样编辑:
<default>
<reference name="root">
<block type="core/template" name="above_main" template="page/html/banner.phtml" />
</reference>
</default>
Run Code Online (Sandbox Code Playgroud)
我可以像这样编辑模板文件:
<body<?php echo $this->getBodyClass()?' class="'.$this->getBodyClass().'"':'' ?>>
<?php echo $this->getChildHtml('after_body_start') ?>
<div class="wrapper">
<?php echo $this->getChildHtml('global_notices') ?>
<div class="page">
<?php echo $this->getChildHtml('header') ?>
<?php // MY EDIT: ?>
<?php echo $this->getChildHtml('above_main');
<div class="main-container col2-left-layout">
<div class="main">
<?php echo $this->getChildHtml('breadcrumbs') ?>
<!-- rest of page... -->
Run Code Online (Sandbox Code Playgroud)
这将最终将文件page/html/banner.phtml
插入到我自己的自定义位置的模板中above_main
.
好的,我的问题是:
我如何在Magento 2中执行此操作?
快速问题 - 假设我们有这两个对象:
var obj={str:'',int:0,bool:false,arr:[]};
var paramObj={str:'Hey',bool:true};
Run Code Online (Sandbox Code Playgroud)
jQuery中的.extend()函数的工作原理如下:(据我所知)
$.extend(obj,paramObj);
// obj={str:'Hey',int:0,bool:true,arr:[]};
Run Code Online (Sandbox Code Playgroud)
但是我想要一些像这样的东西,但反过来,就像这样:
$.extendRev(paramObj,obj);
// paramObj={str:'Hey',int:0,bool:true,arr:[]};
Run Code Online (Sandbox Code Playgroud)
在jQuery(或本机)语言中是否存在这样的函数,它将两个对象合并在一起,将对象值保留在第一个对象中,只在第一个对象中添加对象值(如果它们在第一个对象中不存在).
或者我将不得不从头开始编码?
这就是我要的:
swift中的函数可以采用可选参数,因此对函数的以下调用myFunc
都可以正常工作:
// assume we have a Dictionary like this
let dict=["key":"value"]
myFunc()
myFunc(dict)
Run Code Online (Sandbox Code Playgroud)
功能 myFunc
工作方式如下:
传入的任何词典myFunc
都会与其中的词典合并myFunc
。如果没有传递myFunc
字典,则里面的字典myFunc
将按原样使用。
这就是我想在Swift中实现的目标。这就是我一直在做的事情:
似乎不能完全省略参数,但是在阅读了一些有关我的内容后,我一直在研究默认参数。我希望参数的类型为Dictionary,但是如果没有指定参数,那么我什么也不想要,或者至少是一个空的Dictionary。我已经这样声明了一个空字典:
let emptyDict = Dictionary<String,String>()
Run Code Online (Sandbox Code Playgroud)
然后使用默认参数声明函数,如下所示:
func myFunc(paramDict:Dictionary = emptyDict){ ... }
Run Code Online (Sandbox Code Playgroud)
这给了我以下错误:
Reference to generic type 'Dictionary' requires arguments in <...>
Run Code Online (Sandbox Code Playgroud)
我假设这是在抱怨,因为我使用空字典作为参数。
有人可以告诉我如何在Swift中构建一个功能,该功能可以实现我想要的功能myFunc
吗?
我已经构建了一个记录音频剪辑的应用程序,并将其保存到一个名为的文件中xxx.m4a
.
录制完成后,我可以xxx.m4a
在我的系统上找到这个文件并播放它 - 它播放得很好.问题不在于录制此音轨.
我的问题是从应用程序中播放此音轨.
// to demonstrate how I am building the recordedFileURL
let currentFileName = "xxx.m4a"
let dirPaths = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)
let docsDir: AnyObject = dirPaths[0]
let recordedFilePath = docsDir.stringByAppendingPathComponent(currentFileName)
var recordedFileURL = NSURL(fileURLWithPath: recordedFilePath)
// quick check for my own sanity
var checkIfExists = NSFileManager.defaultManager()
if checkIfExists.fileExistsAtPath(recordedFilePath){
println("audio file exists!")
}else{
println("audio file does not exist")
}
// play the recorded audio
var error: NSError?
let player = AVAudioPlayer(contentOfURL: recordedFileURL!, error: &error) …
Run Code Online (Sandbox Code Playgroud) 我可以从网站上下载一个mp3,这样我以后可以在我的应用程序中使用它,而不会阻止我应用程序执行的其余部分吗?
我一直在寻找的是同步方式.
我想将mp3缓存在一个数组中.我最多只能获得5或6个短片.
有人可以帮忙吗?
我->each()
在循环中有一个Laravel 函数.
我希望能够从每个函数中获取循环变量.
foreach ($stringsArray as $string) {
if (!empty($string)) {
DBModel::all()->each(function (DBModel $model) {
global $string;
// $string at this point is nothing/undefined
Run Code Online (Sandbox Code Playgroud)
如何$string
从->each()
功能中访问?
这是使用laravel 4.2.
当前代码$string
未定义(带或不带global
指令).
swift ×4
ios ×3
cocoa-touch ×1
dictionary ×1
dns ×1
domain-name ×1
ipad ×1
iphone ×1
javascript ×1
jquery ×1
laravel ×1
magento ×1
magento2 ×1
php ×1
uitableview ×1