Search -
Search - Search -
found 2549 matches
 forum index   my profile   search 
Not found what you where looking for? Try the  advanced search 
General Support > ROC Tutorial - Part 2 no longer works after install of 4.1.1
Joined: 19-January-2007
Posts: 30
Posted: 2-September-2010 18:09
ROC Tutorial - Part 2 no longer works after install of 4.1.1
After installing fresh EE 4.1.1, ROC tutorial - Part 2 (Servlet) no longer works. Will send a separate email with Visualizer debug file.
General Support > Downloaded EE-4.1.1 from 2010-8-13 and "firstmodule" tutorial no longer works.
Joined: 7-February-2005
Posts: 404
Location: between ROC and a hard place
Posted: 2-September-2010 13:17
sorry about that...
Hi Kansberry,
your visualizer files show that you still have the same situation. It looks like I didn't test the change I proposed well enough! :-(

The layer1 import was deeply nested inside the mapper and so wasn't visible on the outside the module when it was need to serialize the string.

Try changing the rootspace to this:
<rootspace>
  <!-- Dynamic Import into the HTTP fulcrum -->
  <fileset>
    <regex>res:/etc/system/SimpleDynamicImportHook.xml</regex>
  </fileset>
  <mapper>
    <config>
      <!-- Endpoint for the 'Hello World' resource -->
      <endpoint>
        <grammar>res:/tutorial/firstmodule/helloworld</grammar>
        <request>
          <identifier>active:groovy</identifier>
          <argument name="operator">res:/resources/scripts/helloworld.gy</argument>
        </request>
      </endpoint>
    </config>
    <space>
      <fileset>
        <private />
        <regex>res:/resources/.*</regex>
      </fileset>
      <import>
        <private />
        <uri>urn:org:netkernel:lang:groovy</uri>
      </import>
    </space>
  </mapper>
  <import>
    <uri>urn:org:netkernel:ext:layer1</uri>
  </import>
</rootspace>


Cheers, Tony
Solutions Developer > Any plans to port the address book and forum applications to NK4?
Joined: 21-July-2006
Posts: 25
Location: Toronto, Canada
Posted: 1-September-2010 19:57
Any plans to port the address book and forum applications to NK4?
Hi,

I had found useful the address book and forum applications in NK3 for learning to build apps in NetKernel.

Do you plan to port them to NK4?

Thanks,
Mircea
General Support > Downloaded EE-4.1.1 from 2010-8-13 and "firstmodule" tutorial no longer works.
Joined: 19-January-2007
Posts: 30
Posted: 1-September-2010 18:49
I finally had time to get back to this problem. Looks like I now have a new error with the change you suggested. I am emailing you the Visualizer files of the error I get. Let me know how to fix when you get time.
Solutions Developer > JSONFromXML part II - NK3 only
Joined: 22-April-2007
Posts: 112
Location: Belgium
Posted: 31-August-2010 14:34
JSONFromXML part II - NK3 only
Greetings all,

-- All of the below FYI

Some time ago I wrote http://www.netkernel.org/forum/topic/534/1. I haven't been able to check the JSON implementation in NK4, but there's some other funy stuff in the NK3 implementation ...

Say you want to return this :
{
"errors": {},
"success": true
}


That may not look like a lot, but a lot of services require your result to be like that. So you start writing your service and you end up with the following XML :
<root>
  <errors></errors>
  <success>true</success>
</root>

Nice, but how to convert this valid XML that to the above (valid) JSON. The answer is ... you can't. The conversion will keep the root element (which has to be there in order to have valid XML ... and that closes the circle).

In order to resolve this I hacked the JSONAspect.java source as follows :
/*
* JSONAspect.java
*
* Created on 16 June 2006, 10:09
*/

package org.ten60.json.representation;

import org.json.*;

/**
*
* @author  pjr
*/
public class JSONAspect implements IAspectJSON
{
   private JSONObject mJSON;
   
   /** Creates a new instance of JSONAspect */
   public JSONAspect(JSONObject aJSON)
   { 
           if (aJSON.has("removeme")){
             try{
               mJSON=aJSON.getJSONObject("removeme");
             }
             catch(JSONException e){
             }
           }
           else{
             mJSON=aJSON;
           }
   }
   
   public IJSONObjectReadOnly getJSONObject()
   {   return (IJSONObjectReadOnly)mJSON;
   }
   
}


Simply put, if the root-tag is <removeme>, it gets ... you guessed it ... removed (only the tag, not the content).

There's another issue with the NK3 implementation of JSONFromXML that does something wrong. For one reason or another the resulting JSON will always look like :
{
"errors": {},
"success": "true"
}
Note the double quotes around the boolean value. Same happens with numbers. Probably I do not understand the correct syntax in this case, I do see relevant code in the JSONObject.java source (valueToString method to be exact), it just doesn't work for me. Wrote an ugly hack for the boolean values (since yes, the services I work with require a boolean to be without the quotes).

Enjoy,
Tom
News > NetKernel News Volume 1 Issue 43
Joined: 7-February-2005
Posts: 591
Location: UK
Posted: 28-August-2010 09:59
NetKernel News Volume 1 Issue 43
News is now published in the NetKernel.org wiki.

Issue 43 is available here:

http://wiki.netkernel.org/wink/wiki/NetKernel/News/1/43/August_27th_2010

Topics include:

    * Repository Updates
    * NetKernel ClassLoaders
    * Talk: Resource Oriented Cloud Architectures

To get the most current issue visit:

http://wiki.netkernel.org/wink/wiki/NetKernel/News/latest
News > NetKernel News Volume 1 Issue 42
Joined: 7-February-2005
Posts: 591
Location: UK
Posted: 28-August-2010 09:58
NetKernel News Volume 1 Issue 42
News is now published in the NetKernel.org wiki.

Issue 42 is available here:

http://wiki.netkernel.org/wink/wiki/NetKernel/News/1/42/August_19th_2010

Topics include:

    * NetKernel Enterprise Edition Released to Manufacture.
    * WiNK updates, including Latex mathematics.

To get the most current issue visit:

http://wiki.netkernel.org/wink/wiki/NetKernel/News/latest
News > NetKernel News Volume 1 Issue 41
Joined: 7-February-2005
Posts: 591
Location: UK
Posted: 28-August-2010 09:56
NetKernel News Volume 1 Issue 41
News is now published in the NetKernel.org wiki.

Issue 41 is available here:

http://wiki.netkernel.org/wink/wiki/NetKernel/News/1/41/August_13th_2010

Topics include:

    * NetKernel Enterprise Edition Heads Up
    * NetKernel ssh daemon
    * An Independent View: What is this NetKernel thing Anyway?
    * NetKernel News Volume 1 Anthology (The power of the wiki goes to pjr's head).
    * P v NP

To get the most current issue visit:

http://wiki.netkernel.org/wink/wiki/NetKernel/News/latest
Solutions Developer > How to inline argument passed to xrl2 in its template
Joined: 7-February-2005
Posts: 404
Location: between ROC and a hard place
Posted: 27-August-2010 16:30
Variant 2 is the closest
Hi Mircea,

Variant 2 is the way to go. xrl:eval is the correct operation because it sets a string value into the xml document, xrl:include inserts an xml fragment into the document.

However there are two mistakes in your variant2:

1) xrl:eval attempts to source the specified request. Your argument month-number cannot be sourced because it is not an identifier to a resource, instead it is just a string. To fix this you can change your mapper to convert the argument it a pass-by-value string like this:

      <request>
         <identifier>active:xrl2</identifier>
         <argument name="template">xrl:template</argument>
         <argument name="content">xrl:content</argument>
         <argument name="month-number" method="as-string">arg:month-number</argument>
      </request>

For more details of the method attribute on declarative requests see:
http://docs.netkernel.org/book/view/book:guide:logicalreference/doc:logicalreference:module:standard:logical:declarative:request:syntax

2) When xrl process a document all xrl namespace tags are removed from the document as they are processed. What this means is that the xpath of "." will no longer be there and so cannot be substituted.

Try this:

<html xmlns:xrl="http://netkernel.org/xrl">
   <body>
      <h1>Monthly expenses</h1>
      <xrl:eval>
         <xrl:xpath>../h1</xrl:xpath>
         <xrl:identifier>arg:month-number</xrl:identifier>
      </xrl:eval>
      <xrl:include identifier="arg:content"/>
   </body>
</html>

Cheers, Tony
Solutions Developer > How to use xpath-functions in xslt stylesheets
Joined: 14-March-2005
Posts: 86
Location: Amsterdam, The Netherlands
Posted: 27-August-2010 05:26
Use XSLT 2.0 and its accessor
Hi, Mircea,

You seem to be trying to use XPath 2.0 functions in a XSLT 1.0 stylesheet. That won't work, you'll either have to use EXSLT functions or switch to XSLT 2.0. XSLT 2.0 is much easier for many tasks then XSLT 1.0, so that would be my advice.

Here is an XSLT 2.0 version of your example:


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">

    <xsl:template match="resultset">
        <expenses>
            <xsl:attribute name="total" select="max((1,2,3))"/>
            <xsl:apply-templates/>
        </expenses>
    </xsl:template>

</xsl:stylesheet>


Please notice the following changes:
- stylesheet version is now 2.0
- there is no need to declare the fn namespace prefix, the XSLT 2.0 processor will use that as default
- the max function takes a sequence, so in this case you need an extra set of brackets (you won't need those of you select a nodeset using XPath expression)

You'll need to use the XSLT 2.0 accessor in NK (see http://docs.netkernel.org/book/view/book:xml:saxon:book/doc:xml:saxon:xslt2 for NK4, for NK3 I couldn't find a public website anymore but you can try http://localhost:1060/book/developerreference/doc_ura_xslt2 (notice it's in the xquery module)).

If you've to stick to XSLT 1.0 you find information about EXSLT here: http://www.exslt.org/. It depends a bit on the XSLT processor of some of these functions are already by default available. I'm sorry I haven't been using XSLT 1.0 for a long time, so I don't know the current status ...

Hope this helps,

Menzo
© 2003-2006, 1060 Research Limited. 1060 registered trademark, NetKernel trademark of 1060 Research Limited.