程序设计

专业和发烧友程序员的问答

4
变更分公司基础
我有一棵这样的树: (commit 1) - master \-- (commit 2) - (commit 3) - demo \-- (commit 4) - (commit 5) - PRO 我必须将PRO分支移至主 (commit 1) - master |-- (commit 2) - (commit 3) - demo \-- (commit 4) - (commit 5) - PRO 我已经尝试过git rebase masterPRO分支,但是什么也没有发生。 澄清一下:我在master上工作,然后我必须进行产品演示(git checkout -b demo和一些提交)。然后,由于错误,我从演示(git checkout …
145 git 

6
无法绑定到“ routerLink”,因为它不是已知属性
最近,我开始使用angular2。到目前为止,它很棒。因此,为了学习使用,我已经启动了一个演示个人项目angular-cli。 使用基本的路由设置,我现在要导航到标头中的某些路由,但是由于我的标头是的父级,因此router-outlet会收到此错误。 app.component.html <app-header></app-header> // Trying to navigate from this component <router-outlet></router-outlet> <app-footer></app-footer> header.component.html <a [routerLink]="['/signin']">Sign in</a> 现在,我部分理解了,因为该组件是包装,router-outlet因此无法通过这种方式访问router。那么,对于这种情况,是否有可能从外部访问导航? 如果需要,我将非常乐意添加更多信息。先感谢您。 更新资料 1-我package.json已经有了稳定的@angular/router 3.3.1版本。2-在我的主app模块中,导入了routing-module。请看下面。 app.module.ts import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { HttpModule } from '@angular/http'; import { AlertModule …

6
在TypeScript中导入json文件
我有一个如下JSON文件: { "primaryBright": "#2DC6FB", "primaryMain": "#05B4F0", "primaryDarker": "#04A1D7", "primaryDarkest": "#048FBE", "secondaryBright": "#4CD2C0", "secondaryMain": "#00BFA5", "secondaryDarker": "#009884", "secondaryDarkest": "#007F6E", "tertiaryMain": "#FA555A", "tertiaryDarker": "#F93C42", "tertiaryDarkest": "#F9232A", "darkGrey": "#333333", "lightGrey": "#777777" } 我正在尝试将其导入.tsx文件。为此,我将其添加到类型定义中: declare module "*.json" { const value: any; export default value; } 我正在这样导入它。 import colors = require('../colors.json') 在文件中,我将颜色primaryMain用作colors.primaryMain。但是我得到一个错误: 属性'primaryMain'在类型'typeof“ * .json”上不存在

30
测试未在测试资源管理器中运行
我目前正在研究目前有32个单元测试的解决方案。我一直在与reshaper测试运行程序合作-效果很好。所有测试都在运行,所有测试都显示正确的测试结果。现在,一位同事告诉我,使用Visual Studio测试资源管理器无法在其计算机上运行测试。他们在我的机器上都不工作,因此我可以排除一些本地丢失的文件或其他东西。 测试资源管理器将显示所有单元测试,但是一旦单击“全部运行”,所有测试将显示为灰色,并且不显示测试运行的结果: 所有测试课程都是公开的 所有测试类都具有[TestClass]声明的属性 所有测试方法都使用该[TestMethod]属性 生产力代码和测试项目都针对.NET 3.5。 我已经尝试干净的构建我的解决方案,和/或删除所有obj,bin,Debug和Release文件夹 如果有任何提示可能引起这种行为,我将不胜感激。

6
打字稿:TS7006:参数“ xxx”隐式具有“ any”类型
在测试UserRouter时,我使用的是json文件 data.json [ { "id": 1, "name": "Luke Cage", "aliases": ["Carl Lucas", "Power Man", "Mr. Bulletproof", "Hero for Hire"], "occupation": "bartender", "gender": "male", "height": { "ft": 6, "in": 3 }, "hair": "bald", "eyes": "brown", "powers": [ "strength", "durability", "healing" ] }, { ... } ] 构建我的应用程序时,出现以下TS错误 ERROR in ...../UserRouter.ts (30,27): …
145 typescript 

6
赛普拉斯:测试元素是否不存在
我希望能够单击一个复选框,并测试Cypress中DOM中是否不再有某个元素。有人可以建议您如何做吗? //This is the Test when the check box is clicked and the element is there cy.get('[type="checkbox"]').click(); cy.get('.check-box-sub-text').contains('Some text in this div.') 我想做与上面测试相反的事情。因此,当我再次单击它时,具有类的div不应位于DOM中。
145 cypress 

2
在熊猫MultiIndex DataFrame中选择行
选择/过滤索引为MultiIndex的数据框的行的最常见的熊猫方法是什么? 根据单个值/标签切片 根据一个或多个级别的多个标签进行切片 过滤布尔条件和表达式 哪种方法在什么情况下适用 为简单起见的假设: 输入数据框没有重复的索引键 下面的输入数据框只有两个级别。(此处显示的大多数解决方案一般都适用于N级) 输入示例: mux = pd.MultiIndex.from_arrays([ list('aaaabbbbbccddddd'), list('tuvwtuvwtuvwtuvw') ], names=['one', 'two']) df = pd.DataFrame({'col': np.arange(len(mux))}, mux) col one two a t 0 u 1 v 2 w 3 b t 4 u 5 v 6 w 7 t 8 c u 9 v 10 …


20
有意图地启动短信应用程序
我对意图有疑问...我尝试启动短信应用... Intent intent = new Intent(Intent.ACTION_MAIN); intent.setType("vnd.android-dir/mms-sms"); int flags = Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP; intent.setFlags(flags); intent.setData(Uri.parse("content://sms/inbox")); context.startActivity(intent); 因此,您可以看到我的意图太多了,但这是因为我不知道该怎么做...谢谢

18
使用AngularJS设置活动标签样式
我在AngularJS中设置了这样的路由: $routeProvider .when('/dashboard', {templateUrl:'partials/dashboard', controller:widgetsController}) .when('/lab', {templateUrl:'partials/lab', controller:widgetsController}) 我在顶部栏上有一些链接的标签样式。如何根据当前模板或URL将“活动”类添加到选项卡?

2
在ScrollView中查看并不是全部
我在ScrollView中有一个RelativeLayout。我的RelativeLayout有,android:layout_height="match_parent"但是视图没有占据整个大小,就像wrap_content一样。 有没有办法实现真正​​的fill_parent / match_parent行为? 我的布局: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> <ImageView android:id="@+id/top" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:scaleType="fitXY" android:src="@drawable/top" /> <ImageView android:id="@+id/header" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@+id/top" android:scaleType="fitXY" android:src="@drawable/headerbig" /> <ImageView android:id="@+id/logo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBottom="@+id/header" android:layout_centerHorizontal="true" android:layout_marginBottom="3dp" android:src="@drawable/logo" /> <ScrollView android:layout_width="fill_parent" android:layout_height="match_parent" android:layout_above="@+id/bottom" android:layout_below="@+id/logo" android:background="@drawable/background" > <RelativeLayout android:layout_width="fill_parent" android:layout_height="fill_parent"> <ImageView android:id="@+id/dashboard01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/dashboard02" android:layout_centerHorizontal="true" …

13
Android-startActivityForResult立即触发onActivityResult
我正在使用call从我的应用程序中的主要活动中启动活动startActivityForResult(intent, ACTIVITY_TYPE),而所有活动都只有一个活动。 调用该onActivityResult()函数后,将根据需要启动该活动,但是在日志中,我可以看到它立即被触发。活动显示,但RESULT_CANCELED立即返回onActivityResult()。 然后,我与互动活动,按该呼叫的按钮finish(),并且onActivityResult()不叫这个时候(因为很明显的结果已经返回)。 这对任何人有意义吗?有人见过这种行为吗?


17
自制软件的git不使用补全
当使用OSX的git时,我修改文件后就可以git commit <tab>轻松完成操作,这会将文件名自动完成为修改后的文件名。但是,如果我从自制软件安装了较新版本的git并使用了该功能,则该功能将不再起作用(这意味着我按<tab>,它只是“询问”我要执行的文件,甚至包括没有更改的文件) )。 谁能阐明为什么以及如何解决这个问题?我更喜欢使用自制的git,因为它是最新的。 我的外壳是zsh,并且既未安装bash-completion也未zsh-completions工作(即使遵循homebrew的安装后说明)。 另外,用自制软件安装git后,它说 Bash completion has been installed to: /usr/local/etc/bash_completion.d zsh completion has been installed to: /usr/local/share/zsh/site-functions 所以我不能使用其中之一吗?
144 macos  git  autocomplete  zsh 


By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.