Unix - Tail Utility would open the file or not - unix

Can anybody help me to sort this out.
What is the logic of Tail -f utility in Unix.
Is it open the log file to check the updated content or is there any other way to get this information. All the implimentation of Tail utility says that it will open the fileenter link description here

As per the source code of tail utility, it is opening the file in read mode not in write mode.
So the answer is, I would say TAIL is opening the file for checks. But along with that i would like to answer one more question, since it is opening in read mode the other process that tries to open the same file will not face any issues.

Related

Creating an executable R-file

I want to make an executable R-file (for automation purposes). Therefore I concluded the following tutorial.
After completion however nothing happens... Only the .Rexec file opening in RStudio (in stead of running it and showing me the pop up...
Any more people experienced this? Any clues to where to look to fix this?
The tutorial you gave is useful. However, it missed something.
After done all the things in that blog, you still need to do one more thing. Right click on the "test.Rexec" file and choose "open with" and then select "RScript". Maybe you need to find RScript in your system which is usually here:
C:\Program Files\R\R-3.2.1\bin\Rscript.exe
Remeber to check the "Always use the selected program to open this kind of file".
Next time, when you double click the "test.Rexec" file, evethying would be okay.
I found no need to create Rexec file.
I created .bat file and then set it up in Task Scheduler.
The .bat file opens up the Rscript.exe, as shown in prev answer above. The .bat file then points to the .R file, that I want to be executed.
For some time, I could not get it to work, but solution was to point to Rscript.exe as mentioned above. Then it will not open up in compiler.
Works fine for me.

getting chromebook file to move or contents to paste

On a Chromebook (Dell Chromebook 11), using Vim, I saved a file to /home/user/filename.txt . How can I get that content anywhere else in the world?
gmail attach a file does not let me go to /home/user
copy with Ctrl-C within Vim does not result in my text being in the paste buffer
I can see file:///home/chronos/user/Downloads/ in a browser, so if I could save content to /home/chronos/user/Downloads from Vim, I could get text out, but I can't do that.
In sum, I'd like any way to get the content of filename.txt anywhere outside the machine (cut and paste available in a browser, moving the file, resaving to a thumb drive). Thanks for any help.
file:///home/chronos/user/Downloads/ is literally the same Downloads folder. However, you can do that with terminal as well (if you're linux geek, this should be pretty simple)
Since you said you were using Vim, I assume that developer mode is on. In the shell, you can make use of mv linux command to move it to downloads.
mv /your/path/to/file.txt ~/Downloads/file.txt
Cheers!

XCode open file at error line for custom build script

I Apologize if this question has already been asked. i can't seem to find it anywhere if it has.
I have a custom build script use to syntax check some php files and upload them to a server, and this is executed as a part of the build process. since this script is used to parse inline php statements (embedded in objective c blocks using macros) it's fairly critical this script happens on each build. the actual execution is working fine, i'd just also like to be able to open a particular file when there is an error, and locate the cursor in the approximate location.
i have found that since xcode is configured on my system to open .php files by default (not sure if that's the norm or if i did it manually at some point), using
open filename.php
in a shell script opens the file.
i'd like to be able to specify the line number too.
eg something along the lines of
open filename.php --args --jump-to-line 1234
(--args is a switch for "open" meaning pass the arguments on to Xcode)
any ideas?
You can use the xed command. Only works for Xcode 3 though, not other editors. For Xcode 4, try this
See man xed

Plot() error when using REngine.Rserve

I'm now work on a project which wants to use org.rosuda.REngine.Rserve to use facilities of R by C#. I have a particular problem that when I run the following code in C# client side:
c.eval("pdf(file=\"plots.pdf\", width=11, height=8.5)");
c.eval("plot(1,2)");
An error occour which said
Error in plot.new():cannot open file '', reason No such file or directory
But I checked that the file "plots.pdf" has already been created successfully by "pdf.." function. In R semantics, the successive plot() will output figure to the active device opened by the "pdf(...)" function, i.e. "plots.pdf" this time. But I'm very confused that why the error indicated that the file is ''.
I use R-2.15.0 and Rserve-1.7.0 in linux server side.
I'm eager to see your response.
Thanks a lot.
Try this code :-
c.eval("dev.off()")
A folder named (null).1001.1001
Related answer at
Cannot open file '', reason No such file or directory
suggests using file.path as a alternative to paste for creating filenames with platform-independent path separators.
Comments suggest dev.off(). I had better luck with graphics.off(). The difference is that dev.close() closes the current device, graphics.off() closes all open devices.
But my solution turned out to be
https://askubuntu.com/questions/721485/what-is-folder-null-1001-1001
I found a mysterious folder named (null).1001.1001 (Rserve is running as uid 1001, gid 1001 on Linux). I create this folder at the start of my session and I'm good to go. The presence of this folder seems to help in my case, but I don't know (yet!) what that folder is.

Can R cause a file to be opened by another program?

This is a bit of a strange question, but I thought people here might be interested.
Is it possible to have R cause a file to be opened in another program? For example, could you write a command line that would cause a music file to start playing? The potential application would be that after a model is finished running, music would start to play, alerting you to the model's completion.
In addition to system, on Windows at least you can use shell.exec which will open the file using the application specified in the Windows file associations. For example, shell.exec("file.txt") will open a text file in your favourite text editor, shell.exec("file.mp3") will launch a media player, etc.
There is audio package which allow to play wave files:
require(audio)
wave_file <- dir("C:/Windows/Media", pattern="\\.wav$", full.names=TRUE)[1] # some random windows wave file
f <- load.wave(wave_file)
play(f)
You can do this by calling the system() function.

Resources