Commit a String with JGit

A JGit-beginner-question: I use JGit to read a file (BLOB) from a repository and manipulate its content. After that, I want to write the new content with the same filename back to the repository as a new commit. But how can I commit the new content with JGit? My pseudo-code: String gitUrl = "path/to/repository/.git"; Repository repository = new FileRepository(gitUrl); String filename = "te

用JGit提交一个字符串

一个JGit初学者问题: 我使用JGit从存储库读取文件(BLOB)并操作其内容。 之后,我想用相同的文件名将新内容写回到存储库中作为新的提交。 但是,我如何使用JGit提交新内容? 我的伪代码: String gitUrl = "path/to/repository/.git"; Repository repository = new FileRepository(gitUrl); String filename = "test/seppl.txt"; blobId = getIdOf(filename); ObjectLoader object = repository.open(blobId, Constants.

Custom file type and icon

I have a game I'm writing in java, it has the functionality to save games and load them all working with .txt files but I thought it would be cool if I could have my own file type...I know I can just set it to save as a type that isn't already defined but then I get a blank icon for the file...is there a way I can give it a custom file icon in java? I've looked online etc but all I f

自定义文件类型和图标

我有一个我用java编写的游戏,它具有保存游戏和加载所有与.txt文件一起工作的功能,但如果我可以拥有自己的文件类型,我认为它会很酷......我知道我可以将它设置为另存为一个尚未定义的类型,但是然后我得到一个空白的文件图标...有没有一种方法可以给它一个java中的自定义文件图标? 我看了网上等,但我找到的是微软网站解释一些在C#和VB等... 我想如果你在Windows中创建文件类型,只要你在Windows中,你可以添加文件类型到

SWT issue with syncExec()

This is my first question on StackOverflow (sorry about my english). I'll try to explain the problem as well I can. I have a swt application with a foreground jade application in which I have a progress bar to inform the duration of the application. To refresh this progress bar I use: if(Display.getCurrent() != null) { progress.run(); } else { sShell.getDisplay().syncExec(progress

SWT问题与syncExec()

这是我在StackOverflow上的第一个问题(抱歉我的英语)。 我会尽力解释这个问题。 我有一个前台玉石应用程序的swt应用程序,我有一个进度条来通知应用程序的持续时间。 刷新这个进度条我使用: if(Display.getCurrent() != null) { progress.run(); } else { sShell.getDisplay().syncExec(progress); } 进展是: Runnable progress = new Runnable() { public void run () { if (progressBar.isDispos

What does this Java generics paradigm do and what is it called?

I'm looking at some Java classes that have the following form: public abstract class A <E extends A<E>> implements Comparable <E> { public final int compareTo( E other ) { // etc } } public class B extends A <B> { // etc } public class C extends A <C> { // etc } My usage of "Comparable" here is just to illustrate a poss

这个Java泛型范例做了什么以及它叫什么?

我正在查看一些具有以下形式的Java类: public abstract class A <E extends A<E>> implements Comparable <E> { public final int compareTo( E other ) { // etc } } public class B extends A <B> { // etc } public class C extends A <C> { // etc } 这里我使用“Comparable”只是为了说明泛型参数“E”的可能用法。 这种泛型/继承的用法是否有名字? 它是

Java: fast disk

I need to store a big hash set, able to contain up to approx 200 millions 40 bit values. Storing it as 200 millions 64 bit value would be acceptable (despite the 200 millions * 16 bits loss). The requirements are: tiny memory footprint (disk space ain't an issue, memory is) fast contains(long l) and add(long l) methods (much faster than SQL) embedded free and without nasty licensin

Java:快速磁盘

我需要存储一个大的哈希集,能够包含大约2亿个40位值。 将它存储为2亿个64位值是可以接受的(尽管有2亿* 16位丢失)。 要求是: 微小的内存占用(磁盘空间不是问题,内存是) fast contains(long l)和add(long l)方法(比SQL快得多) 嵌入式 免费且没有恶意许可(没有Berkeley DB)。 LGPL罚款。 没有误报,也没有误报,所以像基于磁盘的Bloom Filters这样的事情并不是我所追求的 SQL不是我在这里之后。 因为

Synchronization of a Queue

I've been reading up on Doug Lea's 'Concurrency Programming in Java' book. As you may know, Doug originally wrote the Java Concurrency API. However, something has caused me some confusion and I was hoping to gain a few my opinions on this little conundrum! Take the following code from Doug Lea's queuing example... class LinkedQueue { protected Node head = new Node(null)

队列的同步

我一直在阅读Doug Lea的“Java中的并发编程”一书。 您可能知道,Doug最初编写了Java Concurrency API。 但是,有些事情使我感到困惑,我希望就这个小难题获得一些我的看法! 从Doug Lea的排队示例中获取以下代码... class LinkedQueue { protected Node head = new Node(null); protected Node last = head; protected final Object pollLock = new Object(); protected final Object putLock = new Object();

prepared statement and SQL injection

I have been reading about prepared statement and it said that SQL injection is still very possible with it. Now I would use spring if I was creating an web app but I thought that it allowing such attacks odd. PreparedStatement forces you to pick the index. This will cause many problems because you will not always want to pick the same location over and over to store data. Even if you create

准备好的语句和SQL注入

我一直在阅读有关准备好的声明,并表示SQL注入仍然是非常有可能的。 现在,如果我正在创建一个Web应用程序,我会用Spring,但我认为它允许这样的攻击很奇怪。 PreparedStatement强制你选择索引。 这会导致很多问题,因为您不会总是想要一遍又一遍地选择相同的位置来存储数据。 即使你创建了一个计数器,它也会产生反效果,因为它会重置程序关闭的所有内容。 String query = "INSERT INTO offers (name,email.text) VALUES

Selenium click sometimes causes page to load and sometimes doesn't

Clicking on a button in my web page sometimes causes the entire page to load, and sometimes only part of it to load. How can I call waitForPageToLoad without the page loading, and to be able to run additional commands after all elements are present, or what other command can I use, that will wait for the page to be loaded and enable me to run additional commands on the page. (Using selenium 2.)

硒单击有时会导致页面加载,有时不会

点击我的网页上的按钮有时会导致整个页面加载,有时只加载一部分。 如何在不加载页面的情况下调用waitForPageToLoad,并且能够在所有元素出现之后运行其他命令,或者我可以使用哪些其他命令,这将等待页面加载并使我能够在页面上运行其他命令页。 (使用硒2) 点击我的网页上的按钮有时会导致整个页面加载,有时只加载一部分。 我认为这是设计,而不是问题。 如果你正在测试,那么你应该知道你期望的行为。 如果您期待

How to add external tags file into CEDET in Emacs

I tried to use CEDET to get auto completion in Emacs and that works fine for C/C++. But I cannot find anything about how to use CEDET with Java without the help of JDEE, which is thought out of date and not compatible to CEDET 1.1. I got a tags file using utility found here but I don't know how to integrate that into CEDET system. According to CEDET's website, that's possible. But

如何在Emacs中将外部标签文件添加到CEDET中

我试图使用CEDET在Emacs中获得自动完成,并且适用于C / C ++。 但是,如果没有JDEE的帮助,我无法找到关于如何使用Java的CEDET的东西,JDEE已经过时并且与CEDET 1.1不兼容。 我在这里找到了一个使用实用程序的标签文件,但我不知道如何将它集成到CEDET系统中。 根据CEDET的网站,这是可能的。 但他们没有解释如何去做。 有人愿意回答这个问题吗? 以下是该实用程序生成的标签文件的一些示例: java.applet.Applet$Accessi

What becomes the search path of a .dll loaded with System.loadLibrary() in java?

I have a system where I have 1 .exe file, 4 .dll files and one jar file where the dependencies are as shown below: A.exe -> calls -> B.dll -> calls through JNI -> C.jar -> loads with System.loadLibrary("") -> D.dll -> calls E.dll Now, B through E is one module and all those files are in the same directory. A.exe is an application placed in a different directory

在java中用System.loadLibrary()加载的.dll的搜索路径是什么?

我有一个系统,其中有1个.exe文件,4个.dll文件和一个jar文件,其依赖关系如下所示: A.exe - >调用 - > B.dll - >通过JNI调用 - > C.jar - >加载System.loadLibrary(“”) - > D.dll - >调用E.dll 现在, B到E是一个模块,所有这些文件都在同一个目录中。 A.exe是放置在可以使用这些模块中的几个的不同目录中的应用程序。 我的主要问题是,当D.dll试图加载E.dll时,我得到'无法找到依赖库'