How to un-buffer StreamHandler?
Help, searched for ~1 hour and couldn't find a solution.
I'm forking to another process with exec (this is Solaris fwiw) and then dumping output from exec program back to a TextArea. Works fine except the input is buffered and does not dump out in realtime as it would to stdout. It fills up the buffer, then dumps multiple lines, etc. How can I un-buffer it?
private int systemCommand (String command, boolean waitFor) {
int exitVal=0;
try {
Runtime rt = Runtime.getRuntime ();
Process exCommand = rt.exec (command);
StreamHandler errorHandler = new StreamHandler (exCommand.getErrorStream (), "ERROR");
StreamHandler outputHandler = new StreamHandler (exCommand.getInputStream (), "OUTPUT");
errorHandler.start ();
outputHandler.start ();
if (waitFor)
exitVal = exCommand.waitFor ();
} catch (Throwable t) {
t.printStackTrace ();
return exitVal;
class StreamHandler extends Thread {
InputStream is;
String type;
StreamHandler (InputStream is, String type) {
this.is = is;
this.type = type;
public void run () {
try {
InputStreamReader isr = new InputStreamReader (is);
BufferedReader br = new BufferedReader (isr);
String line = null;
while ((line = br.readLine ()) != null) {
System.out.println ("E:"+line);
OutputWindowText.append (">" + line + "\n");
OutputWindowText.setCaretPosition(OutputWindowText.getText().length());
} catch (IOException ioe) {
OutputWindowText.append ("IOException encountered.\n");
ioe.printStackTrace ();
If I understand you, I don't think you can unless you change the forked process to write to a raw stream, not a buffered one.
Similar Messages
-
How to reduce buffer busy waits, session hanging due to buffer busy waits
Hi,
How to reduce buffer busy waits, session hanging due to buffer busy waits.
Thanks,
Sathis.When I see through enterprise manager I see lot of
tables with buffer busy waits.
Is there any way by table name we can check the
blocks info.
The simple way is to look at the SQL statement and corresponding table name?
P1=file#, P2=block#. You can extract segment name(table or index) using this info.
Query v$bh like following:
SQL> select file#, block#, class#, objd from v$bh where file# = P1 and block# = P2;
SQL> select object_name from all_objects where object_id = <objd>;See following doc:
http://download-west.oracle.com/docs/cd/B19306_01/server.102/b14237/dynviews_1051.htm
Or you can dump block:
SQL> alter system dump datafie <P1> block <P2>;Some excerpts from block dump:
scn: 0x07df.17e70782 seq: 0x01 flg: 0x04 tail: 0x07822301
frmt: 0x02 chkval: 0x61d0 type: 0x23=PAGETABLE SEGMENT HEADER
Map Header:: next 0x00000000 #extents: 1 obj#: 55881 flag: 0x10000000>
Can we do something at table level that will reduce
the waits.
Yes, some methods are known. But before thinking of that, you must verify which block class and which access are involved.
Typo... always. :(
Message was edited by:
Dion_Cho -
How to caluculate buffer size for import/exports in oracle
Hi DBAS,
how to caluculate buffer size for import exports,here is the formula but how can we use if there is a 100 of tables and datatypes,is the any query to find out rows_in_array ,maximum_row_size total schema and datbase
buffer_size = rows_in_array maximum_row_size*
Thanks,
tmadugulahttp://download.oracle.com/docs/cd/B10501_01/server.920/a96652/ch01.htm
Search "buffer" -
How to calculate #Buffer Gets # Exec Buffer Gets/Exec
Hi,
How to calculate #Buffer Gets,# Execution time,Buffer Gets/Exec for a sql query?Nirmal
You can find out these statistics from two places
1) using SQL_TRACE (10046 trace) and then TKPROF (or Autotrace in SQL*Plus)
2) or looking at V$SQL which records the cost assigned to each SQL statement since the statement was first cached.
If you use Statspack or AWR, you can see the difference between two points in time, so you can calculate the cost for a period of time.
See Using SQL_Trace and TKPROF
http://download-uk.oracle.com/docs/cd/B10501_01/server.920/a96533/sqltrace.htm#1018
and Using Statspack
http://download-uk.oracle.com/docs/cd/B10501_01/server.920/a96533/statspac.htm#34837
(see the 10g documentation equivalents if necessary).
Remember, ratios (eg gets/exec) aren't always very helpful. You're best off concentrating on those operations which take longest (ie where there is the most potential to save time). See (eg) www.hotsos.com, www.oraperf.com, and others to identify effective performance methodologies.
HTH
Regards Nigel -
How to understand buffer swaps
In SAP training materials, it says that buffer swaps occur when buffer content is deleted from the buffer and is replaced by other content. It's no relation at all to the swapping mechanism on OS level.
I am confused about the source and target of buffer swaps. For example, when buffer swaps occur on program buffer(PXA), where will the data in program buffer be put, physical memory?, and where does new data come from? SAP buffers locate on share memory, belong to virtual memory, but virtual memory is the summary of physical memory and OS swap space(or OS paging file). I just remember that extended memory resides on physical memory, don't know whether sap buffers reside on physical too.
For swapping on OS level, I think it's page exchange between physical memory and swap space which locates on disk. Is it right?
Please advise on how to understand buffer swaps and OS swapping. Thanks so much.
JamesHi James,
Plz find the link I hope it might help you,
http://help.sap.com/saphelp_nw70/helpdata/EN/c4/3a6dbb505211d189550000e829fbbd/frameset.htm
as the question you have asked is concentrating in
depth and this can be understood if you have a look
at the following link.
regards,
Manjula. -
How to tune buffer busy waits in RAC
Hi,
In our environment we se lot of buffer busy waits.
How can I tune that.
we are using 9i RAC on HACMP.
Regards
MMUThere could be several reasons for buffer busy waits, however the common reason is high logical reads..
Normally they relate to bad SQL, you can try to identify those bad queries using a 10046 trace at level 8 or 12 and then tkrprof the trace file and look at the output.
In a RAC environment you will see global buffer busy waits which again relates to buffer busy waits at the instance level. -
How to put buffer in dynamic sound(mp3 file)?
Hi,
like row sound we put buffer, like this
buffer = new SoundLoaderContext(65000);
_loop_snd = new Sound(new URLRequest(_mp3), buffer);
how can i put buffer in dynamic sound..as per your code where i can put buffer in below code..
any suggestion,
_dynamicSound = new Sound();
_dynamicSound.addEventListener(SampleDataEvent.SAMPLE_DATA, onSampleData);
the dynamicSound genrated from the row sound, means i modify the row sound.
Sorry for the english.
Thanks
BecharDidn't get exactly what you re trying to ask. But if you want to buffer an mp3 before playing you need to do something like this:
mp3File = new Sound();
var context:SoundLoaderContext = new SoundLoaderContext(5000, false); //Buffer audio for 5 seconds before playback
var songRequest:URLRequest = new URLRequest(songURL); // Our song that we want to laod
mp3File.load(songRequest, context);
Is this what you re looking for? -
How to double-buffer a JWindow?
Hi,
I made a resizable JWindow, but whenever I resize, J-components within the window flicker. (First setSize(), then validate() to redraw for correct sizes). I know JWindow is not double buffered, I want to override the paint() method to implement double buffering -- anyone knows how to do that? (...besides copying from JComponent.java)I think double buffering available in Swing with out you doing anything. Just add the following line to your window initialization.
((JPanel)window.getContentPane()).setDoubleBuffered(true);If this doesn't work, and I think it should. Then use the code below.
This is code copied from http://java.sun.com/j2se/1.3/docs/guide/awt/designspec/lightweights.html
The following is a Panel, but you can apply the same logic to JWindow.
public class DoubleBufferPanel extends Panel {
Image offscreen;
* null out the offscreen buffer as part of invalidation
public void invalidate() {
super.invalidate();
offscreen = null;
* override update to *not* erase the background before painting
public void update(Graphics g) {
paint(g);
* paint children into an offscreen buffer, then blast entire image
* at once.
public void paint(Graphics g) {
if(offscreen == null) {
offscreen = createImage(getSize().width, getSize().height);
Graphics og = offscreen.getGraphics();
og.setClip(0,0,getSize().width, getSize().height);
super.paint(og);
g.drawImage(offscreen, 0, 0, null);
og.dispose(); -
Fiori Enhancment - BSP how to clear buffer/cache?
Hi All,
So I'm trying to make some enhancmenets to a Fiori app. I have downloaded it and reuploaded is as a new BSP application.
I wanted to make some changes to the BSP, so I changed the code directly, in SAP.
I thought I must be doing something wrong, but my changes weren't having any effect.
To further test this I wrote some nonsense which should ahve broken it... but it still ran fine!
To test further again I went to SICF and deactivated the node!! ANd it STILL worked fine!
I opened new sessions in my browser, and new incognito windows, and closed it all and reopened it all, but it STILL works fine!
There is clearly some kind of caching/buffering going on here, I've found the tables: O2PAGDIR and O2PAGDIRT have buffered values (found out this from ST02)
But how do I clear it?! I turned buffering off in these tables, to see if that worked, and made another change, and tried to reload the table... but STILL the page loads with no changes.
Please, can anyone tell me how to clear the buffer/cache that means that when I make UI chanegs in a BSP it doesn't show them?!
Thank you
LindsayHi Mauro,
I overcame this issue in a variety of ways:
Firstly, I do all the customisation of the BSP applications locally on my machine.
Then I upload the whole BSP using the program /UI5/UI5_REPOSITORY_LOAD.
In order to make sure the display you see in your browser is the up-to-date version, there are various cache clearing things you can do:
Program /UI5/RESET_CACHEBUSTER - this has no UI, and takes only a second to run
Transaction /UI5/THEME_TOOL : double click on "Invalidate Cache" to refresh the theme cache (if you have made theme changes)
Then you have the two model caches mentioned above by Ashish - if you changes the Gateway service but aren't seeing these changes you should run these to ensure the model is up-to-date.
Browser caches: make sure you browser cache is cleared: for Chrome this is easy: hit F12 (to get Dev toold open), clickk on the cog icon, and tick the box "Disable cache (while DevTootls is open)" - then keep devtools open while refreshing the page.
The best way to enhance the BSP applications is locally on your machine, and do all your testing locally before uploading.
I hope this helps, let me know how you get on.
Lindsay -
How to decide buffer sizes for specific size of RAM
Hi sdners.
Generally, how can we decide the buffer sizes which are shown in the ST02 screen. suppose we have 100GB ram /5GB ram, then how can we decide the related buffer sizes...and generally which buffer takes more place in the RAM
Thanks in advance.Hi balaji
You can tune your SAP buffer by the statistics of Hit Ratio and swap occuring. There should not be no swap on your system. you can adjust your buffer value by the optimizing the both value.
Regards
Anwer Waseem
SAP BASIS -
How to reset buffer pointer for analog output generation?
I am doing a finite analog output generation on a USB-6216
Sequence of events:
DAQmx Create Task
DAQmx Timing (finite samples, 1000Hz)
Use DAQmx timing property SampQuantamples per channel to set buffer size
Write buffer with DAQmx Write
Repeat
DAQmx Start Task
DAQmx Wait until done
DAQmx Stop Task
Until finished
DAQmx Clear Task
I get a full waveform output on the first iteration of the loop. On subsequent iterations I get only a small section of the waveform, but no error. It seems that it is regenerating the waveform, because when I switch off regeneration I get an error at Start Task, but before it can regenerate all the data Wait Until Done.vi decides that the generation is done and exits, stopping the generation.
I have done this with a PCI device and it works fine; every call to Start Task generates the whole waveform again.
OK, so it looks like after every waveform generation completes I need to reset the pointer to the start of the buffer, so that the Wait Until Done vi does not think the generation is done. Or - maybe there is a way to reset the "Generation Done" state?
I'm sure there's an easy way to do this....?Hi CDancer,
Many thanks for contacting National Instruments. If I can start by giving some general advice, it would be well worth posting your actual VI. This helps others on this forum in helping you with your application.
From the sounds of things, you want to do continuous analog output generation. I have had a look at the examples that come with LabVIEW and I think you should look at the one below.
I would have a look at some of the DAQmx examples that come installed with LabVIEW. The following example would be particularly relevant I feel
Cont Gen Voltage Wfm-Int Clk-non Regeneration.vi
Please let me know how you get on.
Many thanks,
Andrew McLennan
Applications Engineer
National Instruments -
Hi,
I work on a buffer. I want to acquire an .avi in an buffer of ten seconds. For example, all images acquired by the camera come in a buffer
9[1][X][X][X][X][X][X][X][X][X] -> [2][1][X][X][X][X][X][X][X][X] etc... [1][2][3][4][5][6][7][8][9][10] and after [11][1][2][3][4][5][6][7][8][9] and when I push on capture it copy only the ten last seconds. I think that is a ring buffer.I do two .vi but I don't understand how works the buffers.
Attachments:
Essaione.vi 22 KB
Buffer.vi 52 KBwow .. too many questions in one post
you need to learn BASIC ABAP to be precise..
1. Internal table are like array of structure...(hope u can relate it to other coding language now) and workarea is just one structure.. so a work area is used to hold single line of a internal table of same format..
2. text - integer.. integer to text... => YES.. just define a variable as type STRING. and do what ever operation you want on this.
3. use ROUND for rounding off..
4. Please NO MORE TOO MANY QUESTION on ONE thread... Thanks
-Somu. -
How to view buffer for updates
Hi,
Once I have updated the planning buffer, how would I review this to see if the update has worked? Is the planning buffer comprised of tables? Please advise.
Thanks,
RTHello RT,
the planning buffer is in memory and can't be viewed directly. Save the data and you see the results in transaction LISTCUBE or a query.
Regards,
Marc
SAP NetWeaver RIG -
How to tune "Buffer Get" offender
QUESTION: How to tune following sql
SELECT *
FROM trans
WHERE accountid = NVL (NULL, accountid)
AND transtypeid = 171
AND NVL (description, '-1') = NVL ('Card Activation Fee ', '-1')
AND ABS (transamt) = ABS (9.95)
AND accountid <> 7689966
AND postdate BETWEEN ( TO_DATE ('03/14/2006 00:17:43',
'mm/dd/yyyy hh24:mi:ss'
- .00011574
AND ( TO_DATE ('03/14/2006 00:17:53',
'mm/dd/yyyy hh24:mi:ss'
+ .00011574
DETAILS:
Statspack has shown this piece of SQL as the largest contender for "Buffer Gets" chewing up 513.28 seconds of CPU time out of 3,475 (See Top 5 Timed Events below)
However, when I run the sql statement by itself in TOAD, it takes 90ms to complete and has a cost of 202 (See plan below). TRANS table has over 18m rows.
Operation Object Name Rows Bytes Cost Object Node In/Out PStart PStop
SELECT STATEMENT Optimizer Mode=CHOOSE 1 202
TABLE ACCESS BY INDEX ROWID SVOLTP.TRANS 1 65 202
INDEX RANGE SCAN SVOLTP.TRANS_POSTDATE_NIDX 1 K 7
Top 5 Timed Events
~~~~~~~~~~~~~~~~~~ % Total
Event Waits Time (s) Ela Time
CPU time 3,475 49.99
db file sequential read 1,340,884 3,197 45.99
db file scattered read 180,048 70 1.01
db file parallel write 3,983 49 .70
log file sync 20,593 43 .63here is the actual statement taken from the package:
select transid
into lFromTransID
from trans
where accountid = nvl(lacctid, accountid)
and transtypeid = lToTrans.transtypeid
and nvl(description, '-1') = nvl(lToTrans.description, '-1')
and abs(transamt) = abs(lToTrans.transamt)
and accountid <> lToTrans.accountid
-- Transactions must be posted within 10 seconds of each other
and postdate between (lToTrans.postdate - .00011574) and (lToTrans.postdate + .00011574); -
E-Recruiting - BSP application - How to clear buffer?
Hi,
Im debugging one of BSP application (I set an external break point at method of model class).
Very first time program flow stops at break point but after that it is not stopping there b/c records being fetched from buffer. May I know how to clear the buffer?
Regards,
...NaddyWell,
E-Recruiting Infotypes are buffered within the application as internal tables.
The buffer is filled, when first time opening an subapplication. It's also filled, when those infotype records have not been read before.
Refreshing the buffer is only triggered by the application. This is done by "Refresh"-Buttons or Buttons like "Start selection".
You cannot refresh it yourself, while debugging. It's a global event called by button events.
Maybe you are looking for
-
Can anyone assist. I've downloaded the new ios 7 software for my iphone 4s phone. Ever since doing so I often cannot access messages via voicemail. It is infuriating & potentially very costly as I sometimes take business calls on the phone. Can anyon
-
How do i sync my iphone4 contacts to mobile me or outlook 07?
hi there....please help. i signed up for mobile me thinking it would solve my issue and i can't figure it out. i am trying to sync my iphone contacts into my computer or to mobile me??? i dont have an activated contact list in outlook. when i connect
-
Relative url to call flash movie
Please help.. I want to use a flash movie (a.swf) in a shocked piece on a server. The a.swf file is in the same folder with the authorware files on the server and is supposed to call other files while it is running. How do I call the a.swf as an exte
-
Why virtual interfaces added to ManagementOS not visible to Cluster service?
Hello All, I"m starting this new thread since the one before is answered by our friend Udo. My problem in short is following. Diagram will be enough to explain what I'm trying to achieve. I've setup this lab to learn Hyper-V clustering with 2 nodes.
-
Mysql.sock error with php
Hi, I'm trying to get MySQL working on my Mac running OS X 10.5.1 The server runs and I have imported one of my databases into it. However when I run Dreamweaver and try and add the new database I get this error in Dreamweaver; Can't connect to local