TMUX: can you paste the most recent buffer into the search field - tmux

When I bring up the scrollback buffer (enter copy mode) and press ? I can enter text and search backwards through the buffer. However I can't work out how to paste something previously added to the paste buffer into the search field. I can paste from the system buffer but often the contents of the TMUX buffer is what I want to search for.
When I try pasting from the buffer (for me its C-]) nothing appears. However if I exit copy mode the buffer pastes just fine.
Does anyone know if this is possible?

Related

What is the issue if we use text1 =text2? What is the right method to copy text between two text variables?

I am getting error in compile mode for the statement text1=text2. What is the issue with the statement and how can we resolve it?
There is a section in the Wynsure Development Rules dedicated to this question, look for the section "14.3 Texts" I'll summarize:
A text variable is a pointer to a buffer that gets automatically reallocated as we write to the text, therefore the memory location differs as the text grows, changes or shrinks. For this reason the pointer isn't contant. eWAM automatically allocates a new larger buffer and copies the content of the old buffer to the new buffer, frees the old buffer and then updates the MyText pointer to point to the new buffer.
Shallow Assignment
It is the most dangerous operation if you really do not understand how text variables work.
For example the following code will crash (as a general rule what will cause a crash is either accessing to a memory location that has been freed or freeing the same memory location twice.)
MyText2 = MyText1
Write(MyText1, ….)
Blank(MyText1)
Blank(MyText2) // Crash
The shallow assignment MyText2 = MyText1 simply copy pointers. It does not duplicate buffers.
When copying a text from one variable to another one, use a deep copy :=
If you use = it points to the original text var address. And then when you set the second text to blank, it in fact sets the original text to blank (dispose).
Dedicated Text Methods
Text has a number of custom methods that handle them correctly such as the var.type.write function
var.type.blank function
Procedure Test
var tmpText : Text
tmpText.type.Write(‘Hello’, #tmpText)
tmpText.type.blank(#tmpText)
endProc
Note that we always need to blank the old variable text after we move the content so that there isn't a memory leak.
procedure AnotherProcedure
Var MyText : Text
Var tmpText : text
tmpText= GetXXXText
Write(MyText, tmpText )
tmpText.type.blank(#tmpText)
endproc

How to URL encode a long text?

how can I enter a 2KB formatted TXT (line breaks) that should get URL-Encoded? Just pasting it into the input line doesn't work as the result is not formatted in any way.
https://www.dropbox.com/s/z934uvy6bjz98e3/Screenshot%202016-04-13%2014.28.16.PNG?dl=0
If you have a really complex text, I recommend you to just keep the text in a plain text file somewhere in your disk, and use a File Dynamic Value to reference it, and wrap the whole thing in your URL-Encode Dynamic Value.
Some steps:
Create a file with your content
In your URL-Encode dynamic value, right-click on the Input field and pick File > File Content
Click on the newly created File (Not specified) token, and you'll be prompted to either pick or drag-and-drop a file
You should be good to go. And whenever the file changes, you can send the request, and it should be up-to-date, it's just a pointer to the file.
If you use proper URL encoding, the linebreaks \n should be encoded as %0A. This
foo
bar
baz
will be encoded as
foo%0Abar%0Abaz%0A

Download an excel file as attachment using Qt browser

I am working on Qt browser(code taken from Qt Tab Browser Example). This Qt browser successfully downloads an image file, but not an excel/pdf file. I need to download an excel/pdf file as attachment on click of a button. Excel generation code at back-end uses PHPExcel to generate and finally saves it using 'php://output'.
On browser side, when I read through QNetworkReply's 'readAll()' function, some encoded string '��ࡱ�' gets printed and nothing gets saved in QFile object, totally empty file.
How do I get the desired excel file from this encoded string ?
Please, any help. It is Linux OS and I use LibreOffice if it matters.
Well, got the answer. I was printing QNetworkReply object's content on the console using reply->readAll() before reading it into the file and Qt documentation states that:
QNetworkReply is a sequential-access QIODevice, which means that once
data is read from the object, it no longer kept by the device.
Therefore, i ended up with an empty file. Found this when i printed the size of the 'reply' object. Also, found some eventLoop related help from here(Roozbeh's answer).
Hope it helps someone else as well. Thanks SO !

Is zero-byte file a valid sqlite database?

When I call sqlite3_open_v2() on a zero byte file with flag SQLITE_OPEN_READWRITE, the function returns zero. Then the "PRAGMA quick_check;" statement returns a row containing string "ok". So zero-byte file is considered a valid database? Seems a little counter-intuitive?
Well I don't think it's "valid". If it's zero bytes, it's nothing, other than a reference. Yes you can open it. But that's not working if the file has >= 1 byte.
So as long as the file is 0 bytes, you can open it; once you start making changes, it will become an SQLite file.
If you open a non-SQLite file and try to make changes, it will give you an error message:
Error: file is encrypted or is not a database
The (only) way to create a new, empty database is to attempt to open a non-existing file.
A zero-sized file is considered the same; it's just an empty database.
There are some settings (such as the page size) that must be set inside an opened database connection, but that would affect the structure of the database file.
Therefore, SQLite delays actually writing the database structure until it is actually needed.

append text into the beginning of a textfile

Is there a way that I can always append new text into the beginning of a text file in Qt? i'm using QFile::Append to do it.
file.open(QFile::Append | QFile::Text)
You can't, see the documentation at http://doc.qt.io/qt-5/qiodevice.html:
QIODevice::Append 0x0004 The device is opened in append mode, so that all data is written to the end of the file.
The problem is even worse, a file is usually stored sequentially on disk, appending (better: inserting) at the start of a file would involve moving all data towards the end of the file, thus a reorganization of filesystem blocks. I'm not sure such a filesystem exists, but if, I guess it would only allow insertion of a multiple of the filesystem block size into a file.

Resources