我最近从2.3.0升级到Cordova 2.9.0.按照所有升级说明后,我能够让应用程序在模拟器中启动.但是,在Xcode中我看到以下错误:
ERROR: Plugin 'Device' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml.
-[CDVCommandQueue executePending] [Line 103] FAILED pluginJSON = ["Device1776032119","Device","getDeviceInfo",[]]
ERROR: Plugin 'NetworkStatus' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml.
-[CDVCommandQueue executePending] [Line 103] FAILED pluginJSON = ["NetworkStatus1776032120","NetworkStatus","getConnectionInfo",[]]
-[CDVCommandQueue executePending] [Line 103] FAILED pluginJSON = ["INVALID","Logger","logLevel",["LOG","deviceready has not fired after 5 seconds."]]
ERROR: Plugin 'Logger' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml. …
Run Code Online (Sandbox Code Playgroud) 当我们定义@ font-face样式时,我们可以定义引用的文件是否用于字体的粗体,斜体或粗体斜体版本,如本SO问题中所述:
例:
@font-face {
font-family: 'FontinSans';
src: local('?'), url('fontin_sans_regular.woff') format('woff');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'FontinSans';
src: local('?'), url('fontin_sans_bold.woff') format('woff');
font-weight: bold;
font-style: normal;
}
Run Code Online (Sandbox Code Playgroud)
但是,Font Squirrel不会以这种方式生成@ font-face工具包.他们做了类似的事情:
@font-face {
font-family: 'FontinSans';
src: local('?'), url('fontin_sans_regular.woff') format('woff');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'FontinSansBold';
src: local('?'), url('fontin_sans_bold.woff') format('woff');
font-weight: normal;
font-style: normal;
}
Run Code Online (Sandbox Code Playgroud)
这意味着在我们的CSS文件中我们必须做这样的事情:
h2 {
font-family: 'FontinSansBold', Verdana, sans-serif;
font-weight: normal;
}
Run Code Online (Sandbox Code Playgroud)
为什么Font Squirrel不使用font-weight和font-style声明来区分粗体和斜体变体?为什么要使用单独的字体系列?他们是否在某些浏览器中了解(缺乏)对此功能的支持?
我正在设置一个带有flask-login扩展名的Flask应用程序.flask-login文档建议设置一个替代令牌生成器,它不仅仅使用用户ID和app secret来创建会话令牌(这是默认方法).但它没有提供任何关于如何做到这一点的明确建议.
所以,因为User.get_auth_token()
我正在使用make_secure_token
带有用户电子邮件和密码作为参数的函数(所以我得到这些参数的哈希+ app secret).
接下来,我需要能够通过token_loader
回调从令牌中获取用户.在flask-login中生成令牌的默认方法是包括原始用户ID和用户ID + app secret的哈希值.这使得从令牌中查找用户非常简单 - 只需抓住ID并查找用户即可.
但是我应该在会话令牌中公开用户ID吗?如果我不这样做,是否应该将会话令牌存储在数据库中或其他具有用户ID的位置以进行查找?
简而言之:有没有人知道创建安全令牌和相应token_loader
回调的最佳做法是什么?
所以我有一个处理测试结果的Django应用程序,我试图找到某个评估的中位数分数.我认为这会奏效:
e = Exam.objects.all()
total = e.count()
median = int(round(total / 2))
median_exam = Exam.objects.filter(assessment=assessment.id).order_by('score')[median:1]
median_score = median_exam.score
Run Code Online (Sandbox Code Playgroud)
但它总是返回一个空列表.我可以用这个得到我想要的结果:
e = Exam.objects.all()
total = e.count()
median = int(round(total / 2))
exams = Exam.objects.filter(assessment=assessment.id).order_by('score')
median_score = median_exam[median].score
Run Code Online (Sandbox Code Playgroud)
我只是不想查询整套考试.我想过只编写一个原始MySQL查询,看起来像:
SELECT score FROM assess_exam WHERE assessment_id = 5 ORDER BY score LIMIT 690,1
Run Code Online (Sandbox Code Playgroud)
但如果可能的话,我想留在Django的ORM中.大多数情况下,我只是在困扰我,似乎无法使用带有过滤器和限制的order_by.有任何想法吗?
我一直在尝试将D3.js与Angular集成,并遵循本教程:http: //www.ng-newsletter.com/posts/d3-on-angular.html
本教程创建了一个包含的d3模块d3Service
,并将其注入到指令中.我的应用程序结构略有不同,但每当我尝试注入d3服务时,它就会显示undefined
在我的指令link
函数中.我可以毫无问题地将d3服务注入我的控制器.这是我正在做的事情:
app.js
:
var sentimentApp = angular.module('sentimentApp', [
'ngRoute',
'ngSanitize',
'sentimentAppServices',
'sentimentAppDirectives',
'sentimentAppControllers'
]);
Run Code Online (Sandbox Code Playgroud)
在内部services.js
,我有几个服务,其中一个是d3:
var sentimentAppServices = angular.module('sentimentAppServices', ['ngResource'])
// other services
.factory('d3', [function(){
var d3;
d3 = // d3 library code here
return d3;
}]);
Run Code Online (Sandbox Code Playgroud)
现在directives.js
:
var sentimentAppDirectives = angular.module('sentimentAppDirectives', ['sentimentAppServices']);
sentimentAppDirectives.directive('lsPieChart', ['d3', function($compile, d3){
return {
// scope & template
link: function($scope, elem, attr, ctrl) {
console.log(d3); // undefined
}
}
Run Code Online (Sandbox Code Playgroud)
有小费吗?谢谢.
我正在使用Foundation 4.3.0进行项目,并试图以最基本的方式设置Orbit.javascript和CSS似乎正确加载,图像正在加载,所有额外的元素都插入,等等.但主要<ul>
始终具有0px的高度.这是我的HTML:
<div class="row">
<section class="large-12 columns">
<div class="slideshow-wrapper">
<div class="preloader"></div>
<ul data-orbit="">
<li><img src="/media/cache/8a/ec/8aec9d6a99dea3db235f24712e8f3f88.jpg"></li>
<li><img src="/media/cache/20/88/208812a64eee2e7e9b8efe4b5f73c990.jpg"></li>
</ul>
</div>
</section>
</div>
Run Code Online (Sandbox Code Playgroud)
这是HTML曾经做过foundation.orbit.js
的事情:
<div class="row">
<section class="large-12 columns">
<div class="slideshow-wrapper">
<div class="preloader"></div>
<div class="orbit-container orbit-stack-on-small">
<ul data-orbit="" class="orbit-slides-container" style="margin-left: -100%; width: 400%; height: 0px;">
<li data-orbit-slide="" style="width: 25%;"><img src="/media/cache/20/88/208812a64eee2e7e9b8efe4b5f73c990.jpg"></li>
<li class="active" style="width: 25%;"><img src="/media/cache/8a/ec/8aec9d6a99dea3db235f24712e8f3f88.jpg"></li>
<li style="width: 25%;"><img src="/media/cache/20/88/208812a64eee2e7e9b8efe4b5f73c990.jpg"></li>
<li data-orbit-slide="" style="width: 25%;"><img src="/media/cache/8a/ec/8aec9d6a99dea3db235f24712e8f3f88.jpg"></li>
</ul>
<a href="#" class="orbit-prev">Prev <span></span></a>
<a href="#" class="orbit-next">Next <span></span></a>
<div class="orbit-slide-number">
<span>1</span> of <span>2</span> …
Run Code Online (Sandbox Code Playgroud)