Make Checkstyle's suppresion rule file to ignore path separator - checkstyle

We have a suppressions.xml file, where we used rules such as:
<suppress checks="JavadocPackage" files="/impl/"/>
This worked for anyone on Unix or Mac OS X. However on windows the files in that package don't match. We had to rewrite it as follows:
<suppress checks="JavadocPackage" files="[\\/]impl[\\/]"/>
However, this is ugly, especially with longer paths. Is there a trick to make it work with unix-style paths on Windows?

Related

How to set silent_functions(1) as default in Octave? [duplicate]

I'm new to octave, and want to run a few commands on startup automatically every time it opens.
I typed "help startup" and saw "Octave uses the file ".octaverc". I did a bit of searching online at https://www.math.utah.edu/docs/info/octave_4.html, and saw the .octaverc file should be in the following path:
OCTAVE_HOME/lib/octave/VERSION/startup/octaverc
PROBLEM:
In that directory I don't have a startup folder, only "oct" and "site". I do see hidden files, which was my first thought since the file begins with "." character. So I then used Agent Ransack in the directory, and still nothing came up.
QUESTION:
1) Do I have to make the startup folder and octaverc file myself?
2) If so, does one, both or none have to be hidden?
3) Can it be a txt file, or does it have a special extension?
4) Do I just type the commands straight into the file or is there special formatting?
NOTE:
In case I'm going about this the wrong way, there are the operations I'd like to have run on startup:
PS1('>> '), addpath('D:\Users\Me\Desktop'), clc
Thanks ahead of time for the help!!
Possible locations (and their differences) for octaverc files are specified in the documentation.
In short, these are, from more general to specific:
octave-home/share/octave/site/m/startup/octaverc (most generic, for entire system)
octave-home/share/octave/version/m/startup/octaverc (to cover for more than one octave versions installed on the system, possibly requiring different startup scripts)
~/.octaverc (where ~ is unix-speak for a user's home directory -- covering for user-specific startup files)
.octaverc files in any directory, creating specific startup conditions for specific directories
octaverc files are effectively simple script files that are executed from most generic to most specific each time octave starts. Therefore, in the presence of conflicting commands, the more specific file can effectively be used to override the more generic behaviour.
Octave also supports (but does not recommend) the use of the startup.m file, for matlab compatibility.
You might also want to check out pathdef and savepath as well.
As a more general tip, if you ever want to search for a specific keyword from the documentation (e.g. octaverc), you can type this kind of search query in duckduckgo (or google):
octaverc site:https://octave.org/doc/interpreter/
(or just download the documentation as pdf and search the pdf)
Found the solution, the file was in the following path:
OCTAVE_HOME/share/octave/site/m/startup
to find out where OCTAVE_HOME is for you, just type "OCTAVE_HOME" into your Octave command line window.
ANSWERS:
1) You do not have to make a startup octaverc file yourself
2) The file is actually not hidden, so it should be easy to find given you're looking in the right place.
3) The file doesn't have an extension. It's just octaverc.
4) Under the last line of the existing file, you can just append commands as you would type them at the Octave command line window.
the last(7.3.0) octave version placed HERE:/ does not find the THERE:/openEMS/matlab directory even it is already loaded with octaverc or addpath. It keeps looking into the work dir where openEMS is not placed and does not recognize, for instance, the 'physical_constants.m' file.

Cross compiling with mingw64 - wildcard expansion

I'm trying to cross compile GNU grep for Windows from Fedora, using their mingw64 cross compilers. The process is really easy, with one exception. By default, it appears that mingw64 doesn't expand wildcards on the command line, so that grep FOO * gives "Invalid argument: *" rather than searching all files in the current directory.
After a bit of research, I found that there is an external symbol, _dowildcard in the mingw64 CRT, that will trigger wildcard expansion if set to -1. But I've found no useful documentation on how to set this (maybe because it's considered obvious ;-)).
I could modify the source code to set the variable, but I'd much prefer to not have to modify the source if at all possible. (I want to set up an automated build, and applying code patches just adds complexity that I'd like to avoid). Is there any way to set _dowildcard from the configure or make command line? I seem to remember older versions of mingw having a setargv.obj file that could be linked into your project to enable wildcard expansion - is there anything similar for mingw64?
Answer from #ssbssa above:
There is a file CRT_glob.o file supplied with the mingw packages, in /usr/x86_64-w64-mingw32/sys-root/mingw/lib/CRT_glob.o (or the corresponding location for 32-bit) that you can link with your executable to activate command line globbing.
You have to specify the file by full pathname for the linker to find it.

Choosing line separator to prevent blank lines

My local development environment based on Windows and my production environment based on Linux.
I have an issue about "line separators (CR, LF, CRLF)". Every time I got blank lines in my code.
Which line separator type to should I choose for prevent the blank lines?
I am working in this exact environment as well, except my development environment is also in Linux.
The aggravating problem I have run into is editing CRLF text files in the Linux environment, whether they were Apache files, or shell scripts. Mainly, I couldn't easily edit them in Linux through vi, which is unhappy with the CR. If you never do that, then it may not be a problem for you. But if you see blank lines in your code, it might be something similar.
For HTML and PHP, Apache running in the Linux environment has never complained when serving up files or reading configuration files in CRLF.
The other side of it, was that it was hard to wrangle PHPStorm. The related post #LazyOne provided works, but PHPStorm is stubborn if you have been using CRLF as I had when I switched this setting. I found I still needed to change files by hand at times, which you can do along the bottom right of the editor window. You will see CR, LF or CRLF and you can click and change the setting for the particular file loaded in the editor:
As a side note, if you use git, you can set up a .gitattributes file in the project directory with this:
# Set the default behavior to always be linefeed for linux
* text eol=lf
Which causes git to normalize to LF as it states in the git documentation:
Set to string value "lf"
This setting forces Git to normalize line endings to LF on checkin and
prevents conversion to CRLF when the file is checked out.

Nitrous.io pathname

I need to test in the browser because I am using WebAudio. Okay, so since I'm using tape, I run
browserify -t babelify index.js | browser-run -p 3000
The problem is that I'm using Nitrous.io, so the test complains:
Error: Cannot find module '__mySource/models/audio' from '/home/nitrous/code/mrr/source/__mySource/test/audio/model/metronome'
So now I need I need to go into my code and customize all imports for the sake of Nitrous. So instead of
import {initialize} from '__mySource/models/audio';
I now need to hack all imports
import {initialize} from '/home/nitrous/code/mrr/source/__mySource/models/audio';
which is clearly unacceptable. Hopefully there is a simple fix for this problem.
Typically I recommend that developers should use relative paths (starting with a './' or '../') when importing or requiring files. Absolute paths can vary from machine to machine so those are also problematic.
It is possible to define aliases that act like pseudo-packages but those can be tricky to configure and are often more confusing to developers than just using the standard commonjs naming.
So try using relative paths for your imports (or requires) that don't refer to files inside another actual package.

mysql not in my PATH for some reason

I've installed mysql on several macs and on one of them mysql is not in the path. If I export it it shows up in the path correctly, but upon reboot, disappears.
What should I do to get the machine to keep it in the path and what are the machines that DO have it in their path doing differently?
Any thoughts appreciated.
Check the /etc/profile file on the macs it's working on. The path file should be defined there, which would be for all users. The ~/.bash_profile mentioned is for an individual user.
You should see something similar to the previously mentioned
export PATH=/path/to/mysql_folder:$PATH
in this file, though it may be a bit buried. If you don't see PATH defined here, try /etc/environment. Failing this, I'm not sure where else OS X would define the path variable, but being a Unix system, there is a common file read by all profiles where it sets it.
Once you find it, compare the definition on the machines it works on to the one it doesn't, and edit accordingly. If it looks the same, then something's amiss, and you should let us know.
if it is linux you have to add this export to your profile script. if windows edit PATH in My Computer | Properties | Edit environmental variables
To one of your init files (such as /home/username/.bash_profile) add a line like:
export PATH=/path/to/mysql_folder:$PATH