小编Jaa*_*nus的帖子

了解git init

究竟是git init什么?我必须每台计算机执行一次,或者每个使用git的项目执行一次吗?我下载了我的项目,git clone并让它工作,但现在它也存储我的项目C:/Users/myUser/git,是某个文件夹或我可以更改它?

我真的不太了解那个文件夹,它看起来像是一个本地git仓库或其他东西,但是"管理"它,或者它为什么使用这条路径,你能解释一下吗?

这就是我的理解,如果我不正确,请修理我,需要直截了当地说明事实:

  1. git init 是为每个项目
  2. "用户"下的git文件夹是本地仓库,每次我git commit都会更新该文件夹.
  3. 当我这样做时git push,它需要来自该本地存储库,并放入远程存储库.
  4. 当我想更新为"HEAD"时,我就是这么做的 git pull

git

21
推荐指数
1
解决办法
3万
查看次数

如何解决模块X的多个工件被检索到Apache Ivy中的同一文件?

我正在使用ANT将我的东西部署到Tomcat.但我错过了依赖关系,我想添加常春藤,因为它被推荐了.

现在我将它添加到我的build.xml文件中:

<!-- Ivy settings start-->

    <condition property="ivy.home" value="${env.IVY_HOME}">
        <isset property="env.IVY_HOME" />
    </condition>


    <target name="download-ivy" unless="offline" description="Download Ivy">
        <mkdir dir="${ivy.jar.dir}"/>
            <!-- download Ivy from web site so that it can be used even without any special installation -->
        <get src="http://repo2.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar" 
            dest="${ivy.jar.file}" usetimestamp="true"/>
    </target>


    <target name="init-ivy" depends="download-ivy" description="Initialize Ivy">
        <!-- try to load ivy here from ivy home, in case the user has not already dropped
        it into ant's lib dir (note that the latter copy will always take precedence).
        We …
Run Code Online (Sandbox Code Playgroud)

java ant build ivy

19
推荐指数
1
解决办法
1万
查看次数

Postgresql创建数据库

好吧,我在Windows 7上安装了最新的postgreql数据库.

现在我正在尝试通过psql.exe命令行创建数据库

当我打开它时,它说

psql: FATAL: database "Jansu" does not exist
Run Code Online (Sandbox Code Playgroud)

所以我在某处读到,当没有指定数据库时,它试图用我的用户名或其他东西查找数据库.

无论如何..当我无法访问命令行时,我如何创建一个新的数据库.

postgresql

13
推荐指数
1
解决办法
2万
查看次数

Java在屏幕上找到图像

你能给我一些关于如何在屏幕上找到图像的提示吗?我的意思是,一个简单的像素组合.例如,它找到30x30像素白色方块的坐标.

Java机器人类允许我找到某些像素的颜色.但我需要反对,我希望我的程序扫描我的屏幕,然后告诉我这个小图像的坐标.好吧,我可以通过机器人查看所有像素,但它应该比这更快.快多了.

有什么建议?

java image-processing

10
推荐指数
2
解决办法
1万
查看次数

使用Spring Hibernate Sessionfactory从数据库中选择单个项目

这是我的DAO:

public List<Weather> getCurrentWeather() {  
    return sessionFactory.getCurrentSession().createQuery("from Weather").list();
}
Run Code Online (Sandbox Code Playgroud)

这可以从表天气中获取所有元素.但是,让我说我想做这样的事情(我只希望表天气中的一个元素):

public Weather getCurrentWeather() {    
    return sessionFactory.getCurrentSession().createQuery("from Weather where id = 1").list(); // here should be something else than list()
}
Run Code Online (Sandbox Code Playgroud)

我知道最终不应该有 list() ,但我必须在那里写什么才能得到一个对象?

java spring hibernate sessionfactory

10
推荐指数
2
解决办法
3万
查看次数

有没有办法将分离的对象传递给JPA持久化?(传递给持久化的分离实体)

我有2个实体:AccountAccountRole.

public class Account {
   private AccountRole accountRole;

   @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.EAGER)
   public AccountRole getAccountRole() {
      return accountRole;
   }
Run Code Online (Sandbox Code Playgroud)

.

public class AccountRole {
    private Collection<Account> accounts = new ArrayList<Account>();

    @OneToMany(mappedBy = "accountRole", fetch = FetchType.EAGER)
    public Collection<Account> getAccounts() {
         return accounts;
    }
Run Code Online (Sandbox Code Playgroud)

当我从数据库中获取accountRole并试图坚持我的问​​题时出现问题Account.此时我刚创建了我的帐户,角色已经存在于db中.

AccountRole role = accountService.getRoleFromDatabase(AccountRoles.ROLE_USER);
account.setAccountRole(role);

//setting both ways, as suggested
public void setAccountRole(AccountRole accountRole) {
    accountRole.addAccount(this);
    this.accountRole = accountRole;
}

entityManager.persist(account); // finally in my DAO
Run Code Online (Sandbox Code Playgroud)

我读到这个: …

java hibernate jpa entitymanager

10
推荐指数
1
解决办法
3万
查看次数

Spring welcome-file-list正确映射

我知道在春天我必须定义welcome-file,它应该在WEB-INF文件夹之外,所以我这样定义:

web.xml中:

<welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
</welcome-file-list>


<servlet-mapping>
    <servlet-name>spring</servlet-name>
    <url-pattern>/</url-pattern>
</servlet-mapping>
Run Code Online (Sandbox Code Playgroud)

但实际上我的真实代码是在WEB-INF/jsp/contact.jsp中

所以我总是这样做:

<jsp:forward page="/index"></jsp:forward>
Run Code Online (Sandbox Code Playgroud)

在我的控制器中,这意味着:

@RequestMapping("/index")
public String listContacts(Map<String, Object> map) {

    map.put("contact", new Contact());
    map.put("contactList", contactService.listContact());

    return "contact";
}
Run Code Online (Sandbox Code Playgroud)

我怎么能这样做,欢迎文件总是进入我的索引映射,这导致contact.jsp?

如果这令人困惑,请随意提问...

java spring spring-mvc

9
推荐指数
1
解决办法
2万
查看次数

获取webbrowser cookie登录

我正在创建一个Windows窗体应用程序,我有一个webbrowser control.

在用户登录后webbrowser,我想也登录与同一帐户Microsoft.Http.HttpClientHttpWebRequest或类似的,它应该是类似cURLPHP.

问题是网页只允许每个帐户进行单点登录,如果我使用HttpClient签名,它会将webbrowser踢出去.

我想知道的,如果有可能劫持webbrowser会话或者cookies在我HttpClient或类似的地方使用它api.

我可以webbrowser.Cookie用来获取一些数据,但是如何将其推送到HttpClient

这样的事情是否可能,我可以拿走cookie并使用相同的会话?如果是这样,怎么样?

.net c# cookies webbrowser-control

8
推荐指数
1
解决办法
2万
查看次数

Java Spring MVC在同一个JSP中获取/发布

这是我的控制器..

    @RequestMapping(value = "/add", method = RequestMethod.GET)
public String add(Model model) {
    return "add";
}

@RequestMapping(value = "/add", method = RequestMethod.POST)
public String added(@RequestParam("name") String name, Model model) {
    City city = new City();
    city.setCity(name);
    service.addCity(city);
    return "add";
}
Run Code Online (Sandbox Code Playgroud)

这是我的JSP视图..这只是暂时添加...这是add.jsp..so它回发给自己

    <form method="post" action="/spring/krams/edit/add">
Linna nimi
<input type="text" name="name">
<input type="submit" value="Test" name="submit" />
</form>
Run Code Online (Sandbox Code Playgroud)

我想要更改JSP文件,以便当我将其发布到此文件时,它会说..."添加了城市".那可能吗?

什么关于更新城市?

    @RequestMapping(value = "/update", method = RequestMethod.POST)
public String updated(@RequestParam("city") int city_id,
                      @RequestParam("text") String name,
                      Model model) {
    service.updateCity(name, city_id);
    return "update";
}
Run Code Online (Sandbox Code Playgroud)

这里没有对象?

java spring spring-mvc

7
推荐指数
1
解决办法
1万
查看次数

Java,Spring,Hibernate找不到org.springframework.orm.hibernate3.LocalSessionFactoryBean

我正在尝试使用spring + hibernate + ant项目

目前我收到此错误:

HTTP Status 500 -

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Servlet.init() for servlet spring threw exception
    org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
    org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405)
    org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:279)
    org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515)
    org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:300)
    java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    java.lang.Thread.run(Thread.java:722)
root cause

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contactController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private contact.service.ContactService contact.controller.ContactController.contactService; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.orm.hibernate3.LocalSessionFactoryBean] …
Run Code Online (Sandbox Code Playgroud)

java ant spring hibernate

7
推荐指数
1
解决办法
2万
查看次数