我有一个TARGET变量,可以设置为dev,test或prod.
我定义了以下列表:
dev=(server1 user1 target1)
test=(server2 user2 target2)
prod=(server3 user3 target3)
Run Code Online (Sandbox Code Playgroud)
根据TARGET的值,我想动态地将变量CONFIG关联到列表中的一个.
让我们说TARGET = dev.然后我有
eval CONFIG=\$$TARGET # I expect CONFIG to be a list containing (server1 user1 target1)
echo ${CONFIG[*]} # OK, it gives (server1 user1 target1)
echo ${CONFIG[1]} # I would expect to have "server1" but it returns "1", seems like CONFIG is not seen as a list
Run Code Online (Sandbox Code Playgroud)
任何的想法 ?
我使用以下代码来利用群集npm为我的节点应用程序.
form = require("connect-form");
express = require("express");
app = express.createServer(form({ keepExtensions: true }));
cluster = require("cluster");
// App configuration
// ....
// Run on cluster
cluster( app )
.use(cluster.logger('logs'))
.use(cluster.stats())
.use(cluster.pidfiles('pids'))
.use(cluster.cli())
.listen(port);
Run Code Online (Sandbox Code Playgroud)
这在节点0.4.4上工作正常,但我最终在节点0.6.5上出现以下错误
luc @ localhost:〜/ server $ node app.js
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
TypeError: Property 'cluster' of object #<Object> is not a function
at Object.<anonymous> (/home/luc/server/app.js:15:1)
at Module._compile (module.js:432:26)
at Object..js (module.js:450:10)
at Module.load (module.js:351:31)
at Function._load (module.js:310:12)
at …
Run Code Online (Sandbox Code Playgroud) 为了在一些设备上分发我的iPhone用于测试目的,我创建了一个AdHic分发配置文件,并按照我在这个博客中找到的解释(抱歉它是法语但屏幕截图非常详细):
http://www.media-business.biz/content/iphone-cr%C3%A9ez-votre-propre-appstore
我从我的网站上安装了设备上的位置配置文件,但是当涉及到应用程序时,我收到一条错误消息,说明无法下载应用程序.这是一个已知的问题吗?非常感谢你的帮助.此致,吕克
ps:只是添加最后一分钟的问题...有没有一个地方我可以看到一些错误日志?:(
我正在ubuntu上安装data-mapper但是在发出以下命令时出错:sudo gem install dm-sqlite-adapter
luc @ nf310:〜$ sudo gem install dm-sqlite-adapter
Building native extensions. This could take a while...
ERROR: Error installing dm-sqlite-adapter:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb
checking for sqlite3.h... no
*** 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 more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir …
Run Code Online (Sandbox Code Playgroud) 当我的应用程序启动时,我想显示一种"等待视图",这样我就可以在访问应用程序之前进行第一次http调用.
我看到一个漂亮的,灰色的,有点透明,内部只有一个活动指示器.
我真的不知道如何以良好的方式构建这种视图,这是一个简单的UIView吗?
我已经完成了这个功能,使用地理编码器模块,从几个纬度/长度获得城市:
// Get city from lat/long pair
function getCityFromCoordinates(lat, long){
return geocoder.reverseGeocode(lat,long, function ( err, data ) {
var city = "-";
if(err){
city = err.message;
} else {
if(data["results"].length == 0){
city = "not found";
} else {
city = "";
var first_item = data["results"][0];
var address_components = first_item["address_components"];
for (var i=0; i<address_components.length;i++){
var current = address_components[i];
var types = current["types"];
for (var j=0;j<types.length;j++){
var type = types[j];
if((type == "locality") && (city == "")){
city = current["long_name"];
} …
Run Code Online (Sandbox Code Playgroud) 我正在使用"多个nib文件方法"处理2个iOS应用程序.
我不久前遇到了故事板,这在效率方面似乎非常好.
有什么理由不切换到故事板(对于非常简单的应用程序)?在旧方法中是否有任何可能的东西现在不可能实现?
我对摩卡/ OMF非常陌生。我有以下基本测试:
omf('http://localhost:7000', function(client) {
client.get('/apps', function(response){
response.has.statusCode(200);
response.has.body('["test1","test2"]');
});
});
Run Code Online (Sandbox Code Playgroud)
我想检查值“ test2”是否在返回的列表中,但我无法弄清楚这是如何可行的。我在想类似的东西:
omf('http://localhost:7000', function(client) {
client.get('/apps', function(response){
response.has.statusCode(200);
// response.body.split.contains("test2"); // Something like that
});
});
Run Code Online (Sandbox Code Playgroud)
我可以访问response.body然后解析字符串吗?
**更新**
我尝试用mocha进行测试,只是一个简单的状态代码:
request = require("request");
describe('Applications API', function(){
it('Checks existence of test application', function(done){
request
.get('http://localhost:7000/apps')
.expect(200, done);
});
});
Run Code Online (Sandbox Code Playgroud)
但出现以下错误:
TypeError:对象#没有方法“期望”
任何的想法 ?摩卡咖啡是否需要其他插件?
我正在为节点应用程序使用集群npm。
var cluster = require('cluster');
var app = express.createServer({
key: fs.readFileSync('privatekey.pem'),
cert: fs.readFileSync('certificate.pem')
});
cluster(app)
.use(cluster.logger('logs'))
.use(cluster.stats())
.use(cluster.pidfiles('pids'))
.use(cluster.cli())
.listen(443);
Run Code Online (Sandbox Code Playgroud)
但是当我使用端口443时,我的权限被拒绝了。如果使用其他端口,它可以正常工作。显然443是专用于https的,那么如何在我的应用程序中使用它呢?
我有一个包含MKMapView的视图,我在其中显示了sereval引脚:
- (MKAnnotationView *)mapView:(MKMapView *)theMapView viewForAnnotation:(id <MKAnnotation>)annotation
{
NSLog(@"mapView:viewForAnnotation");
// if it's the user location, just return nil.
if ([annotation isKindOfClass:[MKUserLocation class]]){
return nil;
}
static NSString* AnnotationIdentifier = @"AnnotationIdentifier";
MKPinAnnotationView *pinView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:AnnotationIdentifier];
pinView.canShowCallout = YES;
pinView.pinColor = MKPinAnnotationColorPurple;
pinView.annotation = annotation;
return pinView;
}
Run Code Online (Sandbox Code Playgroud)
这工作正常,但方法:
-(void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control
Run Code Online (Sandbox Code Playgroud)
单击引脚时不会调用.似乎点击事件没有传输到引脚,但我无法弄清楚原因.任何的想法 ?
node.js ×4
ios ×3
iphone ×2
adhoc ×1
datamapper ×1
distribution ×1
express ×1
javascript ×1
mkmapview ×1
mocha.js ×1
ruby ×1
shell ×1
sqlite ×1
storyboard ×1
ubuntu ×1
xcode ×1
zsh ×1