How to get rid of zeros in the section numbering in LATEX report document class? - numbers

So I'm writing a report using Latex and the document class I am using is report:
\documentclass[a4paper]{report}
But for some reason the section numbering is written so that it is preceded with "0.", for example it looks like:
0.1 Introduction
0.2 Theory
0.3 Experimental Method
and so on.
Can somebody help me get rid of those zeros so that it appears how it is supposed to be?

report assumes you'll be using \chapters as your main sectional unit. As such, all sectional units are marked "relative" to the \chapter counter. Specifically, \section counters are set using \thechapter.\arabic{section}. Either use
\documentclass[a4paper]{article}
to remove any reference of \chapters, or add
\renewcommand{\thesection}{\arabic{section}}
to your document preamble.
The former would have greater impact on the actual output, as the setting of a \title and possibly the layout may be different. The latter would just remove the \chapter counter from being printed with every \section (and lower-level section unit).

Related

Pure Data abstraction to take n arguments

I've created a Pure Data abstraction which takes 5 MIDI controller IDs as arguments, and has two inlets (velocity and MIDI controller). I use spigot to output the input velocity at outlet i if the MIDI controller ID matches the i th argument to the abstraction.
I use this to control 5 sliders (volume, attack, decay, sustain, release) from my MIDI controller, which look like this:
As you can see, the abstraction is very repetitive, and ideally it would be able to take n arguments, outputting the slider value of the given MIDI slider at the i th outlet. Alternatively I could just use a single argument and use the abstraction anew for each slider, but that's a bit repetitive too.
Is there a way to take n arguments in my abstraction? Or, is there any other more elegant solution to control sliders from MIDI that I'm missing?
For core vanilla objects or externals it is a common feature to take a variable amount of arguments. Many objects like [trigger], [select], [pack] or [unpack] behave this way and create a number of xlets according to how many arguments they are given.
For abstractions however, there is no simple way to have a variable number of outputs depending on the number of arguments given. It's possible, but it's rather a hack.
Let's first look at some techniques to make the patches easier.
As you can see in the following screenshot the [expr] object in your patch can easily be substituted by a simple Pd object: [==]
Let's look at the MIDI messages. MIDI objects output the elements of the hierarchical tree: channel, controller, value in this order but from right to left (true for all objects in Pd, the rightmost outlet fires first). What you want is routing them according to the controller number, ignoring the channel number. For this you need to flip the order of the two first outlets so you can use the controller number as a selector in a list. One way to do this is to pack the numbers and then reorder them in a message using the dollar symbols (careful, dollar symbols in message objects operate on local messages, they have nothing to do with what dollar symbols do in object boxes). Another method would be to use the object [swap] (using [swap] in this case would reduce the number of objects by one in the patch, but the [pack] and [message( is more versatile, that's why I show it here).
Regarding the actual question of taking n arguments to change the number of outlets: This challenge are two separate problems:
How to detect the number of arguments
How to change the number of outlets dynamically
Until recently there hasn't been a way proper way to detect the existence of arguments. Since Pd 0.50 there is [pdcontrol] which allows exactly this.
Using [initbang] here because [loadbang] would fire too late for creating the outlets.
The second part of the challenge may be solved either through a technique called 'dynamic patching' or by outputting a list instead of creating additional outlets. However with a list output you'd need to route it afterwards and then you'll arrive quickly at the patch pictured above.

Rule to measure maximum lines in a method in dart

I am working with flutter project and new to dart programming. I need to validate the length of the method. For example, consider the following method.
void test(){
//Need to validate the number of lines in this method
}
I need to know the dart lint rule to be used to restrict the length of the line in all the methods I am using in my project i.e for example the length of the test method need to be only 50 lines. Kindly suggest me a way to restrict the method length.
Thanks in advance,
Dharani.
This is for characters of line https://dart.dev/guides/language/effective-dart/style#avoid-lines-longer-than-80-characters
It's very clear
If you really find yourself wanting lines longer than 80 characters, our experience is that your code is likely too verbose and could be a little more compact. The main offender is usually VeryLongCamelCaseClassNames. Ask yourself, “Does each word in that type name tell me something critical or prevent a name collision?” If not, consider omitting it.
Note that dartfmt does 99% of this for you, but the last 1% is you. It does not split long string literals to fit in 80 columns, so you have to do that manually.
They don't talk much about how many lines should be in the class, methods, ...
But, with this article, you should follow if you wanted: https://dzone.com/articles/rule-30-%E2%80%93-when-method-class-or
For specific:
Methods should not have more than an average of 30 code lines (not counting line spaces and comments).

How to see the complete list of issues of github's static analysis?

I am using "pullerquest" in github to comment on examination after examination. It generates comments like this one:
Here, I can only see the top ten of issues.
How can I see all of the issues? Is there a link to the complete list of files?
As of the current version (1.4.1),
the maximum number of issues to display in that list is hardcoded at 10,
by the MAX_GLOBAL_ISSUES constant in the source code.
If you want to know more details, here's how the plugin operates:
The PullRequestIssuePostJob class creates an instance of GlobalReport here, calling this constructor, which uses the MAX_GLOBAL_ISSUES constant as the default maximum.
PullRequestIssuePostJob will process each issue, eventually ending up in GlobalReport.process method, where a conditional statement decides to register the issue if we are under the maximum, otherwise simply count it.
If you really want to see all issues, you could fork the code and change the constant to a higher number on this line.
As #JulienH pointed out in a comment, the size of GithHub comments is limited, so it is not possible to display an unlimited number of issues. This is why the cap on the number of issues displayed is necessary.

Using abbreviations for parameter-value input pairs - why does cellfun's `'UniformOutput', false` work as `'un', 0`?

As a frequent user of cellfun(..., 'UniformOutput', false), I was surprised to discover that the latter two arguments could be input as cellfun(..., 'un', 0). This has immediately shortened my code. My question is, are there any another similar shortcuts/aliases out there?
This doesn't appear to be documented on the MathWorks website. Naughty!
Background
The property part of a Property-value pair can be often be shortened to the beginning of the property string so long as it is still uniquely identifiable (see examples below). They are also often not case sensitive.
As far as I know this is not documented for anything other than figure properties, where it is very briefly documented.
However this behaviour is also implemented in many The MathWorks functions which take property-value pair arguments, and also in some functions which take string arguments with no value pair.
The problems become what other properties are there...
For some functions is not well documented... (and many are either
built-in or obfuscated .p files, so no checking the source).
Most importantly we cannot know if future versions will introduce new
properties.
The use of shortened property names is advised against for this reason, to quote
"using the full property name can prevent problems with futures releases of MATLAB if a shortened name is no longer unique because of the addition of new properties." - Matlab documentation
"Don't shorten your code with P-V abbreviations, it's not worth it, trust me." – Sam Roberts
The brief slightly technical side - This functionality is implemented by default by Matlabs inputParser, however it can be disabled so these abbreviations are by no means guaranteed to work on every function. Only those which use the inputParser in this way or are specifically written to allow this.
Examples using figure properties
Simple Shortening
The following
hFig = figure();
get(Hfig,'Visible')
ans =
on
can be shortened to
hFig = figure();
get(Hfig,'v')
ans =
on
as it is the only property beginning with 'v' (note that 'vi','vis', etc... also work)
Uniqueness
However other properties which start similarly e.g. CurrentAxes, CurrentCharacter & CurrentObject
get(Hfig,'Current')
Error using get
Ambiguous property found.
Object Name: figure
Property Name: 'Current'.
Where as 'currenta','currentc' and 'currento' are uniquely identifiable and would work as intended
Impossible to shorten
A special mention to properties such as Color and ColorMap the name of one is the beginning of another
Color can only be used with its full name, due to any shortening being ambiguous with ColorMap
'ColorMap' can be shorted to 'colorm' however, as before.
Counter examples
This section aims to discourage use of shortened property value pairs by showing some of the seemingly unpredictable and unexpected behaviour.
The semi-undocumented hardcopy has some interesting behaviour the documentation states possible options as -dps,-deps,-dps2,-deps2,-dill,-dhpgl
However '-dh' creates an error where as '-di' works as an abbreviated '-dill' sadly there is no checking the source to see why as it is a .p file
Finally cellfun itself doesn't exactly follow there rules as 'u' should theoretically work if following the rules above, however only 'un' and onwards does.
If a routine uses MATLAB's inputParser functionality then usually any parameter name can be shortened such that it is still unambiguous and is matched case insensitively. The same is true for properties of objects such as get(gcf, 'pos') as a shorter version of get(gcf, 'Position').
However, I don't know if there is any documentation on this usage and I suggest you try it and see.
And 0 is usually equivalent to false (non-zero being true).
PS I would suggest that using these shortcuts is fine at the command line but when writing functions and scripts it is better to use the full names.

Setting different Cell-Formats in a Matlab uitable

I am looking for a way to handle different type of data in one column of a Matlab uitable.
Usually uitable is used to set whole columns to the same data type, such as logical (gives a checkboxes), char (gives left-aligned text), numeric (gives right-aligned number) or a 1xn-cell-array (gives pop-up menus with different choices).
It is set using the columnformat property of uitable, e.g.
columnformat = {'numeric', 'logical', {'Fixed' 'Adjustable'}}; % 3 columns
You can find an example at matlab documentation.
I am looking for a way to set the format for single cells to realize something like this:
Matlab's uitable is a crippled version of an underlying JIDE table.
It is possible to get to the underlying java (see findjobj in file exchange), but that requires a lot of work. Yair Altman's undocumented matlab site is a good starting place for understanding the java side of matlab.
It sounds like you want something like a property editor, as opposed to a generic UI table -- i.e. properties listed in first column, property value editable in second column. There are a few "off the shelf" versions in the file exchange, which use JIDE:
See propertiesgui, or property-grid for mostly functional examples. The second example is easier to use -- you simply provide a class or struct, and it creates the proper field entry format. The first one offers more choices -- like color boxes, drop downs, etc, but requires you to be more involved in specifying how things behave.
I had the same problem, but in the end it worked by giving the (numeric) cell an (char) initial value. When changing the char value from the UI the format of the cell remained char, although the rest of the column was numeric.