Changing bash home position makes it run slowly. Any fix? - bash

I'm having some trouble with bash. I'm changing my console's home position so I can reserve some rows in the top of the screen to print the current status of the script, and allow all the standard output to scroll in the lower part of the screen. This way, the upper lines showing the status doesn't get removed when the screen scrolls down.
I'm doing this by using these lines to do so, where <RNUM> is the number of rows I need to freeze.
\033[<RNUM>;r
\033[<RNUM>;1H
It works, however the console performance is highly lowered, it print lines really slowly (say it takes 4 times more to print the same amount of lines it usually prints).
Does anyone have a fix for the performance issue? Am I using the correct codes? I wasn't able to find any information about this stuff on the net, and I don't recall where I got these codes years ago.

Related

printf "\033[8;(width);(height)t" works for a specific height and width but is there something more universal

I have a script which is for running as a first run script on different machines and I don't know ahead of time what the width/height of the monitors will be. What I hoping to find is a command like printf "\033[8;(width);(height)t" which is more universal and will expand the terminal to maximum no matter which size monitor is connected to the computer. I had an escape sequence that worked great, but I lost the script along with the code when one of my drives died (I know, backup, backup, and backup again) and can't seem to find that fix again anywhere.
Using the printf "\033[8;(width);(height)t" escape code sequence works if I know in advance what the height and width of the maximized monitor dimensions are (for instance using printf "\033[8;58;238t" will work on my 1920x1080 monitor just fine and will expand as expected) but it is not enough for a larger monitor. Using tput cols and tput lines will give me what the current window dimensions are, but not the maximum dimensions.
I know I can use the keyboard and mouse to do this, but I am strictly looking for something that will expand the window without any other input or key presses, if for no other reason than knowing how to do it and making it work. This needs to execute at the beginning of a bash script on a fresh Ubuntu flavor installation (the script does unique installations and updates). It might be able to work if I could figure out how to get the maximum terminal size possible of a screen into a variable to be used in the code mentioned above.
I have tried echo -ne '\e[9;1t' and printf '\e[9;1t', also echo -ne '\e[10;2t' and printf '\e[10;2t' escape codes to no avail, mentioned at https://terminalguide.namepad.de/seq/ (Control Characters and Escape Sequences) on pages "Alias: Maximize Terminal" and "Maximize Terminal Window". This is one of the few references I can find. Any searching of various ways to ask this question doesn't seem to yield any results and they all seem to rely on knowing ahead of time what the maximum dimensions can be.
Any hints of what I can use for this would be helpful, thank you.
Set the size to a number that is guaranteed to be larger than any existing screen. Pad it some to accommodate for rapidly increasing screen resolutions:
printf "\033[8;99999;99999t"
The window manager should truncate the size to the maximum available area.

Draw2d: Containing RectangleFigure will sometimes cuts off text when zoomed. (Pictures included)

In my program I have a bunch of RectangleFigures where each figure holds text. The text is held in a TextFlow which is held by FlowPage to allow word wrapping. RectangleFigure then uses getPrefferedSize() to make itself just big enough to hold it's text (using a fixed width).
These RectangleFigures are held by a ScalableLayeredPane. The problem rises when I try to zoom by calling setScale(). Most of the time it works fine but occasionally the ends of the text will be cut off. If I zoom again the figure will correct itself. I should also say that I have tested my program using Figure instead of RectangleFigure with the same result.
Has anyone dealt with this bug before and can shed some light on why this is happening and/or know of any workarounds?
I havn't included any code because this is a rather large program and relevant chunks of code are spread out. But if you would like to see the code let me know and I will try piecing it together.
I was holding the text inside a Figure and that was the Figure I was calling getPrefferedSize() on. But I then put that Figure(lets call it textFigure) inside a second Figure(called containerFigure). I was essentially doing the equivalent of containerFigure.setSize(textFigure.getPrefferedSize()).
You're probably wondering why I was doing that. Well originally I planned on having containerFigure hold multiple things instead of just textFigure. I ended up coding it differently but forgot about the unnecessary extra layer.
So even though containerFigure was technically the size it needed to be scaling caused problems. But when I removed containerFigure and started placing textFigure directly on the screen this bug was fixed.
This is a fairly specific error on my part so I don't know how much help this will be to others. To make it more broad if you're having some kind of sizing issue just check to see how the size of parent Figures are being set. Using sizes from child Figures might be incorrect and/or causing problems.

How can I make command prompt produce miltiple lines of output simultaniously?

I have a batch file that has been aesthetically formatted to display information center console at variable dimensions. In order to achieve this I have used the echo command followed by a period to produce white-space, or just empty space, above and below the content. See the left side of the picture
This works fine for "frames" that switch once per second, but when I remove the the delay it becomes obvious that each 'echo.' is producing one line of white space at a time, creating a rapid scroll, rather than a seamless transition. See the right side of the picture
[]
I've seen a cmd bouncing ball animation on a DIY website, where one of the commenters used a lot of for loops to produce a box with a ball bouncing inside of it. He managed to avoid the scrolling. But that code looked very complicated. I'm not ready to decipher it. But if there were a way to make command prompt produce two ore more lines of white space simultaneously, rather than procedurally, that would be of more use to me. More specifically the ability to produce, as a single instance of output, a whole block of text would be what I am looking to do.
If you want to print on the same line, use echo -ne with \r, which is the return carriage (ie. Print next character at the beginning of the line). Google it for more information.
If you are trying to add intervals between your prints, you can use sleep.
Animation is done through careful use of \r to start writing the same line(s) over again. This can be done with a single or multiple echos.

large column vectors crash in matlab crash win 7 Aero

I'm using matlab R2014b 64 bit. I have a problem with large column or row vectors in matlab, when they get to be the size of about 100K samples or larger. The software behaves just fine with them, but it's actually the tool-tip that is the problem.
If I hover over the variable, it seems like Aero or DWM crashes under windows 7. I get sent to a black screen and then it recovers. After it comes back a bunch of my chrome windows are missing their title bars. I guess it's possible this isn't an Aero problem at all? Maybe just a chrome thing? I hope this is the right stack exchange to be asking this question, thanks.
This is what happens:
Edit:
Save the following code into a .m to reproduced the bug. Put a breakpoint on the disp() and run the code. Hover over the variables to generate the crashing tooltip:
ok = ones(1,500).*1j;
ok2 = ones(500,1);
notok = ones(500,1).*1j;
disp('done')
As seen here, the crash is limited to large complex row formatted variables
1) Run MATLAB as administrator
2) Execute the command edit datatipinfo in the MATLAB command prompt
3) On line 48 of the code (might be different in another MATLAB version) which should be val = val(1:500);, please reduce the value from 500 to lower number.
4) On line 37 which should be tooBig = max(s) > 500 || numel(val) > 500;, please reduce the value to the same number as in step 3
You may have to play around with reducing the value to find something that will work in your case.
from
https://cn.mathworks.com/matlabcentral/answers/43170-viewing-variables-in-debug-window-disables-aero-interface

Firefox 6 background image repeat issue

I realize that the title is a long one, but allow me to explain. If you look at:
http://hardincountychamber.org/Chamber-Commerce-Directory.asp
in Firefox 6 (Windows 7 64bit), the white background will repeat until around halfway through the letter 'D' of the full directory, and then disappear after one small move of the mouse wheel, and then resume displaying just a little further down the page. The background just snaps back to displaying. Personally I am baffled as to what is causing it, and in the back-end admin section of this page, the same thing occurs with another repeated background image.
So to duplicate the bug, at the time of this postings, search for the term, "Starbuck" on the page, and then scroll until that listing is at top of your browser, then scroll down slowly, and the white background should just disappear.
Any help would be extremely helpful, though I am going to have to paginate the results of this page for a quick fix, I would rather know what it is that is causing it, and maybe even a potential fix.
If you check, that happens when you scroll the page down by slightly more than 32000 pixels (yep, signed 16-bit integer limit). Things are even worse in Firefox 9, there the background doesn't come back below that boundary. Which sounds pretty close to bug 215055 - except that it cannot be that bug, it has been resolved two years ago. There doesn't seem to be an existing report for the bug you found, it is probably best if you file a new bug, component is "Layout".

Categories

Resources