小编Sal*_*kci的帖子

在Java中整数为两位十六进制数

我需要在Java中将整数值更改为2位十六进制值.有没有办法解决这个问题.谢谢

我的最大数字是63,最小的数字是0.我想要小值的前导零.

java hex integer

71
推荐指数
4
解决办法
8万
查看次数

我应该购买哪些数据结构和算法书?

我知道C和C++,我有一些Java经验,但我不太了解算法和数据结构.

我在亚马逊上搜索过,但我不知道应该选择哪本书.我不想要一本仅以理论部分为基础的书; 我也想要实用的部分(可能超过理论部分:)).

我不希望代码以某种语言实现,但如果是在Java中,我可能会更高兴.:)

algorithm data-structures

45
推荐指数
5
解决办法
11万
查看次数

操作按钮未显示在操作栏上?

我下面的教程developer.android.com并尝试添加动作条上的项目.

虽然我添加了所有代码,但搜索操作显示为溢出元素而不是操作按钮元素.我尝试了带有软键盘选项的4"和7"虚拟设备.

这里是

main_activity_actions.xml
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<!-- Search, should appear as action button -->
<item android:id="@+id/action_search"
    android:icon="@drawable/ic_action_search"
    android:title="@string/action_search"
    android:showAsAction="ifRoom" />
<!-- Settings, should always be in the overflow -->
<item android:id="@+id/action_settings"
    android:title="@string/action_settings"
    android:showAsAction="never" />
</menu>
Run Code Online (Sandbox Code Playgroud)

下面是MainActivity.javaonCreateOptionsMenu方法.

 @Override
    public boolean onCreateOptionsMenu(Menu menu) {

        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main_activity_actions, menu);
        return super.onCreateOptionsMenu(menu);
    }
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

我想了解导致这个问题的原因.

android

16
推荐指数
2
解决办法
4万
查看次数

在Hibernate中使用SEQUENCE时导致唯一约束违规的原因是什么?

我使用下面的代码为id字段生成唯一ID .它工作正常,直到上周.我使用Hibernate接口删除了一些实体,然后当我尝试插入新记录时,它开始给出一个唯一的约束违例异常.

可能是什么导致了这个问题?

@SequenceGenerator(name = "ParamGenerator", sequenceName = "ParamSequence", allocationSize = 1)
public class Param extends IdNameEntity<Long> {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "ParamGenerator")
    private Long id;
Run Code Online (Sandbox Code Playgroud)

这是删除方法:

@Override
public void delete(final T t) {
    getCurrentSession().delete(t);
}
Run Code Online (Sandbox Code Playgroud)

这是错误日志:

2018-04-25 16:34:41 [http-nio-8081-exec-3] INFO  o.h.e.j.b.internal.AbstractBatchImpl - HHH000010: On release of batch it still contained JDBC statements
2018-04-25 16:34:41 [http-nio-8081-exec-3] ERROR org.hibernate.internal.SessionImpl - HHH000346: Error during managed flush [could not execute statement]
2018-04-25 …
Run Code Online (Sandbox Code Playgroud)

java oracle hibernate jpa sequence

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

ScrollView自动滚动到可选的TextView

我有一个垂直的LinearLayout内部ScrollView.一切顺利,直到设定第三TextViewLinearLayout selectable.

在此更改后,它会自动滚动到第三个TextView.

什么可能导致问题?

之前之后的变化:

在此输入图像描述 在此输入图像描述

布局

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/roota_view"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_gravity="right"
    android:orientation="vertical" >

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:paddingBottom="@dimen/activity_vertical_margin"
        android:paddingLeft="@dimen/activity_horizontal_margin"
        android:paddingRight="@dimen/activity_horizontal_margin"
        android:paddingTop="@dimen/activity_vertical_margin"
        tools:context="com.saliherikci.poemnotebook.ReadPoemActivity$PlaceholderFragment" >

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:focusable="false"
            android:focusableInTouchMode="false"
            android:orientation="vertical" >

            <TextView
                android:id="@+id/poemTitleTextView"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="Çanakkale ?ehitlerine"
                android:textColor="@color/poem_title"
                android:textSize="24dp" />

            <TextView
                android:id="@+id/poemAuthorTextView"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="5dp"
                android:text="Mehmet Akif ERSOY"
                android:textAppearance="?android:attr/textAppearanceSmall"
                android:textSize="11dp" />

            <TextView
                android:id="@+id/poemContentTextView"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="?u Bo?az harbi nedir? Var m? ki dünyâda e?i? "
                android:textColor="@color/poem_content"
                android:textIsSelectable="true"
                android:textSize="10dp" /> …
Run Code Online (Sandbox Code Playgroud)

android scrollview textview android-layout

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

如何在C中将动态int数组元素初始化为0

我创建了一个动态数组,我需要将所有成员初始化为0.如何在C中完成?

   int* array;
    array = (int*) malloc(n*sizeof(int));
Run Code Online (Sandbox Code Playgroud)

c arrays dynamic-arrays

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

Netbeans无法启动Glassfish 4服务器

我使用的是Netbeans 7.4和Glassfish 4.0.我可以从命令行手动启动glassfish 4.0但是当我点击netbeans运行项目按钮时,它会显示"启动GlassFish Server".它变得超过10分钟但没有任何反应.它昨天运行正常,我没有改变任何东西,但今天它无法启动服务器.

可能是什么问题?

在此输入图像描述

java netbeans glassfish java-ee

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

在Github Desktop App上的每次启动时"为github提取命令行工具"

在每次推出Github Desktop应用程序时,我都会看到一个屏幕

请等待,
为github提取命令行工具,这可能需要一两分钟

它真的需要将近1分钟.
在每次启动程序时都会发生这种情况是正常还是有问题?

github github-for-windows

6
推荐指数
1
解决办法
370
查看次数

响应迟到时,Cxf客户端需要很长时间

我正在使用cxf库作为Web服务客户端.

当响应在5秒左右到来时,cxf大约需要20秒才能返回响应.ws返回33912长响应.

客户端对快速响应没有任何问题.

我找不到问题所在.我测试了ws端点,它在8秒内返回最大值.但是cxf客户端有时需要30-50秒.

我打开了调试日志,在这两行之间需要9秒

2018-01-11 17:17:14.022 DEBUG 10492 --- [nio-8086-exec-6] o.apache.cxf.transport.http.HTTPConduit:将带有标题的POST消息发送到 http://example.com/服务 管道:{ http://example.com./ } ExampleWebServicePort.http-conduit

2018-01-11 17:17:23.370 DEBUG 10492 --- [nio-8086-exec-6] org.apache.cxf.endpoint.ClientImpl:由bus提供的拦截器:[org.apache.cxf.ws.policy. PolicyInInterceptor @ 3ec595ab]

这是客户:

HTTPConduit httpConduit = (HTTPConduit) client.getConduit();
            httpConduit.setAuthSupplier(null);
            httpConduit.setAuthorization(null);
            HTTPClientPolicy clientPolicy = new HTTPClientPolicy();
            clientPolicy.setConnectionTimeout(60000L);
            clientPolicy.setReceiveTimeout(60000L);
            httpConduit.setClient(clientPolicy);
Run Code Online (Sandbox Code Playgroud)

什么可能导致这个问题?

java web-services cxf cxf-client

6
推荐指数
1
解决办法
350
查看次数

当响应代码为401时,ClientHttpResponse.getBody()抛出ResourceAccessException

我正在尝试为每个请求记录请求 - 响应对.问题是,当响应代码是401,ClientHttpResponse.getBody()抛出ResourceAccessException,我无法读取响应正文.

这是RestTemplate配置

RestTemplate restTemplate = new RestTemplate();

// Added this requestFactory to make response object readable more than once.
ClientHttpRequestFactory requestFactory =
        new BufferingClientHttpRequestFactory(new SimpleClientHttpRequestFactory());
restTemplate.setRequestFactory(requestFactory);
restTemplate.getInterceptors().add(new RequestLoggingInterceptor(vCloudRequest.getAction(),httpHeaders));
    restTemplate.setErrorHandler(new RequestErrorHandler());

return restTemplate;
Run Code Online (Sandbox Code Playgroud)

下面的拦截器的最后一行抛出以下异常.

我该如何解决这个问题?

org.springframework.web.client.ResourceAccessException:对" https://example.com/api/sessions "的POST请求发出I/O错误:服务器返回HTTP响应代码:401为URL:https://example.com/ api/sessions ; 嵌套异常是java.io.IOException:服务器返回HTTP响应代码:401为URL:https://example.com.11/api/sessions

这是拦截器的相关部分.

@Override
public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException {
    ClientHttpResponse response = execution.execute(request, body);

    String requestString = new String(body);

    // Calling this method because when we …
Run Code Online (Sandbox Code Playgroud)

java spring resttemplate

6
推荐指数
1
解决办法
4404
查看次数