Regex to find the commented Code in XCode - ios

I am trying to make a regex that will find all the commented code in Xcode project. Note that result of Regex must only contain commented code and must not contain the comments that we add to make the project more understandable.
Result of regex searching not contain the line like below
// this comment is added to make the function understandable
But contain the lines like
// [super viewWillDisappear:animated];

I successfully make my required expression and it is
^.*/[/,\*].*;.*$
This will only find your single line or multiline commented code.

To anyone wondering how to use regular expression
search "^./[/,*].;.*$" after selecting regular expression option from find menu after doing global search(command + shift + F)

Related

Intellij IDEA custom dart format. How to make dot operator on the same line

I am trying to configure dart to let the operator . appear on the same line.
I am not having any success on configuring it to do that.
It currently looks like this
I would like colors.removeLast() and colors.length to be each on one line.
So it should be like
do
{
colors.removeLast();
}
while(colors.length > 0);
Any suggestions on how I can make that happen ? Which settings do i need to change ?
Increase line length. The function call is being placed on the new line as the line cannot be longer than 20 (or so) symbols. Increasing this value will prevent IntelliJ IDEA to find ways to fit the text.
See the difference:

Default opening curly braces in Xcode

I am using Xcode, and noticed that Xcode's default auto creation and completion of functions makes opening curly braces go into new lines. For example
(void) this_is_what_xcode_does
{
// Opening braces on a line of its own - default format
}
I do not like that, I would like the opening braces to be on the same line as the function name. Just like below
(void) this_is_what_i_want_xcode_to_do {
// Opening braces on the same line as the function - my preferred format
}
How can I change the default Xcode format/behaviour?
Thanks.
By default Xcode is missing a good, customisable code formatting settings. You can find some external plugins that are mentioned here. Personally I haven't tried them. So in short, Xcode is missing that feature.
As a side tip I can mention that AppCode has a quite good way to format code in the way you want and the keyboard shortcuts for auto formatting code and optimising imports.

Xamarin ios - import library

I need help importing a library to Xamarin. I included the library and inserted it into a new folder named BarcodeScanner, and the name of the library is libBarcodeScanner.a.
gcc_flags "-L${ProjectDir} -lBarcodeScanner -force_load ${ProjectDir}/libBarcodeScanner.a”
But it shows an error:
Error: Could not parse additional mtouch arguments: No matching quote found.
What should i do ?
Do i need to create a binding project to use a library like BarcodeScanner ?
Error: Could not parse additional mtouch arguments: No matching quote found.
That does not look like a Xamarin.iOS (mtouch) error message. Those start with a MT prefix followed by 4 numbers, e.g. MT2001. Could it be Xamarin Studio giving you this error ?
What should i do ?
Review the flags: are they identical to what's pasted above ?
No matching quote found. makes is sound there's an extra quote in there. Maybe one of the " is wrong (e.g. a autocorrection giving you a smart quote) ?
Or maybe your project directory (replaced from ${ProjectDir} contains a quote character ?
Also can you edit your question to add which version of Xamarin Studio you're using ?
Do i need to create a binding project to use a library like BarcodeScanner ?
No, but it's the preferred ways to link static libraries. Using a binding project removed the need to add Additional mtouch arguments inside every projects and every build configuration (e.g. Debug, Release...) of your applications.
I will answer my own question, maybe it will help someone. I declared in my MainController that i needed:
using MonoTouch.CoreVideo;
using MonoTouch.CoreMedia;
using MonoTouch.CoreGraphics;
using MonoTouch.CoreFoundation;
And after that i referenced only the static library with:
-gcc_flags "-L${ProjectDir} -lBarcodeScanner -force_load ${ProjectDir}/libBarcodeScanner.a"
#poupou's "maybe" was spot on, but I'll be pedantic and explain exactly.
Look closely at this line I just quoted from your original question. I've marked it down using code (four spaces prefix per line), and broke it into two lines. Nothing else has been changed. Hopefully the error should be obvious now:
- gcc_flags "-L${ProjectDir} -lBarcodeScanner
-force_load ${ProjectDir}/libBarcodeScanner.a”
Essentially, you used different types of double quotes. The first double-quote character above is Unicode 0x0022, which is the regular Quotation Mark. The second double-quote character above is Unicode 0x8221, or Right Double Quotation Mark. It might be that you had copied & pasted all or part of the line above from a web page, rather than typing it in.
For command-line processing, mixing your styles of double quotes simply won't work. You'll need to use balanced regular quotation marks, as you wrote in your own answer just now (but might not have specifically noticed?) FWIW, the right- and left- variants of the quotation mark are usually used for word processing, web pages, etc. where the style aesthetic matters.
Since you didn't use code-markup when quoting that line originally (while I noticed you did, in your recently posted answer) it looks like Stack Overflow "helpfully" tried to render the quotes as similar in style, fooling us into looking elsewhere for the problem, when it was right in front of us.
Anyway, next time you get an error about mismatched quotes, I suggest you carefully check their type. If they look the least bit different, they may not be the right kind of quotes.

Change format of inline code evaluation in org-mode's LaTeX-export

I have a code block in an org document
#+NAME: result_whatever
#+BEGIN_SRC python :session data :results value :exports none
return(8.1 - 5)
#+END_SRC
which I evaluate inline:
Now, does this work? Let's see: call_result_whatever(). I'd be surprised ...
When exporting to LaTeX, this generates the following:
Now, does this work? Let's see: \texttt{3.1}. I'd be surprised \ldots{}
However, I don't want the results to be displayed in monospace. I want it to be formatted in "normal" upright font, without any special markup.
How can I achieve this?
You should be able to get it work using the optional header arguments which can be added to call_function().
I don't have LaTeX installed on this system so can't fully test the outputs to ensure they come out exactly as desired, I'm using the plain text output to compare instead. However you can use the following syntax as part of your call to modify the results.
Now, does this work? Let's see call_results_whatever()[:results raw].
I'd be surprised ...
Without the [:results raw] the output to Plain Text (Ascii buffer) is Let's see `3.0999999999999996'.. With the added results it becomes Let's see 3.0999999999999996.
For full details of the available results keywords as well as other optional header arguments for the inline blocks please see Evaluation Code Blocks and Results arguments.
this is 5 years later. apparently in org-mode 8.2 or so, a new variable was introduced (documenting in "Evaluating Code Blocks" in the org-mode manual, but this from etc/ORG-NEWS in the source tree):
*** New option: org-babel-inline-result-wrap
If you set this to the following
: (setq org-babel-inline-result-wrap "$%s$")
then inline code snippets will be wrapped into the formatting string.
so, to eliminate \texttt{}
(setq org-babel-inline-result-wrap "%s")
The problem of this type can be solved in two ways:
1: Easy does it:
A plain query-replace on the exported buffer.
Once you're in the LaTeX buffer,
beginning-of-buffer or M-<
query-replace or M-%
enter \texttt as the string that you want to replace
enter nothing as the replacement
continue to replace each match interactively
with y/n or just replace everything with !
2: But I wanna!
The second way is to nag the org-mode mailing list into
implementing a switch or an option for your specific case.
While it's necessary sometimes, it also produces a system
with thousands of switches, which can become unwieldy.
You can try, but I don't recommend.

How do I write comments in a SpecFlow Feature?

I'd like to include some comments in a SpecFlow feature.
I get the the following error:
Custom tool error: Parsing error near '/*'
I've tried the following:
// comment
/* comment */
-- comment
' comment
How do I do this?
As stated by sarfest above - its simply #-sign for comments.
There are no multiline comments but that's easily solved if you can do a vertical selection (hold down ALT-key and select in Visual Studio).
Vertical select and the enter a #-sign.
Additional information: the line has to start with a #, and optionally any whitespace. This means you cannot combine comments with actual code on the same line.
also, if you want to perform multiline comments in an easy way (on visual studio),
you can select the lines to be commented, and hit CTRL+K+C to comment, CTRL+K+U to Uncomment.
thank you for the wonderful idea. I just need to press ALT and select the entire lines (just the little space which holds only one character space in each line) and then enter # which result
from
xyz
abc
to
'# xyz'
'# abc'
You can add comment lines to the feature files at any place starting the line with the # sign. Be careful however, as comments in the specification are often signs of wrongly specified acceptance criteria.
The comment lines are ignored by SpecFlow.

Resources