How to calculate the number of resize operations by StringBuffer
StringBuffer default size is 64 characters.
I would like to calculate how many times a StringBuffer would need to be resized if this size is not amended to achieve a particular final size.
e.g. I expect my total StringBuffer to be 40,000 charcters long - how many times would it need to be resized to reach this capacity?
Can someone provide a simple calculation or a way or a way of outputting it to a log file.
Many thanks.
Aaaah - cheers - it was the "plus 2" which had thrown me - my answers were all 'just out'.
Similar Messages
-
How to calculate the number of operations in Undo/Redo stack?
How to calculate the number of operations in Undo/Redo stack?
I tried to override UndoManager.pushUndo method and increment "operationsCounter" there, but pushUndo is called each time I make a change in text.
Another idea was to override EditManager.finalizeDo and use "operationsCounter" there, but finalizeDo is private...
Do you have any idea?Hi Richard,
Thanks for the reply. I suggested that existed the more simple way to implement this -
How to calculate the number of sent/received emails of a certain domain
Thank you for what you have helped me with!
How to calculate the number of sent/received emails of a certain domain in a certain period? It is Messaging Server 5.2, Directory Server 4.2. Is there a log option for this?
Thank you.Not sure where you find, "LOG_MESSSAGE_ADD". I don't actually find this option in the documentation.
The domains that mails are coming from and being sent to are certainly logged in the normal mail.log, so why mess with additional logging options? If you're talking about "LOG_CONNECTION", I actually see no additional data that is useful to you.
If you decide to change the option.dat, you do indeed need to
imsimta cnbuild (note, it's not cnrebuild)
imsimta restart
If I were facing the same issue, I'd be looking at the log parsing perl script, and simply modifying it to do what I wanted. -
How to calculate the number of user connections in a report?
Hi,
I would like to have a report which automatically calculate the number of connections per user.
Thanks for your answer.
RegardsHi,
What do you mean by number of connections? Do you mean how many times each user has run a specific report?
Thanks -
How to calculate the number of days worked for a given period
I need to calculate the number of days worked by contractor employees for a time period to be entered by a user. I am building a query on an infoset which contains employee information including contract start date and contract end date for the employee.
Ideally I'd like the user to enter the time period which should be reported on e.g. 01.08.2009 to 31.08.2009
The report should then identify all the contractor employees which were working during this period and to work out how many days they worked during this period. Obviously the contract start and end dates could fall both inside and outside the reporting period.
Can this be done and if so, do you have any suggestions as to how to do it?
Thanks.hi
So here you will first have to load the master data table employee in one internal table and read this table with the variables entries.
Your code in the reporting exit should look like that.
bye
data : wa_employee type /bi0/pemployee.
When 'ZDATE1'
if i_step = 2.
LOOP AT i_t_var_range INTO loc_var_range WHERE vnam = 'ZDATE2'.
clear l_s_range.
clear wa_employee
1- select the entries from table employees
select single employee dateto datefrom
from /bi0/pemployee
into corresponding fields of wa_employee
where dateto le loc_var_range-low
and datefrom ge loc_var_range-high.
if sy-subrc eq 0.
CALL FUNCTION 'FIMA_DAYS_BETWEEN_TWO_DATES'
EXPORTING
i_datum_von = wa_employee-datefrom
i_kz_ult_von = 'X'
i_datum_bis = wa_employee-dateto
i_kz_ult_bis = 'X'
i_szbmeth = '1'
IMPORTING
e_tage = no_days.
l_s_range-low = no_days.
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
APPEND l_s_range TO e_t_range.
ENDIF.
ENDIF.
endloop.
ENDIF.
Boujema -
How to calculate the number of vowels from a txt file. Pls give me a hand!!
Guys! How do i calculate the number of vowels from a txt file? I have to create a program to count the number of words, sentence, and vowels. So far I had managed to count the number of words. Now I need help on counting sentence and vowels! Pls give me a hand guys!
I first have to read from the file not the string.I
know how to read from a file. Now the problem ishow
to compare a character from a txt file!You fail to understand, that you have read the data
from the file into a string. Now loop over all
characters in the string. Forget about the file.
KajOr forget the scanners just as others have told you. Just read the file character by character using a FileReader.
Kaj -
How to calculate the number of months between two string as yyyymm
Dear all,
I have two month string like yyyymm e.g. 201003 -- 201105. Now I want to calculate the number of months bertween these two month string? How can I do that? Thanks.888099 wrote:
Hi,
Hope this will help :
public static void main(String[] args) {
Calendar cal1 = new GregorianCalendar(2010, 02, 01);
Calendar cal2 = new GregorianCalendar(2011, 04, 01);
int years = cal1.get(Calendar.YEAR) - cal2.get(Calendar.YEAR);
int months = cal1.get(Calendar.MONTH) - cal2.get(Calendar.MONTH);
System.out.println("number of months : "+Math.abs(years*12 + months));
}Or with only Strings :
public static void main(String[] args) {
String s1 = "201002";
String s2 = "201104";
int years = Integer.valueOf(s1.substring(0,4)) - Integer.valueOf(s2.substring(0,4));
int months = Integer.valueOf(s1.substring(4)) - Integer.valueOf(s2.substring(4));
System.out.println("number of month : "+Math.abs(years*12 + months));
}Edited by: 888099 on 28 sept. 2011 05:49Full code solutions will not help the OP, he will be back here with a different Date question. Posters here try to nudge the OP to figure out the solution himself. -
I'm trying to calculate the number of days until your next birthday. Only using current month, day and birth month and day. I can get close but i'm way off. When i enter in the next day, the amount of days is supposed to be 364. This is where I am having problems. I know my code is way off. I just need some guidance please!
Attachments:
D5.7_1.vi 8 KBI just had a little fun with the Time Record...
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
Attachments:
D5.7_1_BD.png 19 KB -
How to calculate the number of months....
HI all
can any body give the FM name which calculates the number of months between any two dates that are inputted
thanks in advanceTry this in ur source code of FM.....include the import and Export...as given
""Local interface:
*" IMPORTING
*" REFERENCE(BEGDA) LIKE PA0001-BEGDA
*" REFERENCE(ENDDA) LIKE PA0001-ENDDA
*" EXPORTING
*" REFERENCE(DIFF_MONTHS) TYPE I
*" EXCEPTIONS
*" ENDDA_GRTR
DATA : SMONTH TYPE I,
EMONTH TYPE I,
SDATE TYPE I,
EDATE TYPE I,
SYEAR TYPE I,
EYEAR TYPE I,
MONTHSTOBEADDED TYPE I,
YRDIFF TYPE I,
DIFF TYPE I.
Calculating the months to be added
SMONTH = BEGDA+4(2).
EMONTH = ENDDA+4(2).
Finding the difference in years
SYEAR = BEGDA+0(4).
EYEAR = ENDDA+0(4).
IF SYEAR <> EYEAR .
SYEAR = SYEAR + 1.
DIFF = ( 12 - SMONTH ) + 1.
YRDIFF = EYEAR - SYEAR.
IF YRDIFF > 0 .
DIFF = DIFF + ( YRDIFF * 12 ).
ENDIF.
DIFF = DIFF + EMONTH.
ELSE.
DIFF = ( EMONTH - SMONTH ) + 1.
ENDIF.
DIFF_MONTHS = DIFF.
ENDFUNCTION. -
How to calculate the number of events that happened per clock hour.
My example case has a list of patients that were discharged from a hospital yesterday. The patients are in a field caled "Account number".
The field "Discharge Date" lets me select the date. The field "Discharge TIme" shows me the time each patient was discharged.
Example: 0715, 0830,1005, 1010, 1025, 1435, etc. I need to run the report to know how many patients were discharged per each clock hour. How many were discharged from 0000 to 0100, 0100 - 0200, 0200 - 0300, etc.
Acct # Disch Time
P12121 0715
P23233 0731
P34343 0812
P32333 1015
From research I am assuming I need to capture just the first two numbers that represent the hour and discard the minutes.
I would like to see the results in a similar format to this.
Hour #of Patients
07-08 2
08-09 1
09-10 1
22-23 x
23-00 xJamie,
I attemped to create the formula and got an error message.
Also, Please explain in a little more detail how I do the following:
"create a group on this new field, you can then right click on your patient field and choose Insert Summary > Count and add this to the group level. -
How to calculate the number of times an user has accesed a BEx report
Hi Experts,
We have number of reports in our BW portal and users logon to the portal and run the reports.
How do we count the number of times each user has logged in and ran each report.
Kindly advice.
Thanks,
SaiHi Sai:
I think you can use BI statistics information, which could provide you more detail information.
You can follow the document
http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/90080703-4331-2a10-cd98-9c1e95acdea0
Regards,
Louis Lu -
How to calculate the number of records in Multiprovider
Hi Experts
I have created a report based on the multiprovider (Consist of Cube and ODS)
I need count the number of records inside the multiprovider, how can i do it in the reporting level
Regards
SantoshHi,
You can use calculated key figure with replacement path variable.
Follow This:
1) From the context menu of the Key Figure directory, choose New Calculated Key Figure.
2) From the context menu for the Formula Variable, choose New Variable.
3) Choose the Processing type as Replacement Path.
4) In the next screen, select the Characteristic Info Object based on which the number of documents is to be displayed in the report (For example: Document Number / Order Number).
5) Choose Next.
In the Replace Variable with drop down box, choose Attribute Value.
In the Attribute drop down, select Characteristic Reference (Constant 1).
6)Choose Next.
On the Save Variable page, an overview of the settings made for the variable will be displayed.
Confirm the entries and Choose Finish.
7) If the Formula variable is directly assigned to the Calculated Key Figure, a warning Calculated Key Figure is not defined correctly will be displayed while executing the Query.
8) Properties of Calculated Key Figure dialog box, assign a Technical name for the CKF.
9) set the Time of Calculation to After Aggregation.
Hope this will help you.
Cheers,
DK
Edited by: Debasish Khaitan on May 14, 2009 1:03 PM -
How to Calculate the number of pages are printed.
Hi Friends,
I had a problem in calculating the number of pages are printe by the printer which is connected to my systemWow - that must be in for a prize as a question with one of the vaguest connections to Java I've ever seen on this forum, other than an out-and-out troll.
-
How I calculate the number of stores
In one of ours query's I need to obtain the amount of stores that appear in report later to use this data to carry out another one formulates, somebody can help me and to say to me as I can to him does
thank'sHi Ulises,
I guess you are asking if you can use the values of a key figure to calculate some other value. Yes, you can. Pull the # of Stores into the columns and then Right click on the Key Figure structure and select New Formula. Now you can use KF - # of stores in a formula.
Hope this helps.
Bhargava
Message was edited by:
Sista Bhargava Kumar -
I wanted to know how do you calculate the number of days between two dates
i wanted to know how do you calculate the number of days between two dates in java ? i get both the dates from the database. i guess there are many issues like leap year and Febuary having diff no of months ..etc.
thanks..
I solve my problem as
public class MyExample {
public static void main(String a[]) {
String stdate = "2009-03-01";
java.sql.Date currentDate = new java.sql.Date(System.currentTimeMillis());
java.sql.Date preDate = java.sql.Date.valueOf(stdate);
System.out.println(currentDate);
System.out.println(preDate);
// int dateCom = preDate.compareTo(currentDate);
// System.out.println(dateCom);
long diff = currentDate.getTime() - preDate.getTime();
int days = (int) Math.floor(diff / (24 * 60 * 60 * 1000));
System.out.println(days);
}
Maybe you are looking for
-
Integrate MS CRM with call centre avaya
Hi, all. Prompt please how it is possible to integrate MS CRM with call centre avaya
-
Is there anyway to use Mic Office10 on my Macbook OSX lion
Is there any way i can use Mic office 10 on my Macbook OSX lion
-
ANGRY CUSTOMER - Line problems
I have had crackle problems on my line for many years. It is usually corrosion in the line box just outside my property. An engineer repairs but it only lasts for 6 to 12 months and is back again. It is getting more frequent - my current fault is the
-
Looking for a new system working with the adobe creative suite
Hello everybody, i was 6 years happy with my asus notebook series x55s for what I paid around 1000 €. I worked until CS5 with it but now it is getting a little slow and I am looking for a new system. I am considering buying an Imac such as http://sto
-
Can safari tabs on my mac be closed via icloud tabs on my iphone
If I have a tab open in Safari on my iMac, is there a way I can use iCloud tabs on my iPhone to close an open tab on my iMac?