我想配置我的Mercurial项目,使其能够将其推送到gitHub存储库中。
使用命令时:
hg push git + ssh://git@github.com/myusername/myproject.git
我收到一条消息:
中止:找不到存储库git + ssh://git@github.com/myusername/myproject.git!
我已经检查并建立SSH连接,看起来还可以:
嗨,myusername!您已成功通过身份验证,但是GitHub不提供Shell访问。
我从github复制的存储库URL(这是来自其他开源项目的fork):https : //github.com/myusername/myproject.git
我还要检查什么?为什么我有一个实际上不存在的信息?哪里可能有问题?
我正在尝试为checkboxPreferences编写自定义视图.我有:
<CheckBoxPreference
android:key="@string/pref_acceptableads"
android:summaryOff="@string/pref_acceptableads_summary_off"
android:summaryOn="@string/pref_acceptableads_summary_on"
android:title="@string/pref_acceptableads_title"
android:widgetLayout="@layout/helpfulcheckbox_layout" />
Run Code Online (Sandbox Code Playgroud)
和:
<?xml version="1.0" encoding="UTF-8"?>
<ViewGroup xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+android:id/widget_frame"
android:layout_width="wrap_content"
android:layout_height="match_parent">
<ImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/image" />
<CheckBox
android:id="@+id/checkbox"
android:layout_width="0dp"
android:layout_height="wrap_content" />
</ViewGroup>
Run Code Online (Sandbox Code Playgroud)
问题在于我的viewgroup.我收到一个例外:
03-11 13:49:11.520:E/AndroidRuntime(12286):FATAL EXCEPTION:main 03-11 13:49:11.520:E/AndroidRuntime(12286):进程:org.adblockplus.android,PID:12286 03-11 13:49:11.520:E/AndroidRuntime(12286):android.view.InflateException:二进制XML文件行#2:错误膨胀类android.view.ViewGroup 03-11 13:49:11.520:E/AndroidRuntime(12286):在android.view.LayoutInflater.createView(LayoutInflater.java:620)03-11 13:49:11.520:E/AndroidRuntime(12286):at android.view.LayoutInflater.onCreateView(LayoutInflater.java:652)03-11 13 :49:11.520:E/AndroidRuntime(12286):at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:66)03-11 13:49:11.520:E/AndroidRuntime(12286):at android.view.LayoutInflater.onCreateView(LayoutInflater.java:669)03-11 13:49:11.520:E/AndroidRuntime(12286):at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:694)03-11 13: 49:11.520:E/AndroidRuntime(12286):在android.view.LayoutInflater.inflate(LayoutInfla)ter.java:469)03-11 13:49:11.520:E/AndroidRuntime(12286):在android.view.LayoutInflater.inflate(LayoutInflater.java:397)03-11 13:49:11.520:E/AndroidRuntime( 12286):在android.view.LayoutInflater.inflate(LayoutInflater.java:353)03-11 13:49:11.520:E/AndroidRuntime(12286):at android.preference.Preference.onCreateView(Preference.java:489)03 -11 13:49:11.520:E/AndroidRuntime(12286):在android.preference.Preference.getView(Preference.java:460)03-11 13:49:11.520:E/AndroidRuntime(12286):在android.preference .PreferenceGroupAdapter.getView(PreferenceGroupAdapter.java:221)03-11 13:49:11.520:E/AndroidRuntime(12286):at android.widget.AbsListView.obtainView(AbsListView.java:2255)03-11 13:49:11.520 :E/AndroidRuntime(12286):在android.widget.ListView.makeAndAddView(ListView.java:1790)03-11 13:49:11.520:E/AndroidRuntime(12286):在android.widget.ListView.fillDown(ListView. java:691)03-11 13:49:11.520:E/AndroidRuntime(12286):在android.widget.ListView.fillFromTop(ListView.java:752)03-11 13:49:11.520:E/AndroidRuntime(12286):在android.widget.ListView.layoutChildren(ListView.java:1616)03-11 13:49:11.520:E/AndroidRuntime(12286):在android. widget.AbsListView.onLayout(AbsListView.java:2087)03-11 13:49:11.520:E/AndroidRuntime(12286):at android.view.View.layout(View.java:14841)03-11 13:49: 11.520:E/AndroidRuntime(12286):在android.view.ViewGroup.layout(ViewGroup.java:4631)03-11 13:49:11.520:E/AndroidRuntime(12286):在android.widget.LinearLayout.setChildFrame(LinearLayout) .java:1671)03-11 13:49:11.520:E/AndroidRuntime(12286):在android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525)03-11 13:49:11.520:E/AndroidRuntime(12286) ):在android.widget.LinearLayout.onLayout(LinearLayout.java:1434)03-11 13:49:11.520:E/AndroidRuntime(12286):在android.view.View.layout(View.java:14841)03- 11 …
当前结果:
1. Item
1.1 Subitem
1.2 Subitem2
1.2.1 something more
1.2.2 another point
Run Code Online (Sandbox Code Playgroud)
期望的结果:
1. Item
1.1 Subitem
1.2 Subitem2
a. something more
b. another point
Run Code Online (Sandbox Code Playgroud)
如何修改我的代码以使第三级成为字母而不是 3 个数字。我将其添加到HTML 中的type="a"正确元素中,但它被覆盖了。<ol>
1. Item
1.1 Subitem
1.2 Subitem2
1.2.1 something more
1.2.2 another point
Run Code Online (Sandbox Code Playgroud)
1. Item
1.1 Subitem
1.2 Subitem2
a. something more
b. another point
Run Code Online (Sandbox Code Playgroud)
我想每分钟从服务器获取数据以检查新数据.现在我正在使用Timeout循环执行此操作,但我认为可能有更好的方法来执行此操作.应该怎么做?
async componentDidMount () {
await this.callApi();
await this.callNames();
}
callApi = async () => {
try {
const response = await fetch('/rates');
if (response.status === 200) {
const body = await response.json();
this.setState({ rates: body.rates, ratesError: null });
} else {
this.setState({ ratesError: 'Error getting currency rates' });
}
} catch (err) {
console.log(err);
this.setState({ ratesError: err });
}
setTimeout(this.callApi, 60000);
}
Run Code Online (Sandbox Code Playgroud) 在我的组件中,我订阅了一些基本数据:
ngOnInit() {
this.data.getBasics().subscribe(
data => {
this.basics = data
}
)
}
Run Code Online (Sandbox Code Playgroud)
我像这样在 html 中使用它们:
<h1>{{ basics.surname }}</h1>
Run Code Online (Sandbox Code Playgroud)
它工作得很好。一些基础知识是链接。假设 basics.mypage 是“ http://mypage.com ”。我想在我的 html 文档中将它用作 href 。像这样的东西:
<a href={{ basics.mypage }}>Go to my page</a>
Run Code Online (Sandbox Code Playgroud)
但这样它把我送到
如何在标签内使用这个变量?
我有一个多行字符串:
let str = 'line first \n line-second-preceded-with-a-few-spaces';
Run Code Online (Sandbox Code Playgroud)
我想将其注入HTML代码。我设法用替换了所有空格,但replace(/ /g, '\u00a0')我也想这样做,\n但是Wikipedia中提到的Unicode值似乎都不起作用。
Unicode标准定义了一些字符,符合标准的应用程序应将其识别为行终止符:
Run Code Online (Sandbox Code Playgroud)LF: Line Feed, U+000A VT: Vertical Tab, U+000B FF: Form Feed, U+000C CR: Carriage Return, U+000D CR+LF: CR (U+000D) followed by LF (U+000A) NEL: Next Line, U+0085 LS: Line Separator, U+2028 PS: Paragraph Separator, U+2029
{str.replace(/ /g, '\u00a0').replace(/(?:\r\n|\r|\n)/g, '\u000a')}
Run Code Online (Sandbox Code Playgroud)
这样做的正确方法是什么?