Better way for passing parameters ?

Hi, i'm using a hashmap(string) in my java (parameters/value).
At this time, i m calling Java methods from native code to retrieve value from this hashmap.
I think it would be better to pass all the data to native code, and after retrieve data from C structure.
i dont know what jni structure i should use to pass these datas(jobjectArray, jchararray). I cant pass string to native functions because there are too many parameters.
May you help me.
Thks

If you need extremely robust solution, have a look at NewDirectByteBuffer and GetDirectBufferAddress - native functions to allocate ByteBuffer in native memory which could be accessed from Java or retrive the contents of the ByteBUffer allocated in Java. This is pretty neat, since you are not passing any parameters except for a reference to ByteBuffer which can be read directory from native code.
SUch approach does buy off if you need to pass really huge structures (over 10M?..) since parameters to native code are passed 'by value' (so, EVERYTHING is copied) - if I remember everything correctly - haven't touched JNI for a while.
I did some tests with early 1.4.x JVMs long time ago and the trade off wasn't very obvious in my case (< 2-3M of data passed in and out). So, unless you run in performance bottlenecks or can think of some generic 'protocol' for your application to read/write params from a buffer (thus eliminating/limiting changes to JNI interface every time you need to pass new parameter) i don't think it's worth it.

Similar Messages

  • Does XML approach for passing parameters in the query make the query slow?

    Hi,
    I am using XML approach for passing parameters in a query. This is running very slow but when I pass comma separated values in parameter, it runs very fast.
    So it concludes that we should not use XML approach for passing parameters. Please confirm me that Am I right or wrong?
    I have also googled to clear my doubt but not get solution till now. please help me.
    Regards,
    Sachin

    914014 wrote:
    Hi,
    I am using XML approach for passing parameters in a query. This is running very slow but when I pass comma separated values in parameter, it runs very fast.
    So it concludes that we should not use XML approach for passing parameters. Please confirm me that Am I right or wrong?
    I have also googled to clear my doubt but not get solution till now. please help me.
    Regards,
    SachinShow us what you are doing, create a simple yet complete example we can run on our Oracle instances.
    Then we will know exactly what you mean, and can comment appropriately.
    Cheers,

  • What is better way for creating a thread? Why?

    A thread can be create in two way, extending Thread class or implimenting Runnable.
    What is better way for creating a thread? Why?

    Implementing Runnable
    See FAQ #1 here [http://forum.java.sun.com/ann.jspa?annID=9]

  • Efficient or Better Ways for Data Declaration

    Hi Guys,
    Basically I've always programmed much the same way for a pretty long time now. Lately I've been asking myself the question - "how can i start improving on my tried and trusted ways".(oftern a linear programming approach). As part of this I'm examining ways to declare data better within in programs and to adopt a neat way to do so.
    This may seem pretty trivial but the first question I want to ask is how to declare data better
    e.g. I need to declare constants - each constant corresponds to a rule number; 1, 2,3,4,5,6 - 23 etc.
    Instead of declaring the following line 23 times - is there a better way to declare in such a way.
    Constants: c_rule_1 type c value '1' ,
                    c_rule_2  type c value '2',
                    etc etc etc
    Your thoughts are greatly appreciated.
    Thanks.
    DK
    Edited by: Damien Kesle on Nov 26, 2008 10:00 AM

    Hi,
    With my knowledge, data declarations for all constants with DATA comamnd itself is good practise in point of performance. Alternative is dynamic creation of variables. But it consumes more time and is not good to practise. Instead of crating individual parameters for each constant, you could create a structure and add all constants as fields as follows:
    constants: begin of con,
                       1 type c value '1',
                       2 type c value '2',
                    end of con.
    Regards,
    Prasanth

  • Need help for passing parameters to Flash

    Hi,
    I am fairly new to Flash, and has been trying to solve this over past few hours.
    What I want to do is to pass parameters from the browser to flash.  I searched and seems like the best way is FlashVars.
    However, I have tried different codes and can't get Flash to detect the parameters.
    I decided to follow the example here and just copy and paste the whole thing (just changing the "main.swf" to my swf name):
    http://www.kirupa.com/forum/showthread.php?t=334923
    The flash loads, but it only shows "param:" without anything else.
    I gathered that it probably is a more foundamental problem.  (e.g. the way I am debugging, or some settings, etc.)  Any clues?
    (I am using CS4 trial version AS3.)
    Thanks!

    oh, which 3 locations are there?
    I only know 2, one in <param name="FlashVars" value="one=1&two=2" /> and the other in embed.  Where is the 3rd one?
    Thanks!
    edit:
    oh...ha...haha...found the answer...it's in AC_FL_RunContent...
    http://twelvestone.com/forum_thread/view/37553 <--apparently I'm not the only one with this problem...^^"""
    Anyway, thanks a lot for the direction! 

  • Is there any better way for updating table other than this?

    Hi all, I need to update a row in the table that require me to search for it first (the table will have more than hundred thousands of row). Now, I am using a LOV that will return the primary key of the row and put that primary key to DEFAULT_WHERE property in the block and execute query command to fetch the row that need updating. This works fine except that it require 2-query-trip per update (the lov and the execute_query). Is there any better way to doing this? This update is the main objective for my application and I need to use the most effective way to do it since we need to update many records per hour.

    Thanks Rama, I will try your method. Others, how to query row instead of primary key? I thought that querying primary key is faster due to the index?
    BTW, what people do if you need to update a table using Form? I have been using the LOV then execute query since I first developing form. But I am building a bigger database recently that I start worrying about multiple query trip to dbms.
    FYI my table will have up to million rows on it. Each row will be very active (updated) within 1-2 weeks after it creation. After that it will exist for records purposes only (select only). The active rows are probably less than 1% of all the rows.

  • Better way for inserting column into array?

    I have to insert a 2-D array(20x10) into the end (column) of a bigger 2-D array(1000x10). I am seeing two ways to do that:
    1. Insert smaller 2D array at the end of bigger array.
    2. Insert the bigger array at the 0th column of smaller array.
    Which one would be more efficient? Will there be any performance difference?
    Or any other better way to do this?
    The second one looks simpler but I think it would require a bigger copying of memory.

    Both methods use a buffer allocation, so they might be very similar. Since we don't know what the compiler is doing, you could also try this:
    I am assumung that you only need to append once and not append more and more columns as the program progresses. Is this correct? In any case, you should consider operating on the transposed version, because it is always easier to append rows instead of columns (rows are adjacent in memory, while appending columns require more data shuffling under the hood
    In any case, you should simply wire up the alternatives and do a proper benchmark if you are planning to use this on much larger arrays in the future, for example. Can you give us some context how you are planning to use this?
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    AppendColumns.png ‏3 KB

  • I now have 4 itouchs, 1 ipad mini, and three iphones for my own family members.  What's the bet way for me to setup itunes so that we can all share the same music, apps, movies, shows, etc?

    I now have 4 itouches, 1 ipad mini and 3 iphones in use by my direct family.  What's the best way for me to set things up so that we can all share the same music, apps, movies, shows etc?
    I would prefer to have one account to input dollars which allows all the users (my direct family) to share and buy things.
    Can we all have different user ID's however share the same account?

    I'll try to help a bit.
    ITunes match space is different to icloud space. With iTunes match you get storage for 25,000 non iTunes purchased tracks and other than a limit for individual file size, there is no memory limit.
    You can turn match on individuallyon each device (I have it turned off on my iPod but turned on on my iPad and iPhone). When you turn it on then you get access to all the tracks, and in my experience any playlists I create have transferred over very well. I understand that some people have had trouble with playlists though.
    I'm not quite clear with exactly what you mean regarding cleaning up your library, but be careful about using Match for this. There is no guarantee that matched songs will be exactly the same version as your own copy, due to some mismatches, so you could find some problems there. Personall, I am cleaning up my library before matching, but I am rather particular about keeping my library the way I want it. If you aren't as fussed then match could be the answer.
    Hope that helped.

  • What is the better way to pass input parameters between components?

    Hi all,
    I had a dispute with a colleague about passing data between different WDP Development Components. The situation is like this:
    Colleague has a SearchWDP (parent) und I have a BrowseWDP (child). After searching for some objects and clicking a hit in the SearchWDP, the corresponding details should be shown in BrowseWDP, via passing a bunch of parameters such as selected item's id, etc.
    Now which of the following is the better practice:
    - Defining a node in BrowseWDP (child) with isInputParameter set to TRUE, creating a similar node from the same type (simply via ModelBinding, both WDPs are using the same model) in SearchWDP, and defining a mapping between them so that SearchWDP fills the input nodes. From BrowserWDPs perspective, I'd call this Pull method.
    or...
    - Defining a node in BrowseWDP (child) with isInputParameter set to FALSE, creating a setter method in BrowseWDP Interface Controller for the collection (to be passed as parameters) and calling a wdContext.nodeBlaBla().bind(pInputParameterFromModelType). From BrowserWDPs perspective, I'd call this Push method.
    The colleague's argumentation in favor of Push has not convinced me at all and I'd like to ask your opinions. Is there a best practice or recommendation for this scenario? TIA
    ps: Any answer will be rewarded.

    Hi Cuneyt,
    Refer the links below, they are very informative!
    http://help.sap.com/saphelp_nw04s/helpdata/en/22/15a441cd47a209e10000000a155106/content.htm
    http://help.sap.com/saphelp_nw04s/helpdata/en/67/cc744176cb127de10000000a155106/content.htm
    These links are a part of the WebDynpro ABAP documentation, but the concepts are same for WDA and WDJ.
    Considering your scenario, I would recommend the first alternative you have mentioned (if you refer the second link its called External Context Mapping), where component controller context node of component A (SearchWDP) is the source for Interface controller context (same name) of component B (BrowseWDP).
    Thanks.
    Chitrali

  • Whats the best option for passing parameters between tf?

    Dear All,
    I have three Task Flows:
    1. TF1
         -  Main Taskflow that calls a web service to gather its data
    2. TF2
         -  Secondary taskflow which receives a parameter and depending on the value of the parameter received will display its data accordingly.  Generally any data
         is feed from TF1
    3. TF3
         -  Same as TF2Use Case:
    All three TF will be dropped to the page as Regions in a Webcenter Portal Application. Changes in TF1 should propagate into TaskFlow 2.
    Question:
    1. How do I configure that changes in TF1 would be propagated back into task flow 2 and 3 and whats the best option for this?
    2. At runtime, user can choose to edit the page and TF2 and TF3 can be deleted but TF 1 should remain as the source of information.
    Given the scenario above:
    - shall I wire the taskflows via page parameters?
    - contextual events?
    What are the considerations that needs to be thought of. I havent done such requirements before.
    Please help.
    Webcenter 11.1.1.6

    Contextual events seem to be the best case.
    This way you can trigger whenever you want. Web services can be slow so you can trigger the event when the gathering of the data has been finished and then pass some value on the event.
    An event also has a payload so it's an ideal scenario to add the data from the service on it so you can use it in the other TF's.
    In order to manage the deletion of the TF1, you can use the UI events on the composer: http://docs.oracle.com/cd/E23943_01/webcenter.1111/e10148/jpsdg_page_editor_adv.htm#CHDHHFDJ

  • There has to be a better way for Paths & Zooming?

    Hi All,
    Thanks for looking in and poinitng me in the right direction. (Trust me when I tell you I have been reading and watching tutorials)http://www.schoolofflash.com/2008/12/custom-motion-paths-flash-cs4-tutorial/
    I am attempting to create a Tween. with a specific path. All whilst trying to make my 2D assett, or Instance go from one point to other and rotate from one direction like this <---- to half way through the animation Tween then going this direction ----> and then having that Instance grow larger as appears to get closer.   Yes there is a quick point when switching direction of the 2D Instance where it dissapears for a split second. because I cranked up the skew to get the Instance to point (or flip) the other direction or is it the 3D under "Free transform"? I forget now. Anyhow...
    Think  "creating from Template/Advertising/Scripted Snow"  Installing an Instance like a sled that comes from the Right upper mtns across to the Left side weaving and growing in size to give a 3d look as it comes down the mountain zig zagging. -If I lost you just ask.
    I did create this and with great pain. Weeding through old tutorials. Yet they do not give shortcuts. IE: Is there a short cut to make an instance grow on it's path? Instead of doing it frame by frame? As you can do with a path by setting the frame to say number 1 then place your Instance and then move your play head to say frame 400 and then drag your instance to wherever you want it to end up. Then all those frames are created. Albiet the shortest path and with barbaric adjustment of the path itself. 
    I come from AVID editing and if I want an asset to grow I park it in it's "start area and set it's size" then move the play head to the stop point hit 'zoom' set it's finished growth size and it grows smoothly as it moves to it's stop point. No keyframing. Does this flash software have that or must I create my flash video in Premier Pro for that kind of ease? If so ..Will Premier import an SWF form Flash into it's timeline? IF so some steps please.
    I have been learning a few of these softwares I bought CS6 Master Suite and feel like I am new to the whole thing again. I went from GIMP and AVID as an intermediate  to CS6 and am knocked back to a Novice. I have AVID on my desk just waiting for me to go running back to it. LOL However I know if I stick with Adobe I will have more control. Once I learn where and what the shortcuts are. I spend more time hunting a pecking looking for stuff a tutorial rips by as though I am supposed to know where the Pen tool is? Yeah it was buried under another tool. I got it now...
    Regards,
    NetCommercial

    45 views up to date with no answer... OK I got it.
    The frames that you want zoomed can be handled like this. IE: You want frames to go from 10% to 100%. When your Tween layer has been created, select the Start frame or 1st frame and shrink your image to 10% at that key frame. ( I am assuming you know about Transform tool) Next drag your object/Instance to the end point of your path and increase +90% or to desired size.
    That is it.

  • Best practice for passing parameters to a Timer event handler?

    The code hinting is suggesting that I use a Timer object rather than setTimeout or setInterval, however I need to pass a parameter to the timer handler.
    What is the best practice for doing this?
    + Subclass Timer?
    + Subclass TimerEvent?
    + Global variable?
    + other?
    Thanks

    Hmm.  I don’t think I would’ve chosen that option.  I would probably create a class that listens for the TimerEvent dispatches a custom event.  Unless there is information you need in TimerEvent, I don’t see a need to extend it.

  • A better way for my page

    If you take a look at my playlists page you will see that it takes a while to load. It always seems to redraw the page upon loading. I want to avoid this if possible. Each of these entries are linked to a PDF file. Is there a better more efficient way of doing this so that the page loads faster?
    www.mcran.com
    Message was edited by: Randy McElligott1

    Hyperlinks need objects to hold the hyperlink and you need to click on the object to activate the link - this means that just using the spacebar won't work, you will have to click on the object.
    Try this: On the last slide in each subset Keynote file, create an object (a shape or image) - it can be invisible with no fill or border, and it can cover the entire slide if nothing else needs to be clicked on. Just be sure you know where the object is so you can click on it.
    With the object selected, assign a hyperlink back to the Home Slide.
    Note: Hyperlinks to other Keynote files can only link to the first slide of the file, so your use of a single Home Slide will work fine.

  • Dashboard prompts for passing parameters to BIP reports

    We have BIP reports that we want to display on a dashboard.
    These reports are driven by parameters, which we need to display on the dashboard.
    From what I understand from the documentation, Dashboard prompts can be used for that with the presentation variable having the same name as the BIP variable.
    however, i am not able to get this to work.
    Our reports are not using any subject area and are BIP reports based on SQL query data sets.
    Our parameter is also based on a SQL query.
    Has anyone done this before? Any help will be appreciated.
    Thanks
    -anupma

    Check this
    https://blogs.oracle.com/xmlpublisher/entry/running_bip_reports_in_biee_wi

  • Better way for having Auto Expand/Collapse JSplitPane

    Hi,
    I have a JSplitPane, on the left I have a panel (the main content), and on the right I have another component which is more like a "toolbox". So initially I have the right component invisible, so taht my split pane divider will be all the way to the right, and only the left component is visible. As I move my mouse over the divider I would like to have it "pop" open (or expand)....then when the mouse is moved out of the right component, I would like it to collapse. Make sense so far??
    Ok, so I implemented the following:
            MouseMotionAdapter paneMotionAdapter = new MouseMotionAdapter() {
                public void mouseMoved(MouseEvent e) {
                    if (collapsed == false) {
                        preferredDividerLocation = getDividerLocation();
            MouseMotionAdapter dividerMotionAdapter = new MouseMotionAdapter() {
                public void mouseMoved(MouseEvent e) {
                    int x = e.getX() + getDivider().getX();
                    if (getRightComponent().isVisible() == false) {
                        collapsed = true;
                    // if you move mouse to fast, the event is not caught in time
                    QoviaLogger.logDebug("x: " + x + ", dX: " + getDivider().getX());
                    // moving to the right, so expand it
                    if (x > getDivider().getX()) {
                        if (collapsed) {
                            if (getRightComponent().isVisible() == false) {
                                getRightComponent().setVisible(true);
                            if (doneOnce == false) {
                                setDividerLocation(getLastDividerLocation());
                                doneOnce = true;
                            else {
                                setDividerLocation(preferredDividerLocation);
                            collapsed = false;
                            return;
                    // moving to left of divider, so collapse it
                    else {
                        setDividerLocation(Integer.MAX_VALUE);
                        collapsed = true;
                        return;
            getDivider().addMouseMotionListener(dividerMotionAdapter);
            addMouseMotionListener(paneMotionAdapter);...the problem is, if the user moves the mouse to fast over the divider..the event is not caught...so the split pane wont expand/collapse.
    any ideas how to make it better, or perhaps always catch this event??
    thanks

    I tried to show you that mouseExited() would work and ran into the same kind of problems except on a slightly less annoying scale. You should have explained what the problems were. I just assumed that the problem was that you couldn't code it. Here's what I finally had to do.import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.plaf.basic.*;
    public class Test3 extends JFrame {
      JSplitPane jsp = new JSplitPane();
      BasicSplitPaneDivider spd = ((BasicSplitPaneUI)jsp.getUI()).getDivider();
      Container content = getContentPane();
      public Test3() {
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        jsp.setDividerLocation(0);
        JPanel jp = new JPanel();
        jp.add(new JLabel("Label:"));
        jp.add(new JTextField("text"));
        jsp.setLeftComponent(jp);
    //    ((JComponent)jsp.getLeftComponent()).setMinimumSize(new Dimension(0,0));
        content.add(jsp, BorderLayout.CENTER);
        Component c = getGlassPane();
        c.setVisible(true);
        c.addMouseMotionListener(new MouseMotionListener() {
          public void mouseMoved(MouseEvent me) {
            Point p = SwingUtilities.convertPoint((Component)me.getSource(),me.getPoint(),jsp);
            int loc = jsp.getDividerLocation();
            if (loc<=1) {
              if (p.x<spd.getWidth()) jsp.setDividerLocation(.5);
            } else {
              if (p.x>loc) jsp.setDividerLocation(0);
            mousey(me);
          public void mouseDragged(MouseEvent me) { mousey(me); }
        c.addMouseListener(new MouseListener() {
          public void mouseExited(MouseEvent me) {
            if (me.getX()<=0) jsp.setDividerLocation(.5);
            else jsp.setDividerLocation(0);
            mousey(me);
          public void mouseClicked(MouseEvent me) { mousey(me); }
          public void mouseEntered(MouseEvent me) { mousey(me); }
          public void mousePressed(MouseEvent me) { mousey(me); }
          public void mouseReleased(MouseEvent me) { mousey(me); }
        setSize(200,200);
        setVisible(true);
      public void mousey(MouseEvent me) {
        Point p = SwingUtilities.convertPoint((Component)me.getSource(), me.getPoint(), content);   
        Component c = content.findComponentAt(p);
        if (c!=null) c.dispatchEvent(SwingUtilities.convertMouseEvent((Component)me.getSource(), me, c));
      public static void main(String[] args) { new Test3(); }
    }

Maybe you are looking for