Build string.Format parameters with a loop
I need to dynamically build the parameters for the string.Format function dynamically in a loop.
So rather than coding it like this:
string result = string.Format(formatString, crits[0], crits[1], crits[2], crits[3], crits[4]);
I need to add the parameters dynamically in a loop like this:
StringBuilder sb = new StringBuilder();
formatString = "T{0}{1}-R{2}{3}-{4}";
sb.Append(formatString);
foreach (var item in crits)
// some logic here to determine if this param should be passed in
sb.Append(", " + item);
string result = string.Format(formatString);
Any idea how to do this?
Thanks.
No, what you said the other day was to add a column to the table, but the parameters must come from one source and the where clause must come from another source and I have to dynamically mash them together. the same set of parameters might be used
with many different syntax in the where clause.
The output for a where clause might look like this:
(LINE_NO = 'TG-P1269') AND (GEO_LOCATION = 'T155N R96W, Sec. 10')
OR
(LINE_NO = 'TG-G1183') AND (GEO_LOCATION = 'T157N R94W, Sec. 20')
OR
(LINE_NO = 'TG-G1182') AND (GEO_LOCATION = 'T157N R94W, Sec. 20')
OR... etc x 1000
but to simplify it lets just work with:
(GEO_LOCATION = 'T157N R94W, Sec. 20')
which I achieved like this:
string formatString = "T{0}{1} R{2}{3}, Sec. {4}";
string result = string.Format(formatString, crits[0], crits[1], crits[2], crits[3], crits[4]);
However, at run time I don't know how many params to pass in or which ones. I might have to do this:
string result = string.Format(formatString, crits[2], crits[3], crits[4]);
or this:
string result = string.Format(formatString, crits[3]);
or something else.
I would be able to determin which params to pass in in the loop, but of course, that's not how the string function works.
Similar Messages
-
How to process Customer format parameters with Payment Medium Workbench
Hi
I have one bank transfer scenario PC00_M99_FPAYM requiring supplying a payment using the French format FR_ETEBAC_CRT_DOM but the execution date of the bank transfer should be replaced by the banku2019s value date. I planned to enter this required date using the Customer format parameters when running PMW.
The issue I tried to solve is described here below.
How to extract the Customer format parameters assigned to the payment medium format FR_ETEBAC_VRT_DOM when processed by the Payment medium Workbench in order to fill the Customer specific user-defined fields (ZREF01 to ZREF10 in structure FPAYHX)?
I noticed the event type 06 authorizes function modules similar like FI_PAYMEDIUM_SAMPLE_06 but the customer format parameters are only available at low level in function module FI_PAYM_MEDIUM_OPEN (example gc_format_params_c)
Can someone help on this matter? That would be great.
Thanks in advance,
Henri.Just sharing my findings and proposed solution.
This worked
The expected date is the value date/payee's bank.
This date is created by the bank transfer program prior to be processed by Payment Medium Creation Tool (SAPFPAYM)
According to functional investigation it sounds like the bank transfer program does not allow working with the value date/payee's bank.
The investigation has been done in the Payment Medium Creation Tool. It allows adding the required value date/payee's bank into a customer format parameter.
Required configuration and development:
- Clone the current sap format FR_ETEBAC_VRT-DOM into a new Customized format ZFR_ETEBAC_VRT-DOM
- Clone the corresponding DMEE object FR_ETEBAC_VRT-DOM into a new DMEE object tree type PAYM ZFR_ETEBAC_VRT-DOM
- Create a new data structure: ZFR_Bank_Transfer with field CRVAL Value Date at Payee's Bank (comp type PRQ_CRVAL)
- Assign customer structure ZFR_Bank_Transfer to payment format ZFR_ETEBAC_VRT-DOM and declare field CRVAL as required field
- Build function module ZFI_PAYMEDIUM_06_FR in charge to extract value date/payee's bank from the customer structure and move it to the customer specific user-defined field ES_FPAYHX_CREF-ZREF01
- in new DMEE object tree type PAYM ZFR_ETEBAC_VRT-DOM Replace Source field FPAYH-ZALDT by FPAYHX-ZREF01 in the header record -
Need help with while loop format
I'm building a form - everything works but I would like to change the way the data is output into the table.
In other scripting languages, like PHP, you had 2 different ways of dealing with a loop:
<?
do while xyz
do something here
?>
- OR -
<? do while xyz:?>
do something here
<?end while ?>
I would like to do something similar to the 2nd example in .jsp but I'm not sure of the format or how to stop the loop. From the tutorial, I'm using
<%
while(SQLResult.next())
UId = SQLResult.getString("uid");
FName = SQLResult.getString("fname");
LName = SQLResult.getString("lname");
out.println("<tr><td>" + UId + "</td><td>" + FName + "</td><td>" + LName
+ "</td></tr>");
%>
Could anyone point me in the right direction? I'd prefer it if I didn't have to build the table like this if I don't have to but haven't found anything anywhere telling me otherwise.
Thanks so much.
BobSorry - the answer was in JSP:Java Server Pages by Barry Burd. I had just gotten the output format wrong.
-
How to check the current time with a Stored time in string format
Hi All
I would like to compare the system time with an existing time values which is allready there in String format..
i mean i would like to check if the SysTime is inbetween 6:30 and 14:00
I accomplished this in Oracle ..
Select 'Y' from dual where to_date(to_char(sysdate,'HH24:MI '),'HH24:MI') between to_date('06:30','HH24:MI') and to_date('14:00','HH24:MI')
But instead of checking the DB each and every time , the perfomance would be better if we can do this in our java code..
Could some one provide me with a code to accomplish the above scenario..
Thanks in advance..,.,import java.util.Calendar;
Calendar rightNow = Calendar.getInstance(); // gets the current date and time to millisec
Calendar earlyTime = Calendar.getInstance().set(Calendar.HOUR_OF_DAY, 6).set(Calendar.MINUTE, 30);
Calendar lateTime = Calendar.getInstance().set(Calendar.HOUR_OF_DAY, 8).set(Calendar.MINUTE, 0);
if (rightNow.compareTo(earlyTime)> 0 && rightNow.compareTo(lateTime) < 0){
// do something
}Try this. -
String formatting with Write-Output
I have a FileInfo object that I want to print the full file name member value.
I tried this:
Write-Output "Scanning $file.FullName..."
However that just prints out:
"Scanning c:\foo.txt.FullName..."
What is the proper way to format the FileInfo.FullName using Write-Output (In C#, I would use String.Format)?
thanksWrap $file.FullName in $(), such as $($file.FullName). Read more by searching for the subexpression operator.
-
Problem in java.lang.String.format()
Dear Experts,
I tried to display a double value with leading spaces with the following statements:
double val = 123456789.987654321;
System.out.println( String.format("%17.2f", val));They worked in void main(), but didn't in a method of a class. The following error message was found while compiling:
init:
deps-jar:
Compiling 1 source file to C:\JavaProject\ALC-EJB\build\jar
C:\JavaProject\ALC-EJB\src\java\escis\creditControl\BalanceRecord.java:61: cannot find symbol
symbol : method format(java.lang.String,double)
location: class java.lang.String
System.out.println( String.format("%17.2f", val));
1 error
C:\JavaProject\ALC-EJB\nbproject\build-impl.xml:223: The following error occurred while executing this line:
C:\JavaProject\ALC-EJB\nbproject\build-impl.xml:109: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 2 seconds)I've read the mentioned file (build-impl.xml) but still got no idea what happened.
Line 109:
<javac srcdir="@{srcdir}" destdir="@{destdir}" debug="@{debug}" deprecation="${javac.deprecation}" source="${javac.source}" target="${javac.target}" includeantruntime="false">Line 223:
<ejbjarproject2:javac>I'm using NetBeans IDE 4.1. Could you please give me a hand? Thank you very muchNot sure if this has got anything to do with it, but
the format() method was added to String in Java 5.0.
Maybe you are using an older version in that second
case?You're right. It works when I've changed it from 1.4 (default) to 1.5. Thank you very much. -
String.format() error (works in a class file , not in jsp)
Hello all,
I am using Java 5 and am trying to use the String.format() method in a jsp but am getting the following error:
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 5 in the jsp file: /ajax.jsp
Generated servlet error:
C:\Documents and Settings\gforte\.netbeans\5.0beta2\jakarta-tomcat-5.5.9_base\work\Catalina\localhost\agi\org\apache\jsp\ajax_jsp.java:50: cannot find symbol
symbol : method format(java.lang.String,java.util.Date,java.util.Date)
location: class java.lang.String
String dateString = String.format("%tb%td",date,date);
^
1 error
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
org.apache.jasper.compiler.AntCompiler.generateClass(AntCompiler.java:246)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:288)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:293)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.9 logs.
Apache Tomcat/5.5.9
The code I am using is working fine in a class file but wont work in my jsp.
<%@page import="java.util.*,java.lang.String"%>
Date date = new Date();
String dateString = String.format("%tb%td",date,date);
System.out.println(dateString);Any ideas?I get excactly the same problem.
If compile the the JSP in Netbeans it works fine, however when Tomcat attempts to compile it into a servlet at runtime, I get the same error as described.
This is the line in JSP that fails:
<code>Some more text <%= String.format("%s","Bizarre") %> </code>However this one works OK:
<code>Some more text <%= "Bizarre".substring(3) %> </code>Its almost as if Tomcat is compiling under JDK 1.4.2 or something but I don't have any other JDK or JRE installed; only 1.5.
I suspect it may be a Tomcat setting that's causing a 1.4 code compliance.
In Netbeans, if I go to the project properties -> Sources, at the bottom is the "Source Level" drop down list. If I change this to 1.4 and clean and build the whole project I get the same error when the jsp (or any class with this construct) is compiled by NetBeans.
Note: I am using the Netbeans 5.0 and Tomcat and 5.5.9 co-bundle which I downloded from the Sun website.
Can anyone help?
Heres the splurge from the browser output:
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 55 in the jsp file: /login.jsp
Generated servlet error:
C:\Documents and Settings\Peter\.netbeans\5.0\jakarta-tomcat-5.5.9_base\work\Catalina\localhost\SuperStruts\org\apache\jsp\login_jsp.java:105: cannot find symbol
symbol : method format(java.lang.String,java.lang.String)
location: class java.lang.String
out.print( String.format("%s","Bizarre") );
^
1 error
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
org.apache.jasper.compiler.AntCompiler.generateClass(AntCompiler.java:246)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:288)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:293)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)
Note also that when I run this JSP page:
<%@page import="java.util.*"%>
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%
Properties p = System.getProperties();
Enumeration keys = p.keys();
Object key;
while (keys.hasMoreElements()) {
key = keys.nextElement();
out.println("key: " + key + " - " + p.getProperty((String)key) + "<br/>");
%> ... I get this browser output:
key: java.runtime.name - Java(TM) 2 Runtime Environment, Standard Edition
key: sun.boot.library.path - C:\Program Files\Java\jdk1.5.0_06\jre\bin
key: java.vm.version - 1.5.0_06-b05
key: shared.loader - ${catalina.base}/shared/classes,${catalina.base}/shared/lib/*.jar
key: java.vm.vendor - Sun Microsystems Inc.
key: java.vendor.url - http://java.sun.com/
key: path.separator - ;
key: tomcat.util.buf.StringCache.byte.enabled - true
key: java.vm.name - Java HotSpot(TM) Client VM
key: file.encoding.pkg - sun.io
key: user.country - GB
key: sun.os.patch.level - Service Pack 2
key: java.vm.specification.name - Java Virtual Machine Specification
key: user.dir - C:\Program Files\netbeans-5.0\enterprise2\jakarta-tomcat-5.5.9\bin
key: java.runtime.version - 1.5.0_06-b05
key: java.awt.graphicsenv - sun.awt.Win32GraphicsEnvironment
key: java.endorsed.dirs -
key: os.arch - x86
key: java.io.tmpdir - C:\Documents and Settings\Peter\.netbeans\5.0\jakarta-tomcat-5.5.9_base\temp
key: line.separator -
key: java.vm.specification.vendor - Sun Microsystems Inc.
key: java.naming.factory.url.pkgs - org.apache.naming
key: java.util.logging.manager - org.apache.juli.ClassLoaderLogManager
key: user.variant -
key: os.name - Windows XP
key: sun.jnu.encoding - Cp1252
key: java.library.path - C:\Program Files\Java\jdk1.5.0_06\bin;.;C:\WINDOWS\system32;C:\WINDOWS;C:\oracle\product\10.2.0\db_2\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\ATI Technologies\ATI.ACE\;C:\Program Files\MySQL\MySQL Server 5.0\bin;C:\Program Files\Common Files\GTK\2.0\bin;C:\Program Files\CVSNT\
key: java.specification.name - Java Platform API Specification
key: java.class.version - 49.0
key: sun.management.compiler - HotSpot Client Compiler
key: os.version - 5.1
key: user.home - C:\Documents and Settings\Peter
key: catalina.useNaming - true
key: user.timezone - Europe/London
key: java.awt.printerjob - sun.awt.windows.WPrinterJob
key: file.encoding - Cp1252
key: java.specification.version - 1.5
key: catalina.home - C:\Program Files\netbeans-5.0\enterprise2\jakarta-tomcat-5.5.9
key: java.class.path - C:\Program Files\Java\jdk1.5.0_06\lib\tools.jar;C:\Program Files\netbeans-5.0\enterprise2\jakarta-tomcat-5.5.9\bin\bootstrap.jar
key: user.name - Peter
key: java.naming.factory.initial - org.apache.naming.java.javaURLContextFactory
key: package.definition - sun.,java.,org.apache.catalina.,org.apache.coyote.,org.apache.tomcat.,org.apache.jasper.
key: java.vm.specification.version - 1.0
key: java.home - C:\Program Files\Java\jdk1.5.0_06\jre
key: sun.arch.data.model - 32
key: user.language - en
key: java.specification.vendor - Sun Microsystems Inc.
key: awt.toolkit - sun.awt.windows.WToolkit
key: java.vm.info - mixed mode
key: java.version - 1.5.0_06
key: java.ext.dirs - C:\Program Files\Java\jdk1.5.0_06\jre\lib\ext
key: sun.boot.class.path - C:\Program Files\Java\jdk1.5.0_06\jre\lib\rt.jar;C:\Program Files\Java\jdk1.5.0_06\jre\lib\i18n.jar;C:\Program Files\Java\jdk1.5.0_06\jre\lib\sunrsasign.jar;C:\Program Files\Java\jdk1.5.0_06\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.5.0_06\jre\lib\jce.jar;C:\Program Files\Java\jdk1.5.0_06\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.5.0_06\jre\classes
key: server.loader - ${catalina.home}/server/classes,${catalina.home}/server/lib/*.jar
key: java.vendor - Sun Microsystems Inc.
key: catalina.base - C:\Documents and Settings\Peter\.netbeans\5.0\jakarta-tomcat-5.5.9_base
key: file.separator - \
key: java.vendor.url.bug - http://java.sun.com/cgi-bin/bugreport.cgi
key: common.loader - ${catalina.home}/common/classes,${catalina.home}/common/i18n/*.jar,${catalina.home}/common/lib/*.jar
key: sun.io.unicode.encoding - UnicodeLittle
key: sun.cpu.endian - little
key: package.access - sun.,org.apache.catalina.,org.apache.coyote.,org.apache.tomcat.,org.apache.jasper.,sun.beans.
key: sun.desktop - windows
key: sun.cpu.isalist - demonstrating (I think) that the correct JDK and JDK are in use by Tomcat. -
Pad leading zeros in a string.Format function
How could use the string.Format function and in the format text pad a leading zero?
Pseudo code is:
string parm = “5”;
string format = “Some number formatted as 3 dig: Format({0}, 000)”;
string output = string.Format(format, parm);
Where the output would look like this:
“Some number formatted as 3 dig: 005”
Thanks.Thanks everyone. Unfortuantly there's a constraint where the padding operation needs to be embedded in the format string. This entire operatin is being put together dynamically where the format strings are being pulled from a library of format strings stored
in a database. at runtime we don't know how which format will be used and how many parameters will be passed in. we have logic to handle the unknown number of paramters as there is metadata which helps us with that.
the need for leading zeros needs to be part of the overall format defined in the format string. for example, a real format string stored in the database looks like this:
"LINE_NO = '{0}', AND GEO_LOCATION = 'T{1}, {2}, R{3}, {4}, , Sec. {5}'"
and its output from the string.Function is:
"LINE_NO = 'TG-G2469', AND GEO_LOCATION = 'T155, N, R93, W, , Sec. 5'"
the last parameter (param 5) had a value of 5. In another case the output requirement might need to look like this:
"LINE_NO = 'TG-G2469', AND GEO_LOCATION = 'T155, N, R93, W, , Sec. 05'"
note the "05" at the end...
the logic of using the leading zero needs to be embedded in the overall format string text.
Thank you. -
Bulk collect with Nested loops
Hi I've a requirement like this
I need to pull request nos from table a(Master table)
For every request no I need to pull request details from table b(Detail Table)
For every request no I need to pull contact details from table c
For every request no I need to pull customer data table d and I need to create a flat file with that data so I'm using utl_file in normal query criterion because of nested loops it's taking lot of time so I want to use bulk collect with dynamic query option:
Sample code
=======
create or replace procedure test(region varchar2) as
type tablea_request_typ is table of varchar2(10);
tablea_data tablea_request_typ;
type tableb_request_typ is table of varchar2(1000);
tableb_data tableb_request_typ;
type tablec_request_typ is table of varchar2(1000);
tablec_data tablec_request_typ;
type tabled_request_typ is table of varchar2(1000);
tabled_data tabled_request_typ;
stmta varchar2(32000);
stmtb varchar2(32000);
stmtc varchar2(32000);
stmtd varchar2(32000);
rcura SYS_REFCURSOR;
rcurb SYS_REFCURSOR;
rcurc SYS_REFCURSOR;
rcurd SYS_REFCURSOR;
begin
stmta:='select request_no from tablea where :region'||'='NE';
stmtb:='select request_no||request_detail1||request_detail2 stringb from table b where :region'||'='NE';
stmtc:='select contact1||contact2||contact3||contact4 stringc from table c where :region'||'='NE';
stmtd:='select customer1||customer2||customer3||customer4 stringd from table c where :region'||'='NE';
OPEN rcura for stmta;
LOOP
FETCH rcura BULK COLLECT INTO request_no
LIMIT 1000;
FOR f in 1..request_no.count
LOOP
--Tableb
OPEN rcurb for stmtb USING substr(request_no(f),1,14);
LOOP
FETCH rcurb BULK COLLECT INTO tableb_data
for i in 1..tableb_data.count
LOOP
utl_file(...,tableb_data(i));
END LOOP;
EXIT WHEN rcurb%NOTFOUND;
END LOOP;
-- Tablec
OPEN rcurc for stmtc USING substr(request_no(f),1,14);
LOOP
FETCH rcurb BULK COLLECT INTO tablec_data
for i in 1..tablec_data.count
LOOP
utl_file(...,tablec_data(i));
END LOOP;
EXIT WHEN rcurc%NOTFOUND;
END LOOP;
-- Tabled
OPEN rcurd for stmtd USING substr(request_no(f),1,14);
LOOP
FETCH rcurd BULK COLLECT INTO tabled_data
for i in 1..tabled_data.count
LOOP
utl_file(...,tabled_data(i));
END LOOP;
EXIT WHEN rcurd%NOTFOUND;
END LOOP;
END LOOP;
EXIT WHEN rcura%NOTFOUND;
END LOOP;
exception
when other then
dbms_output.put_line(sqlerrm);
end;I 'm using code mentioned above but request nos are repeating as if it's an infinete loop ?for ex if request no is 222 It should run once but here it's running more than once?
How to pass bind parameters say in my case region?
Are there any alternate solutions to run it faster apart from using bulk collect?
Right now I'm using explicit cursor with for loop which is taking lot of time ?so is this better sol?
Thanks,
Mahender
Edited by: BluShadow on 24-Aug-2011 08:52
added {noformat}{noformat} tags. Please read {message:id=9360002} to learn to format your code/data yourself.Use Parameterized cursor :
CREATE OR REPLACE PROCEDURE test(region varchar2)
AS
type tablea_request_typ is table of varchar2(10);
type tableb_request_typ is table of varchar2(1000);
type tablec_request_typ is table of varchar2(1000);
type tabled_request_typ is table of varchar2(1000);
tablea_data tablea_request_typ;
tableb_data tableb_request_typ;
tablec_data tablec_request_typ;
tabled_data tabled_request_typ;
CURSOR rcura(v_region VARCHAR2(100))
IS
select request_no from tablea where region = v_region;
CURSOR rcurb(v_input VARCHAR2(100))
IS
select request_no||request_detail1||request_detail2 stringb from table b where request_num = v_input;
CURSOR rcurc(v_input VARCHAR2(100))
IS
select select contact1||contact2||contact3||contact4 stringc from table c where request_num = v_input;
CURSOR rcurd(v_input VARCHAR2(100))
IS
select select customer1||customer2||customer3||customer4 stringd from table c where request_num = v_input;
BEGIN
OPEN rcura('NE');
LOOP
FETCH rcura BULK COLLECT INTO request_no LIMIT 1000;
FOR f in 1..request_no.count
LOOP
--Tableb
OPEN rcurb(substr(request_no(f),1,14));
LOOP
FETCH rcurb BULK COLLECT INTO tableb_data
for i in 1..tableb_data.count
LOOP
utl_file(...,tableb_data(i));
END LOOP;
EXIT WHEN rcurb%NOTFOUND;
END LOOP;
-- Tablec
OPEN rcurc (substr(request_no(f),1,14));
LOOP
FETCH rcurb BULK COLLECT INTO tablec_data
for i in 1..tablec_data.count
LOOP
utl_file(...,tablec_data(i));
END LOOP;
EXIT WHEN rcurc%NOTFOUND;
END LOOP;
-- Tabled
OPEN rcurd ( substr(request_no(f),1,14) );
LOOP
FETCH rcurd BULK COLLECT INTO tabled_data
for i in 1..tabled_data.count
LOOP
utl_file(...,tabled_data(i));
END LOOP;
EXIT WHEN rcurd%NOTFOUND;
END LOOP;
END LOOP;
EXIT WHEN rcura%NOTFOUND;
END LOOP;
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line(dbms_utility.format_error_backtrace);
END;
/Hope this helps. If not, post your table structures... -
Xcode send post parameters with URL
Hello Developers
How are you?
I am a new developer at all and only 2 weeks working with Objective-c. I came from VoIP PBX World, knows little bit php, shell
So my question is:
I am working right now on Bill application for mobile operator
To send parameters in a blind mode by xcode
I installed POSTER Plugin to my Firefox that can emulate login with 2 parameters (login and password) to this web site and
return me a content from my account there.
So I don't know which instrument in XCODE can do the same as POSTER PLUGIN.
I have a link where I send parameters
"https://www.golantelecom.co.il/rpc/web.account.rpc.php?action=login&p_action="
and parameters I sent
Content-type: application/x-www-form-urlencoded
username=123456&password=PASSWORD
I can't send it from my browser like a get request in this case
https://www.golantelecom.co.il/rpc/web.account.rpc.php?action=login&p_action=use rname=123456&password=PASSWORD it's not working
How I can emulate this same from Xcode?
Very appreciate for your helpHi,
For this thing, you dnt need to use any plugin. What you can do is take the "username=123456&password=PASSWORD" text into string format. And convert that into some encoded format. Ask the server people decode the content what you are sending from device. Check the iPhone Code. May it works...
Eg:
NSMutableURLRequest *req = [[[NSMutableURLRequest alloc] init]autorelease];
[req setURL:[NSURL URLWithString:url]];
[req setHTTPMethod:kPOST];
[req setHTTPBody:[postParam dataUsingEncoding:NSUTF8StringEncoding]];
NSURLConnection *connGet = [[[NSURLConnection alloc]initWithRequest:req delegate:self] autorelease];
if(connGet)
NSLog(@"Connected successfully");
else {
[AppDelegate showAlert:kAlertUnableToConnect];
NSLog(@"Not connected successfully");
Thanks,
Rajesh.. -
HD edited footage in FCP 5.1 to DVDSP 4 to "build and format" to where now?
97 minute movie shot with Sony's HDV-FX1, edited in FCP 5.1, exported to QuickTime movie, full quality, current settings. Imported into DVDSP 4.1, parsed, no problem, authored with HD settings, and built project. DSP produced a proper HDDVD_TS folder. With Apple DVD Player 4.6.5 on my duel 1.8 G5, this plays just fine.
With Toast 8 and a NU Technology Blu-ray burner (Matshita BD-MLT SW 5528), DVD-ROM (UDF), new disc, named and imported the HD file. Clicked record, selected 1x DB write speed to be on the safe side, used both a Panasonic BD-RW and a TDK BD-RW single layer disc and burned successfully. Neither disc now, to my ultimate frustration, will play in our Samsung Blu-ray DVD player or play with Apple's DVD Player. Both report a message about not supporting the media type, although the disc does mount on my G5 via the Blu-ray drive.
Thoughts on where to go from here? Our movie plays fine downconverted to 480i, but we would love to see it play in High def at 1080i.
Any thoughts would be much appreciated.
Larry
G5 Dual 1.8 Mac OS X (10.4.9) FCP 5.1 DVDSP 4.1David,
That is the answer to why I am unable to use the "build and format" option in DSP? Seems crazy that the option is there, but the function isn't.
Did the Toast product manager give any hint as to when this option may be available? I knew were we sailing into unchartered waters, but we had hoped that by the time we were done with post that the path had already been navigated
Thanks,
Larry -
I can't see Loops in Acid WAV format on Logic's loop Browser
Hi everybody,
I recently bought a bunch of loops in Acid WAV format that claims to be compatible with Apple Loops. I can see them and even I can hear them on my finder but they don't show up in Logic's loops browser which makes them useless...
They are placed in the correct file, I'm sure of that... I am suspicious of their real compatibility
Can anyone help me with this problem?
Thanks
FranI'm sure it's just a slip of the keyboard, but I presume by "they are placed in the correct file" you mean "folder". Just checking — which folder is that? On which drive?
There are lots of reasons why 3rd-party Loops might not work at first, including permissions problems, unrecommended locations, still being compressed or archived…
"Get Info…" (Command-I) on one of the files & see if it's locked & if you have read/write permission.
Let us know all the above stuff, & we can take it from there. -
How to assign to String[] from StringBuffer in a loop?
Hi all,
public class Test {
public String[] getSJ()
String[] jg;
String[] jig;
String[] tg;
String[] result;
Date startTime;
StringBuffer buf = new StringBuffer();
int i;
int j;
int k = -1;
jg = {"g1", "g2"};
for( i=0; i < jg.length; i++ )
jig = {"1", "2", "3"};
for( j=0; i < jig.length; j++, k++ )
buf.append( jg[i] ).append( ":" );
buf.append( jig[j] ).append( ":" );
buf.append( Date() );
result[k] = buf.toString();
buf = null;
}I want to add to result string array by assigning from buf which is StringBuffer in a loop. But what happens after buf = null??
Will the added String be gone?
Or should I just do:
buf = "";
and continue with the loop and the string objects will be preserved? But isn't result just an array of references?
Many thanks,I am not sure I understand correctly. Here is a test program (in real program I call APIs from a library which returns String[] for jg and for jig, i.e they are changing in the loop in runtime.
I tried to put together test program:
import java.util.*;
public class Test {
public void Test() {
public String[] getSJ()
String[] jg = {"g1", "g2"};
String[] jig = {"1", "2", "3"};
String[] result = new String[50];
StringBuffer buf = new StringBuffer();
int i;
int j;
int k = 0;
for( i=0; i < jg.length; i++ )
for( j=0; i < jig.length; j++, k++ )
buf.append( jg[i] )
.append( ":" )
.append( jig[j] )
.append( ":" )
.append( new Date() );
result[k] = buf.toString();
buf = null;
return result;
public static void main( String[] args ) {
Test t = new Test();
String[] res = t.getSJ();
for( int i=0; i<res.length; i++ ) {
System.out.println( res[i] );
}but when I run it fails in this statement:
buf.append( jg[i] )
.append( ":" )
.append( jig[j] )
.append( ":" )
.append( new Date() );Exception in thread main
java.lang.NullPointerException
java.lang.String[] Test.getSJ()
Test.java:24
void Test.main(java.lang.String[])
Test.java:38
Wierd!?
And if I change to:
buf.setLength(0);
then it fails with this error:
Exception in thread main
java.lang.ArrayIndexOutOfBoundsException: 3
java.lang.String[] Test.getSJ()
Test.java:24
void Test.main(java.lang.String[])
Test.java:38Also, I would like not to have to allocate like in:
String[] result = new String[50];
because I do not know how many different Strings in array will be returned by API. Is it possible to dynamically adjust
String[] result
somehow?
Many thanks, -
Ok, I understand about numeric string formating (NumberFormat). But what I need help with is string formatting.
For example, I'm working on an app with fixed-length records. Let's take a name field. I need the string "John Doe" formatted to a 40-character field, right-justified. Can someone point me to a class or a URL with information on this.
Sorry for asking such an elementary question.Ok, I understand about numeric string formating
(NumberFormat). But what I need help with is string
formatting.
For example, I'm working on an app with fixed-length
records. Let's take a name field. I need the string
"John Doe" formatted to a 40-character field,
right-justified. Can someone point me to a class or a
URL with information on this.In the JDK I found nothing, but in the jakarta-Projekt of apache.org:
http://jakarta.apache.org/commons/lang.html
There is a class called StringUtils.
You only have to write:
String rightJustified = StringUtils.rightPad("John Doe", 40);
If you don't find something in the JDK look at Jakarta. They have a lot of useful stuff. -
Query parameters with the same name and different values
According to HTTP, multiple query or post parameters with the
same name and different values are permitted. They are transfered
over the wire in the following format -
name1=val1&name1=val2&name1=val3
The problem is that I can't see anyway of assigning multiple
parameters with the same name and different values to the request
object of mx.rpc.http.HTTPService. I have tried using the
flash.utils.Dictionary object as it does strict key comparison but
that doesn't work too. I have tried setting an array of values to a
property of the request object but that sends the request to the
server in the following format -
name1=val1,val2,val3
The java servlet engines throw exceptions when they see this.
Any help would be greatly appreciated.If you're not on 8.1.4 move there. 8.1.3 had limitations in the wsrp
release.
wrote:
I have an html select box that contains several values, and multiple
selection is enabled. When my code runs as a remote portlet, the
following is showing up in the soap monitor when I select multiple
values and submit the form:
<urn:interactionParams>
<urn:portletStateChange>cloneBeforeWrite</urn:portletStateChange>
<urn:interactionState>_action=addEmployeesToGroup</urn:interactionState>
<urn:formParameters
name="P62005wlw-select_key:{actionForm.selectedEmployees}OldValue">
<urn:value>true</urn:value>
</urn:formParameters>
<urn:formParameters
name="P62005wlw-select_key:{actionForm.selectedEmployees}">
<urn:value>beatest1</urn:value>
</urn:formParameters>
In this case, I selected beatest1 and beatest2, but only beatest1 comes
through to the remote portlet. Is this a known bug, and, if so, is
there a patch or workaround available?
Thanks in advance,
Andy
Maybe you are looking for
-
Hi Everyone, I have a requirement where in i have to download data to an excel sheet with some formatting like, few fields need to centrally aligned, few fields to be bold and coloured.Is it possible to have such formatting done thru ABAP.Is there a
-
im not getting my TEXT messages anymore until i get around Wifi and then they flow in....i have Imessage on on both iphone and ipad...i tried turning OFF Imessage and they still dont come in!
-
Currency Conversion TAB is Disabled in Query Designer !
Hi All When I create a selection under STRUCTURES, currency conversion tab becomes disabled...wheras if I create a FORMULA, I can see the Currency conversion TAB... But I need to do the conversion in SELECTION KEY FIGURE..Could I know why that happ
-
Very Poor Quality Device Multiple Issues
I have Purchased this Slate 7 Tab with Great Hope and Trust that HP is a trusted Brand...but Very soon i realised that this is the worst product HP have Launched...Immediately after it started giving problem and since last 1 Year my TAB was in HP Ser
-
Planned delivery cost calculation problem
Hi all, I am maintaining freight as 10 % in my service purchase order with two subservices line items. but system is not calculatiing the freight amount as per quantity while doing the service entry sheet. What can be the possible solutio