What this code does ?
what this code does ?
System.setProperty("java.protocol.handler.pkgs","com.sun.net.ssl.internal.www.protocol");
i am studying this code....
//Verify the hostname, check all trusted cetifcates and install them in the machine
com.sun.net.ssl.HostnameVerifier ver = new com.sun.net.ssl.HostnameVerifier(){
public boolean verify(String urlHostname,String certHostname)
try
{ return true;
} catch(Exception x){ return true; }
javax.net.ssl.TrustManager[] trustAllCerts = new javax.net.ssl.TrustManager[]{
new javax.net.ssl.X509TrustManager() {
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
return null;
public void checkClientTrusted(
java.security.cert.X509Certificate[] certs, String authType) {
public void checkServerTrusted(
java.security.cert.X509Certificate[] certs, String authType) {
// Install the all-trusting trust manager
try {
javax.net.ssl.SSLContext sc = javax.net.ssl.SSLContext.getInstance("SSL");
sc.init(null, trustAllCerts, new java.security.SecureRandom());
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
sc=null;
} catch (Exception e) {
e.printStackTrace();
//Setting the defaultHost name verfier set by the user for communication
HttpsURLConnection.setDefaultHostnameVerifier(ver);/**/please note the bold colored code from the above i.e
HttpsURLConnection.setDefaultHostnameVerifier(ver);
so, ver instance has been presented to the setDefaultHostnameVerifier . fine....but who is calling the methods verify() which is described in the implemented Annoynymous interface HostnameVerifier .
who is calling that overridden method verify() ?
similarly, who is calling getAcceptedIssuers() method?
I DONT see any invocation of these overridden methods .
are these methods are FRAUD and BUGGY...and are not needed in this code....are they redundant ?
OR are these methods are invoked by the HttpsURLConnection internally somehow....
confused about the functionng of this code.
thanks for the time
Similar Messages
-
Can you tell me what this code does?
Can you tell me what this code does?
import java.io.*;
class Assignment1
public static String[][] tdi = { {"Paris", "418", "Rome", "55"},
{"Liverpool", "121", "Copenhagen", "35"},
{"Liverpool", "418", "Paris", "50"},
{"Liverpool", "553", "Frankfurt", "55"},
{"Frankfurt", "553", "Budapest", "50"},
{"Amsterdam", "121", "Madrid", "65"},
{"Amsterdam", "418", "Paris", "35"},
{"Madrid", "121", "Stockholm", "90"},
{"Budapest", "553", "Warsaw", "30"},
{"Copenhagen", "121", "Amsterdam", "35"},
{"Rome", "418", "Amsterdam", "60"},
//--Start Method--
public static void main( String args[] ) throws IOException
System.out.println("Welcome to NoWings Airline.");
InputStreamReader input = new InputStreamReader(System.in);
BufferedReader keyboardInput = new BufferedReader(input);
System.out.println("Please enter the airport you wish to depart from:");
String[] info = TDIDLL.searchDest( keyboardInput.readLine() );
if (info == null)
System.out.println("Sorry, no plane to this destination");
else
System.out.println(info[0]+" departing at platform "+info[1]); }}
public static String[] searchDest( String dest )
String[] result = null;
for(int i = 0; i < tdi.length; i++)
if (tdi[1].equals(dest)) {
result = new String[2];
result[0] = tdi[i][0];
result[1] = tdi[i][2];
return result;
return result; }
// Info Method //
// Fly Method //
// Exit Method //
Thanks. Also, can you tell me where I have gone wrong in the code.
Much appreciated.Can you tell me what this code does?Why don't you run it and find out for yourself?
-
Can anyone explain what this code does.
<b>Below is the FM for a SAP Exit Variable ( 0FPER - Fiscal Period Variable ) , I would really appreciate if someone can give some explanation what does the code do.</b>
FUNCTION RSVAREXIT_0F_FPER.
""Lokale Schnittstelle:
*" IMPORTING
*" VALUE(I_VNAM) LIKE RSZGLOBV-VNAM
*" VALUE(I_VARTYP) LIKE RSZGLOBV-VARTYP
*" VALUE(I_IOBJNM) LIKE RSZGLOBV-IOBJNM
*" VALUE(I_S_COB_PRO) TYPE RSD_S_COB_PRO
*" VALUE(I_S_RKB1D) TYPE RSR_S_RKB1D
*" VALUE(I_S_RKB1F) TYPE RRO01_S_RKB1F
*" VALUE(I_THX_VAR) TYPE RRO01_THX_VAR
*" EXPORTING
*" VALUE(E_T_RANGE) TYPE RSR_T_RANGESID
*" EXCEPTIONS
*" UNKNOWN_VARIABLE
*" UNEXPECTED_VARTYPE
*" INVALID_PERIV
*" VARIABLE_INITIAL
*" NO_REPLACEMENT
data:
l_s_range type rs_s_range,
ld_periv type rro01_s_rkb1f-periv,
ld_curdate like sy-datum,
ld_poper like t009b-poper,
ld_fiscyear like t009b-bdatj.
refresh e_t_range.
clear l_s_range.
l_s_range-sign = 'I'.
l_s_range-opt = 'BT'.
case i_vartyp.
when rro04_c_vartyp-formula.
*--- Determine fiscal year variant
call function 'BWCO_FISCVARNT_GET'
exporting
i_s_rkb1d = i_s_rkb1d
i_s_rkb1f = i_s_rkb1f
i_thx_var = i_thx_var
importing
e_periv = ld_periv
exceptions
no_replacement = 1
unknown_variable = 2
others = 3.
case sy-subrc.
when 0.
when 2.
raise unknown_variable.
when others.
raise no_replacement.
endcase.
if ld_periv is initial.
raise invalid_periv.
endif.
*--- Determine current fiscal year
ld_curdate = sy-datum.
call function 'DATE_TO_PERIOD_CONVERT'
exporting
i_date = ld_curdate
i_periv = ld_periv
importing
e_buper = ld_poper
e_gjahr = ld_fiscyear
exceptions
input_false = 1
t009_notfound = 2
t009b_notfound = 3
others = 4.
if not sy-subrc is initial.
raise invalid_periv.
endif.
*--- Determine the highest fiscal period in the current fiscal year
CALL FUNCTION 'GET_ACCOUNT_OF_PERIODS'
EXPORTING
I_GJAHR = ld_fiscyear
I_PERIV = ld_periv
IMPORTING
E_ANZBUPER = ld_poper
EXCEPTIONS
INPUT_FALSE = 1
T009B_NOTFOUND = 2
T009_NOTFOUND = 3
OTHERS = 4
IF SY-SUBRC <> 0.
raise invalid_periv.
ENDIF.
*--- fill value ranges
l_s_range-low = ld_poper.
append l_s_range to e_t_range.
when others.
raise unexpected_vartype.
endcase.
endfunction.1) Fiscal year variant is determined using Function Module - 'BWCO_FISCVARNT_GET'
2) With Fiscal variant & Current Date as input to Function Module - 'DATE_TO_PERIOD_CONVERT' gets Fiscal Year.
3) With Fiscal year & variant as input to 'GET_ACCOUNT_OF_PERIODS' gets
the highest fiscal period in the current fiscal year -
Anyone know what this code is doing?
Howdy,
Don't suppose ya know what this code could be doing:
TABLES: nast,
*nast.
SELECT * FROM *nast
WHERE kappl = nast-kappl
AND objky = nast-objky
AND kschl = nast-kschl
AND spras = nast-spras
AND parnr = nast-parnr
AND parvw = nast-parvw.
IF *nast-vstat = 1.
processed = 'X'.
ENDIF.
ENDSELECT.
CHECK processed NE 'X'.
Its got me stumped! what on earth is *NAST?
Are we simply looping through all the entries in NAST???
Basically I came across this code because I am trying to write a program that gets triggered when the user saves a Debit note.
My program should then take the billing document number that was saved and use it to create a credit memo request, but finding the billing document number was a pain and someone told me that I had to use NAST or something...
ANyhow, I came a cross the following code but it doesn't make sense...
I think it should be
TABLES: nast.
data: wa_nast type NAST.
SELECT single * FROM nast into wa_nast
WHERE kappl = nast-kappl
AND objky = nast-objky
AND kschl = nast-kschl
AND spras = nast-spras
AND parnr = nast-parnr
AND parvw = nast-parvw.
IF nast-vstat = 1.
processed = 'X'.
ENDIF.
What do you all think?????Thanks Rich,
May be you are right or may be I didn't amke myself clear.
I think my program will be connected to the output type via transaction NACE. Then whenever the user saves a debit memo it will trigger the output type and this should then trigger my program to produce the BDC based on the billing document number in the debit memo.
I thought this would be passed into nast-objkey and I thought I would write an entry routine that could be placed in NACE that access my program.
AM I correct in thinking that this would work???? -
Help Dont know what this code is doing ?????
i dont know what this code is doing from the for part can some one explain it for me
i am confused starting at the for statement thanks for the help
public class LeastToGreatestPlaceHolder {
public static void main(String []args) {
int [] myArray;
myArray = new int[3];
myArray[0] = 6;
myArray[1] = 7;
myArray[2] = 9;
for (int i = 0; i < 2 ; i++){ // confused here
for(int j = 1; j < 3; j++) {
int placeholder = myArray[j];
if (myArray[i] > myArray[j]) {
myArray[j] = myArray;
myArray[i] = placeholder;
System.out.print(myArray[0]);
System.out.print(myArray[1]);
System.out.print(myArray[2]);Have you tried running the program and seeing what it outputs?
Have you considered writing out the state of the array and running through the code by hand?
I'll give you a [head start|http://java.sun.com/docs/books/tutorial/java/nutsandbolts/for.html]. -
How to use "url.openStream()" . What this function does?
how to use "url.openStream()" . What this function does?
Edited by: sahil1287 on Apr 16, 2009 10:02 PMhttp://java.sun.com/javase/6/docs/api/java/net/URL.html#openStream()
http://java.sun.com/docs/books/tutorial/networking/urls/readingWriting.html -
What stub code does APEX uses when making a web service call ?
What stub code does APEX uses when making a web service call (manual web service reference)
I am using APEX (which was part of the 11g installation).Hi Steve,
Some options for the same issue:
web service time out
How to check for Web Srvice Timeout in ABAP Proxy call
Regards
Vijaya -
I tried http://kuba.zilp.pl/?id=1, and don't understand the statement " ADFUtils.executeOperation("downloadingPageDef", "Execute");". What this one does?
Thanks in advance!, I am using jdeveloper 10g.
Rgds!xsyang wrote:
I tried http://kuba.zilp.pl/?id=1, and don't understand the statement " ADFUtils.executeOperation("downloadingPageDef", "Execute");". What this one does?
Thanks in advance!, I am using jdeveloper 10g.
ADFUtils is a utility helper class for usage in the ViewController. I am not familiar with the specific 10g version of executeOperation() method but it seems to be used to execute a method binding. In this case the method binding is called Execute and is bound in the downloadingPageDef page definition file.
Searching the forum will yield these results:
http://forums.oracle.com/forums/search.jspa?objID=f83&q=ADFUtils -
Please explain what does this code does exactly
Can any one explain me what does the below code does.
This is the code written in one of the BADI (ME_PO_PRICING_CUST) .This badi will be triggered when a sales order delivery address is changed and while saving it this will be triggered. Over all what i come to know is they re trigerring a new version in this code. Can anyone explain me what exactly they are doing in this.Thanks...
METHOD IF_EX_ME_PO_PRICING_CUST~PROCESS_KOMK.
FIELD-SYMBOLS: <EKKO> TYPE ANY,
<PROCSTAT> TYPE MEPROCSTATE,
<FRGKE> TYPE FRGKE,
<YNAST> TYPE TABLE,
<WA_YNAST> TYPE NAST.
IM_EKKO-PROCSTAT = 02.
*break-point.
ASSIGN ('(SAPLMEPO)EKKO') TO <EKKO>.
ASSIGN ('(SAPLMEPO)YNAST[]') TO <YNAST>.
IF <EKKO> IS ASSIGNED.
ASSIGN COMPONENT 'PROCSTAT' OF STRUCTURE <EKKO> TO <PROCSTAT>.
ASSIGN COMPONENT 'FRGKE' OF STRUCTURE <EKKO> TO <FRGKE>.
IF <FRGKE> = 'R'.
<PROCSTAT> = '02'.
ENDIF.
ENDIF.
IF <YNAST> IS ASSIGNED.
IF <FRGKE> = 'R'.
LOOP AT <YNAST> ASSIGNING <WA_YNAST>.
<WA_YNAST>-AKTIV = 'X'.
ENDLOOP.
ENDIF.
ENDIF.
ENDMETHOD.r_htkl must be a range table. check the declaration part of it.
p_htkl is a parameter on selection screen i hope.
so, there are four fields on a range table.(range table are similar to your select options)
1. SIGN ( I or E - Inclusive or Exculsive)
2. OPTION(options like EQ = euqal, BT = Between, CP = contains pattern etc)
3. LOW (value)
4. HIGH (value)
so..
IF NOT p_htkl IS INITIAL. " checks if some thing is being passed to the parameter
r_htkl-sign='I'. " give the sign a value I i.e it make inclusive sign
r_htkl-option='EQ'. " EQ to option means you value will be checked for a equal to condition
r_htkl-low=p_htkl. " the low field in now assigned the same value of the parameter p_hktl
APPEND r_htkl. " the range table is appended.
endif.
so this range table can be used in select statements as :
select * from abcd into gt where xyz in r_hktl. ==> this will check for a EQ condition with value in r_hktl-low in database or
in if statements like : if abc in r_hktl. ==> this will check the EQ condition of abc with the r_hktl-low.
Had it been
r_htkl-sign='E'.
then the condition is same but with a NOT.. that means NOT EQ or NOT BT etc.
as exclusive of the option.
etc.
hope this is clear.
AND PLEASE CLOSE THE OTHER THREAD (duplicate) -
Hi all,
Following are few code lines from MAM code :
// this is in common.inc"
<jsp:useBean id="helper"
class="com.sap.mbs.core.web.ViewHelper" scope="request"/>
String allOrderURL = helper.eventURL("onOrderList", "orderListType", "ALL_ORDERS");
helper.getApplicationURL()
Could anyone please tell what this eventURL ,getApplicationURL methods are for ?
I couldnt find any documentation that explains it.
Regards,
VipinHello Vipin.
Jo is rite.
The class is abstract but the class which is used to create the bean is the implementation class:
<b>DefaultViewHelper</b>
This is the implementation of the abstract class ViewHelper.
The ViewHelper is used to create URLs which are used to load a new page with our without submitting a form.
You can use eventURL to build an URL for a link you want to create (JO's example).
You can use submitEventURL in order to submit your form.
This method builds a call to a JavaScript method.
You can find this method in the file:
app-root/include/common.inc
function submitURL(url).
This function uses url as action for the submit.
So if you use something like this:
onClick="<%=helper.submitEventURL("onOK")%>"
all the form content is written to the context and the onOK method of the corresponding controller class is called. You can get the form content using the context in this controller method then.
When I started working with MAM I was also confused about the mbs.core Framework.
Read this maybe it helps:
SAP MAU MVC
Best regards,
Sascha
Message was edited by: Sascha Dingeldey -
Can anyone pls explain what this procedure does?
i could only figure out that it will be performing a transpose.
create or replace
PROCEDURE TEST_TRANSPOSE(o_test OUT SYS_REFCURSOR) AS
report_exists number(3);
report_name varchar(30) := 'REPORT_TBL' ;
query_main varchar(16000) := 'create table ' || report_name || ' as select MAGAZINE ' ;
query_part varchar(1024) ;
my_var varchar2(5);
cursor cur_region is select distinct REGION from MAIN_TBL order by region;
begin
select count(*) into report_exists
from tab
where tname = report_name;
if ( report_exists = 1 ) then
execute immediate 'drop table ' || report_name ;
end if;
open cur_region ;
loop
fetch cur_region into my_var ;
exit when cur_region%NOTFOUND;
query_part := 'select nvl(sum(quantity),0) from MAIN_TBL x where x.magazine = main.magazine and x.region='''||my_var||'''' ;
query_main := query_main || chr(10) || ',(' || query_part || ')"' || my_var || '"';
end loop;
close cur_region ;
query_main := query_main || ' from (select distinct MAGAZINE from MAIN_TBL ) main' ;
DBMS_OUTPUT.PUT_LINE(query_main);
--execute immediate query_main ;
open o_test for query_main;
end;
{code}
i need to transpose a table which has dynamic number of rows.This was what i tried.Could you pls bhelp me out to correct this i get "P_TRAN_YEAR" invalid identifier
[code]
create or replace
PROCEDURE PRM_R_MAT_RPT (p_EmpID IN Integer,
P_TRAN_YEAR IN NUMBER,
P_TRAN_MONTH IN NUMBER,O_rc OUT sys_refcursor) IS
v_cnt NUMBER;
v_sql VARCHAR2(32767);
v_basic Number(16, 4);
BEGIN
select PPH_ORG_AMOUNT into v_basic from prm_p_hop
where pph_emp_id=p_empid
and pph_tran_year=p_tran_year
and pph_tran_month=P_TRAN_MONTH
and pph_hop_code=5
and PPH_SALARY_THRU='R';
-- SELECT distinct count(*)
-- INTO v_cnt
-- FROM PRM_T_VAR_HOP
-- where PTVH_EMP_ID=p_EMPID
-- and PTVH_TRAN_YEAR=p_TRAN_YEAR
-- and PTVH_TRAN_MONTH=P_TRAN_MONTH;
v_sql := 'select distinct PCH_SHORT_DESCRIPTION,v_basic,PTVH_AMOUNT Amount ';
-- FOR i IN 1..v_cnt
-- LOOP
v_sql := v_sql || ',max(decode(rn, PCH_SHORT_DESCRIPTION)) as description ';
--v_sql := v_sql || ',max(decode(rn, '||to_char(i)||', PDSL_INTEREST)) as interest'||to_char(i);
-- v_sql := v_sql || ',max(decode(rn, '||to_char(i)||', PDSL_PRINCIPAL_SALARY)) as principle'||to_char(i);
-- v_sql := v_sql || ',max(decode(rn, '||to_char(i)||', PDSL_SOCIETY_CODE)) as SOC_CODE'||to_char(i);
-- END LOOP;
v_sql := v_sql || ' from (select PRM_T_VAR_HOP.*, PRM_C_HOP.*, row_number() over (partition by PTVH_EMP_ID order by PTVH_EMP_ID) as rn
from
PRM_T_VAR_HOP,
PRM_C_HOP
WHERE PTVH_EMP_ID =P_empid
And PTVH_TRAN_YEAR =P_TRAN_YEAR
And PTVH_TRAN_MONTH =P_TRAN_MONTH
And PTVH_HOP_CODE =PCH_HOP_CODE
AND PCH_CALCULATION_BASIS=''V''
AND PCH_TAG =''C''
AND PTVH_SALARY_THRU =''R'')';
OPEN O_rc FOR v_sql;
END;
[/code]Your first piece of code does not work, because a create table statement cannot be issued using a ref cursor like that. When executed with the "execute immediate" command, it works. Then, the refcursor is only a "select * from report_tbl".
What it does, is dynamically dropping and creating a table report_tbl and filling it with the results of a horribly inefficient pivot query. If the report_tbl has no other purpose after running this procedure, then I'd suggest to not drop and create tables dynamically like that. In the second variant of test_transpose, you can see how you can do that.
SQL> create table main_tbl (magazine,region,quantity)
2 as
3 select 'MAGAZINE1','REGION1',1 from dual union all
4 select 'MAGAZINE1','REGION2',2 from dual union all
5 select 'MAGAZINE1','REGION3',3 from dual union all
6 select 'MAGAZINE2','REGION1',4 from dual union all
7 select 'MAGAZINE2','REGION2',5 from dual union all
8 select 'MAGAZINE2','REGION3',6 from dual
9 /
Tabel is aangemaakt.
SQL> create or replace PROCEDURE TEST_TRANSPOSE(o_test OUT SYS_REFCURSOR)
2 AS
3 report_exists number(3);
4 report_name varchar(30) := 'REPORT_TBL' ;
5 query_main varchar(16000) := 'create table ' || report_name || ' as select MAGAZINE ' ;
6 query_part varchar(1024) ;
7 my_var varchar2(7);
8
9 cursor cur_region is select distinct REGION from MAIN_TBL order by region;
10 begin
11 select count(*) into report_exists
12 from tab
13 where tname = report_name;
14 if ( report_exists = 1 ) then
15 execute immediate 'drop table ' || report_name ;
16 end if;
17
18 open cur_region ;
19 loop
20 fetch cur_region into my_var ;
21 exit when cur_region%NOTFOUND;
22 query_part := 'select nvl(sum(quantity),0) from MAIN_TBL x where x.magazine = main.magazine and x.region='''||my_var||'''' ;
23 query_main := query_main || chr(10) || ',(' || query_part || ')"' || my_var || '"';
24 end loop;
25 close cur_region ;
26
27 query_main := query_main || ' from (select distinct MAGAZINE from MAIN_TBL ) main' ;
28 execute immediate query_main;
29 open o_test for 'select * from ' || report_name;
30 end;
31 /
Procedure is aangemaakt.
SQL> var rc refcursor
SQL> exec test_transpose(:rc)
PL/SQL-procedure is geslaagd.
SQL> print rc
MAGAZINE REGION1 REGION2 REGION3
MAGAZINE1 1 2 3
MAGAZINE2 4 5 6
2 rijen zijn geselecteerd.
SQL> create or replace procedure test_transpose (o_test out sys_refcursor)
2 as
3 l_query varchar2(1000) := 'select magazine';
4 begin
5 for r in (select distinct region from main_tbl)
6 loop
7 l_query := l_query || ', sum(decode(region,''' || r.region || ''',quantity)) ' || r.region;
8 end loop;
9 l_query := l_query || ' from main_tbl group by magazine';
10 open o_test for l_query;
11 end;
12 /
Procedure is aangemaakt.
SQL> exec test_transpose(:rc)
PL/SQL-procedure is geslaagd.
SQL> print rc
MAGAZINE REGION1 REGION2 REGION3
MAGAZINE1 1 2 3
MAGAZINE2 4 5 6
2 rijen zijn geselecteerd.Regards,
Rob. -
Where/how can i find out what this is doing
I know this old but not concerned with that, just what is it doing, this is java script in an .asp that loads
a flash application, I'm most concerned/interested
why it references a clsid?
what is the code base all about? (is this embedding code in the browser? it does the embed everytime the app is loaded?)
what is the PLUGINSPAGE?
how does all this affect the opertion of the flash apps that run after this initializtion?
this is kinda/somewhat/ normal for anytime /anyone running a flash app?
It seems there's a lot going here, if too much to answer please just point me somewhere where i can RTFM, but
please make it a good RTFM not a FWOT!!!
flName = "default-app.swf"
document.write('<OBJECT'
+ ' CLASSID=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
+ ' CODEBASE=":http//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0 ,79,0"'
+ ' ID="flash"'
+ ' WIDTH=' + flWidth
+ ' HEIGHT=' + flHeight + '>'
+ '<PARAM NAME=movie VALUE="' + flName + cookString + '">'
+ '<PARAM NAME=menu VALUE="false">'
+ '<PARAM NAME=quality VALUE=high>'
etc more params
finally
+ ' TYPE="application/x-shockwave-flash"'
+ ' PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">'
+ '</EMBED></OBJECT>'that's standard flash embedding code with variable swf name, width and height.
-
Can anyone tell me what this is doing
hey this is part of some parser code from an earlier java forum post
http://forum.java.sun.com/thread.jspa?threadID=506162&messageID=2399163#239 9163
i modified the code slightly to work with my program which involves its use in an applet and to solve logical equations. However i'm still uncertain as to what certain sections of the code are doing
i know that this code evaluates the variables within the given equation, begins a for loop that does not exit until i = codeSize which is the length of the given String. However i'm not so certain as to how it achieves this. I'd like to know
private int eval(int variableX, int variableY, int variableZ)
try {
int top = 0;
for (int i = 0; i < codeSize; i++)
if (code[i] >= 0)
stack[top++] = constants[code];
else if (code[i] >= POWER)
int y = stack[--top];
int x = stack[--top];
int ans = (int)Double.NaN;
switch (code[i])
case PLUS: ans = x | y; break;
case MINUS: ans = x & y; break;
case TIMES: ans = x & y; break;
case DIVIDE: ans = x / y; break;
// case POWER: ans = Math.pow(x,y); break;
if (Double.isNaN(ans))
return ans;
stack[top++] = ans;
else if (code[i] == VARIABLEX)
stack[top++] = variableX;
else if (code[i] == VARIABLEY)
stack[top++] = variableY;
else if(code[i] == VARIABLEZ)
stack[top++] = variableZ;
/* else {
double x = stack[--top];
double ans = Double.NaN;
int d;
d = (int) ans;
switch (code[i])
case SIN: ans = Math.sin(x); break;
case COS: ans = Math.cos(x); break;
case TAN: ans = Math.tan(x); break;
case COT: ans = Math.cos(x)/Math.sin(x); break;
case SEC: ans = 1.0/Math.cos(x); break;
case CSC: ans = 1.0/Math.sin(x); break;
case ARCSIN: if (Math.abs(x) <= 1.0) ans = Math.asin(x); break;
case ARCCOS: if (Math.abs(x) <= 1.0) ans = Math.acos(x); break;
case ARCTAN: ans = Math.atan(x); break;
case EXP: ans = Math.exp(x); break;
case LN: if (x > 0.0) ans = Math.log(x); break;
case LOG2: if (x > 0.0) ans = Math.log(x)/Math.log(2); break;
case LOG10: if (x > 0.0) ans = Math.log(x)/Math.log(10); break;
case ABS: ans = Math.abs(x); break;
case SQRT: if (x >= 0.0) ans = Math.sqrt(x); break;
case UNARYMINUS: ans = -x; break;
if (Double.isNaN(ans))
return d;
stack[top++] = d;
catch (Exception e)
double b = Double.NaN;
int i = (int)b;
return i;
} double d2;
if (Double.isInfinite(stack[0]))
d2 = Double.NaN;
int i2 = (int) d2;
return i2;
}else
return stack[0];
any help much appreciated
cheers
podgerWell this is a very basic interpreter. What this piece of code does is:
1) take an opcode from the code array, and retrieves the description for it from the constants array. This description is stored in the stack array.
stack[top++] = constants[code];
2) check what opcode it is
switch (code)
3) "execute" the opcode with simple java math operators.
case PLUS: ans = x | y; break;
case MINUS: ans = x & y; break;
case TIMES: ans = x & y; break;
case DIVIDE: ans = x / y; break;4) store the result of the opcode in the stack array, after the description of the opcode retrieved in step 1)
stack[top++] = ans;There is also some sort of error check in there: initially the result of the opcode is "NaN", (not a number). If the opcode passed to this code is not known, the result is not added to the stack according to this piece of code:
if (Double.isNaN(ans))
return ans; -
Q1.
boolean isInterface()
Determines if the specified Class object represents an interface type. what this method means ?
Look it is saying "....object represents an interface type.. But an interface can not refer objects unless it is implemented by some concrete class.
is there any polymorphism involved(i guess) ?
i mean like this ......
interface ABC
// blah
class CDE implements ABC
// defined everything here
ABC s = new CDE(); // it is legal
does this method relates to this ?
Am i right ? However code below is not comfortable.........
Q2:
Here is the code i stumbled................ It usues that method.
Description: Determining If a Class Object Represents a Class or Interface
Code:
Class cls = java.lang.String.class; // Line-1.....is it valid !!!!
boolean isClass = !cls.isInterface(); // true
cls = java.lang.Cloneable.class;
isClass = !cls.isInterface(); // falseLook at Line-1.................i dont see any heirchy down the String class in the API.....( java.lang.String.class .....is it valid ? yes that bold .class !! ) its a peculiar use of String class !!.
can anybody explain what is happening here. what reference who calls ?
Thank yougood explanation indeed.
Look ur comment
// By way of a string........why String ? why
do i hardcode
Class.forName("java.lang.String");......there
are lots of Classes in the API who extends Object
class.
Look
cls = java.lang.String.class // again u have
hardcoded String class !!!
It seems to me i need to hardcode always with
String class( right ? no other class can be
usued !!) to get the Class or Inteface type out of
object.No, you can do it for any class: Class c1 = List.class;
Class c2 = new List().getClass();
Class c3 = Class.forName("java.util.List"); All are legal, and you can do that with any class or interface, not just String.
So if you do something that gets a Class object--say the user enters a class name or interface name, and you pass that to Class.forName()--you can then call isInterface() to see if it's an interface.
String classname = getStringFromUser(); // assume user enters "java.util.Comparator"
Class klass = Class.forName(classname);
boolean isIxfc = klass.isInterface(); // true for java.util.Comparator -
Used createinstallmedis to make a copy of the Mavericks app for use in a new hard drive install.. Copied find but gave error code 110 and failed to make the flash drive bootable.. Any help in what errror code means?
Did you partition and format the flash drive first? See the following:
Make Your Own Mavericks, Mountain/Lion Installer
After downloading the installer you must first save the Install Mac OS X application. After the installer downloads DO NOT click on the Install button. Go to your Applications folder and make a copy of the installer. Move the copy into your Downloads folder. Now you can click on the Install button. You must do this because the installer deletes itself automatically when it finishes installing.
2. Get a USB flash drive that is at least 8 GBs. Prep this flash drive as follows:
Open Disk Utility in your Utilities folder.
After DU loads select your flash drive (this is the entry with the mfgr.'s ID and size) from the leftside list. Under the Volume Scheme heading set the number of partitions from the drop down menu to one. Set the format type to Mac OS Extended (Journaled.) Click on the Options button, set the partition scheme to GUID then click on the OK button. Click on the Partition button and wait until the process has completed.
Select the volume you just created (this is the sub-entry under the drive entry) from the left side list.
Click on the Erase tab in the DU main window.
Set the format type to Mac OS Extended (Journaled.) Click on the Options button, check the button for Zero Data and click on OK to return to the Erase window.
Click on the Erase button. The format process can take up to an hour depending upon the flash drive size.
Make your own Mavericks flash drive installer using the Mavericks tool:
Mavericks has its own built-in installer maker you use via the Terminal:
You will need a freshly partitioned and formatted USB flash drive with at least 8GBs. Leave the name of the flash drive at the system default, "Untitled." Do not change this name. Open the Terminal in the Utilities folder. Copy this command line after the prompt in the Terminal's window:
sudo /Applications/Install\ OS\ X\ Mavericks.app/Contents/Resources/createinstallmedia --volume /Volumes/Untitled --applicationpath /Applications/Install\ OS\ X\ Mavericks.app --nointeraction
Press RETURN. Enter your admin password when prompted. It will not be echoed to the screen so be careful to enter it correctly. Press RETURN, again.
Wait for the process to complete which will take quite some time.
Maybe you are looking for
-
I have a 3rd gen 8gb ipod touch when I try to sync it it goes through phase one of the sync and then says sync complete, changing nothing on the ipod if I reset my Ipod and it wipes everything off and then it still wont sync I will have a worthlerss
-
Web Start Security and the Cache
Hi, If the jars are signed and download occurs then webstart will verify the signature and tell the user that jars signed by user xxxxx are about to be run. Then the jars are cached by web start. My question is, what is to stop an attacker from repla
-
Mail will not display mail content from aol.
Message has no content. All other mail received is ok. Any ideas? The aol message sows no content on iPad but when viewed by iPad mail or Safari login to Gmail. When login to my Gail mail account using win xp &Tbird there is content in the messages.
-
Approval notification emails missing link to login to SRM
Environment: Standalone I have created the one shopping cart. Then the approver received the Email notification for approving the shopping cart. Link login to the SRM missed in that approver's mail. Thanks, Ravi V.
-
Changing timing on a group of stills
HD 6.03 is not updating the length of my stills in groups... I have to do them one by one. Occasionally using the "Show Photo Settings" slider works, but usually not. What's going on? 2.33 ghz dual core Intel Imac Mac OS X (10.4.9)