我在从应用程序生成iOS App存档时遇到问题.应用程序编译得很好,甚至在模拟器中工作.现在我想进行som临时测试,无法生成iOS App Archive.当我点击Product - > Archive时,它会生成一个通用的xcode存档.谁能帮我.我应该提一下,我已经生成了这个应用程序的iOS App Archive.由于某种原因,它刚刚停止生成iOS Archive.非常感谢.
我正试图权衡使用EnumMap
a的优缺点HashMap
.因为,我将一直在寻找使用a String
,似乎HashMap
用一把String
钥匙将是正确的选择.然而,EnumMap
似乎更好的设计,因为它传达了我将密钥限制为特定枚举的意图.思考?
这是一个虚构的例子,展示了我将如何使用Map
:
enum AnimalType { CAT, DOG }
interface Animal {}
class Cat implements Animal {}
class Dog implements Animal {}
public class AnimalFactory {
private static final Map<AnimalType, Animal> enumMap
= new EnumMap<AnimalType, Animal>(AnimalType.class);
// versus
private static final Map<String, Animal> stringMap
= new HashMap<String, Animal>();
static {
enumMap.put(AnimalType.CAT, new Cat());
enumMap.put(AnimalType.DOG, new Dog());
stringMap.put("CAT", new Cat());
stringMap.put("DOG", new Dog());
}
public static Animal create(String …
Run Code Online (Sandbox Code Playgroud) 我想在我的node.js脚本中使用phantomjs.有一个phantomjs节点库..但不幸的是,作者使用这个奇怪的咖啡脚本代码来解释他在做什么:
phantom = require 'phantom'
phantom.create (ph) ->
ph.createPage (page) ->
page.open "http://www.google.com", (status) ->
console.log "opened google? ", status
page.evaluate (-> document.title), (result) ->
console.log 'Page title is ' + result
ph.exit()
Run Code Online (Sandbox Code Playgroud)
现在如果我直接用javascript使用phantomjs,它看起来像这样:
var page = require('webpage').create();
page.open(url, function (status) {
var title = page.evaluate(function () {
return document.title;
});
console.log('Page title is ' + title);
});
Run Code Online (Sandbox Code Playgroud)
所以基本上我正在尝试在普通的javascript中编写相当于上面第一段代码的代码(通过阅读咖啡脚本文档 ..这就是我所做的:
// file name: phantomTest.js
var phantom = require('phantom');
phantom.create(function(ph) {
ph.createPage(function(page) {
page.open('http://www.google.com', function(status) { …
Run Code Online (Sandbox Code Playgroud) 这是一个关于如何将cookie从一个casperjs页面持久存储到另一个页面的问题.
所以基本上我得到一个nodejs文件,它生成casperjs作为工作人员来完成某些任务..一个是登录,一旦登录我将cookie存储在一个文件中.
当我产生下一个casper worker时..我希望它使用cookie而不必再次登录..这两种方法都失败了:
第一:当我产生工人capserjs时,我添加了--cookies-file =./ cookiefilename ie
var child = spawn('casperjs',['scrape.js','--cookies-file=./'+cookieFileName]);
第二:在casperjs工作文件中..我让它读取并从文件中设置cookie即
var casper = require('casper').create();
var cookieFileName = 'monsterCookie.txt';
// grab cookies from file
var fs = require('fs');
var utils = require('utils');
var cookies = fs.read(cookieFileName);
casper.page.setCookies(cookies);
casper.start('domain/page.html', function() {
//FAIL! cookies aren't used here
this.debugHTML();
});
casper.run();
Run Code Online (Sandbox Code Playgroud)
笔记:
start
从页面删除cookies吗?如果是这样我该怎么做呢?[一般]饼干="@变体(\ 0\0\0\0x7F部分\ 0\0\0\x16QList\0\0\0\0\X1\0\0\0 \n\0\0\0YCNTR = LB; expires = Tue,09-Apr-2013 17:12:05 GMT; domain = …
我正在使用arch linux,我按照Anaconda网站上的说明安装了Anaconda.当我试图运行时,conda info --envs
我收到以下错误:
bash:/ home/lukasz/anaconda3/bin/conda:/ opt/anaconda1anaconda2anaconda3/bin/python:bad interpreter:没有这样的文件或目录
我试过寻找目录,/opt/anaconda1anaconda2anaconda3/bin/python:
但它根本就不存在.
此外,当我从终端运行python时,它正常运行,并在顶部显示以下内容
Python 3.5.2 |Anaconda custom (64-bit)| (default, Jul 2 2016, 17:53:06)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
Run Code Online (Sandbox Code Playgroud)
为了完整性,我的.bashrc
文件类似于:
#
# ~/.bashrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
alias ls='ls --color=auto'
PS1='[\u@\h \W]\$ '
# added by Anaconda3 4.0.0 installer
export PATH="/home/lukasz/anaconda3/bin:$PATH"
# python startup …
Run Code Online (Sandbox Code Playgroud) UIScrollView中的UIButton不会点亮.请帮忙解决它.
// Add a button
UIButton *btn1 = [[UIButton buttonWithType:UIButtonTypeCustom] retain];
btn1.frame = CGRectMake(0, 0, 26, 18);
btn1.bounds = CGRectMake(0, 0, 30.0, 30.0);
[btn1 addTarget:self action:@selector(buttonClick1:)
forControlEvents:UIControlEventTouchUpInside];
[scrollView addSubview:btn1];
- (void)buttonClick1:(id)sender {
int dd = 4;
}
Run Code Online (Sandbox Code Playgroud) 我能够在PHPStorm中设置一个php web app调试器,只需将它绑定到我在特定端口的localhost即可,一切正常.但是要实现这一点,我需要先在shell上运行此命令:
php app/console server:run --env=dev
Run Code Online (Sandbox Code Playgroud)
如果我设置断点来浏览网站本身或测试来自基于浏览器的休息客户端(如邮递员)的 api调用,这样就可以了
但是,我正在尝试为我的移动应用程序设置断点(移动应用程序将http调用发送到后端应用程序,这是一个symfony应用程序).使用Web应用程序配置不适用于此配置.
使用本教程,我能够将上述命令行合并到PHPStorm中,所以现在我可以使用phpstorm命令行工具实际运行代码.
我的问题是:如何将调试器实际绑定到PHPStorm中的命令行?现在,当我在PHPStorm中创建内置Web服务器时,它默认使用默认的php解释器(即如果我使用内置的Web服务器运行代码..我在PHPStorm的控制台中看到了这一点:
/usr/local/Cellar/php54/5.4.28/bin/php -S localhost:8000 -t /project/root/directory
Run Code Online (Sandbox Code Playgroud)
我想要的是这样的:
php app/console server:run --env=dev -S localhost:8000 -t /project/root/directory
Run Code Online (Sandbox Code Playgroud)
知道怎么做吗?
我有一个UILongPressGestureRecognizer添加到UIButton.当我按下UIButton时,它会按预期突出显示.但是,当调用UILongPressGestureRecognizer选择器时,突出显示将被关闭.
UILongPressGestureRecognizer *longpressGesture =
[[UILongPressGestureRecognizer alloc] initWithTarget:self
action:@selector(longPressHandler:)];
longpressGesture.minimumPressDuration = 5;
[longpressGesture setDelegate:self];
[self.myUIButton addGestureRecognizer:longpressGesture];
[longpressGesture release];
- (void)longPressHandler:(UILongPressGestureRecognizer *)gestureRecognizer {
NSLog(@"longPressHandler");
}
Run Code Online (Sandbox Code Playgroud)
在上面的示例中,按住按钮5秒后调用选择器.在调用选择器之前,该按钮会突出显示,但在调用选择器时会突然显示该按钮,即使我仍然按下该按钮.
任何人都可以解释为什么会发生这种情况,以及如何预防?我希望按下按钮在整个按下时保持高亮显示.谢谢.
在我的系统更新后,我遇到了在Nginx上运行的PHP应用程序的错误网关错误.
1 connect()到unix:/var/run/php-fcgi-vhostname-php-fcgi-0.sock连接到上游时失败(13:权限被拒绝),客户端:xx.xxx.xx.xx,server:localhost ,请求:"GET/HTTP/1.1",上游:"fastcgi:// unix:/var/run/php-fcgi-vhostname-php-fcgi-0.sock:",主持人:"xx.xx.xx. XX"
这个问题是由于使用的php-fpm套接字的权限不好引起的,实际上我认为这/var/run/php-fcgi.sock
是由root:root
nginx和php-fpm用作用户所拥有的www-data
.
我已经编辑了php-fpm配置/etc/php-fpm.d/www.conf
:
listen.owner = www-data
listen.group = www-data
listen.mode = 0660
Run Code Online (Sandbox Code Playgroud)
但它没有解决问题,当我重新启动nginx和php-fpm时,套接字是用root:root
用户/组创建的.
我发现修复它的唯一方法是将套接字的所有者手动更改为www-data:www-data.但这不是一个真正的解决方案,因为每次重新启动我的服务时,我都要再次应用它.
我该如何解决这个问题?我在CentOS 6.5上
我使用Ajenti-V配置我的虚拟主机和我的PHP-FPM.它为每个网站/虚拟主机创建一个新的套接字,并设置它们/etc/php-fpm.conf
他们有这种结构:
[vhostname-php-fcgi-0]
user = www-data
group = www-data
listen = /var/run/php-fcgi-vhostname-php-fcgi-0.sock
pm = dynamic
pm.max_children = 5
pm.start_servers = 1
pm.min_spare_servers = 1
pm.max_spare_servers = 5
Run Code Online (Sandbox Code Playgroud)
如果我在每个条目中添加这些字符串:
listen.owner = www-data
listen.group = www-data
listen.mode = 0666
Run Code Online (Sandbox Code Playgroud)
一切正常.
所以看起来不包括www.conf(也许?).这是我的php-fpm.conf:
[global]
pid = /var/run/php-fpm/php-fpm.pid
error_log = /var/log/php5-fpm.log
[global-pool] …
Run Code Online (Sandbox Code Playgroud) 我有一个新闻应用程序,它以XML格式在线获取新闻,在本地存储在sqlite dbase中...这是restkit的完美案例.
但是,我想有时手动获取xml数据(即不想将其存储在dbase中).换句话说,我想直接用AFNetworking请求它.我喜欢在AFNetworking 2.0中自动解析xml,所以我想使用该功能.
但是,Restkit 2.0链接到AFNetworking 1.3 ..所以如果我将它添加到我的podfile:
pod 'RestKit', '~> 0.21.0'
pod "AFNetworking", "~> 2.0"
Run Code Online (Sandbox Code Playgroud)
并运行pod install
我得到以下错误:
[!] Unable to satisfy the following requirements:
- `AFNetworking (~> 1.3.0)` required by `RestKit/Network (0.21.0)`- `AFNetworking (~> 2.0)` required by `Podfile`
Run Code Online (Sandbox Code Playgroud)
有没有办法解决?
iphone ×3
ios ×2
node.js ×2
phantomjs ×2
php ×2
afnetworking ×1
anaconda ×1
casperjs ×1
centos ×1
coffeescript ×1
collections ×1
cookies ×1
enum-map ×1
hashmap ×1
ios4 ×1
java ×1
javascript ×1
jquery ×1
linux ×1
macos ×1
nginx ×1
objective-c ×1
phpstorm ×1
python ×1
restkit ×1
session ×1
symfony ×1
xcode ×1
xdebug ×1
xml ×1