小编Pat*_*tan的帖子

在java 8中使用group进行计数的实现

我正在寻找group by的实现,拥有然后根据lambda表达式中的count进行过滤.

select COUNT(employee_id), department_id  from employee
GROUP BY department_id
HAVING COUNT(employee_id) > 1
Run Code Online (Sandbox Code Playgroud)

是否有使用lambda表达式实现此目的的简单实现.

java lambda java-8 java-stream

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

使用Core Service创建组件时出现故障状态错误

在SDL Tridion 2011 SP1中使用Core Service时出现"故障状态"错误.以下是什么问题?

namespace coreservice1
{
      public partial class _Default : System.Web.UI.Page
      {
       protected void Page_Load(object sender, EventArgs e)
       {
        try
        {

            using (ChannelFactory<ISessionAwareCoreService> factory =
      new ChannelFactory<ISessionAwareCoreService>("wsHttp_2011"))
            {
                ISessionAwareCoreService client = factory.CreateChannel();
                string SCHEMA_URI = "tcm:7-426-8";

                var schemaFields = client.ReadSchemaFields(SCHEMA_URI, true, new ReadOptions());
                foreach (var field in schemaFields.Fields) 
                { 
                    Response.Write(string.Format("{0}", field.Name));                         
                } 
                Response.Write(schemaFields.NamespaceUri);
                string NEW_COMPONENT_FOLDER_URI = "tcm:8-15-2";

               Tridion.ContentManager.CoreService.Client.ComponentData component = new Tridion.ContentManager.CoreService.Client.ComponentData
               {
                   Schema = new LinkToSchemaData { IdRef = "tcm:8-426-8"},
                   Title = "Helloworldalll",
                   Id = "tcm:0-0-0", …
Run Code Online (Sandbox Code Playgroud)

tridion

5
推荐指数
1
解决办法
1279
查看次数

访问SDL Tridion 2011 SP1上的核心服务时出错

我在访问SDL Tridion 2011 SP1上的核心服务时遇到错误.当我尝试/webservices/CoreService2011.svc从IIS服务器浏览时,它显示以下错误:

此集合已包含方案http的地址.
此集合中每个方案最多只能有一个地址.如果您的服务是在IIS中托管的,则可以通过将'system.serviceModel/serviceHostingEnvironment/multipleSiteBindingsEnabled'设置为true或指定'system.serviceModel/serviceHostingEnvironment/baseAddressPrefixFilters'来解决问题.参数名称:item

任何人都可以提供帮助,如何纠正.

wcf tridion

5
推荐指数
1
解决办法
236
查看次数

使用SDL Tridion 2011 SP1中的Tom.Net API获取Xhtml字段的完整XMLsource

我正在使用SDL Tridion 2011 SP1中的Tom.Net API.我试图检索XhtmlField的"源"部分.

我的来源看起来像这样.

<Content>
    <text>
        <p xmlns="http://www.w3.org/1999/xhtml">hello all<strong>
            <a id="ID1" href="#" name="ZZZ">Name</a>
        </strong></p>
    </text>
</Content>
Run Code Online (Sandbox Code Playgroud)

我想获取此"text"字段的来源并使用名称处理标记a.

我试过以下:

ItemFields content = new ItemFields(sourcecomp.Content, sourcecomp.Schema);
XhtmlField textValuesss = (XhtmlField)content["text"]; 

XmlElement  textxmlelement = textValuesss.Definition.ExtensionXml;

Response.Write("<BR>" + "count:" + textxmlelement.ChildNodes.Count);
for (int i = 0; i < textxmlelement.ChildNodes.Count; i++)
{
    Response.Write("<BR>" + "nodes" + textxmlelement.ChildNodes[i].Name);
}

//get all the nodes with the name a
XmlNodeList nodeswithnameA = textxmlelement.GetElementsByTagName("a");
foreach (XmlNode eachNode in nodeswithnameA)
{
    //get the value at the …
Run Code Online (Sandbox Code Playgroud)

tridion

5
推荐指数
1
解决办法
208
查看次数

eclipse 搜索资源,包括 jar 文件

我正在尝试在项目中搜索资源“temp.xml”。该资源位于项目的库文件之一中。

我可以手动找到它,但是当我尝试使用 ctrl+shift+RI 时却无法找到它。

任何人都可以建议如何在项目(包括库)中搜索资源。

我正在使用 Indigo SR1。

谢谢。

eclipse

5
推荐指数
1
解决办法
3978
查看次数

创建一个独立的.exe文件

我有一个在Visual Studio 2010中构建的控制台应用程序.

当我实际构建项目时,我得到\ bin\Debug\MyProj.exe下的.exe文件.

当我粘贴并从其他位置运行此.exe时,它也期待其他文件.

有什么想法我怎么能把它作为独立的exe文件.

c# console-application visual-studio-2010

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

是否可以获取没有路径参数的绝对请求URL

我试图获取请求URL而没有路径参数的值.

考虑我的完整网址是

URl: http://localhost:8080/aaa/mock/abcd/1234/true
Path parameters: abcd, true
Output needed: /aaa/mock/abcd
Run Code Online (Sandbox Code Playgroud)

我的Web服务方法如下所示.

@Path(value = "/aaa/mock")
@Component
public class MockService
{
    private static Log log = LogFactory.getLog(MockService.class);


    //address
    @GET
    @Path(value = "/{mockrequest}/{status}")
    @Produces(MediaType.JSON)
    public String mockEngagement(@Context ContainerRequestContext request,@PathParam("mockrequest") String mockrequest,@PathParam("status") String status )
    {
        log.info("The mock url is"+request.getUriInfo().getRequestUri());  
        log.info("The mock url is"+request.getUriInfo().getAbsolutePath()); 
        log.info("The mock url is"+request.getUriInfo().getBaseUri()); 
        log.info("The mock url is"+request.getUriInfo().getMatchedURIs()); 
        **//Out put needed /aaa/mock/abcd**
        return "ajaja";
    }


}
Run Code Online (Sandbox Code Playgroud)

以上呼叫均不返回所需信息.

我在想是否有一个通用的过程来获得所需的输出,而不管路径参数的数量.

任何这样的方法.

java rest jersey

5
推荐指数
1
解决办法
5508
查看次数

Jersey 从 1.19 迁移到 2.25 Maven 依赖项

我正在从 Jerser 1.19 迁移到 Jersey 2.25

<dependency>
  <groupId>com.sun.jersey</groupId>
  <artifactId>jersey-server</artifactId>
  <version>1.19</version>
  <scope>compile</scope>
</dependency>
<dependency>
  <groupId>com.sun.jersey</groupId>
  <artifactId>jersey-client</artifactId>
  <version>1.19</version>
  <scope>compile</scope>
</dependency>
<dependency>
  <groupId>com.sun.jersey.contribs</groupId>
  <artifactId>jersey-apache-client</artifactId>
  <version>1.19</version>
  <scope>compile</scope>
</dependency>
<dependency>
  <groupId>com.sun.jersey</groupId>
  <artifactId>jersey-json</artifactId>
  <version>1.19</version>
  <scope>compile</scope>
</dependency>
<dependency>
  <groupId>com.sun.jersey.contribs</groupId>
  <artifactId>jersey-spring</artifactId>
  <version>1.19</version>
  <scope>compile</scope>
</dependency>
Run Code Online (Sandbox Code Playgroud)

我正在尝试在 Jersey 2.25 中找到合适的罐子

我已经设法获得这些依赖项。

<dependency>
    <groupId>org.glassfish.jersey.core</groupId>
    <artifactId>jersey-server</artifactId>
    <version>2.25</version>
</dependency>
<dependency>
    <groupId>org.glassfish.jersey.core</groupId>
    <artifactId>jersey-client</artifactId>
    <version>2.25</version>
</dependency>
<dependency>
    <groupId>org.glassfish.jersey.media</groupId>
    <artifactId>jersey-media-json-jackson</artifactId>
    <version>2.25</version>
</dependency>
<dependency>
        <groupId>org.glassfish.jersey.ext</groupId>
        <artifactId>jersey-spring3</artifactId>
        <version>2.25</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)

我还没有找到等同的东西jersey-apache-client

如果需要任何额外的罐子,有人可以帮助我吗?

java jersey jersey-client jersey-1.0 jersey-2.0

5
推荐指数
1
解决办法
3156
查看次数

当map返回null时执行orElse

我写了一个简单的片段

String aa = "aa";
String aaa = null;

String result = Optional.ofNullable(aa)
                        .map(s -> aaa)
                        .orElse("bb");

System.out.println(result);
Run Code Online (Sandbox Code Playgroud)

orElseaa当为空时执行。map但当返回 null 时它也会被执行。

我的理解是,orElse只会被执行aa为空。但即使map返回null也会执行吗?

java java-8 option-type

5
推荐指数
1
解决办法
8171
查看次数

telnet到端口8089正确的命令

我在远程服务器上使用telnet端口8089.

可以告诉我以下哪个命令是真的.

telnet 74.255.12.25 8089
Run Code Online (Sandbox Code Playgroud)

要么

telnet 74.255.12.25 89
Run Code Online (Sandbox Code Playgroud)

提前致谢.

unix telnet

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