In clang format, how does ExperimentalAutoDetectBinPacking work? - clang

The description of ExperimentalAutoDetectBinPacking is a little confusing on https://clang.llvm.org/docs/ClangFormatStyleOptions.html#adding-additional-style-options.
If set it true, how does it decide to act(bin_packed or one-per line)?
Is there some examples? Thanks.

Related

Analyzer option for using const

Is there an analyzer option I can use in analysis_options.yaml that will notify me when I could use the const keyword? It would be nice to be notified about all the places in my code where I can use it.
There are a few dartanalyzer lints related to const:
prefer_const_constructors
prefer_const_constructors_in_immutables
prefer_const_declarations
prefer_const_literals_to_create_immutables
Also:
unnecessary_const
You can see the full list of supported lint rules.
What you're looking for is prefer_const_constructors

DLV predicate not being derived

I have this simple DLV program consisting of few predicates and derivations rules. One of the rules is not being activated and I have no clue why since apparently all predicates exist. I have to admit I am no expert in DLV and a bit rusty since the last time I used it so please forgive me if this is too obvious :-/
Among others, I have this rule:
knows(ps, chunk(v, ps, pd)) :- value(v),
knows(ps, v),
connected(ps, pd).
And here you can see what I get after executing the code:
./dlv -nofinitecheck model.edb rules.idb
{participant(p1), participant(p2), participant(p3), value(v1),
value(r1), value(v2), value(r2), value(v3), value(r3),
connected(p1,p2), connected(p1,p3), connected(p2,p3), knows(p1,v1),
knows(p1,r1), knows(p2,v2), knows(p2,r2), knows(p3,v3), knows(p3,r3)}
Since I have "value(v1)" and "knows(p1,v1)" and "connected(p1,p2)", I was expecting the output of the program should contain "knows(p1, chunk(v1, p1, p2))".
Can anyone explain me why this is not happening?
Edit: I have removed all rules and created just this single one
chunk(v, ps) :- value(v), participant(ps).
But this rule is not being activated either! What's the problem? I have tried the simplest one:
chunk(v) :- value(v).
and no activation. What am I missing?
OK. I Just realised of my stupidity. The problem is I am using lowercase letters for the variables rather than capitol letters... Sorry, as I said I am rusty!
So, just for the record. Rather than chunk(v) :- value(v) it should be something like chunk(V) :- value(V)

Is there a way to wrap Erlang code to a certain character limit

Suppose I have a method
timer:apply_after(timeout, module, method, [Hosts])
Is there a tool that can help format this into something like:
timer:apply_after(
timeout,
module,
method,
[Hosts]
)
I don't think erl_tidy does this.
You could give prettypr a try. I've never used it myself, and might not give the exact output you specified, but it does format the source code according to the available horizontal space.
It should be possible to do this through erl_tidy, by passing an option {printer, fun (Tree, Opts) -> erl_prettypr:format(Tree, [{paper, P}, {ribbon, R} | Opts]) end}.
See http://erlang.org/doc/man/erl_prettypr.html#format-2 for details about the ribbon and paper options, and http://erlang.org/doc/man/erl_tidy.html#file-2 for info about the printer option.

JSLint : how to use it?

I've understood that JSLint is a great tool for JavaScript development but I've some dark points in my global comprehension of this.
How to use it inside my development environment ? In other words how and when do you run JSLint against your code ? I've seen the Aptana integration but it seems that it doesn't take into account statements like :
/* jslint nomen: false */
How to work correctly in a client side development environment ? I want JSLint to feel good when parsing calls including objects like "console", "$" or "JQuery".
How to use it on a whole project with multiple files (with no import statement inside of them) ?
I've read to much statement suggesting to copy paste on jslint to sleep correctly, so any answer consisting of configuring the online JSLint form would be considered as irrelevant.
I'm sorry to write this answer which is not really one. The best solution I've found is to use JSHint which is a concurrent to JSLint with some nice extra features :
Installation is made easy through NPM with command like (also works for JSLint), NPM is required :
npm install -g jshint
Execution is made easy against a lot of file (doesn't work for JSLint) :
jshint mycodedirectory
Configuration is possible through the --config options, config files look like :
{
"curly":true,
"eqeqeq": true,
"immed": true,
"bitwise": true,
"newcap": true,
"noempty": true,
"unused": true,
"camelcase":true,
"undef": true,
"strict": true,
"trailing": true,
"maxparams": 7,
"maxdepth": 5,
"maxstatements": 50,
"maxcomplexity": 13
}
This solution works for both browser and server code, it's IDE and OS independent, it can be easily integrated in continuous integration process.
Some one came up with a solution to run it automatically on your project using node.js:
Automating JSLint Validation
I use (a slightly modified) JSLINT for WSH on Emacs/WinXP. It highlights problematic code right while I am typing:
This is of great help not only to enforce the configured coding style, but also to find many JavaScript syntax errors before executing code.
It does respect statements such as /* jslint nomen: false */.
As you are asking concerning linting code that runs in a browser environment with jQuery, simply use standard JSLint options:
/*jslint browser: true */
/*global $ */
Just be sure to replace the included JSLint code with the latest version.

How to make M-p and M-n work on rinari-console

M-p and M-n do not seem to work in rinari-console, when they should iterate the previously-issued commands list. Does anyone know how to fix this?
Maybe some other mode interferes with your keybindings? Try checking with M-h k and then entering M-p or M-n. According to the Rinari docs (C-h m) comint-next-input and comint-previous-input are also bound to C-down and C-up, maybe those work for you.

Resources