Symfony2 Console and clipboard - symfony

I am using Symfony2 Console as a stand alone component and I am looking for a way to copy some text on clipboard with a command. It must be for all Operating Systems.
For example:
php cli/console smth:copy
And when the command is run it must copy some text to user clipboard.
I've have google it and didn't found anything.
Is that possible an if is it how can i accomplish this task?

Related

How do I run SQL commands through Notepad++?

I am trying to start out using Notepad++ to run SQLite commands. I have tried following two brief YouTube tutorials to get me going. I can run the initial .bat file, but still cannot run the .sql file.
I have a Windows system environment Path variable set to the folder containing sqlite3.exe
"C:\Users\Adam\sqlite\"
I have saved the following file RunSQLite.bat in the folder containing sqlite3.exe
sqlite3.exe testDB.db
I have created a second file queries.sql
SELECT 34;
When I try to run queries.sql from Notepad++, using the RUN command:
C:\Users\Adam\sqlite\RunSQLite.bat "$(FULL_CURRENT_PATH)"
the only file that appears to run is RunSQLite.bat, giving the output:
SQLite version 3.36.0 2021-06-18 18:36:39
Enter ".help" for usage hints.
sqlite>
Can anyone tell where I have gone wrong?
Thanks in advance.
aphopk
This C:\Users\Adam\sqlite\RunSQLite.bat "$(FULL_CURRENT_PATH)" will do exactly the same thing if run at the shell. RunSQLite.bat does not take any arguments so the Run command in npp is working as expected.
sqlite3 takes input from an external file with the .read command.
Path issues notwithstanding a bat file something like this should accomplish the task:
sqlite3.exe testDB.db ".read %1"
Notepad++ is a text editor, so you can now use it to edit your SQL file. After selecting the Language > SQL, Notepad++ will highlight SQL syntax as you type. Try typing some SQL, like
SELECT "Hi";
SELECT * FROM mydatabase WHERE id LIKE 'ID%';
You will see color, bold, and other possible formatting applied to the text you type. If you save the file as something.sql, and then load something.sql in your SQL client, the client will run the SQL commands from that file. If you have an existing somethingElse.sql file, you can open it in Notepad++, which will auto-recognize that it’s SQL and apply the syntax highlighting, allowing you to edit it and save it.
By using the Run > Run dialog, you can run an arbitrary command. For example, if your SQL client has a command-line mode accessed thru sqlclient.exe, you could type
c:\path\to\sqlclient.exe $(FILE_NAME)
If you just run it, that probably won’t show you any results… but if you ran
cmd /k c:\path\to\sqlclient.exe $(FILE_NAME)
It will open a new cmd.exe Windows command prompt, and show the output from that file.
If instead of running, you hit “SAVE”, you can give it a name (which will end up later in the Run menu), and/or a keyboard shortcut, so that you can easily re-use that many times.
If you want to do something more fancy, use the NppExec plugin, which includes a better batch/scripting language. Once again, you can save the NppExec script, and make it show up in the Macro menu.
If Python is a programming language you know or could learn (or if, like me, you know enough other programming languages that you can fake the Python), then the Python Script plugin will allow you to do even fancier stuff. (Python is a complete programming language, and has many libraries written, which could act as an interface between your SQL source file and your database engine; PythonScript has access to a full python2.7 interpreter. For example, you could write a script in Python which executes the commands from your SQL, grabs the results from your database engine, and displays them in Notepad++, either inline with your original SQL code, or in a new text document. You are really limited only by your imagination and knowledge of Python.)

Jenkins for syncing folder in separate environments

We have a legacy system whose code files are stored in a proprietary (binary) format.
You cannot modify them unless:
You use the proprietary editor, which is awful
You export the code to a text file, do your changes using any text editor, then import the code back to it's original format. Any attempt to modify the binary files outside the official editor will corrupt them.
Also, any developer who want to work on the code in their Windows machines must:
Log into their unix account through terminal.
Use a shell script to convert the binary to text.
Download the text file to Windows through FTP.
Code using their preferred editor.
Upload finished code, again through FTP, to the unix server.
Use another shell script to convert text to binary format.
Now to my question(s):
Let's say the developers has all the code converted to text in a predefined folder in their machines. Is it possible to configure Jenkins to automatically upload any changes made to their unix account and convert back into binary? And vice versa.
I am currently working on this, but my solution implies installing a script/service which will run continuously in the developers' machines.
I would prefer this other solution, with the goal of in the future starting a CI/CD pipeline from it.
Use any version control system to store code in text format.
Developers will pull, do job and push changes, all in text format.
In Jenkins create job, use Build Triggers to convert to binaries on any changes in version control system. Copy binaries where needed.

missing sqlite3 history file

I cannot find the command history created by sqlite3.
I have both Windows and Cygwin version.
Using the Windows binary, I can use up/down arrow to see previous commands, even from previous runs of command. But I can't find the file .sqlite_history. This answer suggests it should be in the home directory, but I can't find it there. I do have working a .sqliterc so I know it is the correct directory.
Using the Cygwin binary, I can't get the history to work at all. It seems history is not saved at all?
On the documentation page I cannot find any mention of history at all.
For Windows console programs, the command history is handled by the Windows console itself. There are separate history buffers for different programs and different console sessions, and these buffers are not stored anywhere by default. However, you can use the doskey tool to manage them manually.
Cygwin uses Windows pipes to emulate the Unix tty devices; this often results in programs not detecting that they are running in a console. Try running the program both from within the Cygwin shell and from the Windows shell.
The SQLITE_HISTORY environment variable, if it exists, specifies
the name of the command-line editing history file
To repeat the last command, just press the ↑ key, to search for older
ones — use Ctrl+R shortcut. History search It's faster to find a query than to type it again
By default, SQLite stores the history file in the user’s home directory
and names it .sqlite_history It’s in plain text, so you can view it
in your favorite editor. If you prefer to save it elsewhere, specify
the full path in the SQLITE_HISTORY environment variable.
source: https://antonz.org/sqlite-history
e.g:
cd ~
nano .sqlite_history

Execute Shell command in tideSDK

I need to run a shell command, that will call the script file that I have written in RUBY
For eg: Lets say, I have a file.sh in my working directory, How can I execute this file using TideSDK( I tried Using the Process)
Titanium Desktop createProcess to run shell script
Is there some other alternatives for this kind of stuffs in tideSDK?
Thanks
UPDATE:
I need to run the ruby script after a click of a button.
I think you don't need to run a process for that. TideSDK allows you to run other scripts like php, ruby and python directly in script tags. On the tag you just need to define the script on the type attribute: text/ruby
There ar several methods to include scripts on TideSDK. Take a look on the documentation at www.tidesdk.org. There is a section related to how to get started.
http://tidesdk.multipart.net/docs/user-dev/generated/#!/guide/using_ruby

Executing a command programatically in Eclipse console

From my Eclipse plugin, I want to execute a command and show the results in the Console view (and later do some formatting and hyperlinking and pattern matching, which is done via the org.eclipse.ui.console.consolePatternMatchListeners extension point AFAIK). My question is how to do this? In plain Java, I would use a ProcessBuilder. Do I have to do this and bind the stdout/stderr somehow to a newly created console page or is there another way? Any pointers/experiences are appreciated.
Using Eclipse FAQ, this SO question and the ProcessBuilder, I managed to lazily create my console, show it and echo the input stream of the process to the console's message stream (instead of System.out).

Resources