scripting

Running a Qt application at startup

假装没事ソ 提交于 2019-12-18 06:52:56
问题 I wrote a Qt application that is going to run on Linux. It supposed to run at startup. It's supposed to run on every Linux- Suse, RedHat etc. What script should I write and Where to put it? I don't know how to write scripts at all, so I would appreciate it if you will attach an example. 回答1: You need to create a desktop entry file for your application (see here) and to put it in user's $HOME/.config/autostart directory. Any desktop entry file in that dir will get executed when a Window

Running a Qt application at startup

眉间皱痕 提交于 2019-12-18 06:50:53
问题 I wrote a Qt application that is going to run on Linux. It supposed to run at startup. It's supposed to run on every Linux- Suse, RedHat etc. What script should I write and Where to put it? I don't know how to write scripts at all, so I would appreciate it if you will attach an example. 回答1: You need to create a desktop entry file for your application (see here) and to put it in user's $HOME/.config/autostart directory. Any desktop entry file in that dir will get executed when a Window

Is it possible to redirect the output of a batch file inside the script?

我只是一个虾纸丫 提交于 2019-12-18 05:49:33
问题 I would like to set the standard output of a batch script to go to a file. I would like to do this inside the script if possible. Note: I do not want to do this: foo.bat > StdOut.txt I would like to do something inside the script to redirect the output to a file For example: foo.bat :: Redirect standard output to StdOut.txt :: Insert batch code to do what I want here. 回答1: One way of doing it is the following. Use the call command to execute a label in the script. Edit I realized the first

Find line number of function call from sourcing file

耗尽温柔 提交于 2019-12-18 05:42:52
问题 I'm trying to find a way to find out what file and line number a function was called from. The function is in a library file which is being sourced by my script. file1: $source file2 $warn_me "Error: You didn't do something" file2: $function warn_me() { $ message=???? $ echo ${message} $} Desired Output: $: file1:Line 2: Error: You didn't do something The function call already occurs many times in many files so I'm trying to find a way to do this without changing that. Previously the warn_me

sh read command eats slashes in input?

℡╲_俬逩灬. 提交于 2019-12-18 05:28:07
问题 Perhaps easiest to explain with an example: $ echo '\&|' \&| $ echo '\&|' | while read in; do echo "$in"; done &| It seems that the "read" command is interpreting the slashes in the input as escapes and is removing them. I need to process a file line by line without changing its contents and I'm not sure how to stop read from being smart here. Any ideas? 回答1: Accrding to: http://www.vias.org/linux-knowhow/bbg_sect_08_02_01.html : -r If this option is given, backslash does not act as an escape

Scala script in 2.11

♀尐吖头ヾ 提交于 2019-12-18 05:16:05
问题 I have found an example code for a Scala runtime scripting in answer to Generating a class from string and instantiating it in Scala 2.10, however the code seems to be obsolete for 2.11 - I cannot find any function corresponding to build.setTypeSignature . Even if it worked, the code seems hard to read and follow to me. How can Scala scripts be compiled and executed in Scala 2.11? Let us assume I want following: define several variables (names and values) compile script (optional improvement)

Scala script in 2.11

我怕爱的太早我们不能终老 提交于 2019-12-18 05:16:03
问题 I have found an example code for a Scala runtime scripting in answer to Generating a class from string and instantiating it in Scala 2.10, however the code seems to be obsolete for 2.11 - I cannot find any function corresponding to build.setTypeSignature . Even if it worked, the code seems hard to read and follow to me. How can Scala scripts be compiled and executed in Scala 2.11? Let us assume I want following: define several variables (names and values) compile script (optional improvement)

Enable dropping a file onto a Ruby script

痴心易碎 提交于 2019-12-18 05:12:32
问题 I'm creating a small ruby script to resize images and save them in a specified directory. I'd like the application to be as transparent as possible. Is it possible to allow file dropping onto my Ruby script in all platforms? For instance, the user drags a file onto the script, which then takes the file path as an argument and resizes the image accordingly -- No GUI, no console, etc.. 回答1: The behavior of drag & drop is dependent on the OS (and in case of Linux of the Window Manager), so no.

VBA: How to get the last used cell by VBA code when the last error occured in a Workbook/Worksheet?

余生长醉 提交于 2019-12-18 05:06:13
问题 Eventually, I want to move the cell to the location where the last error occured. Edit: Forgot to say that I'm using Excel 2003. 回答1: As requested in comments... Look up the 'Caller' property of the 'Application' object in the Excel VBA help. When you use it from a VBA routine, it will tell you where the call to the routine came from - what Range, Chart, etc. An important thing to be aware of when using 'Application.Caller' is that it isn't always a Range object. Look at the help, but the

How do you run a long PHP script and keep sending updates to the browser via HTTP?

百般思念 提交于 2019-12-18 04:54:32
问题 How do you run a long PHP script and keep sending updates to the browser via HTTP? Something to do with output buffering but I don't know exactly how. 回答1: Output Buffering is thinking in the right direction, you start output buffering with ob_start() just like you would with sessions ( session_start ) somewhere in the top of your script, before any output is sent. Then, you can use ob_flush and flush to keep flushing the output. For example, if you are in a foreach loop and at the end of