I wish to find a file in the lower levels of the OS X file system (Below where Spotlight searches) by content.
In other words: I know the sting abc12345 os in a text file someplace.
It could be in /Library or perhaps /Users/joe/Library or even /Users/joe/Library/Caches
How does one file the file?
I.m not sure how to use grep (or even if it the appropriate tool for the job)
Humor a newbee to the command line?
In Terminal, type
find $HOME -type f -exec grep "abc12345" {} \+
That says... starting in your HOME directory, find all things that are files (not directories) and look inside them for the string "abc12345" and print anything you find. The \+ at the end says to look in several files in one go, rather than one at a time.
If you want to read all about the find command, or any other command, type find in the Terminal, put your mouse over the word and right click, then left-click Open man Page.
Related
I need to add a new path (sumatraPDF) on my PATH variable.
I don't know why it does not work...
I think everything is right but when I try to execute sumatrapdf.exe from CMD it cannot find the program.
This is what I did:
The path is correct, I checked it 1000 times.
The idea is use LaTeX with sublimetext and when I save a .text file sumatra has to open and show to me the result. If I want that I have to add the path of SumatraPDF... but it does not work.
I think you are editing something in the windows registry but that has no effect on the path.
Try this:
How to Add, Remove or Edit Environment variables in Windows 7
the variable of interest is the PATH
also you can type on the command line:
Set PATH=%PATH%;(your new path);
Another method that worked for me on Windows 7 that did not require administrative privileges:
Click on the Start menu, search for "environment," click "Edit environment variables for your account."
In the window that opens, select "PATH" under "User variables for username" and click the "Edit..." button. Add your new path to the end of the existing Path, separated by a semi-colon (%PATH%;C:\Python27;...;C:\NewPath). Click OK on all the windows, open a new CMD window, and test the new variable.
I founded the problem:
Just insert the folder without the executable file.
so Instead of:
C:\Program Files (x86)\SumatraPDF\SumatraPDF.exe
you have to write this:
C:\Program Files (x86)\SumatraPDF\
In answer to the OP:
The PATH environment variable specifies which folders Windows will search in, in order to find such files as executable programs or DLLs. To make your Windows installation find your program, you specify the folder that the program resides in, NOT the program file itself!
So, if you want Windows to look for executables (or other desired files) in the folder:
C:\PHP
because, for example, you want to install PHP manually, and choose that folder into which to install PHP, then you add the entry:
C:\PHP
to your PATH environment variable, NOT an entry such as "C:\PHP\php.exe".
Once you've added the folder entry to your PATH environment variable, Windows will search that folder, and will execute ANY named executable file you specify, if that file happens to reside in that folder, just the same as with all the other existing PATH entries.
Before editing your PATH variable, though, protect yourself against foul ups in advance. Copy the existing value of the PATH variable to a Notepad file, and save it as a backup. If you make a mistake editing PATH, you can simply revert to the previous version with ease if you take this step.
Once you've done that, append your desired path entries to the text (again, I suggest you do this in Notepad so you can see what you're doing - the Windows 7 text box is a pain to read if you have even slight vision impairment), then paste that text into the Windows text box, and click OK.
Your PATH environment variable is a text string, consisting of a list of folder paths, each entry separated by semicolons. An example has already been given by someone else above, such as:
C:\Program Files; C:\Winnt; C:\Winnt\System32
Your exact version may vary depending upon your system.
So, to add "C:\PHP" to the above, you change it to read as follows:
C:\Program Files; C:\Winnt; C:\Winnt\System32; C:\PHP
Then you copy & paste that text into the windows dialogue box, click OK, and you should now have a new PATH variable, ready to roll. If your changes don't take effect immediately, you can always restart the computer.
The path is a list of directories where the command prompt will look for executable files, if it can't find it in the current directory. The OP seems to be trying to add the actual executable, when it just needs to specify the path where the executable is.
Try this in cmd:
cd address_of_sumatrapdf.exe_file && sumatrapdf.exe
Where you should put the address of your .exe file instead of adress_of_sumatrapdf.exe_file.
I need some extra pairs of more experienced eyes on these declaration warnings:
and this code:
As you can see; despite what the declaration warnings may say, I indeed have declared the file in the OPF. The OPF is in its standard location inside the OEBPS folder. I have spent a good few hours trying to find what is wrong, and I still don't see why epubcheck isn't seeing the declaration.
Things that I've checked:
• The declaration is between the <manifest></manifest> tags.
• The path is correct. (Unless I'm missing something)
• I've tried to make sure that the mimetype file comes first in the zip.
Since I'm very new to creating epubs, I don't know if I'm missing something else entirely, like, there's something wrong with the code before the css declarations. Would you have any suggestions as to what I could check?
It turns out, there was a discrepancy between the spelling of the iexcercises folder and the declared iexercises folder. There was no 'C'.
Also, I found a very helpful comment on a forum site while I was troubleshooting the epub; it describes how to save the epubcheck errors and warnings log into a text file for easier browsing.
Source
Comment by bernieh2...#gmail.com, Nov 6, 2011 || My five cents for
non-techies...
For using epubcheck on a Windows PC, do the following:
(1) Download and unzip the latest epubcheck version wherever you
please on your computer (That is, rename the unzipped folder as you
like and put it on whatever directory you may deem it fit). For the
sake of this explanation, let's rename such unzipped folder as
"my_epubcheck" (w/o the "" characters).
(2) Open any ASCII text editor of your choice (e.g. notepad) and type
the following:
java -jar epubcheck-1.2.jar file.epub> report.txt 2>&1
pause
(3) Save this as an ASCII text file (name it, let's say,
"validate.bat" -- w/o the "" characters) on your my_epubcheck folder.
The only important thing is that the extension MUST be .bat
(4) To check any epub file, do the following:
Copy the file you intend to check to your my_epubcheck folder. Rename it as "file.epub" (w/o the "" characters).
Double-click on the validate.bat icon in your my_epubcheck folder.
A new (system) window will appear on your screen, epubcheck will start working and then pause with the message "press any key to
continue..."
Press any key.
Examine the contents of your my_epubcheck folder. You'll find a file named report.txt.
Double-click on the report.txt icon to see the results of your test.
IMPORTANT: Should you use a different epubcheck version, replace
epubcheck-1.2.jar on the validate.bat file with the exact name of the
.jar file you're using (find the name in your my_epubcheck folder).
Hope this helps,
Bernieh.
Again, I hope this helps someone!
I think (correct me if I am wrong) that it is better to put a / at the end of most of url. Like this: http://www.myweb/file/
And not put / at the end of filenames: http://www.myweb/name.html
I have to correct that in a website with a lot of links. Is there a way I can do that in a fast way. For instance in some programs like Dreamweaver I can use find and replace.
The second case is quite easy with Dreamweaver:
- Find: .html/"
- Replace: .html"
But how can I say something like:
- Find: all the links that end with a directory. Like http://www.myweb/file
- Replace: the same link but with a / at the end. Like http://www.myweb/file/
Your approach may work but it is based on the assumption that all files have a file extension.
There is a distinct difference between the urls http://www.myweb/file and http://www.myweb/file/ because the latter could resolve to http://www.myweb/file/index.php, or any other in the default set configured in your web server. That URL could also reference a perfectly valid file which doesn't contain a file extension, such as if it were a REST endpoint.
So you are correct insofar as you should explicitly add a "/" if you are referring to a directory, for example if you are expecting the web server to look up the correct index page to respond, or doing a directory listing.
To replace the incorrect URLS, regular expressions are your friend.
To find all files which have an erroneous "/" you could use /\.(html|php|jpg|png)\//, adding as many different file extensions into that pipe-separated list as you like. You can then replace that with .$1 or .\1 depending on your tool.
An example of doing this with Perl would be:
perl -pi -e 's/\.(html|php|jpg|png)\//.\1/g' theFileYouWantToCheck.html
Of (if you're using a Linux-based system) you can automate that nicely with find:
find path/to/html/root -type f -name "*.html* | xargs perl -pi -e 's/\.(html|php|jpg|png)\//.\1/g'
which will find all html files in the directory and do an inline find and replace. Assuming you're using version control, it's then easy to see the changes it's applied :)
Update
Solving the problem for adding a slash to directories isn't trivial. The approach I'd take:
Write a script to recurse through your website structure locally, making a list of all files
Parse the HTML files to extract all href=".*" and replace them with href=".*/" only if the end of the URL isn't present in the list extracted by the first script.
Any text-based find and replace is not going to be aware of whether the link is actually to a file or not.
Let me explain my situation with some dummy file names.
I am working in directory 'A' which has a sub directory 'a'. I am running a function 'func1' which is present in both folders. 'func1' needs 'file1' & 'file2' during its execution. 'file1' & 'file2' are present in both folders with some parameters changed inside them. It is not possible for me to change file names at all.
Now, the problem is that when I am running 'func1' in 'A', everything is working fine. But, when I run 'func1' in 'a' using 'addpath/rmpath', rather than using 'file1' & 'file2' from 'a', it is using 'file1' & 'file2' from 'A' which is producing wrong results.
Please tell me how can I change path so that when I run 'func1' in sub directory 'a', it always use 'file1' & 'file2' from 'a' rather than directory 'A'.
I hope I am clear in my explanation :S
If I have understood correctly, you are hoping that if you use addpath to add the subdirectory to the search path, Matlab will give the search path precedence over the current directory. Unfortunately, it is precisely the other way around, as per the Matlab documentation: "Functions in the current folder take precedence over functions with the same file name that reside anywhere on the search path." - and this also applies to the load function when reading data files. (incidentally, I suspect that for this reason you are also not running the version of func1 that you think you are running - try typing which func1 to find out).
Anyway, the solution here is to make sure that Matlab picks the right version of file1 and file2, which you could do in several ways:
Change your working directory to a, since the working directory has precedence: cd a
Put the two versions into separate subfolders, e.g. a and b, and use addpath to add them separatley
Change the different versions of func1 to have explicit references to the files, i.e. load('./a/file1')
With addpath and rmpath you modify the search path in Matlab. Your search path basically is a list of folders where Matlab looks for functions. Not for files you want to open.
If you have your files in folder A and this is your current working directory, Matlab will look for the files in A. If you change to a and change your working directory accordingly, Matlab will open the files in a - this has nothing to do with your search path. If you want to open files from a specific directory, use the entire path in the open command:
fileID = fopen('/path/to/A/file1');
In your case, the case may be that the fopen is applied in the way explained above. If you want Matlab to always open files from the current working directory, change it to:
fileID = fopen('file1');
Vim noob here. I have code folding working in most places, via indent mode, but for some reason I cannot get Vim to fold .html.erb files in ruby... even with indents.
Here's the relevant region of my vimrc. Is there something else I need to do to make Vim aware of the erb files? Is it possible to customize my folding per file type?
I'm running all the Janus plugins, so have rails.vim, etc. all installed.
let ruby_fold=1
set foldmethod=indent
set foldcolumn=0
set foldlevel=99
nnoremap <space> za<cr>
It's a difficult question, because there's probably something in your vim configuration that inhibits folding and I, for example, can't reproduce it. But I can suggest a few things you could try.
First of all, check what the values of those settings are in the actual buffer. Meaning, open up an erb file and check if the settings are correct. In order to do that, you can type, for example, set foldmethod, which will echo the current value of foldmethod to the screen. If one of the settings doesn't match the ones in your .vimrc, then that might be the problem.
Also, see if the file really does have the "eruby" filetype. If it's not displayed in your statusline, you could check that with set filetype.
Most importantly, one way of customizing settings per filetype is by creating a file with the filetype's name inside the ~/.vim/ftplugin directory. In your case, you can create the file ~/.vim/ftplugin/eruby.vim and put any filetype-specific settings in it. Setting them with setlocal instead of set will keep them local to the file. If it turns out the settings for erb are off, you can "fix" them by putting the values you want there.