在下面的代码中,我希望当点击次数增加时 webView 内容不会改变,但每次加载时,都会显示一个新的时间戳。
const webView = (
<WebView
source={{
uri:
'data:text/html,<html><script>document.write("<h1 style=\\"font-size:64px\\">"+Date.now()+"<h1>");</script>',
}}
/>
);
export default class App extends React.Component {
state = {
clicks: 0,
};
onClick = () => {
this.setState({ clicks: this.state.clicks + 1 });
};
render() {
return (
<View>
<Text onPress={this.onClick}>
Click Me: {this.state.clicks}
</Text>
{this.state.clicks % 2 === 0 ? webView : null}
{this.state.clicks % 2 === 1 ? webView : null}
</View>
);
}
}
Run Code Online (Sandbox Code Playgroud)
链接到博览会小吃以在设备上检查它。
情况就是这样:开发人员Foo从我们的svn repo创建了一个hg repo.Foo的hg repo只是svn中主干的浅层克隆(没有svn分支,标签等,历史不完整[约100个变更集]).Developer Bar做了同样的事情,但克隆了整个svn repo,包括整个历史,分支,标签等.Foo和Bar都在他们的存储库上进行了分支开发.
两个存储库都有一个共同的SVN祖先,但每个hg repo都有不同的版本号.我想重温Foo从共同祖先到Bar's repo的变化.这是我正在寻找的图表:
Foo的回购:
C'-D'-E-F---G
\ /
H-I
Run Code Online (Sandbox Code Playgroud)
Bar的回购:
...A-B-C-D-J-K---L
\ /
M-N
Run Code Online (Sandbox Code Playgroud)
C,C'和D,D'具有相同的内容,但版本号和注释不同.
目标:
...A-B-C-D--E-F---G
\ \ /
\ H-I
\
J-K---L
\ /
M-N
Run Code Online (Sandbox Code Playgroud)
我已经没有关于如何实现这一目标的想法.我试过转换--splicemap splice.map [splice.map文件包含ED](没有做任何事情).克隆-f设法将所有内容整合到一个仓库中,但它们似乎是独立的树.克隆-f后,我尝试了rebase --source E --dest D --detach,但它只是崩溃了:(
想法?
我知道更改历史记录将使任何人对存储库的克隆无效,在这种情况下这不是问题.所有用户都将从这项工作的结果中重新克隆.
我有以下分支结构:
- Main
|- Release 1
|- Release 1.1
|- Release 2
Run Code Online (Sandbox Code Playgroud)
我想重新发布1.1版到Main,所以它看起来像
- Main
|- Release 1
|- Release 1.1
|- Release 2
Run Code Online (Sandbox Code Playgroud)
我想这样做的原因是因为许多变更集需要从Main合并到Release 1.1而不是版本1
我一直在尝试使用以下命令从Main到Release 1.1进行无基本合并:
tf merge /recursive /baseless $/Main $/Releases/Release1.1
Run Code Online (Sandbox Code Playgroud)
它工作得很好,一旦签入,我可以重新发布1.1版到Main.
但事实是,这个命令合并了Main的所有内容,我只想创建一个合并关系.我不想合并从Main到Release 1.1的所有内容,因为其他分支的许多其他更改同时发生.
有没有办法实现这一目标,还是所有未来的变更集都需要每次都毫无根据地合并?
我需要创建一个新进程,但它是另一个进程的“子进程”,而不是当前进程,例如重新创建新进程的父进程。
以下使我几乎到了.NET:如何使用 C#和.NET 的STARTUPINFOEX 调用 CreateProcessAsUser() :如何 PInvoke UpdateProcThreadAttribute和http://winprogger.com/launching-a-non-child-process/
using System;
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
public class ProcessCreator
{
[DllImport("kernel32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool CreateProcess(
string lpApplicationName, string lpCommandLine, ref SECURITY_ATTRIBUTES lpProcessAttributes,
ref SECURITY_ATTRIBUTES lpThreadAttributes, bool bInheritHandles, uint dwCreationFlags,
IntPtr lpEnvironment, string lpCurrentDirectory, [In] ref STARTUPINFOEX lpStartupInfo,
out PROCESS_INFORMATION lpProcessInformation);
[DllImport("kernel32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
private static extern bool UpdateProcThreadAttribute(
out IntPtr lpAttributeList, uint dwFlags, IntPtr Attribute, IntPtr lpValue,
IntPtr …Run Code Online (Sandbox Code Playgroud) 似乎在 QML 的设计中用户 reparent 并没有真正“设想”,因为即使有可能,它也涉及创建和更改状态,这只是不方便添加到每个项目。
import QtQuick 1.0
Item {
width: 200; height: 100
Rectangle {
id: redRect
width: 100; height: 100
color: "red"
}
Rectangle {
id: blueRect
x: redRect.width
width: 50; height: 50
color: "blue"
states: State {
name: "reparented"
ParentChange { target: blueRect; parent: redRect; x: 10; y: 10 }
}
MouseArea { anchors.fill: parent; onClicked: blueRect.state = "reparented" }
}
}
Run Code Online (Sandbox Code Playgroud)
我想知道是否有一种更优雅的方式来重新设置项目而不用不必要的状态污染项目?