mercredi 6 mai 2015

Change Visual Studio 2013 Summary Tag Color on Dark Theme

When I have the Blue Theme on VS2013, the summary shows as:

Summary on Blue Theme

But when I change to my preferred theme, the Dark theme, the summary tag becomes all green:

Summary on Dark Theme

I like the grayed out version, since it gives more attention to the summary's text, instead of the tag itself, I just can't find how to change it on the Dark theme... any ideas? (I tried the color theme editor, but didn't help much).

How to access parent XML elements using Groovy/GPath

Using the following XML can anyone tell me how in Groovy (Gpath or Xpath) I perform a select on the left most element and also include a reference back to the correct parent element?

<CompoundEmployee>
  <person>
    <person_id_external>21554</person_id_external>
    <employment_information>
      <start_date>2014-02-27</start_date>
      <job_information><end_date>2013-04-21</end_date><event>H</event><start_date>2012-09-28</start_date></job_information>
      <job_information><end_date>2013-04-26</end_date><event>5</event><start_date>2013-04-22</start_date></job_information>
      <job_information><end_date>9999-12-31</end_date><event>R</event><start_date>2014-02-27</start_date></job_information>
    </employment_information>
  </person>
  <person>
    <person_id_external>8265</person_id_external>
    <employment_information>
      <start_date>2000-10-02</start_date>
      <job_information><end_date>2014-10-24</end_date><event>5</event><start_date>2014-05-22</start_date></job_information>
      <job_information><end_date>2014-05-21</end_date><event>H</event><start_date>2000-10-02</start_date></job_information>
      <job_information><end_date>9999-12-31</end_date><event>5</event><start_date>2014-10-25</start_date></job_information>
    </employment_information>
  </person>
  <execution_timestamp>2015-05-05T08:17:51.000Z</execution_timestamp>
  <version_id>1502P0</version_id>
</CompoundEmployee>

The select statement written in English is:

"Start Date of Job Information record is less than Employement Information Start Date AND Job Information event type is one of Hire or Rehire"

The elements returned by the query must include person_id_external from employment_information along with start_date from job_information.

So far I have tried.....

def xml = """ xml from above """
def list = new XmlSlurper().parseText(xml)
x = list.'**'.findAll { person ->
    person.event.text() in ['H','R'] && person.start_date.text() < list.person.employment_information.start_date.text()
} 
x.each { l -> println "Type -> ${l.event}, Start Date -> ${l.start_date}, End Date -> ${l.end_date}" }

which works great when there is only one person in the input file but when there are multiple employees the results are incorrect due to the wrong "list.person.employment_information.start_date" being referenced i.e. the parent/child nodes are not related.

Based on the above an example of the output is:

Type -> H, Start Date -> 2012-09-28, End Date -> 2013-04-21

Type -> R, Start Date -> 2014-02-27, End Date -> 9999-12-31

Type -> H, Start Date -> 2000-10-02, End Date -> 2014-05-21

where in fact it should return only 1 row:

Type -> H, Start Date -> 2012-09-28, End Date -> 2013-04-21

As you can see I am nearly there but I just can't work out how to reference and return the logically correct parent employment_information record.

Any ideas anyone?

Thanks, Greg

templating ejs in node for xml

I have a big well-formed xml and I want tempalte it like do ejs.

`<foo>
  <url><%= url %></url>
<foo>`

but if I do

res.render('template.xml', { url: 'http://foo.com' })

I am getting

Error: Cannot find module 'xml'

Can anyone suggest how to deal with it? I need just insert values in already formed xml, I don't want to serialize object to xml by schema. THank you in advance

Warnings in generating wsdl and soap stub codes using ws-security plugin and gsoap

I have a header file say myService.h in which I have included #import wsse.h in top of the file. Now,

soapcpp2 -S -x -e -Igsoap-2.8/gsoap/import -c myService.h

After firing the above command, I am getting 50 warnings:

**WARNING**: SOAP RPC encoding does not support XML attributes (detected at line 76 in wsu.h)

**WARNING**: SOAP RPC encoding does not support XML attributes (detected at line 118 in wsse.h)

and so on.....

I have tried adding two following lines in myService.h:

//gsoap myService schema elementForm: qualified

//gsoap myService schema attributeForm: qualified

But it didn't work...

What should I do to get rid of these warnings?

XSLT muenchian grouping with the help of key

I am trying to get to a solution and so far have got nothing. What I am trying to achieve is to transform

Input:
<?xml version="1.0" encoding="utf-8"?>
<Root>
    <Query>
        <ID>123123</ID>
        <NameOfTeam>Team1</NameOfTeam>
        <RaisingYear>2014</RaisingYear>
        <Brief>N/A</Brief>
        <TeamMembers>
          <Member>
            <Name>Person1</Name>
            <Role>Role1</Role>
          </Member>
          <Member>
            <Name>Person2</Name>
            <Role>Role2</Role>
          </Member>
            <Name>N/A</Name>
            <Role>
              Role4
            </Role>
          </Member>
        </TeamMembers>
        <TeamMembers2>
          <Member>
            <Name>Person3</Name>
            <Role>Role3</Role>
          </Member>
          <Member>
            <Name>Person4</Name>
            <Role>Role4</Role>
          </Member>
          <Member>
            <Name>Person5</Name>
            <Role>Role5</Role>
          </Member>
        </TeamMembers2>
        <Projects>
          <Project>NISAR</Project>
        </Projects>
        <Documents>
          <Document>
            <Language>en</Language>
            <LanguageName>English</LanguageName>
            <GeneralInfo>Useless project</GeneralInfo>
          </Document>
        </Documents>
      </Query>
      <Query>
        <ID>123124</ID>
        <NameOfTeam>Team2</NameOfTeam>
        <RaisingYear>2012</RaisingYear>
        <Brief>N/A</Brief>
        <TeamMembers>
          <Member>
            <Name>Person6</Name>
            <Role>Role1</Role>
          </Member>
          <Member>
            <Name>Person7</Name>
            <Role>Role2</Role>
          </Member>
            <Name>Person8</Name>
            <Role>Role3</Role>
          </Member>
        </TeamMembers>
        <TeamMembers2>
          <Member>
            <Name>Person3</Name>
            <Role>Role3</Role>
          </Member>
          <Member>
            <Name>Person4</Name>
            <Role>Role4</Role>
          </Member>
          <Member>
            <Name>Person5</Name>
            <Role>Role5</Role>
          </Member>
        </TeamMembers2>
        <Projects>
          <Project>MissionMars</Project>
        </Projects>
        <Documents>
          <Document>
            <Language>en</Language>
            <LanguageName>English</LanguageName>
            <GeneralInfo> </GeneralInfo>
          </Document>
          <Document>
            <Language>en</Language>
            <LanguageName>English</LanguageName>
            <GeneralInfo>It is a rubbish comment</GeneralInfo>
          </Document>
          <Document>
            <Language>fr</Language>
            <LanguageName>English</LanguageName>
            <GeneralInfo>It is another rubbish comment.</GeneralInfo>
          </Document>
        </Documents>
    </Query>
</Root>

to

Output:

<?xml version="1.0" encoding="utf-8"?>
<Root>
    <Query>
        <ID>123123</ID>
        <NameOfTeam>Team1</NameOfTeam>
        <RaisingYear>2014</RaisingYear>
        <Brief>N/A</Brief>
        <TeamMembers>
          <Member>
            <Name>Person1</Name>
            <Role>Role1</Role>
          </Member>
          <Member>
            <Name>Person2</Name>
            <Role>Role2</Role>
          </Member>
            <Name>N/A</Name>
            <Role>
              Role4
            </Role>
          </Member>
        </TeamMembers>
        <TeamMembers2>
          <Member>
            <Name>Person3</Name>
            <Role>Role3</Role>
          </Member>
          <Member>
            <Name>Person4</Name>
            <Role>Role4</Role>
          </Member>
          <Member>
            <Name>Person5</Name>
            <Role>Role5</Role>
          </Member>
        </TeamMembers2>
        <Projects>
          <Project>NISAR</Project>
        </Projects>
        <Documents>
          <Document>
            <Language>en</Language>
            <LanguageName>English</LanguageName>
            <GeneralInfo>Useless project</GeneralInfo>
          </Document>
        </Documents>
      </Query>
      <Query>
        <ID>123124</ID>
        <NameOfTeam>Team2</NameOfTeam>
        <RaisingYear>2012</RaisingYear>
        <Brief>N/A</Brief>
        <TeamMembers>
          <Member>
            <Name>Person6</Name>
            <Role>Role1</Role>
          </Member>
          <Member>
            <Name>Person7</Name>
            <Role>Role2</Role>
          </Member>
            <Name>Person8</Name>
            <Role>Role3</Role>
          </Member>
        </TeamMembers>
        <TeamMembers2>
          <Member>
            <Name>Person3</Name>
            <Role>Role3</Role>
          </Member>
          <Member>
            <Name>Person4</Name>
            <Role>Role4</Role>
          </Member>
          <Member>
            <Name>Person5</Name>
            <Role>Role5</Role>
          </Member>
        </TeamMembers2>
        <Projects>
          <Project>MissionMars</Project>
        </Projects>
        <Documents>
          <Document>
            <Language>en</Language>
            <LanguageName>English</LanguageName>
            <GeneralInfo>It is a rubbish comment</GeneralInfo>
          </Document>
          <Document>
            <Language>fr</Language>
            <LanguageName>English</LanguageName>
            <GeneralInfo>It is another rubbish comment.</GeneralInfo>
          </Document>
        </Documents>
    </Query>
</Root>

All document with same ID and Language information should be merged and if any of the details in document tag is empty than it should be replaced, only if available, by other document tag's information with same language tag.

The code that I am using for it is

<xsl:stylesheet version="1.0"
 xmlns:xsl="http://ift.tt/tCZ8VR">
  <xsl:output omit-xml-declaration="yes" indent="yes"/>

  <xsl:key name="QueryIDAndLangauge" match="Query" use="concat(ID, '+', Documents/Document/Language)"/>

  <xsl:key name="DocumentsAndLanguage" match="Language" use="Language"/>

  <xsl:key name="DocumentsAndLanguageValue" match="Language" use="concat(ID, '+', .)"/>

  <xsl:template match="node()|@*">
    <xsl:copy>
      <xsl:apply-templates select="node()|@*"/>
    </xsl:copy>
  </xsl:template>

  <xsl:template match="/*">
    <Root>
      <xsl:apply-templates select=
   "Query[generate-id()
          =
           generate-id(key('QueryIDAndLangauge',
                          concat(ID, '+', Documents/Document/Language)
                          )
                           [1]
                      )
           ]
   "/>
    </Root>
  </xsl:template>

  <xsl:template match="Document">
    <Document>
      <xsl:apply-templates select=
    "key('DocumentsAndLanguage', ../../ID)
        [generate-id()
        =
         generate-id(key('DocumentsAndLanguageValue',
                         concat(../../ID, '+', Langauge)
                         )
                          [1]
                     )
         ]
    "/>
    </Document>
  </xsl:template>
</xsl:stylesheet>

Thanks in Advance.

P.S.: Needless to mention, I am doing it in XSLT 1.0

Storing and retrieving large data in C# [on hold]

Currently, I am working on a project where I need to bring approx 100 Millions row of data from a table on to client code to retrieve the data faster.

The loading of data would be one time process so instead of making a database call I want to store it locally. somewhere in collection/xml and define function to get the row details:

I am not in a position to look into DB structure as its a third party vendor and I have to optimize the response time.

SO i want to save time for DB connection and return the data from any existing collection/ customised collection/xml/json.

It could be a local file stored having all these 10M rows and fetch the data from that one.

Pls suggest.

lets say: I have to

public list<mylist> GetDetailsbyId (int id)
{
//implementation
}

public list<mylist> GetDetailsbyName (string name)
{
//implementation
}

Can any one suggest what would be ideal way to store these large volume of data in c# code. I am thinking of XML.

Using org.apache.cxf.binding.soap.SoapMessage for creating SOAP WS project

I want to use org.apache.cxf.binding.soap.SoapMessage and org.apache.cxf.message.Message for testing of SOAP Web-service. I have project and .xml and .msg files for tests, but I don't know, how can I create message with cxf.binding.soap.SoapMessage and send this message into WS. I have this steps in project:

  1. Upload xml or msg file
  2. Create SoapMessage and Message variables
  3. Try create SoapMessage and overwrite this messgae with security header, which contains information about cert
  4. Send this message into WS and get response

But I catched java.lang.NullPointerException into SoapMessage. Please, give me advice or some links, which show me how I can correctly create SoapMessage and send it. UPD: Also, I asked about SoapMessage here but I haven't exact answer