我使用Windows 7,Python 2.7.9加上最新版本的IPython 3.1.
我%python在IPython笔记本内部运行并运行单元格,而不是返回Python版本,它没有运行并跳转到新行并打印In [*]而不是行号.现在ipython中没有运行任何行我尝试运行单元格值时会忽略所有内容.
谁知道发生了什么?
是否可以将用户设置配置为在打开 Visual Studio Code 时自动启动集成终端?
我所说的孤儿词是指一行中的一个单词。是否可以借助 CSS 来避免任何只有一个单词的行?
例如 SERUM 是一个孤立词:
ECSTASY OF EXISTENCE FIRMING ANTIOXIDANT BODY
SERUM
Run Code Online (Sandbox Code Playgroud)
它应该看起来像这样
ECSTASY OF EXISTENCE FIRMING ANTIOXIDANT
BODY SERUM
Run Code Online (Sandbox Code Playgroud)
我正在尝试使用新的HttpClient类而不是旧的Http.
我想映射我从subscribe方法获得的数据,但得到以下错误.关于我为何得到这个的任何建议?
码:
export class YoutubeSearchService {
constructor(
private http: HttpClient,
@Inject(YOUTUBE_API_KEY) private apiKey: string,
@Inject(YOUTUBE_API_URL) private apiUrl: string,
) { }
search(query: string): Observable<SearchResult[]> {
const params: string = [
`q=${query}`,
`key=${this.apiKey}`,
`part=snippet`,
`type=video`,
`maxResults=10`,
].join("&");
const queryUrl = `${this.apiUrl}?${params}`;
return this.http.get(queryUrl).subscribe(data => {
data.map(item => {
return new SearchResult({
id: item.id.videoId,
title: item.snippet.title,
description: item.snippet.description,
thumbnailUrl: item.snippet.thumbnails.high.url,
});
});
});
}
}
Run Code Online (Sandbox Code Playgroud)
错误:
ERROR in src/app/services/youtube-search.service.ts(26,5): error TS2322: Type 'Subscription' is not assignable to type 'Observable<SearchResult[]>'.
Property '_isScalar' …Run Code Online (Sandbox Code Playgroud) 我正在使用Angular 4,Bootstrap 4并尝试实现固定的可滚动右div和固定的左div.它应该与Trulia非常相似.
Bootstrap在版本4中删除了Affix jQuery插件,所以这个方法不再有效,他们建议使用position:sticky,但我无法让它工作.
请帮忙!
的index.html
<div class="container-fluid">
<div class="row h-100">
<div class="col-md-6">
<div id="left-container">
<div class="search-property">
<input type="text">
</div>
</div>
</div>
<div class="col-md-6">
<div id="right-container">
<app-home-right></app-home-right>
</div>
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
style.css文件
#left-container {
height: 100%;
position: fixed;
width: inherit;
}
#right-container {
position: absolute;
}
.search-property {
position: relative;
top: 50%;
transform: perspective(1px) translateY(-50%);
margin-left: 50%;
}
.nopadding {
padding: 0 !important;
margin: 0 !important;
}
.border {
border: 1px solid black;
}
Run Code Online (Sandbox Code Playgroud) 当 /logout 路由被命中时,我试图将用户重定向到登录页面。身份验证正在工作(删除了 jwt 令牌,但应用程序无法重定向到 /login。
另外,如果我这样做/应用程序也会崩溃。
在登录路由上,我使用了 react-router-dom 包中的 withRouter,我可以访问this.props.history.push('/redirect_to_a_new_path'),但是当我尝试使用withRouter方法包装 App 组件时,它也会崩溃。
请帮忙!
这是github 仓库:
应用程序.js
import React, { Component } from "react";
import {
BrowserRouter as Router,
Route,
Switch,
withRouter
} from "react-router-dom";
import MuiThemeProvider from "material-ui/styles/MuiThemeProvider";
import lightBaseTheme from "material-ui/styles/baseThemes/lightBaseTheme";
import getMuiTheme from "material-ui/styles/getMuiTheme";
import injectTapEventPlugin from "react-tap-event-plugin";
// Components
import Navbar from "./components/Navbar";
import HomePage from "./components/HomePage";
import SpotMap from "./components/SpotMap";
import SignUpPage from "./components/containers/SignUpPage";
import LoginPage from "./components/containers/LoginPage";
import …Run Code Online (Sandbox Code Playgroud) javascript reactjs react-router react-router-v4 react-router-dom
他们设置 width={width} 和 height={height},如果我这样做,我什么也不会显示...要显示某些内容,我需要将高度设置为某个值,例如 600px,但我想将其设置为 100%窗户的高度。
我怎么做?
CSS
.AutoSizerWrapper {
flex: 1 1 auto;
}
Run Code Online (Sandbox Code Playgroud)
这是我的代码。
<div className="AutoSizerWrapper">
<AutoSizer>
{({ width, height }) => (
<Table
width={width}
height={600}
headerHeight={50}
rowHeight={50}
rowCount={this.props.list.length}
rowGetter={({ index }) => this.props.list[index]}
>
<Column label="#" dataKey="_id" width={100} flexGrow={1} />
<Column
label="Part Number"
dataKey="itemNumber"
disableSort
width={100}
flexGrow={1}
/>
<Column
width={100}
label="Part Name"
dataKey="partName"
disableSort
flexGrow={1}
/>
<Column
width={100}
label="Part Description"
dataKey="partDescription"
disableSort
flexGrow={1}
/>
<Column
width={100}
label="customs Tariff Number"
dataKey="customsTariff"
disableSort
flexGrow={1} …Run Code Online (Sandbox Code Playgroud) 我已经安装了https://materialdesignicons.com/
npm install @mdi/font
Run Code Online (Sandbox Code Playgroud)
在 nuxt.config.js 文件中,我不确定如何导入图标模块...请帮忙!
export default {
build: {
/*
** You can extend webpack config here
*/
extend(config, ctx) {}
},
buildModules: [
// Simple usage
'@nuxtjs/vuetify',
// With options
// ['@nuxtjs/vuetify', { /* module options */ }]
]
}
Run Code Online (Sandbox Code Playgroud)
以下是使用 MDI 图标的 Vuetify 选项卡的示例。
<v-icon large color="blue darken-2">mdi-message-text</v-icon>
Run Code Online (Sandbox Code Playgroud) 当我运行下面的代码时,我收到此错误"主循环'builtin_function_or_method'对象不可迭代":
我有搜索stackoverflow,但无法找到我的问题的答案...
我检查过拼写错误,但无法找到任何错误.请帮我!
import urllib2
import time
import datetime
stocksToPull = 'AAPL','GOOG','MSFT','CMG','AMZN','EBAY','TSLA'
def pullData(stock):
try:
print 'Currently pulling',stock
print str(datetime.datetime.fromtimestamp(time.time()).strftime('%Y-%m-%d %H:%M:%S'))
urlToVisit = 'http://chartapi.finance.yahoo.com/instrument/1.0/'+stock+'/chartdata;type=quote;range=5d/csv'
saveFileLine = stock+'.txt'
try:
readExistingData = open(saveFileLine,'r').read()
splitExisting = readExistingData.split('\n')
mostRecentLine = splitExisting[-2]
lastUnix = mostRecentLine.split(',')[0]
except:
lastUnix = 0
saveFile = open(saveFileLine,'a')
sourceCode = urllib2.urlopen(urlToVisit).read()
splitSource = sourceCode.split
for eachLine in splitSource:
splitLine = eachLine.split(',')
if len(splitLine) ==6:
if splitLine[0] > lastUnix:
if 'values' not in eachLine:
lineToWrite = eachLine+'\n'
saveFile.write(lineToWrite)
saveFile.close()
print 'Pulled',stock
print …Run Code Online (Sandbox Code Playgroud) 我有一个使用Http的工作代码,我想学习如何将其转换为使用最新的HttpClient.
我已完成以下步骤:
现在,以下步骤我无法正确(如何重写return this.http.get(queryUrl)..)
有任何想法吗?
...
使用Http工作的代码:
import { Injectable, Inject } from "@angular/core";
import { Http, Response } from "@angular/http";
import { Observable } from "rxjs/Observable";
import { SearchResult } from "../models/search-results.model";
export const YOUTUBE_API_KEY = "AIzaSyCIYsOjnkrIjZhVCFwqNJxe1QswhsliciQ";
export const YOUTUBE_API_URL = "https://www.googleapis.com/youtube/v3/search";
@Injectable()
export class YoutubeSearchService {
constructor(
private http: Http,
@Inject(YOUTUBE_API_KEY) private apiKey: string,
@Inject(YOUTUBE_API_URL) private apiUrl: string,
) {}
search(query: string): Observable<SearchResult[]> {
const params: string = …Run Code Online (Sandbox Code Playgroud) 我正试图在我的Angular 4安装上使用angular-google-maps/@ agm/core.
我在组件html文件中有这个:
<sebm-google-map [latitude]="lat" [longitude]="lng">
<sebm-google-map-marker [latitude]="lat" [longitude]="lng"></sebm-google-map-marker>
</sebm-google-map>
Run Code Online (Sandbox Code Playgroud)
当我运行它时,我收到此错误消息:
Unhandled Promise rejection: Template parse errors:
Can't bind to 'latitude' since it isn't a known property of 'sebm-google-map'.
1. If 'sebm-google-map' is an Angular component and it has 'latitude' input, then verify that it is part of this module.
2. If 'sebm-google-map' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
3. To allow any property …Run Code Online (Sandbox Code Playgroud) 可以说我有一个带有不同键的对象列表,其中之一是name。
var resulttemp = [{name: "HYD. CYLINDER"}, {name: "pelle"}, {name: "HYD. CYLINDER"}, {name: "1212"}, {name: "pelle"}]
Run Code Online (Sandbox Code Playgroud)
最终结果应为:
var uniquePartNamesWithCount = [{name: "HYD. CYLINDER", count: 2}, {name: "pelle", count: 2}, {name: "1212", count: 1}]
Run Code Online (Sandbox Code Playgroud)
我知道如何将唯一名称推入数组,但是如何添加计数器?
angular ×3
css ×2
javascript ×2
python ×2
reactjs ×2
arrays ×1
bootstrap-4 ×1
built-in ×1
counter ×1
cpu-word ×1
for-loop ×1
google-maps ×1
html ×1
ipython ×1
iterable ×1
jupyter ×1
nuxt.js ×1
object ×1
observable ×1
orphan ×1
react-router ×1
startup ×1
sticky ×1
terminal ×1
typescript ×1
vuetify.js ×1