how to set -A flag in screenrc - command-line

The screen man says
‘-A’
Adapt the sizes of all windows to the size of the display. By
default, screen may try to restore its old window sizes when attaching
to resizable terminals (those with ‘WS’ in their descriptions, e.g.
suncmd or some varieties of xterm).
This works when you start off a screen with the -A flag. But, how do I set it in screenrc so that all my screen sessions get it by default?

fit
Change the window size to the size of the current region. This command is needed
because screen doesn't adapt the window size automatically if the window is dis-
played more than once.
Default key binding for fit is C-a F.

Related

Slowing down MongoDB shell output for large documents?

I am trying to inspect a document that is larger than the print buffer for the Windows command window. For some queries more allows you to type it for more output. Is there a way to apply this to other commands?
For instance I might do db.coll.findOne() which greatly surpasses the print buffer. I'd like to see as much as fits, type it, see more, etc.
You could use this workaround:
Make a file with your command... i.e. tmp.txt containing
db.coll.findOne()
Then execute the query via command line - piping the output to an output text file like this:
mongo yourDatabaseName < tmp.txt > output.txt
You can always extend you windows terminal's buffer.
At left top corner, click right mouse button and select properties.
At layout tab, you can change "Screen buffer size" to width 9999 and height 9999, that's quite big scroll back buffer...
Same time you can enlarge your "window size" to cover whole screen (if you want) and change your font to smaller (you can fit more text to screen).

Select * from showing blank in PSQL shell after changing data type to binary

I'm using Ecto/Elixir with Postgres and I created a field with the binary datatype. Everything is working OK except that now when I make a simple query: Select * from "table name"; the sql shell shows only blank and seems that didn't like it...
What should I do to see these contents?
By default, psql display contents in cells aligned inside a grid. Each column is made wide enough to accodomate the largest value in it, and the smaller contents get blank-padded. When a column is much wider than the size of its containing window, entire pages of contents appear to be blank because of all the padding inside giant column(s) and the wrapping across consecutive lines.
The simplest workaround against that is to turn off alignement, with
\pset format unaligned or the on/off shortcut \a
Sometimes it's also interesting to use horizontal scrolling. Personally I use less as a pager with LESS=-FX as options and occasionally run inside psql:
\setenv LESS -FXS
then when displaying a result larger than the window, it does not wrap horizontally and the left and right cursor keys allow to scroll horizontally.
Also even when not using -S and when horizontal wrapping occurs, it's still possible with less to switch to horizontal scrolling/paging by hitting the right cursor key → or ESC) :
ESC-) or RIGHTARROW
Scroll horizontally right N characters, default half the screen width (see the -#
option). If a number N is specified, it becomes the default for future RIGHTARROW
and LEFTARROW commands. While the text is scrolled, it acts as though the -S option
(chop lines) were in effect.

How to increase size of DOSBox window?

I am running Turbo C on DOSBox in Ubuntu 12.04.
The problem is that two black stripes are coming on either of screen. I want to remove them.
My computer is a Dell Studio 15z with screen resolution 1366x768. I don't have a problem even if distortion occurs.
Relevant part of my dosbox.conf file:
[sdl]
fullscreen=true
fulldouble=false
fullresolution=1366x768
windowresolution=1366x768
output=overlay
autolock=true
sensitivity=100
waitonerror=true
priority=higher,normal
mapperfile=mapper-0.74.map
usescancodes=true
go to dosbox installation directory (on my machine that is C:\Program Files (x86)\DOSBox-0.74 ) as you see the version number is part of the installation directory name.
run "DOSBox 0.74 Options.bat"
the script starts notepad with configuration file: here change
windowresolution=1600x800
output=ddraw
NOTE: Non-windows users will want to use output=opengl instead.
(the resolution can't be changed if output=surface - that's the default).
safe configuration file changes.
For using DOSBox with SDL, you will need to set or change the following:
[sdl]
windowresolution=1280x960
output=opengl
Here is three options to put those settings:
Edit user's default configuration, for example, using vi:
$ dosbox -printconf
/home/USERNAME/.dosbox/dosbox-0.74.conf
$ vi "$(dosbox -printconf)"
$ dosbox
For temporary resize, create a new configuration with the three lines above, say newsize.conf:
$ dosbox -conf newsize.conf
You can use -conf to load multiple configuration and/or with -userconf for default configuration, for example:
$ dosbox -userconf -conf newsize.conf
[snip]
---
CONFIG:Loading primary settings from config file /home/USERNAME/.dosbox/dosbox-0.74.conf
CONFIG:Loading additional settings from config file newsize.conf
[snip]
Create a dosbox.conf under current directory, DOSBox loads it as default.
DOSBox should start up and resize to 1280x960 in this case.
Note that you probably would not get any size you desired, for instance, I set 1280x720 and I got 1152x720.
Here's how to change the dosbox.conf file in Linux to increase the size of the window. I actually DID what follows, so I can say it works (in 32-bit PCLinuxOS fullmontyKDE, anyway). The question's answer is in the .conf file itself.
You find this file in Linux at /home/(username)/.dosbox . In Konqueror or Dolphin, you must first check 'Hidden files' or you won't see the folder. Open it with KWrite superuser or your fav editor.
Save the file with another name like 'dosbox-0.74original.conf' to preserve the original file in case you need to restore it.
Search on 'resolution' and carefully read what the conf file says about changing it. There are essentially two variables: resolution and output. You want to leave fullresolution alone for now. Your question was about WINDOW, not full. So look for windowresolution, see what the comments in conf file say you can do. The best suggestion is to use a bigger-window resolution like 900x800 (which is what I used on a 1366x768 screen), but NOT the actual resolution of your machine (which would make the window fullscreen, and you said you didn't want that). Be specific, replacing the 'windowresolution=original' with 'windowresolution=900x800' or other dimensions. On my screen, that doubled the window size just as it does with the max Font tab in Windows Properties (for the exe file; as you'll see below the ==== marks, 32-bit Windows doesn't need Dosbox).
Then, search on 'output', and as the instruction in the conf file warns, if and only if you have 'hardware scaling', change the default 'output=surface' to something else; he then lists the optional other settings. I changed it to 'output=overlay'. There's one other setting to test: aspect. Search the file for 'aspect', and change the 'false' to 'true' if you want an even bigger window. When I did this, the window took up over half of the screen. With 'false' left alone, I had a somewhat smaller window (I use widescreen monitors, whether laptop or desktop, maybe that's why).
So after you've made the changes, save the file with the original name of dosbox-0.74.conf . Then, type dosbox at the command line or create a Launcher (in KDE, this is a right click on the desktop) with the command dosbox. You still have to go through the mount command (i.e., mount c~ c:\123 if that's the location and file you'll execute). I'm sure there's a way to make a script, but haven't yet learned how to do that.
Looking again at your question, I think I see what's wrong with your conf file. You set:
fullresolution=1366x768
windowresolution=1366x768
That's why you're getting the letterboxing (black on either side). You've essentially told Dosbox that your screen is the same size as your window, but your screen is actually bigger, 1600x900 (or higher) per the Googled specs for that computer. So the 'difference' shows up in black. So you either should change fullresolution to your actual screen resolution, or revert to fullresolution=original default, and only specify the window resolution.
So now I wonder if you really want fullscreen, though your question asks about only a window. For you are getting a window, but you sized it short of your screen, hence the two black stripes (letterboxing). If you really want fullscreen, then you need to specify the actual resolution of your screen. 1366x768 is not big enough.
The next issue is, what's the resolution of the program itself? It won't go past its own resolution. So if the program/game is (natively) say 1280x720 (HD), then your window resolution setting shouldn't be bigger than that (remember, it's fixed not dynamic when you use AxB as windowresolution).
Example: DOS Lotus 123 will only extend eight columns and 20 rows. The bigger the Dosbox, the bigger the text, but not more columns and rows. So setting a higher windowresolution for that, only results in bigger text, not more columns and rows. After that you'll have letterboxing.
Hope this helps you better.

Print query results when using format=alinged, instead of open them in EDITOR

If a do a select and only retrieve a few columns, the results are printed to the terminal, if I have more columns, and they do not fit in the terminal width, the query results are opened in the default editor (vim), but when I exit the editor the results are no longer visible.
I know I can user \x (but I have many rows, and for my it's seems worst ).
If I change the format to unaligned, html, latex or troff-ms even if the results are wider then the terminal width they are still printed.
When the resulted rows do not fit in the terminal height they are always opened in the default EDITOR, no mater what format I am using.
Q:
There is any posibility to use format=aligned and allways print the results instead of opening them in the default EDITOR, so I will not loose their visibility (something similar to what mysql-client does) ?
Thank you.
The query results are passed to the PAGER program when they don't fit in the screen, unless it's disabled with \pset pager off. EDITOR is used for input.
Some pagers restore the previous display when they quit, and it can be quite irritating when you need to use previous results in further queries.
I've found PAGER="less -FX" to be a good fit with psql since it allows scrolling in both directions and keeps the display intact when it quits.

Wrapping variable width text in Emacs Lisp

I am hacking up a tagging application for emacs. I have got a tag cloud/weighted list successfully displaying on a buffer, but i am running into a snag. I need to be able to properly word-wrap the buffer, but I haven't a clue where to start.
The font I am using is a variable width font. On top of that, each tag is going to be in a different size, depending on how many times it shows up on the buffer. Finally, the window that displays the tagcloud could be in a window that is 200 pixels wide, or the full screen width.
I really have no idea where to start. I tried longlines mode on the tagcloud buffer, but that didn't work.
Source code is at: http://emacswiki.org/cgi-bin/emacs/free-tagging.el
You probably want to track posn-at-point and posn-at-x-y as you put the tags in the buffer.
Can you use (fill-paragraph) or (fill-region) or similar? They wrap at a column, so don't have variable width font smarts, but if the fill column is low they might work for next to no effort. At least until you get a pixel-perfect solution sorted out :-) (maybe YAGNI...)