Calling a function with eval causing CS5 to crash
I'm calling a function depending on user input from a dialog and the resulting call is something like:
eval(fromFormat + "To" + toFormat + "(selection, data)");
where selection is the app.selection.
The correct function is called, and I can trace through it all the way through to the end of the called function, and control has returned to the next line after the eval... and this is where it crashes. Even something simple like: var a = 1; causes CS5 to exit.
When it exits, CS5 closes, with an OK dialog box coming up stating: "An unhandled win32 exception occurred in InDesign.exe [6036]. ..."
Not pretty huh?
So I'm wondering what could be the cause? The called function does some shifting, and moving around of things, but nothing that I'd have thought would cause an exception.
I'm confused.
Is it eval() or remove() which is causing the crash?
If it's remove(), you can try separating the reference to the text from the hyperlink.
Maybe something like this:
var source = doc.hyperlinks[i].source;
source.remove();
or possibly, getElements() might be needed:
var source = doc.hyperlinks[i].source.getElements()[0];
source.remove();
Harbs
Similar Messages
-
How to call a function with pl/sql
How does one call a function with pl/sql that uses a function?
Hi,
How does one call a function with pl/sql that uses a
function?I'm not sure what you mean.
In PL/SQL function can be used just about anywhere where an expression (with the same data type that the function returns). Arpit gave a very common example.
Here's another example, where all the functions take a single NUMBER argument and return a NUMBER, so they can all be used in places where NUMBERs are used:
IF fun_a (fun_b (0)) < fun_c (1)
THEN
UPDATE table_x
SET column_y = fun_d (2)
WHERE column_z = fun_e (ROUND ((fun_f (3), fun_g (4)));You call a function simply by using its name, followed by its argument list, if any.
If the function is in a package, you must call it with the package name, like "pk_foo.bar (1, 2, 3)", unless the call comes from within the same package.
If the function is owned by someone else, you must give the owner name, like "scott.bar (SYSDATE)" or "scott.pk_foo.bar (1, 2, 3)". You can create synonyms to avoid having to name the owner. -
Call outside function with same name in a package
I created a function as follows:
create or replace function f1 return number
is
begin
return 1;
end;
This f1 is to be called in a package created below.
Then I create a package with a function in it, as follows:
create or replace package pack1 as
function f1 return number;
end;
Now I define the package body as follows:
create or replace package body pack1 as
function f1 return number as
-- I am trying to call the first function f1 defined above here
How do I resolve the name issues here?
In other words, I want to call a function with the same signature outside a package.
Thanks for your kind help.Hi,
Welcome to the forum!
Do you have a good reason for using the same name?
Refer to the stand-alone function with the owner name, even though it's your current schema.
That is, even if the package and the stand-alone function are owned by scott, in the package, say
x := scott.f1; -
Is there a way to call a function with in the initializer of a ArrayCollection?
Is there a way to call a function with in the initializer of a ArrayCollection?
It won't let me do this:
var ac:ArrayCollection = new ArrayCollection([
{childName:'addTrade',index:addTradeIndex },
{childName:'tradeList',dealsCanvas.getChildIndex(tradeList) }The correct syntax is
var ac:ArrayCollection = new ArrayCollection([
{childName:'addTrade',index:addTradeIndex },
{childName:'tradeList',index:dealsCanvas.getChildIndex(tradeList) } -
How to call a function with event
How do I call a function with a event inside it?
function showTopTen(e:Event):void
highscoreData = new XML(e.target.data);
trace("Hiscores: " + highscoreData.item[0].name.text() + " - " + highscoreData.item[0].score.text())
//showTopTen(); ..??Could you indicate why you would want to?
The eventhandler you show here uses the properties of the event object passed as an argument.
The way I read it it is data retrieved from a server so your app won't know anything about is untill it is loaded from the server which should be done with an URLLoader object which in it's turn calls your eventHandler when the Event.COMPLETE is triggered.
something like:
var urlLoader = new URLLoader();
urlLoader.addEventListener( Event.COMPLETE, showTopTen )
urlLoader.load( new URLRequest( "http:// etc." ) );
to me would seem the proper method to have the function execute. -
How to call java function with parameter from javascript in adf mobile?
how to call java function with parameter from javascript in adf mobile?
The ADF Mobile Container Utilities API may be used from JavaScript or Java.
Application Container APIs - 11g Release 2 (11.1.2.4.0) -
Dot source/calling a function with switch from the cmd line
Hi
This is driving me crazy and I know its something really obvious.
If I have an example script like so, called myexample.ps1
[CmdletBinding()]
param
[Parameter(Mandatory=$false, HelpMessage="My Switch")]
[switch] $Myswitch,
[Parameter(Mandatory=$false, HelpMessage="Email Address")]
[string] $email
Function Main
[CmdletBinding()]
param
[switch] $Myswitch,
[string] $email
if ($Myswitch)
Write-Host "Switch Enabled"
Write-Host "Email is $email"
else
Write-Host "Switch Disabled"
Write-Host "Email is $email"
Main -email $email #This is the line that I think is at fault
I have two issues
1) How do I correctly write the code so that the script can be called with either or both parameters. The switch ($Myswitch) is the one that is really causing me issues.
2) Is invoking it the easiest method/best/most common method of calling it via a batch file
Here's my understanding
a) I could dot source it (. .\myexample.ps1) to load the functions into the current session, then call the function
Main -email hello.com -Myswitch
or
Main -email hello.com
b) or I could Invoke it, which I think is my preference as my final goal here is for it to be called via a batch file in a scheduled task
& 'C:\Users\myusername\Desktop\MyExample.ps1' -email hello -myswitch
or
& 'C:\Users\myusername\Desktop\MyExample.ps1' -email hello
Any push in the right direction will be appreciated :)Why the function? Just call the file. We don't "Invoke" scripts. Just call the script..
# MyExample.ps1
[CmdletBinding()]
param(
[Parameter(Mandatory=$false, HelpMessage="My Switch")]
[switch] $Myswitch,
[Parameter(Mandatory=$false, HelpMessage="Email Address")]
[string] $email
if ($Myswitch){
Write-Host "Switch Enabled"
Write-Host "Email is $email"
}else{
Write-Host "Switch Disabled"
Write-Host "Email is $email"
Now jsut call it like a normal script:
.\MyExample.ps1 -email someemail -MySwitch
It is as simple as that.
If it has to be a function as in a library then you must either dot source or create a module.
¯\_(ツ)_/¯ -
Call a function with variable function name
Hey guys,
I have a func_table which maintains function names (each one makes reference to a dynamically generated stored function)
I need to make a procedure that calls the functions in that table one by one using its name retrieved from SELECT func_name FROM func_table;
Thanks929955 wrote:
I have a func_table which maintains function names (each one makes reference to a dynamically generated stored function)
I need to make a procedure that calls the functions in that table one by one using its name retrieved from SELECT func_name FROM func_table;Okay, first the bit where I, foaming at mouth and vigorously waving a well used lead pipe around, tell you that this is HIGHLY SUSPECT and likely a FLAWED DESIGN. That dynamic code is 99% of the time wrong. That dynamic code opens securities hole for code injection. That dynamic code often results in severe performance penalties as the coder is clueless about what the Oracle Shared Pool is about. And so on...
As for a basic procedure template to do this - assuming all functions get the same parameter as input and that all functions returns the same data type:
create or replace procedure FooBarFunctions( paramVal number ) is
.. variables and types and cursor definitions..
begin
for c in (
select function_name from my_fubar_functions order by function_order
) loop
plsqlBlock := 'begin :result := '||c.function_name||'( param => :p ); end;';
execute immediate plsqlBlock using out funcResult, in paramVal;
.. do something with funcResult ..
end loop;
.. more code..
end;
{code}
Looks not like a sensible approach though - and begs for justification as to why this approach is needed. What justification do you have? -
Call Plugin-Function with parameters via JavaScript
Hi!
I have following problem: I wrote a plugin for Illustrator CS2 in C++ and now I would like to call a function of the plugin from outside of illustrator (from a JavaScript).
This can be done with the Actionsuite. But how could I then give some parameters to my function?
For example:
In the plugin, I have a function "void myFun(char * test)" and I want to call this function in JavaScript with test="Hello World" for example.
The only possible way right now seems to write parameters into a file and open that file in the plugin to "receive" them.Hi,
Could you send your plugin coding.
Regards,
Maria -
How to call a function with parameters in ScriptStart function
i am trying to call ScriptStart function from SUD dialog. This is how iam calling Call ScriptStart(path & "test.vbs","abc") abc is function which is written test.vbs. It is working. But when i want to pass some parameters to the abc function of test.vbs. It is not working why. can anybody suggest where i went wrong. I am calling the same function as Call ScriptStart(path & "test.vbs","abc(" & text1.Text & ")"). It is not working why ? Is the ScriptStart function only point to functions. it does not take any parameters or waht ?
Hi abc421,
Another option in addition to UserCommands would be to use ScriptInclude(path). If you execute a ScriptInclude(path) command at the beginning of your VBScript, then all the functions and Subs in the VBscript located at "path" are now available to you-- including passing parameters and receiving return values from functions. If you are calling a VBscript that uses only VBScript variables, then this is the preferred method.
If instead you are calling a VBScript that uses global DIAdem variables declared in a VAS file (their variable names all end with the "_" character), then those parameters are already available at the subroutine called with ScriptStart(path, routine).
Brad Turpin
DIAdem Product Support Engineer
National Instruments -
Call a function with tables in a FORM
Hi all,
I am currently willing to create a FORM that would call a function (which has a table in its parameters).
In the form, I modify the fields of this table, and then I call the function.
I put the table in the FORM parameters (either 'USING' or 'TABLES').
Problem is: the syntax check keeps on telling me that my internal table is not correctly defined (missing the statement 'OCCURS 0') and won't compile.
I tried to add this statement 'OCCURS 0', even 'WITH HEADER LINE', but I cannot make it work.
Can anyone help ?
Thx a lot.
Isa.Hi,
Declare a Ztable inside the form of the type declared in the FM with a header line.Assign the fields that u require to pass through the table and append to this Ztable.
Now pass this Ztable to the parameters of the FM.
This should help u out...
Mark useful answers... -
Xdk: calling java function with a CharSequence parameter
When using xdk version 10.1.0.2.0_production, you can not call a javamethod with a CharSequence parameter.
Sun documentation:
Interface CharSequence
All Known Implementing Classes:
CharBuffer, String, StringBuffer
This prevents us from calling a method like
java.util.regex.Pattern.matches(String, CharSequence)
Converting the parameter to a normal string would solve the problem.
Example to illustrate the issue:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdt="http://www.w3.org/2005/02/xpath-datatypes" xmlns:Pattern="http://www.oracle.com/XSL/Transform/java/java.util.regex.Pattern">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<xsl:if test="Pattern:matches('...','123')">
<xsl:text>MATCH</xsl:text>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
results in the following stacktrace:
oracle.xml.parser.v2.XPathException: Extension function error: Error invoking 'matches':'java.lang.NullPointerException'
at oracle.xml.parser.v2.XSLExtFunctions.callStaticMethod(XSLExtFunctions.java:113)
at oracle.xml.parser.v2.XPathExtFunction.evaluateMethod(XPathExtFunction.java:296)
at oracle.xml.parser.v2.XPathExtFunction.evaluate(XPathExtFunction.java:223)
at oracle.xml.parser.v2.XSLCondition.testCondition(XSLCondition.java:185)
at oracle.xml.parser.v2.XSLCondition.processAction(XSLCondition.java:165)
at oracle.xml.parser.v2.XSLNode.processChildren(XSLNode.java:403)
at oracle.xml.parser.v2.XSLTemplate.processAction(XSLTemplate.java:191)
at oracle.xml.parser.v2.XSLStylesheet.execute(XSLStylesheet.java:507)
at oracle.xml.parser.v2.XSLStylesheet.execute(XSLStylesheet.java:484)
at oracle.xml.parser.v2.XSLProcessor.processXSL(XSLProcessor.java:256)
at oracle.xml.parser.v2.XSLProcessor.processXSL(XSLProcessor.java:146)
at oracle.xml.parser.v2.XSLProcessor.processXSL(XSLProcessor.java:218)
at XSLSample.main(XSLSample.java:75)
Message was edited by:
user449717Hi Grarup,
I took a stab at getting this to run and compile and this is what I came up with. Let me know if this helps at all.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
class Program
static void Main(string[] args)
Console.WriteLine("\"True\" or \"False\"?");
bool boolVal = bool.Parse(Console.ReadLine());
Functions f = new Functions();
TestStruct t = new TestStruct() { Value = boolVal };
f.Flip(ref t);
Console.WriteLine(string.Format("Flipped value = {0}: ", t.Value));
Console.ReadLine();
public struct TestStruct
public bool Value;
public class Functions
public void Flip(ref TestStruct testStruct)
testStruct.Value = !testStruct.Value;
Best of luck. -
Call javascript function using parameters cause a immediate execute at load
Hello.
I recognized a strange behavior if I try to use parameters to javascript in af:clientListener method property.
Using syntax <af:commandButton text="Init" id="cb1"
partialSubmit="true">
<af:clientListener method="OnInitControl1" type="click"/>
</af:commandButton> and javascript function OnInitControl1() {
alert('OnInitControl1 called');
} the method OnInitControl1 is called first with the click of the button.
But with the syntax <af:commandButton text="Init" id="cb1"
partialSubmit="true">
<af:clientListener method="InitCtrl('Control1')" type="click"/>
</af:commandButton> and javascript function InitCtrl(frameName) {
alert('InitCtrl(' + frameName + ') called');
}the function InitCtrl is called immediate at load of the page.
In both cases the javascript file is inserted in af:document using<af:resource type="javascript" source="/ScriptHelper.js"/>Is my syntax for "method" property of the af:clientListener wrong?
Paul.Hi,
I am using Oracle JDeveloer version 11.1.1.0.2. I have gone through your discussion. Since i am new to ADF, just wanted to request you to share the code related to <af:resource type="javascript" source="/ScriptHelper.js"/>. Also, the Tag included for the same. In my Environment, if i use <af:resource, it shows, "element af: resource is not expected".
My requirement is similar to your as you explained in details. I need to push all the client side validation to Javascript file and need to call in the ADF pages wherever it is required (re-usable). Also, is there any specific formate for JS file to be maintained from the point of view of ADF calling the JS file.
Your help will be greatly appreciated.
Thanks in Advance,
--Mahesh -
Is it possible to call a function with the same name from 2 different dll's at the same time.
I'm trying to call a function ( F ) form 2 different libraries ( A.dll and B.dll ) at the same time. The first lib loaded determines the function F. A->F and B->F have same interface and name but different implementation.
Hi,
I tried it with two dll's, both with the same interface, and at the same
time, in the same VI. The popups even appear at the same time.
But now I understand the problem... Both dll's are created by LabVIEW! If
they are not (or one is not, and the other is), this is no problem.
And VI's in memory cannot have the same name. LabVIEW doesn't care if VI's
are in a dll or not.
This might not help, but if you want to make some sort of "plug in" system,
you might consider using llb's. By loading VI's dynamically, you can select
the path from which they are loaded. You must unload (close all references)
one before the loading the other, or the same problem will occur. If you go
this way, I consider a different approach. Make on
e library (or even a dll)
that has the interface you like, this is the "loader". Now make several
"plug in"'s, with the same interfaces. The name of each function in a plug
in is a concatenation of the library name and the function name. The loader
has one extra function, that loads (and unloads, when done) references to
all desired libraries to use (the names of the functions can be figured out
easily). All that the loader functions do is dynamically call the library
functions. You can use a call by reference node for this (you can use the
connector pane or the loader vi, since the interface must be the same!).
If you go this way, I guess the loader library can be converted to a dll...
Hope this helps.
Wiebe.
"rsam" wrote in message
news:[email protected]..
> Thx Wiebe,
>
> did you load both dll at the same time? For example in 1 vi. Somehow
> the first loaded function keeps to overrule the second. Notice that
> the interface is
exactly the same.
>
> I loaded 2 dll created in Labview with results described above.
>
> Regards Ruud -
How to call LabView function with nested structs and arrays from C#
Hi,
I've got the following functions defined in a LabView-dll:
uint32_t __stdcall VOSC04_General(uint32_t Command, TD18Hdl *Messages);
uint32_t __stdcall CheckDiameter(uint32_t Command, TD6 *Parameter);
typedef struct {
double SP_Diameter;
double SP_Tolerantie;
double PV_Diameter;
} TD6;
typedef struct {
int32_t dimSize;
int32_t Numeric[1];
} TD18;
typedef TD18 **TD18Hdl;
I've got some C#-code (generated by PInvoke-wizard) to call these functions:
[DllImport("vosc04.dll")]
public static extern uint32_t VOSC04_General (uint32_t Command, ref TD18Hdl Messages);
[DllImport("vosc04.dll")]
public static extern uint32_t CheckDiameter(uint32_t Command, ref TD6 Parameter);
[StructLayout(LayoutKind.Sequential,Pack=4)]
public struct TD18
public int32_t dimSize;
[ MarshalAs( UnmanagedType.ByValArray, SizeConst=1)]
public int32_t [] Numeric;
[StructLayout(LayoutKind.Sequential,Pack=4)]
public struct TD6
public Double SP_Diameter;
public Double SP_Tolerantie;
public Double PV_Diameter;
The problem now is that when I try to read the Messages-output-parameter, I get wrong values (pointers?). I think that the problem lies in the fact that LabView generated a TD18 AND an TD18Hdl struct.
How can I correct this problem?
Can anyone give me some advise to correct this problem? I'm not an expert in C, only in C#.I think the problematic line is this:
public struct TD18
public int32_t dimSize;
[ MarshalAs( UnmanagedType.ByValArray, SizeConst=1)]
public int32_t [] Numeric;
It looks like C# is forcing the array to be of size 1. The thing is, LabVIEW stores arrays as handles which are double pointers to a structure which contains a size element followed by the elements of the array. For your example, int32 arrays are stored in memory as:
handle -> location -> |size|element 1|element 2| .... |element size-1|
Because C does not do runtime array bounds checking, you can get away by declaring the structure as:
typedef struct {
int32_t dimSize;
int32_t Numeric[1];
} TD18;
The correct declaration would've been:
typedef struct {
int32_t dimSize;
int32_t Numeric[size];
} TD18;
But size is not a constant, so C/C++ won't let you do that. So, even though the array is declared to be of size 1, it can (and usually does) have more than 1 element. This does not cause a problem because LabVIEW allocates memory based on the actual size of the array.
If I were you, I'd try to change the prototype of the LabVIEW DLL function to accept a pointer to array data, rather than an array handle, pre-allocate memory for the array in C# and pass a pointer to the allocated memory into LabVIEW so that LabVIEW can "fill it up".
Let me know if you need more information.
Pramod
Maybe you are looking for
-
CD tracks list in non English letters.
Loading Enya Christmas album on to my computer. The CD tracks are in an "Asian" language, but album and artist are listed in English. I have loaded this CD to other computers with Itunes and have never had a problem before.
-
I have a powerbook and I wish to connect it with my video camera that is a super8 camera. It does not have the luxury of firewire so I heard I need something like a Digitizer that will take composite or S-video outputs from the camera and output to t
-
Apple TV2 & iTunes 10 video streaming
Hi all, I have difficulties streaming video's from iTunes to my Apple TV2. Before i import them to iTunes they have a format of 1920x1080 from my video camera. After the Import they have 3413x1080. Any Idea's?
-
Invalid node structure. Free solution!
Invalid node structure. Free solution! Jan 2007. Disk problem on an Intel Core Duo Macbook with 1.25 gig RAM and updated to OS X Tiger 10.4.8 Background. About a month ago I ran into a problem with expose behaving oddly and after posting a question o
-
Revision: 10214 Author: [email protected] Date: 2009-09-13 07:33:58 -0700 (Sun, 13 Sep 2009) Log Message: This fixes the problem that if two text components share the same textFlow there is an infinite loop involving updateDisplayList -> damage