# symbol in Drupal modules - drupal

I'm trying to learn Drupal modules. Can someone tell me what the '#' symbol is? I dont remember coming across it in PHP. (Its tricky to search for it cos as far as I can tell, you cant google for symbols). Can I convert it into a normal PHP variable, modify it and finally put it back into an # thing within the PHP of the .module file?
UPDATE: e.g.:
$error['msg'] = t("We're sorry. We have now only #qty of the ....
in file...
http://drupal.org/project/uc_out_of_stock

While that is the case in general PHP, it is used differently in Drupal within the t() function.
You can properly use placeholders in your text (which should be wrapped in t() for translation purposes on i18n capabilities) by putting a # , ! or % in front.
! = insert as is
# = run text through check_plain
% = html escape text
More info on the API page

In PHP the # symbol suppresses error messages.
There's plenty about it in the manual. When in doubt that's the place to go.
http://us3.php.net/manual/en/language.operators.errorcontrol.php

Related

How do I tell Vim to use any/all dictionary files that fit a filepath wildcard glob?

I am trying to set the dictionary option (to allow autocompletion of certain words of my choosing) using wildcards in a filename glob, as follows:
:set dict+=$VIM/dict/dict*.lst
The hope is that, with this line in the initially sourced .vimrc (or, in my case of Windows 10, _vimrc), I can add different dictionary files to my $VIM/dict directory later, and each new invocation of Vim will use those dictionary files, without me needing to modify my .vimrc settings.
However, an error message says that there is no such file. When I give a specific filename (as in :set dict+=$VIM/dict/dict01.lst ), then it works.
The thing is, I could swear that this used to work. I had this setting in my .vimrc files since I started using Vim 7.1, and I don't recall any such error message until recently. Now it shows up on my Linux laptop as well as my Windows 7 and Windows 10 laptops. I can't remember exactly when this started happening.
Yes, I tried using backslashes (as in :set dict+=$VIM\dict\dict*.lst ) in case it was a Windows compatibility issue, but that still doesn't work. (Also this is happening on my Linux laptop, too, and that doesn't use backslashes for filepaths.)
Am I going senile? Or is there some other mysterious force going on?
Assuming for now that it is a change in the latest version of Vim, is there some way to specify "use all the dictionary files that fit this glob"?
-- Edited 2021-02-14 06:17:07
I also checked to see if it was due to having more than one file that fits the wildcard glob. (I thought that if I had more than one file that fit the wildcard, the glob would turn into two filenames, equivalent to saying dict+=$VIM/dict/dict01.lst dict02.lst which would not be syntactically valid.) But it still did not working after removing extra files so that only one file fit my pathname of $VIM/dict/dict*.lst . (I had previously put another Addendum here happily explaining that this was how I solved my problem, but it turned out to be premature.)
You must expand wildcards before setting an option. Multiple file names must be separated by commas. For example,
let &dictionary = tr(expand("$VIM/dict/dict*.lst"), "\n", ",")
If adding a value to a non-empty option, don't forget to add comma too (let is more universal than set, so it's less forgiving):
let &dictionary .= "," . tr(expand(...)...)

Why Juila module have to be prefixed with dot?

Why module using .A has to be prefixed with dot? It doesn't work if you omit the dot.
File ./A.jl
module A
export sayHi
function sayHi()
println("hi")
end
end
File ./Main.jl
include("./A.jl")
using .A # <= Why it has to be prefixed with dot?
sayHi()
Running, start REPL and type
include("./Main.jl")
Part 2
And if you move file A.jl to different location, like ../some-dir/A.jl it has to be prefixed to two dots using ..A. Why?
Because you define module A inside your current module. The dot means "look inside the current module for this". https://docs.julialang.org/en/v1/manual/modules/#Relative-and-absolute-module-paths-1
After digging it deeper - it seems like the answer is - don't use modules.
The documentation is wrong, it says
When in reality, the module usage is heavily tied to the location of files, it could be using Foo, using .Foo, using ..Foo or using Main.Foo - depending on the location of the Foo module relative to the file that imports it. In my personal opinion - something is very wrong with that design.
No support in the VSCode Editor, it doesn't understand using ..Foo. There are other ways to use modules, including altering startup.jl or JULIA_LOAD_PATHS - none of it works either. I assume nobody noticing these problems because nobody actually using modules.
Top answer on YCombinator - gives the same answer - the best way to use modules in Julia - is to not use it at all https://news.ycombinator.com/item?id=19232824

vim-rmarkdown plugin configuration

I've just installed vim-rmarkdown, vim-pandoc, and vim-pandoc-syntax plugins in conjunction with Vundle (latest github versions).
When I open an RMarkdown file (.Rmd) in vim, as expected it detects the filetype as rmarkdown; it marks the start of an R code chunk with a lambda symbol etc. (replacing the ```), as I've seen on an example vim-rmarkdown screenshot.
What is driving me nuts is that vim has decided to highlight some strings (unhelpfully completely obscuring the text as if it were redacted). I would normally hit space to clear the highlighting of search terms; it isn't that. It also hides terminating ``` for R chunks; they only become visible when you move the cursor over that line.
Can anyone help with:
Pointers to vim-rmarkdown FAQs/docs (:h rmarkdown only calls up the same basic info you get on the github page),
Why it is overwriting (highlighting with solid colour) some text and how to stop it,
How to show the ends of R code chunks (```), or otherwise better manage distinguishing between "text" and R code chunks.
As per the vim-rmarkdown documentation available, I've added the following to the start of my .vimrc
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" plugin on GitHub repo
Plugin 'vim-pandoc/vim-pandoc'
Plugin 'vim-pandoc/vim-pandoc-syntax'
Plugin 'vim-pandoc/vim-rmarkdown'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
Thanks for posting the question, I think I came across the same issues.
Pointers to vim-rmarkdown FAQs/docs (:h rmarkdown only calls up the same basic info you get on the github page),
As far as I can tell the vim-rmarkdown plugin just adds syntax highlighting for R code chunks and the :RMarkdown command described in the help docs. Most of the documentation that you're probably looking for is related to the vim-pandoc and vim-pandoc-syntax modules so :help vim-pandoc and :help vim-pandoc-syntax cover most of the issues.
Why it is overwriting (highlighting with solid colour) some text and how to stop it,
I don't know if you're having the same issue I am, but I saw this behavior because of the spell checking and the particular color scheme I am using in my terminal (iTerm with a dark color scheme) obscuring the text. It was solved for me by either turning off spell checking let g:pandoc#modules#disabled = ["spell"] or modifying the color scheme (in my case increasing the minimum contrast setting in iTerm helped)
How to show the ends of R code chunks (```), or otherwise better manage distinguishing between "text" and R code chunks.
My solution to this issue was to turn off concealing, it just confuses me anyway. (I'm not smart enough to handle an editor hiding stuff from me so I turn off folding too) There's probably a better way to deal with this for people who want concealing, but I don't know it.
The lines I added to my .vimrc to manage my issues with vim-rmarkdown:
" configuration for vim-pandoc and vim-rmarkdown
let g:pandoc#modules#disabled = ["folding", "spell"]
let g:pandoc#syntax#conceal#use = 0
The relevant setting you need to change can be found in the vim-pandoc-syntax plugin
Basically, putting this in your .vimrc should solve the issue:
let g:pandoc#syntax#conceal#use = 0
If you scroll down, you'll find a more granular way to disable this for particular filetypes, and specific settings for specific overrides, but it seems like you just want to disable it wholesale.
This seems to be in the documentation, but not the one from vim-rmarkdown (which, I admit, is a bit confusing). Try :help pandoc-syntax and you should find explanations on all the settings.
Some general explanation on hiding text with syntax settings can be found with :help conceal.
Just to pull together the helpful answers I got, in case anyone else comes by this post:
adding to my .vimrc,
let g:pandoc#modules#disabled = ["spell"]
directly solved the issue of some text ("words") being completely obscured (in my dark-theme terminal editor);
let g:pandoc#syntax#conceal#use = 0
directly resolved what (to me) was somewhat over-zealous concealing of code segments.
:help pandoc-syntax
is generally very useful documentation for controlling the syntax highlighting used my rmarkdown.
Thanks to all.

open graph image url problems with converted special chars XKB Symbols

I try to use the like-Button and therefor the open graph.
My problem is, that "&" and "$" chars are always replaced by & and %24
Of course, thats the normal case, but I need a clean $ and no entity there, becuase otherwise the link is not working for this image.
I could see, that facebook´s raw output produces \u0024 and so on (seems to be XKBSymbols). But if I try to put this symbols in the link in my typo3 meta-tag, it doesnt work either.
I already tried:
#page.headerData.12345.htmlSpecialChars = 0
#page.headerData.12345.htmlSpecialChars.preserveEntities = 1
#page.headerData.12345.rawUrlEncode = 0
to solve this problem, but none of those work.
Please give me a useful hint.
Thanks
try to write to your php code trough htmlspecialchar php function and add it to header with
$GLOBALS['TSFE']->additionalHeaderData['somekey'] = '...'

Where is keywords code assist and letter not allowed problem(Aptana Studio 3)

I recently switched from Aptana2 to version3.0.3, and the first thing i did was to install the sdomcl. file to get jQuery code assist.It works fine for jQuery, but there is no code assist for many keywords.For exymple there is no support for var,while,throw,try,break,case,catch etc.
Also there is no function, instead intellisense sugests Function.
The second problem is that i am constantly getting this warning '<' + '/' +letter not allowed here when typing something valid like this:
confirmDiv =$("")-sorry for this,but it wont let me type what i want, basically i am just creating a new div with the correct syntax.
Could it be something with Html Tidy?Anyways, big thanks in advance!
Aptana Studio 3.0.4 includes code assist for JavaScript keywords.
I've read that for Javascript the slashes / must be escaped with backslashes \ as it says here
Doing so the warning dissapears ;)

Resources