Undefined recursion?
what is an undefined recursion? i was playing 2 instances of ES1 with a drum loop, and logic suddenly quit with the message 'undefined recursion'...
I haven't had a crash in logic for ages with much heavier sessions.
I was not manipulating any windows at the time. I actually never need to touch windows, cos i'm happy with my screensets
Thank god i've at least learned to save a lot over the years
Similar Messages
-
SCRIPT5007: Unable to get property 'top' of undefined or null and too much recursion
I am not sure about placing two questions into one post, but here it goes:
The error above "SCRIPT5007: Unable to get property 'top' of undefined or null" is coming from this function:
Code:
$(function () { //this is the way to run your code at the DOM Ready event $('a').click(function () { $('html, body').animate({ scrollTop: $($(this).attr('href')).offset().top }, 1500); return false; }); });
This is the effected code I believe that is causing the problem:
Code:
scrollTop: $($(this).attr('href')).offset().top
the error occurs when I click on a "clear" button in my form. My website is one long page and that function allows my navigation to slide up and down the site. Without it, everytime you click a nav, it jumps to that anchor.
For the 2nd problem, the too much recursion, the problem lies within here:
Code:
function () { if ($.isReady) return; imReady = true; $.each($.includeStates, function (url, state) { if (!state) return imReady = false }); if (imReady) { $.readyOld.apply($, arguments) } else { setTimeout(arguments.callee, 10) } }
where the error is actually coming from the 2nd "function" script. This is part of the browser compatibility script for mozilla/opera at the top of the index page. Any help would be great. Thanks.Ahh I apologize. I simply was posting to JavaScript forums in hopes of
finding a solution. Sorry for the mixup. -
Linking Error : Undefined Symbols: SUN Studio 5
Hi ,
I am facing some Linking error which throws up Undefined Symbol errors like .
[Undefined first referenced
symbol in file
__rwstd::__rb_tree<DevNexus,DevNexus,__rwstd::__ident<DevNexus,DevNexus>,std::less<DevNexus>,std::allocator<DevNexus> >::iterator __rwstd::__rb_tree<DevNexus,DevNexus,__rwstd::__ident<DevNexus,DevNexus>,std::less<DevNexus>,std::allocator<DevNexus> >::erase(__rwstd::__rb_tree<DevNexus,DevNexus,__rwstd::__ident<DevNexus,DevNexus>,std::less<DevNexus>,std::allocator<DevNexus> >::iterator,__rwstd::__rb_tree<DevNexus,DevNexus,__rwstd::__ident<DevNexus,DevNexus>,std::less<DevNexus>,std::allocator<DevNexus> >::iterator) PacketServer.o
__type_0 std::find<std::deque<AdapterPort,std::allocator<AdapterPort> >::iterator,AdapterPort>(__type_0,__type_0,const __type_1&) PacketServer.o
void std::vector<Controller,std::allocator<Controller> >::__insert_aux(Controller*,const Controller&) Subsystem.o
void std::deque<AdapterDisc,std::allocator<AdapterDisc> >::__allocate_at_end() PacketServer.o
__rwstd::__rb_tree<unsigned long,std::pair<const unsigned long,char*>,__rwstd::__select1st<std::pair<const unsigned long,char*>,unsigned long>,std::less<unsigned long>,std::allocator<std::pair<const unsigned long,char*> > >::iterator __rwstd::__rb_tree<unsigned long,std::pair<const unsigned long,char*>,__rwstd::__select1st<std::pair<const unsigned long,char*>,unsigned long>,std::less<unsigned long>,std::allocator<std::pair<const unsigned long,char*> > >::erase(__rwstd::__rb_tree<unsigned long,std::pair<const unsigned long,char*>,__rwstd::__select1st<std::pair<const unsigned long,char*>,unsigned long>,std::less<unsigned long>,std::allocator<std::pair<const unsigned long,char*> > >::iterator,__rwstd::__rb_tree<unsigned long,std::pair<const unsigned long,char*>,__rwstd::__select1st<std::pair<const unsigned long,char*>,unsigned long>,std::less<unsigned long>,std::allocator<std::pair<const unsigned long,char*> > >::iterator) DeviceProp.o
std::deque<AdapterPort,std::allocator<AdapterPort> >::~deque() PacketServer.o
__type_0 std::find<std::deque<AdapterDisc,std::allocator<AdapterDisc> >::iterator,char*>(__type_0,__type_0,const __type_1&) PacketServer.o
unsigned std::deque<AdapterPort,std::allocator<AdapterPort> >::__buffer_size() PacketServer.o
unsigned std::deque<AdapterDisc,std::allocator<AdapterDisc> >::__buffer_size() PacketServer.o
void __rwstd::__rb_tree<DevNexus,DevNexus,__rwstd::__ident<DevNexus,DevNexus>,std::less<DevNexus>,std::allocator<DevNexus> >::__deallocate_buffers() PacketServer.o
std::deque<AdapterDisc,std::allocator<AdapterDisc> >::~deque() PacketServer.o
ld: fatal: Symbol referencing errors. No output written to spagent
*** Error code 1
make: Fatal error: Command failed for target `spagent'
Current working directory /home/kiranc/solaris_hang1/4.0/agent
*** Error code 1
make: Fatal error: Command failed for target `recurse'
Current working directory /home/kiranc/solaris_hang1/4.0/agent
*** Error code 1
make: Fatal error: Command failed for target `all'
I am using Sun Studio 5. Pls let me know how to resolve/fix this. Unfortunately I cant upgrade the Sun Studio.
Thanks in Advance
KiranHi Kiran ,
if you cannot upgrade Sun Studio, I suggest that you take a view on this solution:
http://forum.java.sun.com/thread.jspa?forumID=850&threadID=5069680
It only works to std::vector::__insert_aux method, but I think you could get some useful idea from it.
Good luck.
Bye. -
While trying to figure out if the recursive definition in java is innermost, outermost, ...
I stumbled upon a problem. Why is it that running "return eval(x--, eval(x , y));" or running "return eval(x - 1, eval(x , y));" yeilds different results. Please try running one and then the other before replying. I'm well aware or the fact that x-- is an autodecrementation and x - 1 doesn't store the value into x, but my reursive calls take care of that.
If there is an easier way to determine Java's recursive definition please let me know.
public class RecurF
public RecurF()
System.out.println(eval(1, 1));
public int eval(int x, int y)
System.out.print(x + " other ");
if(x == 0)
return x;
System.out.print(x + " ");
return eval(x--, eval(x , y));
//return eval(x - 1, eval(x , y));
public static void main(String [] arg)
RecurF test = new RecurF();
}I stumbled upon a problem. Why is it that running
"return eval(x--, eval(x , y));" or running "return
eval(x - 1, eval(x , y));" yeilds different results.First of all, the expression
eval(x--, eval(x , y))has undefined semantics, because you are modifying x inside the expression. The compiler is free to generate code that evaluates the second parameter before the first parameter, or the other way around.
This is true for any language, and Java does not enforce a particular order of evaluation of arguments, or even the order of evaluation and calling (i.e. the compiler is free to do something like:
t1 = x--;
t2 = y;
t3 = x;
t4 = eval(t2,t3);
eval(t1,t4);If you have variable modification side-effects in an expression, you need to make sure that you don't use any of the affected variables more than once in the same statement (because the sequence point is the statement boundary). -
How can I implement a recursive update within triggers?
Given
INSTANCE (table)
INST_ID
etc.
INSTANCE_STRUCTURE (table)
PARENT_ID (fk to INST_ID)
CHILD_ID (fk to INST_ID)
And that I COULD write code which recursively navigates the hierarchy (ie. START WITH parent_id = ? CONNECT BY PRIOR child_id = parent_id) and issues UPDATEs to each "child" along the way, thereby propogating the desired update, how can I accomplish the same thing using triggers?
Keep in mind I am using Oracle 7.3 and I have no choice. Also, the DBA is very difficult to get a hold of and I have no idea if there may be some server settings which are preventing some of my attempts from succeeding.
Of course the simplest method is to make an update trigger on INSTANCE select all CHILD_ID from INSTANCE_STRUCTURE and issue UPDATE to each which, in turn, would invoke the same trigger, however, we can't have a mutating table, now can we?
Next, I tried the old global variable in a package bit. That's when I first started getting this "end of channel" business which essentially disconnects me from Oracle (while using SQLPlus). I started to debug that, and then other users started getting errors ... apparently due to the global variable being global ACROSS sessions ... which I did not expect (correct me if I'm wrong and I can try it again), however, due to the amount of data I'm dealing with in any one particular line of hierarchy, I'm not sure I wouldn't get an error anyhow ... particularly if I have to maintain a global array for everyone at once. Anyhow, it was during that, that I realized the "too many open cursors" thing and so I started working with START WITH CONNECT BY to identify all rows which must be dealt with.
Then, I tried setting up some new tables (as opposed to global variables) in which I would identify userenv('sessionid') and other data so that a BEFORE UPDATE, FOR EACH ROW trigger could check to make sure that the AFTER UPDATE trigger had not begun yet (IOW, not recursing yet). Basically, everything's fine until the AFTER UPDATE trigger tries to apply UPDATEs for the children (identified from a cursor on START WITH CONNECT BY) ... then I get the "end of channel" thing again.
Obviously, this whole thing is an attempt to denormalize some data for performance reasons.
Any help would be appreciated.
Thanks.Nevermind, I figured somethin' out.
-
Error while deploying a composite (Message part "body" is undefined)
Hi All,
I am trying to deploy a composite but i am getting the following error.
Buildfile: C:\Oracle\MiddlewareJdev\jdeveloper\bin\ant-sca-compile.xml
scac:
[scac] Validating composite "C:\JDeveloper\mywork\Sample\SampleDequeueBPEL\composite.xml"
[scac] /C:/JDeveloper/mywork/Sample/SampleDequeueBPEL/Outputftp.wsdl: error: Message part "body" is undefined [element = EmpCollection
[scac] Setting BPELC option 'classpath' to C:\Oracle\MiddlewareJdev\jdeveloper\jdev\extensions\oracle.sca.modeler.jar;C:\Oracle\MiddlewareJdev\jdeveloper\soa\modules\oracle.soa.fabric_11.1.1\fabric-runtime.jar;C:\Oracle\MiddlewareJdev\jdeveloper\soa\modules\oracle.soa.mgmt_11.1.1\soa-infra-mgmt.jar;C:\Oracle\MiddlewareJdev\oracle_common\modules\oracle.fabriccommon_11.1.1\fabric-common.jar;C:\Oracle\MiddlewareJdev\jdeveloper\soa\modules\oracle.soa.bpel_11.1.1\orabpel.jar;C:\Oracle\MiddlewareJdev\jdeveloper\soa\modules\oracle.soa.mediator_11.1.1\mediator_client.jar;C:\Oracle\MiddlewareJdev\oracle_common\modules\oracle.mds_11.1.1\mdsrt.jar;C:\Oracle\MiddlewareJdev\oracle_common\modules\oracle.adf.model_11.1.1\adfbcsvc.jar;C:\Oracle\MiddlewareJdev\oracle_common\modules\oracle.adf.model_11.1.1\adfbcsvc-share.jar;C:\Oracle\MiddlewareJdev\oracle_common\modules\commonj.sdo_2.1.0.jar;C:\Oracle\MiddlewareJdev\modules\org.eclipse.persistence_1.1.0.0_2-1.jar;C:\Oracle\MiddlewareJdev\oracle_common\modules\oracle.webservices_11.1.1\wsclient.jar;C:\Oracle\MiddlewareJdev\oracle_common\modules\oracle.web-common_11.1.1.jar;;C:\JDeveloper\mywork\Sample\SampleDequeueBPEL\SCA-INF\classes
[scac] C:\JDeveloper\mywork\Sample\SampleDequeueBPEL\composite.xml:21: error: SCAC-50012
BUILD FAILED
C:\Oracle\MiddlewareJdev\jdeveloper\bin\ant-sca-compile.xml:272: Java returned: 1 Check log file : C:\JDeveloper\mywork\Sample\SampleDequeueBPEL\SCA-INF\classes\scac.log for errors
Total time: 4 seconds
This is an integration from Dequeue to FTP . Dequeue have a payload of message type which is transformed to Ftp message type. Below is the wsdl file where i am getting error
<wsdl:definitions
name="Outputftp"
targetNamespace="http://xmlns.oracle.com/pcbpel/adapter/ftp/Sample/SampleDequeueBPEL/Outputftp"
xmlns:jca="http://xmlns.oracle.com/pcbpel/wsdl/jca/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="http://xmlns.oracle.com/pcbpel/adapter/ftp/Sample/SampleDequeueBPEL/Outputftp"
xmlns:plt="http://schemas.xmlsoap.org/ws/2003/05/partner-link/"
>
<plt:partnerLinkType name="Put_plt" >
<plt:role name="Put_role" >
<plt:portType name="tns:Put_ptt" />
</plt:role>
</plt:partnerLinkType>
<wsdl:types>
<schema targetNamespace="http://xmlns.oracle.com/pcbpel/adapter/ftp/Sample/SampleDequeueBPEL/Outputftp"
xmlns="http://www.w3.org/2001/XMLSchema" >
<include schemaLocation="xsd/FileFTP.xsd" />
</schema>
</wsdl:types>
<wsdl:message name="Put_msg">
<wsdl:part name="body" element="EmpCollection"/>
</wsdl:message>
<wsdl:portType name="Put_ptt">
<wsdl:operation name="Put">
<wsdl:input message="tns:Put_msg"/>
</wsdl:operation>
</wsdl:portType>
</wsdl:definitions>XSD of FTP:
<?xml version= '1.0' encoding= 'UTF-8' ?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="EmpCollection">
<xs:complexType>
<xs:sequence>
<xs:element name="Emp" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:string" name="name"/>
<xs:element type="xs:byte" name="id"/>
<xs:element type="xs:byte" name="dept"/>
<xs:element type="xs:string" name="address"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>Could someone help me on this. Thanks in advance.
Thanks
Gnanaprakasam RGnanaprakasam ,
Check log file : C:\JDeveloper\mywork\Sample\SampleDequeueBPEL\SCA-INF\classes\scac.log for errorsDid you managed to look into logs.
Try to reconfigured the ftp adapter from scratch.
I had ran into same error as yours what i did was, restarted the Jdeveloper and was able to compile !!
Regards,
Abhinav Gupta -
Adobe Bridge CS6 undefined in not an object Help Please
I am so sick and tired of getting this error message when I try to create a pdf contact sheet - undefined is not an object. Can someone help me?
What frustrates me the is there is no log file telling me what image has the problem which Bridge does not like.
This example is of brand new eps files that were created in the last month
I also have the same undefined object is not an object using AI files but none are shown in this example.
If there is no solution to tell me what eps or ai file(s) bridge does not like - is there a setting I can change so Bridge skips the file it does not like? Sorta silly skipping a file for a contact sheet but if that is a workaround to make it bridge work that would be a huge improvement versus the program not working at all, LOL...
1. I have tried using another program to rename all my files to be sequential numbers too, so that is taking more time and I am losing the ability to find my files by name and I still get the undefined is not an object.
2. I am to the point of using other programs to create jpeg images of AI and EPS files and then using bridge to make contact sheets and doing that takes a ton more time and is just silly to do so now I am to the point of asking for help.
3. Operating system is Wondows 7 - I use CS6 - Adobe Bridge for making contact sheets - screen shoot is attached - all CS6 items are up to date with updates.
4. Yes, I have searched the internet for help and searched adobe for help --- seems like no one has posted a solution.I am having this same issue. I'm attempting to make a pdf in Bridge but am getting the error message "undefined is not an object." A log or a report of some kind would be very useful here to find out which object is the offender. Looking at my files they appear to be in order but obviously something is amiss....
-
Downloaded update toi mFirewfox 4. ISP is Talktalk. Can open My mail and get to screen with inbox but page seems to stopp loading then as it doesa not show amount of space being used etc which it normally does. Instead message says 'You have undefined new mails in your inbox' Nothing then happens and the button to open the inbox does not work. Can however access my email and inbox through Outlook express. Contacted TalkTalk help line and after running some checks was told that the problem is with the browser. Canb anyone help solve this please.
Me too, problem is being googled alot by other tiscali users also.
-
View attributes can not be retrieved. View instance not found or undefined
Hi,
I am creating a simple master detail OAF page. For this I have done following steps:
1. Created ParentEO and ChildEO
2. Created ParentVO with a transient attribute called "SelectFlag" with default value "Y" .
3. Created ChildVO
4. Created a UserViewLink.
5. Created Application module (UserAM).
6. New Page UserPG
7. In the main region I have defined Application Module.
8. Under the main region, I have created a new advanced table region with following properties:
View Instance : ParentVO1
Detail View Attribute : SelectFlag
View Link Instance: UserViewLink.
Now when I click to select the "Child View Attribute", it gives a pop up saying "View attributes can not be retrieved. View instance not found or undefined".
Please help, I am not able to proceed on this.
Thanks,
AnupamAnupam,
I do not see in your steps where you associated the VO with the AM. In order to select an attribute, the AM must have an instance of the VO associated with it. Double click the AM in the navigator. Click Data Model and shuttle the VO's you want to be available from the left to the right.
Hope this helps.
Kristofer -
The error message "An undefined AIM socket error has occurred." comes up when I try and log on to ichat.
I have the same issue. Does anybody know why this has happened
-
I have taken the cfdump for tmpqry and it shows all data for
the range ( No error at this step ) . But when we exceute this
dbquery we get below mentioned error .
<cfquery name="qry" dbtype="query" >
SELECT *
FROM tmpqry
ORDER BY #arguments.colSort# ASC
</cfquery>
senerio:
I am using createobject to create a reference for component
and call MDArraySort function in the cfc and getting this error .
'The system has attempted to use an undefined value, which
usually indicates a programming error, either in your code or some
system code.
Null pointer is undefined.... '
i am using this code in a cfc file.
<cffunction name="MDArraySort" Returntype="query"
access="public" >
<cfargument name="colArray" type="array"
required="true">
<cfargument name="colNames" type="string"
required="true">
<cfargument name="colSort" type="string"
required="true">
<cfargument name="sensorIDs" type="string"
required="true">
<cfscript>
var tmpqry = Querynew(arguments.colNames);
var qRow = QueryAddRow(tmpqry, Arraylen(arguments.colArray)
</cfscript>
<cfloop from="1" to="#Arraylen(arguments.colArray)#"
index="qRowIndex">
<cfscript>
sIndexinSensorIDs = colArray[qRowIndex]["SENSOR"]&"##";
Temp_readin_code =
colArray[qRowIndex]["READING_CODE"]&"##";
QuerySetCell(tmpqry, 'SENSOR', sIndexinSensorIDs,
qRowIndex);
QuerySetCell(tmpqry,
'TYPE',javacast('String',colArray[qRowIndex]["TYPE"]), qRowIndex);
QuerySetCell(tmpqry, 'TIMESTAMP2',
LSParseDateTime(colArray[qRowIndex]["TIMESTAMP2"]), qRowIndex);
QuerySetCell(tmpqry,
'ORDER_BY_PARAM',javacast('String',colArray[qRowIndex]["ORDER_BY_PARAM"]),
qRowIndex);
QuerySetCell(tmpqry, 'READING_CODE',Temp_readin_code ,
qRowIndex);
QuerySetCell(tmpqry,
'READING',javacast('String',colArray[qRowIndex]["READING"]),
qRowIndex);
QuerySetCell(tmpqry,
'PK_READING',javacast('String',colArray[qRowIndex]["PK_READING"]),
qRowIndex);
QuerySetCell(tmpqry,
'ALARM_STATUS',javacast('String',colArray[qRowIndex]["ALARM_STATUS"]),
qRowIndex);
QuerySetCell(tmpqry, 'DURATION',
javacast('String',colArray[qRowIndex]["DURATION"]), qRowIndex);
QuerySetCell(tmpqry,
'DESCRIPTION',javacast('String',colArray[qRowIndex]["DESCRIPTION"]),
qRowIndex);
</cfscript>
</cfloop>
<cfquery name="qry" dbtype="query" >
SELECT *
FROM tmpqry
ORDER BY #arguments.colSort# ASC
</cfquery>
<cfreturn qry >
</cffunction>
It is working fine for some date range and and getting above
mentioned error in sone situation .Hi All ,
Thank you for your support ,
Finally i have fix the issue using some changes in my
function in cfc .
<cffunction name="MDArraySort" Returntype="query"
access="public" >
<cfargument name="colArray" type="array"
required="true">
<cfargument name="colNames" type="string"
required="true">
<cfargument name="colSort" type="string"
required="true">
<cfargument name="sensorIDs" type="string"
required="true">
<cfscript>
//Declare variable collection used in function as local
--->
var tmpqry =
Querynew(arguments.colNames,"CF_SQL_VARCHAR,CF_SQL_VARCHAR,CF_SQL_DATE,CF_SQL_VARCHAR,CF_ SQL_VARCHAR,CF_SQL_VARCHAR,CF_SQL_VARCHAR,CF_SQL_VARCHAR,CF_SQL_VARCHAR,CF_SQL_VARCHAR");
var qRow = QueryAddRow(tmpqry,
Arraylen(arguments.colArray));
</cfscript>
<cfloop from="1" to="#Arraylen(arguments.colArray)#"
index="qRowIndex">
<cfscript>
// Populate the query table
QuerySetCell(tmpqry, 'SENSOR',
colArray[qRowIndex]["SENSOR"], qRowIndex);
QuerySetCell(tmpqry,
'TYPE',arguments.colArray[qRowIndex]["TYPE"], qRowIndex);
QuerySetCell(tmpqry, 'TIMESTAMP2',
LSParseDateTime(arguments.colArray[qRowIndex]["TIMESTAMP2"]),
qRowIndex);
QuerySetCell(tmpqry,
'ORDER_BY_PARAM',arguments.colArray[qRowIndex]["ORDER_BY_PARAM"],
qRowIndex);
QuerySetCell(tmpqry, 'READING_CODE',
colArray[qRowIndex]["READING_CODE"] , qRowIndex);
QuerySetCell(tmpqry,
'READING',arguments.colArray[qRowIndex]["READING"], qRowIndex);
QuerySetCell(tmpqry,
'PK_READING',arguments.colArray[qRowIndex]["PK_READING"],
qRowIndex);
QuerySetCell(tmpqry,
'ALARM_STATUS',arguments.colArray[qRowIndex]["ALARM_STATUS"],
qRowIndex);
QuerySetCell(tmpqry, 'DURATION',
arguments.colArray[qRowIndex]["DURATION"], qRowIndex);
QuerySetCell(tmpqry,
'DESCRIPTION',arguments.colArray[qRowIndex]["DESCRIPTION"],
qRowIndex);
</cfscript>
</cfloop>
<cfquery name="qry" dbtype="query" >
SELECT *
FROM tmpqry
ORDER BY #arguments.colSort# ASC
</cfquery>
<cfreturn qry >
</cffunction>
Rajesh
SCMS
India -
Getting bobj is undefined when report is viewed in Internet Explorer 8
Background
We are running a web application on a server that has "BusinessObjects Enterprise XI 3.1 FP 2.6 Update" installed on it.
The server uses the 1.1 .net framework.
This web app can generate Crystal reports and display them either by exporting to pdf, or by using the CrystalReportViewer control.
(The CrystalDecisions references in the sln for the website are using version 12.0.1100.0.
The web app is a custom web app that is not defined in iis at the default level. It lives as a virtual website under the default website and uses the crystalreportviewers12 virtual directory.)
when the browser displays a report by exporting to pdf, it works just fine.
Here is our issue:
When the browser displays a report by using the CrystalReportViewer control using Internet Explorer 8 (IE8), it generates a javascript error:
'bobj' is undefined
Here are a few peculiar things on this:
- the report displays ok for other IE8 users (so the issue only occurs for select IE8 users).
- the report displays ok in ie6.
- One notable observation is that IE8 has different sets of options amongst browsers. We compared 2 machines that didnu2019t work, with 1 machine that does work. All 3 sets of IE8 settings differ in one way or another.
Does anyone know if this is an issue that that can be fixed through an IE8 setting? Or does it need to be fixed elsewhere? Thank you!Hi Brownie,
We only support IE 8 in Compatibility mode. Try selecting that option in the Browser and test again
Thank you
Don -
How to find square root, log recursively???
I need to find the square root of a number entered recursively and log as well. Your help would be greatly appreciated. Thanks in advance!
import java.io.*;
/**Class provides recursive versions
* of simple arithmetic operations.
public class Ops2
private static BufferedReader in = null;
/**successor, return n + 1*/
public static int suc(int n)
return n + 1;
/**predecessor, return n - 1*/
public static int pre(int n)
if (n == 0)
return 0;
else
return n - 1;
/**add two numbers entered*/
public static int add(int n, int m)
if (m == 0)
return n;
else
return suc(add(n, pre(m)));
/**subtract two numbers entered*/
public static int sub(int n, int m)
if (n < m)
return 0;
else if (m == 0)
return n;
else
return pre(sub(n, pre(m)));
/**multiply two numbers entered*/
public static int mult(int n, int m)
if (m == 0)
return 0;
else
return add(mult(n, pre(m)), n);
/**divide two numbers entered*/
public static int div(int n, int m)
if (n < m)
return 0;
else
return suc(div(sub(n, m), m));
/**raise first number to second number*/
public static int exp(int n, int m)
if (m == 0)
return 1;
else
return mult(exp(n, pre(m)), n);
/**log of number entered*/
public static int log(int n)
if (n < 2)
return 0;
else
return suc(log(div(n, 2)));
/**square root of number entered*/
public static int sqrt(int n)
if (n == 0)
return 0;
else
return sqrt(div(n, ));
/**remainder of first number entered divided by second number*/
public static int mod(int n, int m)
if (n < m)
return 0;
else
return mod(div(n, pre(m)), m);
public static void prt(String s)
System.out.print(s);
public static void prtln(String s)
System.out.println(s);
public static void main(String [ ] args)
prtln("Welcome to the amazing calculator");
prtln("It can add, multiply and do powers for");
prtln("naturals (including 0). Note that all the");
prtln("HARDWARE does is add 1 or substract 1 to any number!!");
in = new BufferedReader(new InputStreamReader ( System.in ) );
int It;
while ( (It = getOp()) >= 0)
prt("" + It + "\n");
private static int getOp( )
int first, second;
String op;
try
System.out.println( "Enter operation:" );
do
op = in.readLine( );
} while( op.length( ) == 0 );
System.out.println( "Enter first number: " );
first = Integer.parseInt( in.readLine( ) );
System.out.println( "Enter second number: " );
second = Integer.parseInt( in.readLine( ) );
prtln("");
prt(first + " " + op + " " + second + " = ");
switch( op.charAt( 0 ) )
case '+':
return add(first, second);
case '-':
return sub(first, second);
case '*':
return mult(first, second);
case '/':
return div(first, second);
case '^':
return exp(first, second);
case 'v':
return log(first);
case 'q':
return sqrt(first);
case '%':
return mod(first, second);
case 's':
return suc(first);
case 'p':
return pre(first);
default:
System.err.println( "Need +, *, or ^" );
return -1;
catch( IOException e )
System.err.println( e );
return 0;
}Hi,
Is there any one to make a program for me in Turbo
C++ for Dos, which can calculate the square root of
any number without using the sqrt( ) or any ready
made functions.
The program should calculate the s.root of the number
by a formula or procedure defined by the user
(programmer).
Thanks.This is a Java forum!
If you want Java help:
1. Start your own thread.
2. Use code tags (above posting box) if you post code.
3. No one will write the program for you. We will help by answering your questions and giving advice on how to fix problems in code you wrote.
4. The formula you need to implement is given above by dizzy. -
Confusion between references in recursion
Hi all,
I am trying to create B+ trees for a database. My algorithm for the insert function is:
void insert(page_no, entry, newchildentry )
if page_no is not a leaf ,say N
find i such that Ki <= entry's key value < K i+1 //choose subtree
insert(newPage(i), entry,newchildentry )
if newchildentry is null, return;
else
if N has space, insert the newchildentry, set it to null and return
else
split the page in half, the newchildentry is set to a new value
if N is the root , do some extra things return;
if page_no is a leaf, say L
if L has space, insert entry on to it, set newchildentry to null and return;
else split L in half, populate the newchildentry to some new values
return;
}The problem that i am facing is that newchildentry is being populated by some values in the "if page_no is a leaf, say L" part and on collapsing the recursion, these values are being lost and I can't figure what the problem is. i'm new to java even though i have programmed in c/c++ before and i think this would work. is it because java is maintaining different placeholders for the newchildentry?
thanks.
~dang_itHi all,
I am trying to create B+ trees for a database. My
algorithm for the insert function is:
void insert(page_no, entry, newchildentry )
if page_no is not a leaf ,say N
find i such that Ki <= entry's key value < K i+1
//choose subtree
insert(newPage(i), entry,newchildentry )
if newchildentry is null, return;
else
if N has space, insert the newchildentry,
hildentry, set it to null and return
else
split the page in half, the newchildentry is
dentry is set to a new value
if N is the root , do some extra things
ra things return;
if page_no is a leaf, say L
if L has space, insert entry on to it, set
newchildentry to null and return;
else split L in half, populate the newchildentry to
some new values
return;
}The problem that i am facing is that newchildentry is
being populated by some values in the "if page_no is
a leaf, say L" part and on collapsing the recursion,
these values are being lost and I can't figure what
the problem is. i'm new to java even though i have
programmed in c/c++ before and i think this would
work. is it because java is maintaining different
placeholders for the newchildentry?
thanks.
~dang_itIn the code that is failing, what type is newchildentry. You need to be aware that objects are not passed in the argument list. A copy of the object reference is passed. When the method finishes, even if the object contents have changed, the reference has not. So, to say that in some case you set newchildentry to null does not change the newchildentry object reference in the calling method.
� {� -
I am getting the following error with IE9 and Firefox 26 with application express 3.2:
SCRIPT5007: Unable to get value of the property 'nodeName': object is null or undefined
apex_ns_3_1.js, line 589 character 10
this.dialog.check2 = function (e){
var tPar = html_GetTarget(e);
var lEl = $x('apexir_col_values_drop');
var l_Test = true;
****** while(tPar.nodeName != 'BODY'){
tPar = tPar.parentNode;
if(tPar == lEl){l_Test = false;}
if(l_Test){$x_Remove('apexir_col_values_drop')}
This happens when I click the Gear Icon, then Filter, then I click the dropdown arrow under expressions and pick an expression from the list.
If I set (through IE Developer tools) back to IE8 mode, I don't get the error.Guess no one is using 3.2 any longer or no one else gets this error..... Guess I can edit the JavaScript file to trap the error since it really doesn't seem to cause an issue. Just didn't want to have to go that route.
Maybe you are looking for
-
I have tried to reset Firefox and that didn't work. Chrome is having the same problem, only it says "Unable to connect to the Internet". I tried to open some links from my favorites folder and all it does is load for a fraction of a second and nothin
-
My situation is that my son, now 12, has his own iPhone and has been purchasing his games, apps and music on my itunes account. Am I able to transfer all his purchases to his new itunes account or is all his data and game progress gone?
-
Configuring DBAT 9.1.0.5 connector with PostgreSQL database in OIM 11g
Hi, I am trying to configure the DBAT 9.1.0.5 connector with PostgreSQL database in OIM 11g (11.1.1.5.0), thou' in the connector document the suppot for this postgres is not mentioned. So, as mentioned for other databases that the JDBC driver has to
-
My MacBook is only a few months old and I've run games and game demos on it. But lately, when I try and open a couple of my demos, the screen goes black and flcikers, as if going to full screen mode to play the game, but then exits the program, witho
-
Cannot open pdf file in IE or Firefox in Win7
I just got a new laptop with Win7. When I try to open a pdf file on the internet with either Firefox or IE. I cannot open it. Also cannot open in Outlook. It usually just coses down with no error message. I have taken all Adobe Reader and ACrobat pro