New java-like scripting language w/ powerful regex

Hi,
Just wanted to let you know that there's now a new scripting language called P~ with the following important aspects:
1) matches and exceeds Perl regex solveability -- e.g. offers full regex-based boolean query on non-indexed corpus, offers completely general side-effects, more accurate than Perl code assertions
2) basic grammar is very Java like
3) regex grammar is algebraic, not metacharacter-based, leads to more readable and maintainable solutions to hard problems
4) offers an easy tool to debug matching behavior of your regexes (rules)
5) though a full featured scripting language, you can write scriptlets and call them from Java classes, with arguments. Allows you to use your regex solutions in Java applications.
6) the language is offered as a Java library, as well as a standalone application that runs the library. This means that your scripts can import java classes available in the classpath, you can leverage existing Java libraries.
Check out the website and try it out: http://ptilde.pbwiki.com
Andy

True to an extent. We don't yet have lookaround assertions and won't have backreferencing any time soon. But there are same-time assertions which offer much of the same, and allow for boolean query.
More accurate general statement insertion side-effects (than Perl code assertions) means that your statements are executed if and only they wrap a subpattern that is part of the ultimate best match -- Perl code assertions execute when the automata encounters them, even if where they are in the regex is ultimately not part of the match, or even if there is no match at all. This aspect is a huge part of the solveability advantage.
As to the regex test cases, there are about 1000, and we will post them soon.

Similar Messages

  • Arranging data in excel by using any scripting language like VB, Java \

    I need a help in arranging the data in first column into different columns according to equivalent row value.
    for example.
    Time        
    Name Class
    Activity Subject
    12 Feb 2014 10:00 AM Robert
     5th School started
    12 Feb 2014 10:30 AM Robert
     5th Break
    12 Feb 2014 11:00 AM Robert
     5th Session Started
    Science
    12 Feb 2014 11:30 AM Edwin
     5th School Started
    12 Feb 2014 12:00 AM Edwin
     5th Break
    12 Feb 2014 01:00 PM Edwin
     5th Session Started
    Maths
    Above Data to be arranged as mentioned below
    Time A Time B
    Time C        
    Name Class
    Subject
    12 Feb 2014 10:00 AM 12 Feb 2014 10:30 AM 12 Feb 2014 11:00 AM
    Robert 5th
    Science
    12 Feb 2014 11:30 AM 12 Feb 2014 12:00 AM 12 Feb 2014 01:00 PM
    Edwin 5th
    Maths
    As actual data is different and i cannot share the data here.. but i need to create a VB or Java or any language script for n number of above mentioned data to bring out the data into below format.. 
    Please help me in finding out solution

    Data from A1
    VVBA Code:
    Sub lk()
    Dim wks As Worksheet: Set wks = ActiveSheet
    Dim x&, y&: y = 2 '1st data row
    Dim max_row&: max_row = wks.Cells(wks.Rows.Count, "a").End(xlUp).Row
    Dim n_wks As Worksheet: Set n_wks = ActiveWorkbook.Worksheets.Add
    'Headers
    With n_wks.Cells(1, 1)
    .Value = "Time A"
    .Offset(, 1) = "Time B"
    .Offset(, 2) = "Time C"
    .Offset(, 3) = "Name"
    .Offset(, 4) = "Class"
    .Offset(, 5) = "Subject"
    End With
    'Pull datas i step
    For x = 2 To max_row Step 3 'rows 2|5|8...
    n_wks.Cells(y, 1).Value = wks.Cells(x, 1).Value
    n_wks.Cells(y, 2).Value = wks.Cells(x + 1, 1).Value
    n_wks.Cells(y, 3).Value = wks.Cells(x + 2, 1).Value
    n_wks.Cells(y, 4).Value = wks.Cells(x, 2).Value
    n_wks.Cells(y, 5).Value = wks.Cells(x, 3).Value
    n_wks.Cells(y, 6).Value = wks.Cells(x + 2, 5).Value
    y = y + 1
    Next
    End Sub
    p.s.
    Gallery is not for that ;] - use OneDrv, Dropbox, Or other
    Oskar Shon, Office System MVP - www.VBATools.pl
    if Helpful; Answer when a problem solved

  • How to create a scripting language in java?

    Hello,
    All that I want to do is to create a scripting language in java. I�m familiar with javacc, jsr223 and other things but don�t know how to start. The language syntax is java 5 syntax with some change and I want to generate java source code from small scripts. In fact I don�t know how other languages (like groovy) are created.
    I hope you can show me the required steps.
    Looking forward to hear from you.
    Thanks.

    That's all, huh?
    For a start, generally when I hear "scripting language" I'm thinking interpretter, not a system which creates compiled (or compilable) code.
    I get the impression that what you're talking about is what I'd call a "preprocessor" language, some extra syntax added to java which the preprocessor renders into ordinary java.
    As far as complexity is concerned, much depends on how deeply involved the extra syntax is with the embedded ordinary Java. Does you preprocessor need to understand the java, or is it just embedded as text? How easilly identified are your preprocesor statments? It's a lot easier to do this if preprocessor lines are instantly identifiable from Java code (e.g. start with a #).
    Basically the stages are always the same;
    1) Lexical analysis i.e. picking out words, operators, numbers, quoted strings.
    2) Construct a syntax tree.
    3) Generate code (in this case Java).
    Now, in this case, some of the nodes in the syntax tree may simply be chunks of undigested Java.

  • Opening OA page in new java script window from ProcessRequest method

    I wish to open new OA page in new java script window.
    Code is
    javascript:var help_win = window.open(strHelpDesk,'help_win',
    'resizable=yes,scrollbars=yes,toolbar=yes,width=600,height=500'); help_win.focus();
    strHelpDesk is the url of the requested new OA page .. How can we open that page in new window from processRequest .. I can't assign this code in pages's attribute ... The new Oa page should be opened whenever , control goes in Processrequest ... Do we have such command ? can we use pagecontext.redirectImmediately..or any other command ..
    thx in advance

    Yes, you can, what you need to do is
    add a raw text bean in your page.
    Attach this raw text bean to a transient attribute (column) of VO
    populate this column with your javascript function which will open a new window and inlcude its call here
    now whenyour page will render and process request is called ur javascript function is triggered and a new window will be opened.I guess i am clear!
    --Mukul                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • The candara font in italics is turning my words into what looks like another language (it's only happening in the italics version).  Does anyone know how to fix it? (I'm running OSX 10.8.3 on a new iMac

    The candara font in italics is turning my words into what looks like another language (it's only happening in the italics version).  Does anyone know how to fix it? (I'm running OSX 10.8.3 on a new iMac and the only change I've made recently is to install MS Office for Mac 2011)

    This is what the font turns it into (it's supposed to say Chrysler Building & New York Public Library).  The font came with Pages which is what I'm working in.  It worked before but isn't now.

  • Query a resultset in java like CFQUERY

    Hello,
    Is there a way to query a resultset in java. Yes what I mean is after obtaining one resultset, again query on that resultset like we do to a table in the DB.
    Here is my problem in detail and any help doing the same in Java will be most appreciated :-)
    I am working on a peculiar problem where we are moving our application from cold fusion to Java. Cold fusion being very powerful for database oriented applications my project was initially developed using CF and uses a lot of advanced features of CF. However the need to move to java was soon realised due to various reasons. Now one of the main problems we are facing is the CFQUERY tag in cold fusion.
    This tag lets you create a resultset by
    <cfquery name="aaa" datasource="blah-blah">
    QUERY COMES HERE
    </cfquery>
    The best part is.... you can also query the above resultset obtained as follows:
    <cfquery name="bbb" dbtype="query">
    SELECT * from aaa where ***************
    </cfquery>
    We have used it so often in CF since it significantly reduces the query throughput times. Now we would love to find a way to do the same in Java.
    Any ideas
    Thanks
    Karen

    Yes thats one way of working with it. But the problem
    is we are dealing with very huge volume of data and
    hence querying an already existing resultset is the
    best option and has been working very well with our
    kind of project too. We also have several concurrent
    users doing the same which adds more load on the DB so
    doing it from the CF/Java end seems a better choice
    for us.I understand your sentiment, but having worked with applications trying to 'port' applications to new technologies I would have some concerns with your approach. Rather then 'port' the application I would suggest that you will have to re-engineer the application. This is more true for larger systems where larger system is heavy mulit-user, or large database access. It is also more true for applications moving from procedural to object based languages.
    I don't agree that you are better off manipulating data on the application server. In my experience I have found that data manipulation is optimized when running as close to the database as possible (for the reasons listed in my previous post). So if you decide to re-engineer you may want to consider this in your design decisions.
    We already have the DB so we are not even considering
    looking for another one. BTW we're using SQL SERVER.Well, as long as you don't have too many users (darn that original sybase lock manager) :-)
    I too can't think of a way to get this done using Java
    like CF. Hmmm .... yeah if nothing else then we'll
    have to change the way we work all together.I have no experience in using it, but user "cluckcluck" posted the following. Might be something to take a look at. This is similar to what I was talking about when using embedded Java databases like Cloudscape, but this works with external databases:
    "An excellent solution for this sort of problem is Hibernate (www.hibernate.org) a DB independent ORM persistance layer. Each data source would need to be defined, and each datasource would have its own SessionFactory but once this mapping and config is done you can treat the contents of the DB as POJOs, and perform queries against them. Its not so generic that you wouldn't still have to know which data model the entity you are after is in..."
    Good Luck!

  • Simple statically typed scripting language for my game?

    Hi, I'm looking for a scripting language for my little game. I want make game runnable on both mobile and desktop. I would like to compile scripts to native java for j2me, so they don't suffer from interpreter overhead (possiblity of running an interpreter on j2me is a plus, I can imagine it on high-end devices). On j2se, I would like to have all code to be interpreted (or dynamically compiled, whatever) so user can, for example, download new game content from the internet. Also I would like the language to be simple and cute and it does not have to provide advanced features (like closures or generators). Even classes are optional.
    To sum up the requirements:
    - statically typed (ideally with smart type inference). This is must in order to allow compilation.
    - as simple as possibly (all I want is to define some functions and call them from the game).
    - can be compiled to clean Java (byte)code. I mean, it should not wrap every int to Integer for example. Compiled code runs on J2ME.
    - can be interpreted (or compiled on demand). Possibility to do this on J2ME is not required but welcome.
    - direct importing of native java classes is not required (actually I don't like it, I would like to draw a clean line between scripts and the engine)
    - free license (gpl is ok too)
    - python-like syntax is a plus :)
    Anyone ever heard about such thing? I'm prepared to implement some missing features. Actually I'm prepared to write it all if I don't find suitable starting point.

    I fail to see how this is a Java Game Development Issue, or even a Java issue: what you are asking for is a scripting language that you can consequently get the freedom to run on multiple environments through compiling to Java. IMO: not a Java issue at all.

  • Scripting Languages are for Insane People!!!!

    Hope you brought your flamethrowers because I am feeling a bit chilled.
    Sooo I am knee deep in some heavy javascript(Nodejs) and while fighting to populate an array with the results of a sqlite query
    (somehow my array is getting nuked nodejs or nodejs-sqlite3 bug? )
    I am left scratching my head saying to my self WTF!! This would have taken me like 5 sec in Qt C++. So I wrote up the same example
    in Ruby, Python, Java, Lua and Perl. And in every case my Qt C++ example was not only cleaner, shorter but easier to write/understand.
    Granted scripting languages are not only valuable but necessary in CERTAIN cases, but the way people use them today is just INSANE.
    My primary scripting language is javascript but that is only because my work requires it. But ill take lua over any scripting language any day.
    I am going to go sink my teeth in Django see if that pisses me off any less!
    Sooo whats your opinion.
    Last edited by zester (2011-09-13 05:19:18)

    satanselbow wrote:
    ethail wrote:
    keenerd wrote:But Lua is a scripting language.  Maybe I missed the joke?
    I think he could be pointing that of the many scripting languajes he has used, seems that only LUA satisfies him, and it's not widely used as he would like. That's what it seemed to me.
    Somewhat ironically (within this threads context) - one of Lua's biggest selling points is it's simple integration with other languages, both scripting and higher level.
    Good point!
    Lua is insanely <-- Word of the day (Pee-Wee Herman Play House AHHHHHHHHHH) easy
    to embed and bind.
    Little examples I wrote a couple of years ago sooooo it is what it is.
    If using C++
    extern "C" {
    #include "lua.h"
    #include "lualib.h"
    #include "lauxlib.h"
    How to call a C Function from Lua
    luaavg.c
    #include <stdio.h>
    #include "lua.h"
    #include "lualib.h"
    #include "lauxlib.h"
    /* gcc -o luaavg luaavg.c -I/usr/local/include -L/usr/local/lib -llua -lm -ldl */
    /* the Lua interpreter */
    lua_State* L;
    static int average(lua_State *L)
    /* get number of arguments */
    int n = lua_gettop(L);
    double sum = 0;
    int i;
    /* loop through each argument */
    for (i = 1; i <= n; i++)
    /* total the arguments */
    sum += lua_tonumber(L, i);
    /* push the average */
    lua_pushnumber(L, sum / n);
    /* push the sum */
    lua_pushnumber(L, sum);
    /* return the number of results */
    return 2;
    int main ( int argc, char *argv[] )
    /* initialize Lua */
    L = lua_open();
    /* load Lua base libraries */
    luaL_openlibs(L);
    /* register our function */
    lua_register(L, "average", average);
    /* run the script */
    luaL_dofile(L, "avg.lua");
    /* cleanup Lua */
    lua_close(L);
    /* print */
    printf( "Press enter to exit..." );
    getchar();
    return 0;
    -- call a C function
    avg, sum = average(10, 20, 30, 40, 50)
    print("The average is ", avg)
    print("The sum is ", sum)
    avg, sum = average(1, 2, 3, 4, 5)
    print("The average is ", avg)
    print("The sum is ", sum)
    --- How to call a Lua Function from C
    #include <stdio.h>
    #include "lua.h"
    #include "lualib.h"
    #include "lauxlib.h"
    /* gcc -o luadd luadd.c -I/usr/local/include -L/usr/local/lib -llua -lm -ldl */
    /* the Lua interpreter */
    lua_State* L;
    int luaadd ( int x, int y )
    int sum;
    /* the function name */
    lua_getglobal(L, "add");
    /* the first argument */
    lua_pushnumber(L, x);
    /* the second argument */
    lua_pushnumber(L, y);
    /* call the function with 2 arguments, return 1 result */
    lua_call(L, 2, 1);
    /* get the result */
    sum = (int)lua_tointeger(L, -1);
    lua_pop(L, 1);
    return sum;
    int main ( int argc, char *argv[] )
    int sum;
    /* initialize Lua */
    L = lua_open();
    /* load Lua base libraries */
    luaL_openlibs(L);
    /* load the script */
    luaL_dofile(L, "add.lua");
    /* call the add function */
    sum = luaadd( 10, 15 );
    /* print the result */
    printf( "The sum is %d\n", sum );
    /* cleanup Lua */
    lua_close(L);
    /* pause */
    printf( "Press enter to exit..." );
    getchar();
    return 0;
    -- add two numbers
    function add ( x, y )
    return x + y
    end
    --- How to load and call a lua function from c
    //last.cc
    # extern "C" {
    # #include "lua.h"
    # #include "lualib.h"
    # #include "lauxlib.h"
    int main()
    double z;
    lua_State *L = lua_open();
    luaL_openlibs(L);
    if (luaL_loadfile(L, "last.lua") || lua_pcall(L, 0, 0, 0)) {
    printf("error: %s", lua_tostring(L, -1));
    return -1;
    lua_getglobal(L, "f");
    if(!lua_isfunction(L,-1))
    lua_pop(L,1);
    return -1;
    lua_pushnumber(L, 21); /* push 1st argument */
    lua_pushnumber(L, 31); /* push 2nd argument */
    /* do the call (2 arguments, 1 result) */
    if (lua_pcall(L, 2, 1, 0) != 0) {
    printf("error running function `f': %s\n",lua_tostring(L, -1));
    return -1;
    /* retrieve result */
    if (!lua_isnumber(L, -1)) {
    printf("function `f' must return a number\n");
    return -1;
    z = lua_tonumber(L, -1);
    printf("Result: %f\n",z);
    lua_pop(L, 1);
    lua_close(L);
    return 0;
    function f (x, y)
    return (x^2 * math.sin(y))/(1 - x)
    end
    ---- How to execute a Lua Script from C.
    #include "lua.h"
    #include "lualib.h"
    #include "lauxlib.h"
    /* gcc -o luatest luatest.c -I/usr/local/include -L/usr/local/lib -llua -lm -ldl */
    int main()
    int s=0;
    lua_State *L = lua_open();
    // load the libs
    luaL_openlibs(L);
    //run a Lua scrip here
    luaL_dofile(L,"foo.lua");
    printf("\nAllright we are back in C.\n");
    lua_close(L);
    return 0;
    io.write("Please enter your name: ")
    name = io.read() -- read input from user
    print ("Hi " .. name .. ", did you know we are in lua right now?")
    ---- How to get a Variable value from Lua to C.
    #include <stdio.h>
    #include <lua.h>
    #include <lualib.h>
    #include <lauxlib.h>
    #include <string.h>
    /* gcc -o test test.c -I/usr/local/include -L/usr/local/lib -llua -lm -ldl */
    int main()
    lua_State *L = lua_open();
    if(luaL_loadfile(L,"settings.lua") || lua_pcall(L,0,0,0))
    printf("Error failed to load %s",lua_tostring(L,-1));
    else
    lua_getglobal(L,"screenWidth");
    const int screenWidth = lua_tonumber(L,-1);
    printf("Screen Width = %d \n", screenWidth);
    lua_getglobal(L,"appName");
    const char *appName = luaL_checkstring(L, -1);
    printf("Screen Name = %s \n", appName);
    lua_close(L);
    /* If we got this far, everything worked */
    printf("Success!\n");
    return 0;
    appName = "Firefox"
    screenWidth = 400
    ------ How to write a lua binding in C.
    #include "lua.h"
    #include "lualib.h"
    #include "lauxlib.h"
    #include <string.h>
    /* gcc zstring.c -Wall -shared -o zstring.so */
    static int zst_strlen(lua_State *L)
    size_t len;
    len = strlen(lua_tostring(L, 1));
    lua_pushnumber(L, len);
    return 1;
    int luaopen_zstring(lua_State *L)
    lua_register(L,"zst_strlen", zst_strlen);
    return 0;
    require "zstring"
    print(zst_strlen("Hello, World"))
    ----- Another Binding Example
    #include "lua.h"
    #include "lualib.h"
    #include "lauxlib.h"
    #include <unistd.h>
    #include <sys/stat.h>
    #include <stdlib.h>
    /* gcc general.c -Wall -shared -o general.so */
    /* system */
    static int zst_exec(lua_State *L)
    int status;
    status = system(lua_tostring(L, 1));
    lua_pushnumber(L, status);
    return 1;
    /* mkdir */
    static int zst_mkdir(lua_State *L)
    int status;
    mode_t mode = lua_tonumber(L, 2);
    status = mkdir(lua_tostring(L, 1), mode);
    lua_pushnumber(L, status);
    return 1;
    /* symlink */
    static int zst_symlink(lua_State *L)
    int status;
    const char *old = lua_tostring(L, 1);
    const char *new = lua_tostring(L, 2);
    status = symlink(old, new);
    lua_pushnumber(L, status);
    return 1;
    /* rmdir */
    static int zst_rmdir(lua_State *L)
    int status;
    status = rmdir(lua_tostring(L, 1));
    lua_pushnumber(L, status);
    return 1;
    /* rename */
    static int zst_rename(lua_State *L)
    int status;
    const char *old = lua_tostring(L, 1);
    const char *new = lua_tostring(L, 2);
    status = rename(old, new);
    lua_pushnumber(L, status);
    return 1;
    /* remove */
    static int zst_remove(lua_State *L)
    int status;
    const char *filename = lua_tostring(L, 1);
    status = remove(filename);
    lua_pushnumber(L, status);
    return 1;
    /* chown */
    static int zst_chown(lua_State *L)
    int status;
    const char *filename = lua_tostring(L, 1);
    uid_t owner = lua_tonumber(L, 2);
    gid_t group = lua_tonumber(L, 3);
    status = chown(filename, owner, group);
    lua_pushnumber(L, status);
    return 1;
    /* chmod */
    static int zst_chmod(lua_State *L)
    int status;
    const char *filename = lua_tostring(L, 1);
    mode_t mode = lua_tonumber(L, 2);
    status = chmod(filename, mode);
    lua_pushnumber(L, status);
    return 1;
    /* get_current_dir_name */
    static int zst_getcwd(lua_State *L)
    char *dir;
    dir = get_current_dir_name();
    lua_pushstring(L, dir);
    return 1;
    int luaopen_general(lua_State *L)
    lua_register(L,"zst_exec", zst_exec);
    lua_register(L,"zst_mkdir", zst_mkdir);
    lua_register(L,"zst_symlink", zst_symlink);
    lua_register(L,"zst_rmdir", zst_rmdir);
    lua_register(L,"zst_rename", zst_rename);
    lua_register(L,"zst_remove", zst_remove);
    lua_register(L,"zst_chown", zst_chown);
    lua_register(L,"zst_chmod", zst_chmod);
    lua_register(L,"zst_getcwd", zst_getcwd);
    return 0;
    Ugggg lost all the formating in that.
    If you cant make heads or tails of the above you can view it on my google code wiki http://code.google.com/p/zester/wiki/Lua_C
    Last edited by zester (2011-09-13 18:20:07)

  • Script language (ex: Perl) in LabVIEW

    Hello,
    It is possible to implement script language in LabVIEW?
    Currently i have only one idea, install on computer Perl and use
    Communications\System exec.vi.
    Other variants?
    Deniss Karai
    [email protected]

    LabVIEW currently supports script nodes to interface with Matlab and HiQ. If
    you think that it would benefit to have other script interfaces (like TCL
    and Perl) you can submit your request to NI on the LabVIEW wish list.
    Jean-Pierre Drolet
    "Kevin B. Kent" a écrit dans le message news:
    [email protected]..
    > Danny Thomson wrote:
    >
    > > Hi Jens-Achim,
    > >
    > > I have tried the link you suggested and it does not work for me, could
    you
    > > please
    > > let meb know if there is one that still works. I am new to Labview but
    used
    > > Tcl/Tk on Unix for a long
    > > time. I would be very grateful for some type of pointer how to setup the
    > > interface
    > >
    > > regards
    > >
    > > Danny
    > >
    > > Jens-Achim Ke
    ssel wrote:
    > >
    > > > Hi,
    > > >
    > > > You should have a look at
    > > > http://dev.ajubasolutions.com/
    > > > The TCL shell is a very powerful bytecompiling interpreter, that can
    be
    > > > implemented using simple DLL/LIB-calls. It's free.
    >
    > You have a few options.
    > 1) Use the SysExec and Wish (for TCL, Perl may have similar) to call
    scripts.
    > 2) Make a DLL (or platform equivalent) and use the Call Library Function.
    > 3) I saw an ad for something called LabScript but I can not find it now.
    > Kevin Kent
    >

  • Looking for a more universal scripting language than AppleScript or Automator

    I want to learn a cross-platform/web scripting language to automate tasks, write scripts and with the potential to create programs and web apps.
    I am looking for something that:
    - is not a program with a GUI like Automator, iKey, Quickeys, Maestro... 
    - is more "universal" than Applescript, cross-platform
    - can be used to automate simple tasks in a simple way
    - can also be used to create more complex scripts, web apps and maybe, eventually, programs (with GUI)
    I've read about Javascript, Python, Ruby, PHP, Perl, C+, C++, Java and others, but I really don't know.
    - Java sounds pretty cool, Python too.
    - I'm not crazy about PHP or Perl, with Javascript, but some people swear by it
    - I don't know anything about C+, C++
    Does anyone have any suggestion(s)?  Please let me know if you need any more details.  Thank you.

    C, C++, Objective-C are nor scripting languages and will not help you do web pages. (Don;t know what C+ is).
    Forget Java it has lots of security problems and more and more users are disabling Java in their web browsers because of this. Developing in Java would be, in my opinion, a mistake.
    If you are doing any web works at all you will need to know some Javascript, no way around that.  But Javascript is actually not a bad language
    Note Java and Javascript are two totally separate languages that have nothing in common  but the first 4 letters of their names.
    So you are left with PHP, Perl, Python and Ruby.
    Dismissing PHP and Perl out of hand is a big mistake, They are both major players and you will run into them just about everywhere. If you are looking to do this for possible employment you will need to be familiar with them at least.
    Python and Ruby are both strong languages as well. I don't have a lot of experience with either so I can;t speak to their strengths  but  learnign either would not be a mistake.
    Knowing what your reasons are for asking this, personal use or for employment, might help refine the list some.
    regards
    Message was edited by: Frank Caggiano - Perl is also included in OS X by default. Not sure about PHP but I believe it also is. I agree TextWrangler would be a good editor for this type of work.

  • Calling java from scripting

    Hello,
    I would like to integrate some scripting capability in my web application.
    The main purpose is to cover the following scenario :
    - I develop a web app with JSP technology, packaged in a MyAPP.WAR file containing my application and another file (MyCustomer.RAR?) containing installation specific informations. I want the MyApp.WAR to be the same for all my customers, just having the RAR file specific to each customer (installation).
    - In this ressource file, there could be some scripting functions that will be called from my JSP Pages to change the default presentation with some customer particular informations.
    Those informations would be extracted from my java data model. The purpose is to enable the customer to code some little script, and to avoid coding those in Java.
    The question I have on that are :
    1/ is it possible to call java instances from scripting language (I read on apache that the answer was yes for some of them), but I would like to know if javascript can do that.
    2/ Can I recover the "result" of the script in JSP ?
    An example :
    1/ The class containing a marvellous property
    class MyClass {
    public String myProperty;
    2/ The JSP page :
    <stlLib:callScript(Customer.RAR, "ScriptToCall",anInstance) />
    <stlLib:getResult ???>
    3/ A user script (pseudo-code)
    Customer 1 :
    Function ScriptToCall(object) {
    variable iwanttoshowsquareroot;
    iwanttoshowsquareroot = squareroot(object.myProperty);
    return iwanttoshowsquareroot ;
    Customer 2 :
    Function ScriptToCall(object) {
    variable mychoiceisdifferent;
    mychoiceisdifferent= object.myProperty / 2;
    return mychoiceisdifferent;
    According to what ScriptToCall looks like the result on page would be different
    Thanks in advance for your advises
    Olivier.

    1) The script will be running in the browser, not the server, yes? So in Netscape you can load Java objects via Javascript, but IE doesn't seem to support this. Although in either, you can call methods on an applet in the page. But you can't call a JS function from the Java code in the JSP page, since that is only executed on the server.
    2) Only if the "result" is submitted back to the server.

  • Scripting Languages Tool Preview

    Ok, this new thread is for posting about the Scripting Languages Tool Preview. Any comments, thoughts, ideas, contributions?
    Greetings,
    Blag.

    John: as Frank said, we'd love to see generators for other languages - like JavaScript - in future. But we don't want to create them all alone. So here's the deal: we create the framework and some generators for the most widely-used languages and you cool guys on SDN build on that and create other generators, other viewers, anything you think is useful. And for all questions or problems we (SAP Scripting Team) will offer all the help we can. I'm very looking forward to see what will evolve from this
    This works two-way. It's you who have year-long experience in all kind of scripting languages - combined it's much more knowledge than we can have. So when I face a scripting problem during generator-creation I'll just ask for your help here
    Piers: no, it did not arrive. Please send again. I checked my profile and the mail-address was just not set to 'visible'. Your's isn't, too
    About the 'integration': it is a clear goal to let it work inside other frameworks (Eclipse-based). As we do not have or use all of these I can just assume that it'll work just fine using the standard Eclipse mechanisms. Scripting in a Box is definitely a good candidate for this, and I myself use it for testing both tool integration and generated scripts.
    Bundling - we thought about this, but there might be legal issues, so we have to wait for an official approval. Meanwhile it's not that complicated just getting SiaB and installing the tool afterwards
    :Frederic:

  • There is any Scripting languages is used for mobile application development

    Is there is any Scripting languages is used for mobile application development?
    For example java script,vb script is used for web development.Like that is there is any scripting language is used for mobile application development along with J2me.
    Thanks & Regards, Sivakumar.J

    806437 wrote:
    .. is there is any scripting language is used for mobile application development along with J2me.If you are talking about javax.script,
    google ( [url http://www.google.com/search?q=java+me+javax.script]java me javax.script ) gave me http://sourceforge.net/projects/rhinoj2mecldc/

  • Coding Problem 6 Now Defined in Scripting Languages/Bioinformatics WIKI

    In the "Scripting Languages and Bioinformatics" WIKI, I have completed a new page here:
    https://wiki.sdn.sap.com/wiki/display/EmTech/Bio-InformaticBasicsPartII-AlignmentToolsforRelatingProteinGenestoProteinPrimaryStructures
    and also defined Coding Problem 6 at the end of this page.
    This problem involves scripting an interactive session with a web site and parsing what the web site returns at various points duing the session.
    Am looking foward to a script that solves this problem, if anyone feels like spending the time to do it.

    <?
    // sequence to search ---------------------------------------------
    $bquery      = "MTQIIKIDPLNPEIDKIKIAADVIRNGGTVAFPTETVYGLGANAFDG";
    $bquery     .= "NACLKIFQAKNRPVDNPLIVHIADFNQLFEVAKDIPDKVLEIAQIVW";
    $bquery     .= "PGPLTFVLKKTERVPKEVTAGLDTVAVRMPAHPIALQLIRESGVPIA";
    $bquery     .= "APSANLATRPSPTKAEDVIVDLNGRVDVIIDGGHTFFGVESTIINVT";
    $bquery     .= "VEPPVLLRPGPFTIEELKKLFGEIVIPEFAQGKKEAEIALAPGMKYK";
    $bquery     .= "HYAPNTRLLLVENRNIFKDVVSLLSKKYKVALLIPKELSKEFEGLQQ";
    $bquery     .= "IILGSDENLYEVARNLFDSFRELDKLNVDLGIMIGFPERGIGFAIMN";
    $bquery     .= "RARKASGFSIIKAISDVYKYVNI";
    // url for form1 --------------------------------------------------
    $url = "http://blast.ncbi.nlm.nih.gov:80/Blast.cgi";
    // parameters for form1 -------------------------------------------
    $bdb         = "protein";
    $bgeneticcode= "1";
    $bquery_from = "";
    $bquery_to   = "";
    $bjobtitle   = "ACW-" . time();
    $bdatabase   = "nr";
    $bblastprog  = "tblastn";
    $bpagetype   = "BlastSearch";
    $pf  = "";
    $pf .= "QUERY=" . $bquery;
    $pf .= "&db=" . $bdb;
    $pf .= "&QUERY_FROM=" . $bquery_from;
    $pf .= "&QUERY_TO=" . $bquery_to;
    $pf .= "&JOB_TITLE=" . $bjobtitle;
    $pf .= "&DATABASE=" . $bdatabase;
    $pf .= "&BLAST_PROGRAMS=" . $bblastprog;
    $pf .= "&PAGE_TYPE=" . $bpagetype;
    $pf .= "&GENETIC_CODE=1";
    $pf .= "&DBTYPE=";
    $pf .= "&EQ_MENU=";
    $pf .= "&EQ_TEXT=";
    $pf .= "&NEWWIN=";
    $pf .= "&MATCH_SCORES=";
    $pf .= "&MAX_NUM_SEQ=100";
    $pf .= "&EXPECT=10";
    $pf .= "&WORD_SIZE=3";
    $pf .= "&MATRIX_NAME=BLOSUM62";
    $pf .= "&GAPCOSTS=11 1";
    $pf .= "&COMPOSITION_BASED_STATISTICS=2";
    $pf .= "&REPEATS=";
    $pf .= "&FILTER=";
    $pf .= "&LCASE_MASK=";
    $pf .= "&TEMPLATE_LENGTH=";
    $pf .= "&TEMPLATE_TYPE=";
    $pf .= "&I_THRESH=0.005";
    $pf .= "&CLIENT=web";
    $pf .= "&SERVICE=plain";
    $pf .= "&CMD=request";
    $pf .= "&PAGE=Translations";
    $pf .= "&PROGRAM=tblastn";
    $pf .= "&MEGABLAST=";
    $pf .= "&RUN_PSIBLAST=";
    $pf .= "&SELECTED_PROG_TYPE=tblastn";
    $pf .= "&SAVED_SEARCH=true";
    $pf .= "&BLAST_SPEC=";
    $pf .= "&QUERY_BELIEVE_DEFLINE=";
    $pf .= "&DB_DIR_PREFIX=";
    $pf .= "&SHOW_OVERVIEW=true";
    $pf .= "&SHOW_LINKOUT=true";
    $pf .= "&GET_SEQUENCE=true";
    $pf .= "&FORMAT_OBJECT=Alignment";
    $pf .= "&FORMAT_TYPE=HTML";
    $pf .= "&ALIGNMENT_VIEW=Pairwise";
    $pf .= "&MASK_CHAR=2";
    $pf .= "&MASK_COLOR=1";
    $pf .= "&DESCRIPTIONS=100";
    $pf .= "&ALIGNMENTS=100";
    $pf .= "&NEW_VIEW=true";
    $pf .= "&OLD_BLAST=true";
    $pf .= "&NCBI_GI=false";
    $pf .= "&SHOW_CDS_FEATURE=false";
    $pf .= "&NUM_OVERVIEW=100";
    $pf .= "&FORMAT_EQ_TEXT=";
    $pf .= "&FORMAT_ORGANISM=";
    $pf .= "&EXPECT_LOW=";
    $pf .= "&EXPECT_HIGH=true";
    $pf .= "&QUERY_INDEX=0";
    // define the HTTP connection -----------------------------
    $ch = curl_init();
    curl_setopt($ch,CURLOPT_URL,$url);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch,CURLOPT_POSTFIELDS, $pf);
    curl_setopt($ch,CURLOPT_COOKIEJAR,
    dirname(__FILE__).'/cookie.txt');
    curl_setopt($ch,CURLOPT_FOLLOWLOCATION,1);
    curl_setopt($ch, CURLOPT_HEADER , 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
    // call it ------------------------------------------------
    $my_result = curl_exec($ch);
    // get the request ID; the query takes some time and this ID
    // allows to identify the original request
    $query = "/<tr><td>Request ID<\/td><td> <b>([0-9A-Z]*)<\/b><\/td><\/tr>/";
    preg_match($query, $my_result, $request_id);
    // query for the result page every 2 seconds...when the result
    // is ready, we recognize it by its signature
    $not_ready = true;
    $result_url = "http://blast.ncbi.nlm.nih.gov/Blast.cgi?CMD=Get&VIEW_RESULTS=FromRes&RID=" . $request_id[1];
    while($not_ready){
      $temp_page = null;
      curl_setopt($ch,CURLOPT_URL,$result_url);
      curl_setopt($ch, CURLOPT_POST, 0);
      $my_result = curl_exec($ch);
      $query = "/This page will be automatically updated in <b>(\d*)<\/b> seconds/";
      preg_match($query, $my_result, $temp_page);
      if(isset($temp_page[1])) {  sleep(2); }
      else { $not_ready = false; }
    // parse the results page; split it into result fragments first --------
    $pat = "/";
    $pat .= "><input type=\"checkbox\" name=\"getSeqGi\"([^\n]*)\n";
    $pat .= "Length=\d*\n\n";
    $pat .= "[\w\s]*:\n";
    $pat .= "(\s*<a[^>]*>[^<]*<\/a>\n)*\n";
    $pat .= "([^\n]*\n){3}\n";
    $pat .= "(([^\n]*\n){3}\n[^n])*";
    $pat .= "/";
    preg_match_all($pat, $my_result, $fragments);
    // 'fine parse the result fragments and get some important parameters -----
    foreach($fragments[0] as $fragment){
      $query = "/<a href=\"http:\/\/(www\.ncbi\.nlm\.nih\.gov\/entrez\/query\.fcgi\?";
      $query .= "[^>]*)>([^<]*)<\/a><a[^>]*>[^<]*<\/a>\s*<a[^>]*><img[^>]*><\/a>([^\n]*)/";
      preg_match($query, $fragment, $u);
      $query  = "/\s*Score\s*=\s*(\d*) bits\s*\(\d*\),\s*Expect\s*=\s*([^,]*),";
      $query .= "[^\n]*\n\s*Identities\s*=\s*\d*\/\d*\s*\((\d*%)\)[^\n]*\n\s*Frame\s*=\s*([^\n]*)\n/";
      preg_match($query, $fragment, $u1);
      preg_match_all("/Sbjct\s*(\d*)\s*[A-Z\-]*\s*(\d*)\n/", $fragment, $positions);
      $fr["url"]        = $u[1];
      $fr["shname"]     = $u[2];
      $fr["name"]       = $u[3];
      $fr["score"]      = $u1[1];
      $fr["expect"]     = $u1[2];
      $fr["identities"] = $u1[3];
      $fr["frame"]      = $u1[4];
    // find out if we have to reverse the strand direction or not; adjust
    // lower and upper limit
      if ($fr["frame"] >= 0) {
        $fr["high"] =  $positions[2][count($positions)-1]; $fr["low"] = $positions[1][0]; $fr["reverse"] = ""; }
      else {
        $fr["high"] =  $positions[1][0]; $fr["low"] = $positions[2][count($positions)-1]; $fr["reverse"] = true;}
      $frx[] = $fr;
    // we call the final details form for the top ranked result
    // here we could loop over several results
    curl_setopt($ch,CURLOPT_URL,$frx[0]["url"]);
    curl_setopt($ch, CURLOPT_POST, 0);
    $my_result = curl_exec($ch);
    // parse the final details form to get the necessary parameters to execute
    // the final details form
    preg_match("/<input name=\"WebEnv\" type=\"hidden\" value=\"([^\"]*)\"/",
               $my_result, $u5);
    preg_match("/<input name=\"query_key\" type=\"hidden\" value=\"([^\"]*)\"/",
               $my_result, $u6);
    preg_match("/<input name=\"db\" type=\"hidden\" value=\"([^\"]*)\"/",
               $my_result, $u7);
    preg_match("/<input name=\"qty\" type=\"hidden\" value=\"([^\"]*)\"/",
               $my_result, $u8);
    preg_match("/<input name=\"c_start\" type=\"hidden\" value=\"([^\"]*)\"/",
               $my_result, $u9);
    preg_match(
      "/<select name=\"dopt\".*<option value=\"([^\"]*)\" selected=\"1\">/",
      $my_result, $u10);
    preg_match(
      "/<select name=\"dispmax\".*<option value=\"([^\"]*)\" selected=\"1\">/",
      $my_result, $u11);
    preg_match(
      "/<select name=\"sendto\".*<option value=\"([^\"]*)\" selected=\"1\">/",
      $my_result, $u12);
    preg_match(
      "/<input type=\"hidden\" id=\"([^\"]*)\" name=\"fmt_mask\".*value=\"([^\"]*)\"/",
      $my_result, $u13);
    preg_match(
      "/<input type=\"checkbox\" id=\"truncate\" name=\"truncate\" value=\"([^\"]*)\"\/>/",
      $my_result, $u14);
    // fill in the necessary parameters parsed out now and earlier
    $of  = "WebEnv=" . $u5[1];
    $of .= "&query_key=" . $u6[1];
    $of .= "&db=" . $u7[1];
    $of .= "&qty=" . $u8[1];
    $of .= "&c_start=" . $u9[1];
    $of .= "&dopt=" . $u10[1];
    $of .= "&dispmax=" . $u11[1];
    $of .= "&sendto=" . $u12[1];
    $of .= "&fmt_mask=" . $u13[1];
    $of .= "&truncate=" . $u14[1];
    $of .= "&less_feat=";
    $of .= "&from=" . $fr["low"];
    $of .= "&to=" . $fr["high"];
    $of .= "&strand=" . $fr["reverse"];
    $of .= "&extrafeatpresent=1";
    $of .= "&ef_SNP=1";
    $of .= "&ef_CDD=8";
    $of .= "&ef_MGC=16";
    $of .= "&ef_HPRD=32";
    $of .= "&ef_STS=64";
    $of .= "&ef_tRNA=128";
    $of .= "&ef_microRNA=256";
    $of .= "&ef_Exon=512";
    $of .= "&submit=Refresh";
    $ourl = "http://www.ncbi.nlm.nih.gov/entrez/viewer.fcgi?" . $of;
    // execute the final details form
    curl_setopt($ch,CURLOPT_URL,$ourl);
    curl_setopt($ch, CURLOPT_POST, 0);
    curl_setopt($ch,CURLOPT_POSTFIELDS, $of);
    curl_setopt($ch,CURLOPT_FOLLOWLOCATION,1);
    curl_setopt($ch, CURLOPT_HEADER , 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
    $my_result = curl_exec($ch);
    // parse the result page and get the final ORIGIN snippet
    preg_match("/ORIGIN\s*\n\s*<a name=\"[^\"]*\"><\/a>\s*([^\/]*)\//", $my_result, $u99);
    // output the final result ----------------------------------
    echo "\n" . preg_replace("/\s{2,}/", "\n", preg_replace("/\d+\s/", "", $u99[1]));
    ?>
    Edited by: Anton Wenzelhuemer on Aug 6, 2008 8:08 PM (Re-Formatted)

  • Open JApplet with new java plugin ??

    Hi,
    I want to open an applet with new java run time envorinment, i.e. i must see 2 java consoles in the windows tray
    here is my code in html, but the problem is they work in same jvm..
    how do i make them work in different jvm
    Hope i am clear, if not i will explain more in detail
    <script language="JavaScript1.2">
    function openPlanApplet()
    TheNewWin = window.open('AppletTest.htm', '');
    // where AppletTest.htm is the html which has applet defined in it
    TheNewWin.moveTo(-10, -0);
    Ashish

    HI,
    I think i will get 2 consoles, but the problem is the end user will be forced have 2 jvm installed on his machine, also what if i want 3 applets in 3 different envoriment , then
    Let me send u some example of what i am trying to do
    This is my java Applet, and there are 2 HTML files,
    first open test.html and then click button to open the applet window, then click on the button "GO" in applet to change the text of label
    , then go back to test.html and again click on the button to open applet u will see that the button text is "change it" instead of "Applet1"
    and that is why i want to start a new jvm window to avoid this
    Hope this makes sense,
    or send me an email at [email protected] and i will send u a zip file of all html and class file for u to test
    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.net.*;
    public class AppletTest extends JApplet
    implements ActionListener
    public static String name = "Applet1";
    JLabel label;
    public void init()
    JButton b = new JButton("go");
    b.addActionListener(this);
    label = new JLabel(name);
    this.getContentPane().setLayout(new FlowLayout(FlowLayout.LEFT, 20,50));
    this.getContentPane().add(b);
    this.getContentPane().add(label);
    this.setSize(100,100);
    public void actionPerformed(ActionEvent ae)
    name="Change it";
    label.setText(name);
    // end of code
    /** test.html
    <html><head>
    <title>Test Screen size</title>
    <script language="JavaScript1.2">
    var TheNewWin;
    function openPlanApplet()
    TheNewWin = window.open('AppletTest.html', '', config='height=300, width=300, toolbar=no, menubar=no,scrollbars=no,resizable=no, location=no,directories=no, status=no ,offscreenBuffering=false');
    TheNewWin.moveTo(-10, -0);
    </SCRIPT>
    </head>
    <body bgcolor="#ffffff">
    Open new window
    <br>
    <input type="button" value="Open Window" onclick="openPlanApplet()">
    </body>
    /** AppletTest.html
    <html>
    <head>
    <title> test applet </title>
    </head>
    <body>
    This is testing of applet
    <br>
    <applet code="AppletTest.class" WIDTH = "800" HEIGHT = "600">
    </applet>
    </body>
    </html>
    **/

Maybe you are looking for

  • List View Web Part Search problem

    We have a problem with the search in the List View Web Part (SearchBox). If you enter anything in SearchBox and the beginning of the search, nothing happens. This problem only occurs in non-admins. In this case, the browser generates an error: "inplv

  • Error while creating standard sales order

    Hi While creating a standard sales order , I am getting a problem  in the incompleteness log asking for the internal sales order no. in the 'accounting' tab of my order. It is related to cost assignment and profitability segment no.I am not able to t

  • Transport from ECC6 to 4.6C

    Hi there, I need to transport a whole lot of custom development objects including ABAP, screens, functions, tables etc. They are all contained in a single workbench request. The original system is a unicode ECC6 (700) system running off Win 2008 R2,

  • Anyone know where I can get an Athlon XP Barton 3000?

      FSB 333. online sources seem to be drying up.

  • Does the VirtualListViewResponseControl support .contentCount?

    The javadoc for the VirtualListViewResponseControl shows a member called .contentCount http://www.cs.rit.edu/usr/local/pub/jeh/rit/java/lib/doc/ldapcontrols/com/sun/jndi/ldap/ctl/VirtualListViewResponseControl.html I am looking for a means of getting