走过海棠暮

文章 0 评论 0 浏览 24

走过海棠暮 2024-11-09 10:37:15

您可能会发现 Timpani Software 的 MergeMagician 工具很有趣。它是一个分支管理和自动合并解决方案,可与 TFS(以及 Subversion)配合使用。您在分支之间创建发布/订阅关系,然后服务器自动进行合并。

MM 可用于实现 Shawn 提到的 TFS 分支指南中讨论的所有模式。

仅供参考,它是一个商业工具。我不知道有任何开源工具可以与 TFS 一起执行类似的操作。

请访问 http://www.timpanisoftware.com 查看。主页上有一个很好的概述视频。

You might find Timpani Software's MergeMagician tool interesting. It is a branch management and automated merging solution that works with TFS (and also Subversion). You create publish/subscribe relationships between branches, and then the server automates the merges.

MM can be used to implement all of that patterns discussed in the TFS Branching Guide that Shawn mentioned.

FYI, it is a commercial tool. I don't know of any open source tools that do anything like this that work with TFS.

Check it out at http://www.timpanisoftware.com. There's a good overview video on the home page.

TFS 分支和合并策略

走过海棠暮 2024-11-09 08:57:45

如果您的目标是在 Jenkins 中执行 Jython 代码,您可能需要查看 Jython 插件

从版本 1.6 开始,您实际上可以安装 Jython 软件包(假设您有自己想要使用的库),并且它会自动在所有 Jenkins 从属设备之间同步软件包。

If your goal is to execute Jython code within Jenkins, you may want to have a look at the Jython Plugin.

Starting version 1.6, you can actually install Jython packages (say if you have your own library you'd like to use), and it'll automatically sync up the packages across all Jenkins slaves.

我可以使用 Jython/Python 扩展 Jenkins

走过海棠暮 2024-11-09 05:07:38

尝试一下,因为当我想对 TextView 执行此操作时,上述建议对我不起作用:

TextView.setScrollbarFadingEnabled(false);

祝你好运。

Try this as the above suggestions didn't work for me when I wanted to do this for a TextView:

TextView.setScrollbarFadingEnabled(false);

Good Luck.

如何始终显示滚动条

走过海棠暮 2024-11-09 03:39:27

try-catch 中使用 :colorscheme 作为 Randy 已完成 如果您只想加载它(如果存在)并执行其他操作,则可能就足够了。如果您对 else 部分不感兴趣,可以使用简单的 :silent! colorcheme 就足够了。

否则, globpath() 是要走的路。然后,如果您确实愿意,可以检查使用 filereadable() 返回的每个路径。

" {rtp}/autoload/has.vim
function! has#colorscheme(name) abort
    let pat = 'colors/'.a:name.'.vim'
    return !empty(globpath(&rtp, pat))
endfunction

" .vimrc
if has#colorscheme('desert')
     ...

编辑: fileread($HOME.'/.vim/colors/'.name.'.vim') 可能看起来很简单,而且绝对有吸引力,但如果我们正在寻找的颜色方案,这还不够因为是在别处。通常,如果它已通过插件管理器安装在另一个目录中。在这种情况下,唯一可靠的方法是检查 vim 'runtimepath '(又名'rtp')。因此globpath()。请注意,:colorscheme name 命令在 {rtp}/colors/{name}.vim 中搜索。

Using :colorscheme in a try-catch as Randy has done may be enough if you just want to load it if it exists and do something else otherwise. If you are not interested in the else part, a simple :silent! colorscheme is enough.

Otherwise, globpath() is the way to go. You may, then, check each path returned with filereadable() if you really wish to.

" {rtp}/autoload/has.vim
function! has#colorscheme(name) abort
    let pat = 'colors/'.a:name.'.vim'
    return !empty(globpath(&rtp, pat))
endfunction

" .vimrc
if has#colorscheme('desert')
     ...

EDIT: filereadable($HOME.'/.vim/colors/'.name.'.vim') may seem simple and it's definitively attractive, but this is not enough if the colorscheme we're looking for is elsewhere. Typically if it has been installed in another directory thanks to a plugin manager. In that case the only reliable way is to check in the vim 'runtimepath' (a.k.a. 'rtp'). Hence globpath(). Note that :colorscheme name command searches in {rtp}/colors/{name}.vim.

在我的 .vimrc 中,如何检查配色方案是否存在?

走过海棠暮 2024-11-09 02:27:53

该语言是否支持面向对象对于您的目的来说并不重要。毕竟,PHP 支持对象,而且您似乎用得很好。

就我个人而言,我建议从 Java 或 C# 开始。这两种语言的社区非常庞大,并且有大量在线教程可以帮助您入门。

使用 Visual Studio Express 开始编写 C# 非常容易。还有一个很好的hello world 教程

另外,如果您坚持使用 C#,则可以利用 WMI 将使您能够完成该项目所需的一切(以及更多)。

最后,大多数 Windows 计算机将能够运行您的应用程序,而无需安装任何额外的东西,并且 Visual Studio 会在构建过程中为您构建 .exe。

Whether or not the language supports OO doesn't really matter for your purposes. After all, PHP supports objects and you seem to do just fine with it.

Personally, i'd recommend Java or C# to get started with. The communities for these two languages are huge and there are plenty of tutorials online to help you get started.

It's extremely easy to get starting writing C# with Visual Studio Express. And a good hello world tutorial.

Also, if you stick with C# you can take advantage of WMI which will allow you to do everything you need for this project (and much much more).

Lastly, most windows machines will be able to run your application without having to install anything extra and Visual Studio builds the .exe for you as part of the build process.

Web 开发人员可以使用哪种非面向对象语言来创建一次性桌面应用程序?

走过海棠暮 2024-11-09 01:06:47

但我在想..尝试立即插入然后捕获异常会更有效吗?

如果异常很少发生(通常是这种情况),这确实是一种更有效且更简单的方法。

如果发生 FK 违规的可能性很高,那么预插入检查(假设它们不访问数据库)将节省到数据库的往返行程,因此会更有效。

回复:找出失败的原因。供应商异常通常包含一些有关触发异常的约束的信息。您应该查看供应商异常的字段和方法。

But I was thinking.. would it be more efficient to just try to do the insert straight away and then catch the exception?

If exceptions happen rarely (usually the case), this is indeed a more efficient and much more simple way.

If the chance of getting FK violation is high, than the pre-insert checks (providing they do not hit the database) will save the round-trip to db and back, and thus will be more efficient.

Re: figuring out the reason of failure. Vendor exceptions usually contain some information about what constraint has triggered the exception. You should look at vendor exception's fields and methods.

使用 Jdbc 捕获某些 FK 异常

走过海棠暮 2024-11-08 20:55:20

在 .NET 框架中,程序集是
编译后的代码库
用于
部署、版本控制和安全性。

有两种类型:进程
程序集 (EXE) 和库
程序集 (DLL)。
工艺装配
代表一个将使用的过程
库程序集中定义的类。

.NET 程序集包含 CIL 中的代码,
通常是从 CLI 生成的
语言,然后编译成
CLR 运行时的机器语言
即时编译器。

- 维基百科

如果您的资源只是复制到同一个文件夹中,那么它不是您的资源的一部分装配。
但如果它被编译成 .dll 或 .exe,它就是程序集的一部分。

对于大多数 .NET Framework 应用程序,
您找到组成
应用程序中的应用程序
目录,在子目录中
应用程序的目录,或在
全局程序集缓存(如果程序集
是共享的)。 -MSDN


另外请参阅
.NET 中的程序集:它们是什么以及如何管理它们

In the .NET framework, an assembly is
a compiled code library
used for
deployment, versioning, and security.

There are two types: process
assemblies (EXE) and library
assemblies (DLL).
A process assembly
represents a process which will use
classes defined in library assemblies.

.NET assemblies contain code in CIL,
which is usually generated from a CLI
language, and then compiled into
machine language at runtime by the CLR
just-in-time compiler.

- Wikipedia

If your resource is just copied in the same folder it is not a part of your assembly.
But if it is compiled into a .dll or .exe it is a part of the assembly.

For most .NET Framework applications,
you locate assemblies that make up an
application in the application's
directory, in a subdirectory of the
application's directory, or in the
global assembly cache (if the assembly
is shared). -MSDN


Also See
Assemblies in .NET: What they are and how to manage them

外部资源是装配的一部分吗?

走过海棠暮 2024-11-08 19:14:59

您还可以使用 AtroCore 。该系统具有完全可配置的数据模型,可以完全满足您的需求。数据交换可以通过 REST API 自动进行。

You can also use AtroCore for it. This system has a completely configurable data model and can do exactly what you need. Data exchange can be automated via REST API.

是否有免费开源的 CDI/MDM 解决方案?

走过海棠暮 2024-11-08 18:54:37

最好使用“with”关键字重写它。 “With”将自动关闭游标(这很重要,因为它是非托管资源)。好处是它也会在出现异常时关闭游标。

from contextlib import closing
import MySQLdb

''' At the beginning you open a DB connection. Particular moment when
  you open connection depends from your approach:
  - it can be inside the same function where you work with cursors
  - in the class constructor
  - etc
'''
db = MySQLdb.connect("host", "user", "pass", "database")
with closing(db.cursor()) as cur:
    cur.execute("somestuff")
    results = cur.fetchall()
    # do stuff with results

    cur.execute("insert operation")
    # call commit if you do INSERT, UPDATE or DELETE operations
    db.commit()

    cur.execute("someotherstuff")
    results2 = cur.fetchone()
    # do stuff with results2

# at some point when you decided that you do not need
# the open connection anymore you close it
db.close()

It's better to rewrite it using 'with' keyword. 'With' will take care about closing cursor (it's important because it's unmanaged resource) automatically. The benefit is it will close cursor in case of exception too.

from contextlib import closing
import MySQLdb

''' At the beginning you open a DB connection. Particular moment when
  you open connection depends from your approach:
  - it can be inside the same function where you work with cursors
  - in the class constructor
  - etc
'''
db = MySQLdb.connect("host", "user", "pass", "database")
with closing(db.cursor()) as cur:
    cur.execute("somestuff")
    results = cur.fetchall()
    # do stuff with results

    cur.execute("insert operation")
    # call commit if you do INSERT, UPDATE or DELETE operations
    db.commit()

    cur.execute("someotherstuff")
    results2 = cur.fetchone()
    # do stuff with results2

# at some point when you decided that you do not need
# the open connection anymore you close it
db.close()

何时使用 MySQLdb 关闭游标

走过海棠暮 2024-11-08 18:21:45

如果您使用 PHP 的内置会话功能。您可以使用 $session_id = session_id(); 获取会话的 ID

当用户登录时,您可以获取它生成的会话 ID,并将其存储到该用户帐户下的数据库中。然后在每个页面上检查当前会话 ID 是否与该用户数据库中存储的会话 ID 匹配(如果不匹配,则终止当前会话并将其重定向到登录页面)。

他们登录所用的每台设备上的会话 ID 都不同。

这有道理吗?

If you are using PHP's built in sessions feature. You can get the Session's ID using $session_id = session_id();

When a user logs in you could take the session id that it generates and store it into a database under that user's account. Then on each page check to see if the current Session ID matches the one stored in the database for that user (If not, kill the current session and redirect them to a sign in page).

The session id will be different on each device they login using.

Does that make sense?

如何防止同一账号在不同设备上同时登录?

走过海棠暮 2024-11-08 09:44:28

您好,@anu 发布的答案是正确的,但它不会完全按要求工作。通过对 child_open() 函数进行轻微更改,它可以正常工作。

<html>
<head>
<script type="text/javascript">

var popupWindow=null;

function child_open()
{ 
if(popupWindow && !popupWindow.closed)
   popupWindow.focus();
else
   popupWindow =window.open('new.jsp',"_blank","directories=no, status=no, menubar=no, scrollbars=yes, resizable=no,width=600, height=280,top=200,left=200");

}
function parent_disable() {
  if(popupWindow && !popupWindow.closed)
    popupWindow.focus();
}
</script>
</head>
  <body onFocus="parent_disable();" onclick="parent_disable();">
     <a href="javascript:child_open()">Click me</a>
  </body>    
</html>

Hi the answer that @anu posted is right, but it wont completely work as required. By making a slight change to child_open() function it works properly.

<html>
<head>
<script type="text/javascript">

var popupWindow=null;

function child_open()
{ 
if(popupWindow && !popupWindow.closed)
   popupWindow.focus();
else
   popupWindow =window.open('new.jsp',"_blank","directories=no, status=no, menubar=no, scrollbars=yes, resizable=no,width=600, height=280,top=200,left=200");

}
function parent_disable() {
  if(popupWindow && !popupWindow.closed)
    popupWindow.focus();
}
</script>
</head>
  <body onFocus="parent_disable();" onclick="parent_disable();">
     <a href="javascript:child_open()">Click me</a>
  </body>    
</html>

Javascript 打开弹出窗口并禁用父窗口

走过海棠暮 2024-11-07 20:36:48

我猜这是由于日期格式不匹配造成的。请验证 C#SQL Server 中参数的日期格式是否相同。如果不匹配,您可以在存储过程本身中转换格式。

I guess this is due to mismatch in the Date Format. Please verify that the date format of parameters are same in C# as well as SQL Server. In case of mismatch you can convert the format in Stored Procedure itself.

为什么存储过程结果为零?

走过海棠暮 2024-11-07 12:31:40

只需将字符串的初始子字符串从最短到最长的反向附加到字符串中,直到得到回文。例如,对于“acbab”,尝试附加“a”,它产生“acbaba”,它不是回文,然后尝试附加“ac”反向,产生“acbabca”,它是回文。

更新:请注意,您不必实际执行附加操作。您知道子字符串匹配,因为您刚刚反转了它。因此,您所要做的就是检查字符串的其余部分是否是回文,如果是,则附加子字符串的反向内容。这是皮蒂瓦尔象征性地写下的内容,所以他可能应该得到答案。示例:对于“acbab”,找到最长的回文后缀;那是“bab”。然后反向附加余数“ac”:ac bab ca。

Just append the reverse of initial substrings of the string, from shortest to longest, to the string until you have a palindrome. e.g., for "acbab", try appending "a" which yields "acbaba", which is not a palindrome, then try appending "ac" reversed, yielding "acbabca" which is a palindrome.

Update: Note that you don't have to actually do the append. You know that the substring matches since you just reversed it. So all you have to do is check whether the remainder of the string is a palindrome, and if so append the reverse of the substring. Which is what Ptival wrote symbolically, so he should probably get the credit for the answer. Example: for "acbab", find the longest suffix that is a palindrome; that is "bab". Then append the remainder, "ac", in reverse: ac bab ca.

如何获得字符串的最短回文

走过海棠暮 2024-11-07 09:09:40

别打扰。它不兼容。它很混乱并且容易出错。早在这个功能存在之前,c++ 就有更容易管理的解决方案。你要在结构的末尾添加什么?通常,您只需使用 std::vector、std::array 或固定大小数组之类的东西。

更新

我想要一个音符开始时间 (uint64_t) 列表,并遍历它们以查看正在播放的音符(如果有)。我打算向结构添加一个计数变量来跟踪灵活数组中有多少项。

好的,如果你有固定的复调音乐,那么固定大小的数组应该没问题。在大多数 iOS 合成器中,你不需要多个这样的数组。当然,“即将发布的笔记”数组大小可能会根据应用程序合成器的不同而有所不同?采样器?定序器?实时输入?

template <size_t NumNotes_>
class t_note_start_times {
public:
    static const size_t NumNotes = NumNotes_;
    typedef uint64_t t_timestamp;

    /*...*/

    const t_timestamp& timestampAt(const size_t& idx) const {
        assert(this->d_numFutureNotes <= NumNotes);
        assert(idx < NumNotes);
        assert(idx < this->d_numFutureNotes);
        return this->d_startTimes[idx];
    }
private:
    t_timestamp d_presentTime;
    size_t d_numFutureNotes; // presumably, this will be the number of active notes,
                             // and values will be compacted to [0...d_numFutureNotes)
    t_timestamp d_startTimes[NumNotes];
};

// in use       
const size_t Polyphony = 16;
t_note_start_times<Polyphony> startTimes;
startTimes.addNoteAtTime(noteTimestamp); // defined in the '...' ;)
startTimes.timestampAt(0);

如果您需要一个可能非常大的动态大小的数组,那么使用向量。如果您只需要一个实例,并且最大复调数是(比如说)64,那么就使用它。

don't bother. it's not compatible. it is messy and error prone. c++ had solutions which are managed more easily long before this feature existed. what are you tacking onto the end of your struct? normally, you'll just use something like a std::vector, std::array, or fixed size array.

UPDATE

I want to have a list of note start times (uint64_t) and iterate through them to see which, if any, is playing. i was going to add a count var to the struct to track how many items are in the flexible array.

ok, then a fixed size array should be fine if you have fixed polyphony. you will not need more than one such array in most iOS synths. of course, 'upcoming note' array sizes could vary based on the app synth? sampler? sequencer? live input?

template <size_t NumNotes_>
class t_note_start_times {
public:
    static const size_t NumNotes = NumNotes_;
    typedef uint64_t t_timestamp;

    /*...*/

    const t_timestamp& timestampAt(const size_t& idx) const {
        assert(this->d_numFutureNotes <= NumNotes);
        assert(idx < NumNotes);
        assert(idx < this->d_numFutureNotes);
        return this->d_startTimes[idx];
    }
private:
    t_timestamp d_presentTime;
    size_t d_numFutureNotes; // presumably, this will be the number of active notes,
                             // and values will be compacted to [0...d_numFutureNotes)
    t_timestamp d_startTimes[NumNotes];
};

// in use       
const size_t Polyphony = 16;
t_note_start_times<Polyphony> startTimes;
startTimes.addNoteAtTime(noteTimestamp); // defined in the '...' ;)
startTimes.timestampAt(0);

if you need a dynamically sized array which could be very large, then use a vector. if you need only one instance of this and the max polyphony is (say) 64, then just use this.

iOS 上 Objective-C 中的灵活数组成员

走过海棠暮 2024-11-07 04:42:32

唯一的方法是for-each,在这里使用它就可以了。

DataTable t = new DataTable();
var fwdRowGroups = t.AsEnumerable().GroupBy(row => row.Field<object>("AcctId"));

DataTable g = new DataTable();
foreach (var row in fwdRowGroups)
{
    g.Rows.Add(row);
}

另请注意删除多余的 ToList()。你需要它做什么?

并在 DataRow.Field() 中使用更具体的类型,它是为类型安全操作而创建的。否则仅使用 row["AcctId]

The only way is for-each and it's ok to use it here.

DataTable t = new DataTable();
var fwdRowGroups = t.AsEnumerable().GroupBy(row => row.Field<object>("AcctId"));

DataTable g = new DataTable();
foreach (var row in fwdRowGroups)
{
    g.Rows.Add(row);
}

Also note the removal of excess ToList(). What for do you need it?

And use more specific type in DataRow.Field<T>(), it's created for type-safe operations. Otherwise use just row["AcctId]

将 GroupBy 行添加到数据表中

更多

推荐作者

亚希

文章 0 评论 0

cyp

文章 0 评论 0

北漠

文章 0 评论 0

11223456

文章 0 评论 0

坠似风落

文章 0 评论 0

游魂

文章 0 评论 0

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文