I've been using a lot the .dir-locals.el file for all of my different projects (personal / work / community / etc) and I have defined a couple of settings depending on the project.
Today, I tried to change the value of browse-url-generic-program since I need Google Chrome for my work and Firefox for my personal projects. So, I added this to my .dir-locals.el
((nil
. (
;; use Firefox as browser for this project
(browse-url-generic-program . "firefox")
)))
and also I have this in my .emacs because the documentation says that it's a risky variable:
(custom-set-variables
'(safe-local-variable-values
(quote
((browse-url-generic-program "firefox")
(browse-url-generic-program "google-chrome")))))
and I can see this message in the description/documentation of this variable:
browse-url-generic-program’s value is "google-chrome"
Original value was nil
This variable may be risky if used as a file-local variable.
However, you have added it to ‘safe-local-variable-values’.
But Emacs still keep asking me about The local variables list in /home/humitos/ contains variables that are risky (**). Do you want to apply it? and the only variable mentioned there is browse-url-generic-program with the value "firefox".
What am I doing wrong?
Related
I mean to set the default legend font size (and other properties as well) in my Octave script.
Both set (activated separately)
legend_fontsize = 14;
set(0, "defaultlegendlocation", "northoutside");
set(0, "defaultlegendfontsize", legend_fontsize);
produce error: invalid default property specification.
What is the correct syntax?
In Matlab, this suggests it should not throw any error, and it should possibly work.
In theory you are right that this should also work in octave, since according to the manual, octave supports the same syntax, for all kinds of graphical object 'types'.
However, legend is a special case, because it is not implemented as its own graphical object 'type' in octave; instead, as stated in the documentation:
A legend is implemented as an additional axes object with the 'tag'
property set to "legend". Properties of the legend object may be
manipulated directly by using 'set'.
Therefore, this means that the defaultlegendfontsize strategy won't work.
It also means that, since in principle a 'legend' object is an 'axes' object in disguise, set( 0, 'defaultaxesfontsize', 30 ) will work ... but obviously with unintended consequences affecting all axes objects.
You could point that out in the octave bug tracker if you'd like.
In the meantime, you could always do something like the following in your .octaverc as a workaround:
function h = legend( varargin )
% Wrapper to builtin legend function, also setting font to default size of 30
h = builtin( 'legend', varargin{:} )
set( h, 'fontsize', 30 )
endfunction
This effectively shadows the builtin 'legend' command with a custom one, that applies 'default' values as an extra step before returning the handle.
PS: Having said this, one needs to be careful with setting such defaults, in the case of code dissemination and re-use which assumes such defaults are preset in all environments.
This is a common point of caution in R users against creating elaborate .Rprofile files, for instance.
PS 2: Alternatively, a nice approach when you have lots of defaults to apply would be to create a function applydefaults( handle ) which applies all your preferences in one go, and call it at the end of whatever object you want to apply these to. This is what I used to do in my thesis. It may sound like slightly more effort, but you end up thanking yourself 1 month down the line when it's 100% clear what is happening and where the formatting changes came from!
I want to change the path to images I have on my site however there are hundreds to change.
Is there a batch process for this?
You should try the most obvious approach: global find & replace.
Edit | Find | Replace in Path... (Ctrl + Shift + R using Default keymap).
Search functionality allows you to specify the very narrow search scope -- only specific folder .. or user-defined custom scope where you can include on per-file level.
If find finds too many possible occurrences (search is too broad -- e.g. folder name is not too unique etc) you can still review and exclude particular occurrences before doing actual replace part.
I recently found out that you can get Octave to warn when you are using features not compatible with Matlab. Due to working with others this feature is appealing.
warning ('on', 'Octave:matlab-incompatible')
However when I use it in even simple scripts
warning ('on', 'Octave:matlab-incompatible');
x = 5;
plot(x);
I get many warning due to the implementation of plot using non-Matlab compatible features. For example
warning: potential Matlab compatibility problem: ! used as operator near line 215 offile /usr/share/octave/3.8.1/m/plot/draw/plot.m
Is there a way to turn off these warnings? I don't care if plot is implemented using non-Matlab features because when I use Matlab its implementation will be fine.
No that is not possible which makes the Octave:matlab-incompatible almost useless. Also, that warning is only printed for syntax so you can still use Octave only functions (such as center or sumsq) without any problem.
I recommend you use a text editor that has separate Matlab and Octave syntax highlight (such as gedit) and avoid things that don't get highlighted.
Here's how it's done in Matlab, which looks to be similar to the Octave case:
warning('on', 'Octave:matlab-incompatible'); % Your Octave warning
x = 5;
WarnState = warning('off', 'Offending_MSGID'); % You'll need to get the specific ID
plot(x);
warning(WarnState); % Restore
Yes, it's a bit clumsy. There's no way to specify that a warning is not enabled within a particular file that I know of.
One thing that can happen is that the code an be interrupted by the user or an error before the warning state is restored. In this case, Your system now is in an unknown warning state. One way to avoid this is to use onCleanup. This function is called when a function exits, even if it exits due to an error. You might rewrite the above as:
warning('on', 'Octave:matlab-incompatible'); % Your Octave warning
x = 5;
WarnState = warning('off', 'Offending_MSGID'); % You'll need to get the specific ID
C = onCleanup(#()warning(WarnState));
plot(x);
...
Note that onCleanup won't be called until the function exits so the warning state won't be restored until then. You should be able to add a warning(WarnState); line to manually restore before if you want. Just be sure that whatever function onCleanup is calling can never return an error itself.
In my code I use Registry pattern like that:
$data = Registry::get('classA')->methodOfClassA($param1, param2);
Registry class stores instances of some classes in internal array, so in any place of my code I can call class methods for handy functions like in line above.
But, the problem is that PHP-storm does not autocomplete when I type:
Registry::get('classA')->
And, that is worse, it does not go to declaration of the method "methodOfClassA" when I hover mouse cursor holding mac-button (analogue of control-button on windows)
I suppose, that IDE AI is not so good to recognise cases like that, but maybe there is some tricks to do that in a hard way? hardcoding classes+method names in some file and so on...
At least, I want it to understand to go to method declaration when I click method name...
Any advices?
http://confluence.jetbrains.com/display/PhpStorm/PhpStorm+Advanced+Metadata
This link describes it all -- it is already used by multiple projects/frameworks/code-generation helpers, like Magento, for example (some other can be found mentioned in the comments of the actual ticket).
For other situations you may want to check out DynamicReturnTypePlugin plugin (Settings | Plugins | Browse repositories...) -- have not tried myself and therefore cannot comment how good/fast/laggy it is.
You can always indicate the variable type in two steps:
/** #var $foo MyClass */
$foo = $this->get('MyClass');
$foo->bar(); // autocomplete works
According to Adobe's Manual on PDF Open Parameters PDF files can be opened with certain parameters from command line or from a link in HTML.
These open Parameters include page=pagenum, zoom=scale, comment=commentID and others (the first parameter should be preceded with a # and the next should be preceded with a &
The official PDF Open Parameters from adobe gives this example:
#page=1&comment=452fde0e-fd22-457c-84aa-2cf5bed5a349
but the comment part doesn't work for me!
page=pagenum and zoom=scale work for me well. But comment=commentID does not work. I tried on Adobe reader 6.0.0 and Adobe Pro Extended 9.0.0: I can't get to the specified comment.
Also, I get the comment ID by exporting the comments in XFDF format and in the resulting file, there is a name attribute for every comment that I hope corresponds to the ID (well, the appearance looks like the example in the manual).
I thought maybe there is a setting that I should first enable (or maybe disable in adobe) or maybe I am getting the comment IDs wrong, or maybe something else?!
Any help would be extremely appreciated
According to the docs, you must include a page=X along with your comment=foo. Your copied sample has it, but it's copied from the docs, not something you did yourself.
Are you missing a page= when setting comment?
BASTARDS!
From the last page of the manual you linked:
URL Limitations
●Only one digit following a decimal point is retained for float values.
●Individual parameters, together with their values (separated by & or #), can be no greater then 32 characters in length.
Emphasis added.
The comment ID is a 16-byte value expressed as hex, with four hyphens thrown in to break up the monotony. That's 36 characters right there... starting with "comment=" adds another 8 characters. 44 characters total.
According to that, a comment ID can NEVER WORK, including the samples they show in their docs.
Are you just trying it on the command line, or have you tried via a web browser too? I wonder if that makes a difference. If not, we're looking at a feature that CANNOT WORK. EVER... and probably never has.