我刚开始使用AngularJS以下代码在控制台中给出了错误.
未知提供者:$ scopeProvider < - $ scope < - newActiveOrdersModel.我已经研究过,但看起来像Unknown Provider错误可能由于各种原因而发生.如果有人能指出我哪里出错了会很好吗?
var app;
(function(angular){
app = angular.module('OrdersDashboard',[]);
app.config(['$routeProvider', function($routeProvider) {
$routeProvider.
when('/current/new', {templateUrl: 'orders/partials/new_current', controller: 'newActiveOrdersCtrl'}).
otherwise({redirectTo: '/'});
}]);
app.service('newActiveOrdersModel', ['$scope', '$rootScope',
function($scope, $rootScope){
this.Orders=["This is a test order"];
this.fetchOrders = function(){
console.log("This is a test order");
this.Orders=["This is a test order1111"];
};
}]);
app.controller('newActiveOrdersCtrl', ['$scope', '$rootScope', 'newActiveOrdersModel',
function($scope, $rootScope, newActiveOrdersModel){
$scope.test="Hello World";
}]);
})(angular);
Run Code Online (Sandbox Code Playgroud)
似乎Angular Js无法识别"newActiveOrdersModel".
我试图找出事件冒泡的路径.例如,我有一个标记
<div id="container" onclick="func">
<div id="div1"></div>
<div id="div2">
<div id="div2.1"></div>
<span id="span2.2"></span>
<div id="div2.3">
<button id="btn2.3.1"></button>
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
现在如果单击btn2.3.1,我希望看到事件已经冒出的整个路径,其中btn2.3.1 - > div2.3 - > div2 - > container.有没有办法只在容器上放一个处理程序?(请不要Jquery)
我找到了一个event.path数组.这是什么东西,但是找不到很多关于它的细节.它是否跨浏览器?实现这一目标的正确方法是什么?
我的文档结构是root-> public-> angular-> scripts-> main-> app.js.我用过yeoman角度发生器并设置了咕噜声.我的html文件看起来像这样
<div>
<script src="bower_components/jquery/jquery.js"></script>
<script src="bower_components/angular.js"></script>
<!-- build:js scripts/plugins.js -->
<script src="bower_components/bootstrap/js/bootstrap-alert.js"></script>
<!-- endbuild -->
<!-- build:js scripts/modules.js -->
<script src="bower_components/angular-bootstrap/ui-bootstrap-tpls.js"></script>
<!-- endbuild -->
<!-- build:js scripts/scripts.js -->
<script src="scripts/main/app.js"></script>
<!-- endbuild -->
</div>
Run Code Online (Sandbox Code Playgroud)
html文件位于root-> public-> angular中.运行grunt之后,.tmp和dist文件夹包含来自bower_components的缩小文件.但是scripts.js是空的.如果我将app.js放在脚本中的主文件夹之外,那么它将被连接到tmp/scripts.js中.为什么会这样?我究竟做错了什么 ??
My grunt.js file
// Generated on 2013-12-06 using generator-angular 0.6.0
'use strict';
// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all …Run Code Online (Sandbox Code Playgroud) 在我的 Jupyter 笔记本中,我试图显示我正在通过 Keras 迭代的图像。我使用的代码如下
def plotImages(path, num):
batchGenerator = file_utils.fileBatchGenerator(path+"train/", num)
imgs,labels = next(batchGenerator)
fig = plt.figure(figsize=(224, 224))
plt.gray()
for i in range(num):
sub = fig.add_subplot(num, 1, i + 1)
sub.imshow(imgs[i,0], interpolation='nearest')
Run Code Online (Sandbox Code Playgroud)
但这只是绘制单通道,所以我的图像是灰度的。如何使用 3 个通道输出彩色图像图。?
我正在尝试使用Gradle执行此命令.
.\build\build.exe parse /p 246 /o ".\strings.xml.bcg" /novalidate /l 1033 /sr "@LbaRoot@\settings\default\lss\default.config" "..\app\src\main\res\values\strings.xml"
Run Code Online (Sandbox Code Playgroud)
我在命令行执行时工作正常.我试图使用Gradle复制行为
task runLSBuild(type:Exec) {
workingDir '../outer_build'
//on windows:
commandLine '.\\build\\build.exe','parse /p 246 /o ".\\strings.xml.bcg" /novalidate /l 1033 /sr "@LbaRoot@\\settings\\default\\lss\\default.config" "..\\app\\src\\main\\res\\values\\strings.xml"'
}
Run Code Online (Sandbox Code Playgroud)
但是这个失败并出现错误".\ build\build.exe",系统找不到指定的文件.我需要运行带有工作目录的程序作为outer_build.
关于我哪里出错的任何建议?
我正在尝试将我的应用程序设置为"帐户部分".因此,当用户点击添加帐户时,我的应用名称可见.完整的代码可以在这里找到 我创建了一个身份验证服务.这就是我的清单的样子
<service android:name=".AuthenticatorService">
<intent-filter>
<action android:name="android.accounts.AccountAuthenticator" />
</intent-filter>
<meta-data android:name="android.accounts.AccountAuthenticator"
android:resource="@xml/authenticator" />
</service>
Run Code Online (Sandbox Code Playgroud)
我还创建了一个"authenticator.xml"
<?xml version="1.0" encoding="utf-8"?>
<account-authenticator xmlns:android="http://schemas.android.com/apk/res/android"
android:accountType="com.udinic.auth_example"
android:icon="@drawable/ic_launcher"
android:smallIcon="@drawable/ic_launcher"
android:label="testing"
android:accountPreferences="@xml/prefs"/>
Run Code Online (Sandbox Code Playgroud)
但我仍然没有在帐户下看到我的应用程序.我正在关注本教程, 但它不起作用.你能告诉我我做错了什么吗?
我正在尝试使用Nodejs sequelize来创建数据库.被调用的命令是
CREATE TABLE IF NOT EXISTS `wheel` (`id` INTEGER NOT NULL auto_increment , `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, `shopId` VARCHAR(255), PRIMARY KEY (`id`),
FOREIGN KEY (`shopId`) REFERENCES `shop` (`id`) ON DELETE SET NULL ON UPDATE CASCADE) ENGINE=InnoDB;
CREATE TABLE IF NOT EXISTS `segments` (`segmentID` VARCHAR(255) NOT NULL , `heading` VARCHAR(255) NOT NULL, `subHeading` VARCHAR(255) NOT NULL, `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, `wheelId` INTEGER, PRIMARY KEY (`segmentID`),
FOREIGN KEY (`wheelId`) REFERENCES `wheel` (`id`) ON …Run Code Online (Sandbox Code Playgroud) 所以我有一个形状(224,244,3)的图像作为ndarray.我有一个看起来像这样的图像的边界框注释
{
annotations: [
{
class: "rect",
height: 172,
width: 341,
x: 282,
y: 165
},
{
class: "rect",
height: 172,
width: 353,
x: 592,
y: 90
}
],
class: "image",
filename: "img_05974.jpg"
}
Run Code Online (Sandbox Code Playgroud)
如何裁剪numpy数组,以便它给我一个像上面的边界矩形的图像?
我想绘制一个38像素宽,38像素长的矩形.
<div id="dpi1" style="height: 38px ; width: 38px;background-color: red"></div>
Run Code Online (Sandbox Code Playgroud)
这按预期工作.但是,当我尝试使用此代码在画布上绘制矩形时
var cxt=canvas.getContext("2d");
cxt.beginPath();
cxt.rect(0, 0, 38, 38);
cxt.fillStyle = 'yellow';
cxt.fill();
cxt.stroke();
Run Code Online (Sandbox Code Playgroud)
我得到一个较小的矩形.为什么会这样?这是否意味着画布中的网格(x,y坐标)小于1像素?
我已经在我的应用程序中实现了cardview,并且功能向右滑动以删除.当我向右滑动卡片视图时,它会返回并返回十分之一秒,然后增益消失,导致闪烁.
我的代码对于滑动触摸侦听器是这样的.我正在更新内容解析器以及通知适配器.
SwipeableRecyclerViewTouchListener swipeTouchListener =
new SwipeableRecyclerViewTouchListener(recyclerView,
new SwipeableRecyclerViewTouchListener.SwipeListener() {
@Override
public boolean canSwipe(int position) {
return true;
}
@Override
public void onDismissedBySwipeRight(RecyclerView recyclerView, int[] reverseSortedPositions) {
for (int position : reverseSortedPositions) {
Post post = posts.get(position);
post.setIsDeleted(true);
getActivity().getContentResolver().update(PostsContract.PostEntry.buildUriForPost(posts.get(position).get_ID()), Utility.changePostToContentValue(post), "_id=" + post.get_ID(),null);
posts.remove(position);
adapter.notifyItemRemoved(position);
}
}
});
recyclerView.addOnItemTouchListener(swipeTouchListener);
Run Code Online (Sandbox Code Playgroud)
我的onLoadFinished看起来像这样
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
if(data!=null && data.getCount() != posts.size()){
posts.clear();
while (data.moveToNext()){
Post post = new Post(data);
posts.add(post);
adapter.notifyDataSetChanged();
}
}
}
Run Code Online (Sandbox Code Playgroud)
当我提出突破点.它在处理器onDismissedSwipeByRight中工作正常,其中删除的卡片不可见.但是当谈到OnLoadFinished断点时,我看到删除的卡片回来然后在函数执行后自动关闭,即使帖子Arraylist的大小完全相同.
由于删除的卡片返回十分之一秒.这会导致闪烁.谁能告诉我哪里出错了?
android android-adapter android-cursorloader android-cardview
android ×3
javascript ×3
angularjs ×2
matplotlib ×2
numpy ×2
python ×2
canvas ×1
database ×1
dom ×1
gradle ×1
gradlew ×1
grunt-usemin ×1
gruntjs ×1
html ×1
html5 ×1
html5-canvas ×1
image ×1
mysql ×1
pixel ×1
sequelize.js ×1
sql ×1
yeoman ×1