只是想知道如何在Angular Material中更改默认字体...
默认是Roboto,我找不到将其更改为不同字体的方法.
有没有机会以某种方式将www重定向到node.js中的非www URL?由于节点Web服务器中没有htaccess,我很好奇如何做到这一点.
我希望我的模型的主键是一个自动递增的整数.这是我的模型的样子
class Region(db.Model):
__tablename__ = 'regions'
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
name = db.Column(db.String(100))
parent_id = db.Column(db.Integer, db.ForeignKey('regions.id'))
parent = db.relationship('Region', remote_side=id, primaryjoin=('Region.parent_id==Region.id'), backref='sub-regions')
created_at = db.Column(db.DateTime, default=db.func.now())
deleted_at = db.Column(db.DateTime)
Run Code Online (Sandbox Code Playgroud)
上面的代码创建了我的表,但没有id自动增量.因此,如果在我的插入查询中我错过了该id字段,它会给我这个错误
错误:列"id"中的空值违反非空约束
所以我把id声明改成了这样的样子
id = db.Column(db.Integer, db.Sequence('seq_reg_id', start=1, increment=1),
primary_key=True)
Run Code Online (Sandbox Code Playgroud)
还是一样的错误.上面的代码有什么问题?
我的XML文件如下所示:
<?xml version="1.0"?>
<ItemSearchResponse xmlns="http://webservices.amazon.com/AWSECommerceService/2008-08-19">
<Items>
<Item>
<ItemAttributes>
<ListPrice>
<Amount>2260</Amount>
</ListPrice>
</ItemAttributes>
<Offers>
<Offer>
<OfferListing>
<Price>
<Amount>1853</Amount>
</Price>
</OfferListing>
</Offer>
</Offers>
</Item>
</Items>
</ItemSearchResponse>
Run Code Online (Sandbox Code Playgroud)
我想做的就是提取ListPrice.
这是我正在使用的代码:
>> from elementtree import ElementTree as ET
>> fp = open("output.xml","r")
>> element = ET.parse(fp).getroot()
>> e = element.findall('ItemSearchResponse/Items/Item/ItemAttributes/ListPrice/Amount')
>> for i in e:
>> print i.text
>>
>> e
>>
Run Code Online (Sandbox Code Playgroud)
绝对没有输出.我也试过了
>> e = element.findall('Items/Item/ItemAttributes/ListPrice/Amount')
Run Code Online (Sandbox Code Playgroud)
没有不同.
我究竟做错了什么?
我有一个像这样的小角度应用程序:
HTML
<body ng-app>
<div ng-controller="Ctrl">
<div ng-repeat="user in users | filter:1">
<span>{{ user.username }}, {{ user.id }}</span>
</div>
</div>
</body>
Run Code Online (Sandbox Code Playgroud)
app.js
function Ctrl($scope) {
$scope.users = [
{"id":1,"username":"simon",},
{"id":8,"username":"betty",},
{"id":14,"username":"archie",},
{"id":3,"username":"jumbo1"},
]
}
Run Code Online (Sandbox Code Playgroud)
产量
simon, 1
archie, 14
jumbo1, 3
Run Code Online (Sandbox Code Playgroud)
我想要做的是仅在id字段上过滤过滤器参数AND过滤器的完全匹配.
基本上,我希望输出为:
产量
simon, 1
Run Code Online (Sandbox Code Playgroud)
我正在使用Angular 1.2.
我已经构建了一个工厂来处理我的控制器的功能,但不知何故控制器在其中一个函数上返回错误:
错误:Auth.getUser(...).成功不是函数@ http:// localhost:8080/app/controllers/mainCtrl.js:10:1
...
我不知道这里发生了什么,其余的功能似乎工作得很好?
主控制器:
angular.module('mainCtrl', [])
.controller('mainController', function($rootScope, $location, Auth) {
var vm = this;
vm.loggedIn = Auth.isLoggedIn();
$rootScope.$on('$routeChangeStart', function() {
vm.loggedIn = Auth.isLoggedIn();
Auth.getUser()
.success(function(data) {
vm.user = data;
});
});
vm.doLogin = function() {
Auth.login(vm.loginData.username, vm.loginData.password)
.success(function(data) {
$location.path('/users');
});
};
});
Run Code Online (Sandbox Code Playgroud) 有没有可能改变mat-spinner或大小的方法mat-progress-circle?
我读的文档mat-spinner和mat-progress-circle,但他们表示,mat-diameter中断和微调将父元素的大小.
如何mat-spinner在mat-button不改变按钮高度的情况下放入左角?
<button mat-button>
<mat-spinner style="float:left;"></mat-spinner>
processing....
</button>
Run Code Online (Sandbox Code Playgroud)
我也尝试使用内联css来改变高度
style="float:left;height:10px;width:10px;
Run Code Online (Sandbox Code Playgroud)
但是看起来并不好看.
我试图在我的matplotlib图中拟合最适合的线性线.我不断得到x和y没有相同的第一个维度的错误.但他们都有15个长度.我做错了什么?
import matplotlib.pyplot as plt
from scipy import stats
import numpy as np
x = [0.46,0.59,0.68,0.99,0.39,0.31,1.09,0.77,0.72,0.49,0.55,0.62,0.58,0.88,0.78]
y = [0.315,0.383,0.452,0.650,0.279,0.215,0.727,0.512,0.478,0.335,0.365,0.424,0.390,0.585,0.511]
xerr = [0.01]*15
yerr = [0.001]*15
plt.rc('font', family='serif', size=13)
m, b = np.polyfit(x, y, 1)
plt.plot(x,y,'s',color='#0066FF')
plt.plot(x, m*x + b, 'r-') #BREAKS ON THIS LINE
plt.errorbar(x,y,xerr=xerr,yerr=0,linestyle="None",color='black')
plt.xlabel('$\Delta t$ $(s)$',fontsize=20)
plt.ylabel('$\Delta p$ $(hPa)$',fontsize=20)
plt.autoscale(enable=True, axis=u'both', tight=False)
plt.grid(False)
plt.xlim(0.2,1.2)
plt.ylim(0,0.8)
plt.show()
Run Code Online (Sandbox Code Playgroud) 我昨天得到了1803更新,今天意识到我在Bitvise SSH上出错了.
我有多个VPS,我得到同样的错误.
这是我收到的错误消息:
SSH2会话因错误而终止.原因:组件会话/传输/ kexHandler出错.错误类:流量,代码:ComponentException,消息:异常在组分:视窗CNG(86)与加法:AsymKey:CngAgree:意想不到secretData-> cbStruct.
在Angular 1中,我的配置如下所示:
$routeProvider
.when("/news", {
templateUrl: "newsView.html",
controller: "newsController",
resolve: {
message: function(messageService){
return messageService.getMessage();
}
}
})
Run Code Online (Sandbox Code Playgroud)
如何在Angular2中使用resolve?
python ×3
angular ×2
angularjs ×2
css ×1
elementtree ×1
express ×1
flask ×1
html ×1
matplotlib ×1
node.js ×1
numpy ×1
postgresql ×1
sqlalchemy ×1
ssh ×1
windows ×1
xml ×1
xpath ×1