小编Mar*_*tin的帖子

PhoneGap:在默认浏览器中打开外部链接(在应用程序外部)

我正试图通过PhoneGap应用程序在Safari(在iPhone上)打开链接.我正在使用PhoneGap 3.1.0版,并使用PhoneGap Build来构建应用程序.

我在页面上有两个链接(如下面的www/index.html所示).两个链接都在PhoneGap应用程序内打开.我可以看到PhoneGap已正确加载,因为警报('设备就绪!'); 被触发了.

我需要更改什么,在默认浏览器中打开链接(在应用程序外部)?

WWW/config.xml的文件看起来像这样:

<?xml version="1.0" encoding="UTF-8"?>

<widget xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0" id="com.company.appname" version="0.0.3">
  <name>AppName</name>
  <description>description</description>
  <author href="http://www.example.com/" email="hello@example.com">
    Company
  </author>
  <preference name="phonegap-version" value="3.1.0" />
  <preference name="orientation" value="portrait" />
  <preference name="stay-in-webview" value="false" />

  <gap:plugin name="org.apache.cordova.inappbrowser" version="0.2.3" />
  <gap:plugin name="org.apache.cordova.dialogs" version="0.2.2" />
  <gap:plugin name="com.phonegap.plugins.pushplugin" version="2.0.5" />

  <plugins>
    <plugin name="InAppBrowser" value="CDVInAppBrowser" />
  </plugins>

  <feature name="InAppBrowser">
    <param name="ios-package" value="CDVInAppBrowser" />
  </feature>
  <access origin="*" />
</widget>
Run Code Online (Sandbox Code Playgroud)

WWW/index.html的文件看起来像这样:

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, …
Run Code Online (Sandbox Code Playgroud)

phonegap-plugins cordova phonegap-build inappbrowser

26
推荐指数
4
解决办法
7万
查看次数

获取belongsTo ID而不获取记录

我正在尝试获取belongsTo ID而不获取实际记录.我的JSON API返回belongsTo关系的ID.

我有以下型号

App.Recipe = DS.Model.extend(
  title: DS.attr()
  ingredients: DS.hasMany('ingredient', async: true)
)

App.Ingredient = DS.Model.extend(
  recipe: DS.belongsTo('recipe')
  product: DS.belongsTo('product', async: true)
)

App.Product = DS.Model.extend(
  title: DS.attr()
)
Run Code Online (Sandbox Code Playgroud)

这是我的路线:

App.RecipeIndexRoute = Ember.Route.extend(
  model: (args) ->
    @store.find('recipe', args.recipe_id)
)
Run Code Online (Sandbox Code Playgroud)

这是我的控制器:

我正在尝试在此控制器中找到产品ID.

App.RecipeIndexController = Ember.ObjectController.extend(
  hasRecipeInCart: null

  actions:
    toggleCart: ->
      @content.get('ingredients').then((ingredients) =>
        # how do I get product id here, without lookup up the product relation?
        # this 'get' makes Ember call: /api/v1/products/1
        # I simply want the product ID …
Run Code Online (Sandbox Code Playgroud)

ember.js ember-data

20
推荐指数
3
解决办法
6069
查看次数

本地安装的TTF会覆盖Google字体

我正在使用Google Fonts中的Ubuntu字体:

<link href='http://fonts.googleapis.com/css?family=Ubuntu:300,400,300italic,400italic,500,500italic,700,700italic' rel='stylesheet' type='text/css' />
Run Code Online (Sandbox Code Playgroud)

我的样式表:

body {
    font-family: 'ubuntu',arial;
}
Run Code Online (Sandbox Code Playgroud)

它可以工作,但如果安装一个具有相同名称的字体(Ubuntu),它将覆盖来自Google字体的字体.

是否可以强制浏览器使用Google字体中的那个?

css fonts google-font-api

10
推荐指数
1
解决办法
4429
查看次数

每行的开头和结尾都有相同的填充

我有一个span元素,里面有一些文字.我希望文本具有纯色背景颜色以及使用相同数量的填充开始/结束每一行.

这个jsfiddle显示了这个问题:http: //jsfiddle.net/VwsQg/

我发现了这个非常相似的问题:在每行文本的开头和结尾添加填充,但我也需要在每一行之间留出一些空格.

这张图片说明了我想要完成的结果:

在此输入图像描述

先感谢您.

html javascript css

7
推荐指数
1
解决办法
295
查看次数

Ember.js有很多复选框列表

我有以下两种型号:

App.Child = DS.Model.extend({
    name: DS.attr('string')
});
Run Code Online (Sandbox Code Playgroud)

和:

App.Activity = DS.Model.extend({
    children: DS.hasMany('child',{async:true}),
    name: DS.attr('string')
});
Run Code Online (Sandbox Code Playgroud)

我想使用复选框在hasMany关系中在现有子节点之间进行选择.

例如,我有这三个孩子:

App.Child.FIXTURES = [
  { id: 1, name: 'Brian' },
  { id: 2, name: 'Michael' },
  { id: 3, name: 'James' }
];
Run Code Online (Sandbox Code Playgroud)

用户应该能够在创建或编辑活动时使用复选框,以选择要添加到hasMany关系的子项.

我创建了一个JSFiddle来说明我的问题:http://jsfiddle.net/Dd6Wh/.点击"创建新活动"以查看我正在尝试执行的操作.

基本上它与Ember.Select [...] multiple ="true"相同,但是对于复选框.

对于像Ember.js这样的事情,正确的方法是什么?

javascript ember.js ember-data

5
推荐指数
1
解决办法
2541
查看次数

Ghostscript创建了巨大的图像,比预期的像素数量级更多

我使用此Ghostscript命令将PDF转换为图像:

gs \
 -q -dQUIET -dPARANOIDSAFER -dBATCH -dNOPAUSE -dNOPROMPT \
 -dCOLORSCREEN \
 -dDOINTERPOLATE \
 -dMaxBitmap=500000000 \
 -dNumRenderingThreads=4 \
 -dAlignToPixels=0 \
 -dGridFitTT=0 \
 -dTextAlphaBits=4 \
 -dGraphicsAlphaBits=4 \
 -sDEVICE=jpeg \
 -dFirstPage=1 \
 -dDEVICEWIDTHPOINTS=1654 \
 -dDEVICEHEIGHTPOINTS=2333 \
 -dDEVICEXRESOLUTION=1654 \
 -dDEVICEYRESOLUTION=2333 \
 -sOutputFile=d:\images\%01d.jpg \
  d:\test.pdf
Run Code Online (Sandbox Code Playgroud)

它会转换图像,但图像为13675x27280像素.我想要1654x2333px中的图像.我究竟做错了什么?

ghostscript

4
推荐指数
2
解决办法
2579
查看次数

Lucene .NET 搜索结果

我正在使用此代码来索引:

public void IndexEmployees(IEnumerable<Employee> employees)
{
    var indexPath = GetIndexPath();
    var directory = FSDirectory.Open(indexPath);

    var indexWriter = new IndexWriter(directory, new StandardAnalyzer(Version.LUCENE_29), true, IndexWriter.MaxFieldLength.UNLIMITED);

    foreach (var employee in employees)
    {
        var document = new Document();
        document.Add(new Field("EmployeeId", employee.EmployeeId.ToString(), Field.Store.YES, Field.Index.NO, Field.TermVector.NO));
        document.Add(new Field("Name", employee.FirstName + " " + employee.LastName, Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.NO));
        document.Add(new Field("OfficeName", employee.OfficeName, Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.NO));
        document.Add(new Field("CompetenceRatings", string.Join(" ", employee.CompetenceRatings.Select(cr => cr.Name)), Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.NO));

        indexWriter.AddDocument(document);
    }

    indexWriter.Optimize();
    indexWriter.Close();

    var indexReader = IndexReader.Open(directory, true);
    var spell = new …
Run Code Online (Sandbox Code Playgroud)

c# lucene lucene.net c#-4.0

4
推荐指数
1
解决办法
7364
查看次数

Ember减少了对hasMany和belongsTo查找的请求

我有以下三种型号:

ConversationApp.Post = DS.Model.extend(
  body: DS.attr()
  replies: DS.hasMany('reply', async: true)
  author: DS.belongsTo('user', async: true)
  likedBy: DS.hasMany('user', async: true)
)

ConversationApp.Reply = DS.Model.extend(
  body: DS.attr()
  post: DS.belongsTo('post')
  author: DS.belongsTo('user', async: true)
  likedBy: DS.hasMany('user', async: true)
)

ConversationApp.User = DS.Model.extend(
  firstName: DS.attr()
  lastName: DS.attr()
)
Run Code Online (Sandbox Code Playgroud)

我的索引路由进行此调用:

ConversationApp.IndexRoute = Em.Route.extend(
  model: (args) ->
    @store.find('post', page: 1) # => /api/v1/posts?page=1
)
Run Code Online (Sandbox Code Playgroud)

在进行该呼叫之后,Ember开始获取第一页所需的所有用户 - 在第一页上共有17个(!)不同的用户请求(具有10个帖子).以下是Ember向服务器发出的3个请求示例:

  • / API/V1 /用户/ 11375
  • / API/V1 /用户/ 4383
  • / API/V1 /用户?IDS [] = 34588&IDS [] = 7442&IDS [] = 10294 …

handlebars.js ember.js ember-data

4
推荐指数
1
解决办法
1374
查看次数

无法使用Chrome Experimental Devtools API

我正在尝试使用Chrome Experimental Devtools API.

我尝试使用以下命令运行Chrome: - enable-experimental-extension-apis,如下所示:http://developer.chrome.com/extensions/experimental.html并在标记设置中启用了"Experimental Extension API".

当我在Chrome(或Canary)中打开控制台时,我会得到以下信息:

  • chrome.devtools:undefined
  • chrome.experimental:undefined

我正在运行Chrome 21.0.1180.77 beta-m.我也试过金丝雀.

我错过了什么?

google-chrome google-chrome-extension google-chrome-devtools

3
推荐指数
1
解决办法
3360
查看次数

多点之间的最短路线

我需要找到多点之间的最短路径.让我们说我有以下四点:

var startPoint = new Point(1, 1);
var pointsToGoPast = new List<Point> { new Point(3,1); new Point(2,4); };
var endPoint = new Point(10, 10);
Run Code Online (Sandbox Code Playgroud)

因此,为了获得从startPoint到endPoint的最短路径,我想找出首先要经过的点.

谁能帮我?

更新:必须经过pointsToGoPast列表中的每个点.每条路线的成本都是均匀的.

c# math geometry 2d

-2
推荐指数
1
解决办法
1万
查看次数