How to remove only comments from this code snippet using vim? [closed] - vim

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I want to remove all comments from the following code snippet using vim. Please help me in this.
int main()
{
Computer compute;
// To create an 'instance' of the class, simply treat it like you would
// a structure. (An instance is simply when you create an actual object
// from the class, as opposed to having the definition of the class)
compute.setspeed ( 100 );
// To call functions in the class, you put the name of the instance,
// a period, and then the function name.
cout<< compute.readspeed();
// See above note.
}

:g/<Pattern>/d
It will delete all lines which match the <Pattern>. e.g.
:g/\s*\/\//d
will delete all lines which has first two non-whitespace character as //.

There is several way to do this.
The easiest is probably to use a plugin like NERDCommenter http://www.vim.org/scripts/script.php?script_id=1218
If you don't want to install things, then you can use the visual mode:
- Ctrl + V to get into column visual mode
- Select the //
- then x
You can also use a macro with qa then delete the // of the first line, close the recording with q, and replay the macro with #a.
Finally, if you are a regex fan, then you can do this : :g/\s*\/\//d

Related

How to offset carriage in $write function in verilog [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I would like to print using a built-in $write() function in verilog vcs on the same line twice, where the second write starts at a specified character position beginning from the column 0. Is it even possible? The pseudo-code would be something like:
$write("Hello world"); // Assuming printed from a new line
$write("Test",10); // Starts printing on the same line at 10th position from the beginning
The output console would look like:
Hello worlTest
You need to know the proper ASCII escape sequences for the terminal the output is going to. And not all terminal windows support the same codes or this feature at all. For example see the Move Cursor commands for the vt-100.
Other than that, you can manipulate a string before printing it.

Batch files - names [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
I have a code that looks for png files with a specific pattern on the desktop and moves them to another directory.
While going over the files, I want to check if there is the pattern in the name.
This is how I did it:
for %%f in (C:\Users\user\Desktop\*.png) do (
if %%f==Hearthstone Screenshot*.png (
move %%f C:\destination\
)
)
Note: All the needed files start with Hearthstone Screenshot then some numbers.
My main problem is in line 2. I can't make it work.
Depending upon you needs, perhaps this is what you're looking for…
#RoboCopy "%UserProfile%\Desktop" "%UserProfile%\Desktop\HearthStone_Screenshots" "HearthStone Screenshot*.png" /MOV>Nul 2>&1
This should automatically create the holding directory, HearthStone_Screenshots if it doesn't already exist.
Note:I have corrected what I'm assuming to be your very poor spelling issues. If those files and directories should be named using ea instead of ee please re-adjust as necessary.
What's wrong with this:
move C:\Users\user\Desktop\HearthstoneScreanshot*.png C:\Users\user\Desktop\Hearthstonescreanshot\

I have a text file that i want to find and delete (replace with nothing) a part that is similar but not the same [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
I have a text file with thousands of this code below which is almost identical apart from it has a different id number. I want to find and delete all instances of this code but I do not know how to do this as find and replace requires the text to be identical. How can I do this? And what text editor on a mac can do this? Eg:
<br><a target='_blank' href='http://example.com/home/details/indexid/1101372'>Read More</a>
<br><a target='_blank' href='http://example.com/home/details/indexid/1101337'>Read More</a>
Use any text editor that allows you regular expression replace. E.g. Sublime Text.
Then do replace with <br><a target='_blank' href='http:\/\/example\.com\/home\/details\/indexid\/\d+'>Read More<\/a>

Android Studio "Search Everywhere" feature not searching in code files [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
"Search everywhere" feature in Android Studio is not finding strings in code files. Why is it not able to find a string literal or a variable name?
Irrefutable photographic evidence:
What am I doing wrong?
"Search Everywhere" is generally looking for the following things:
Class/Module names
Function names
File names
Database names
Configuration options named similarly
It's not suitable for finding a string literal or a variable based in hundreds of lines of code which may have similar literals available to it.
For that, I'd recommend either "Find in Path", or "Symbol", which is CTRL + ALT + SHIFT + N or Command + Alt + O.

How to get text into Unity? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I have a basic Java program with output of "hello world". What I want to do is to write a Java script to run that program and import that into Unity so I can use it in my program in Unity.
Is there a way?
You can communicate with Unity from a Java application trough OSC(Open Sound Control) and send text, commands triggers or load an external file(xml or similar) into Unity.
Unity and Open Sound Control
http://www.sundh.com/blog/2012/07/unity-processing-demo/
On unity you have to use function OnGui() to show text.
In the related documentation you have many example.
For show message in a console just use in a javascript:
Debug.Log("Hello world");
You can also put files in your /Resources folder in your unity project, then load them at run time. These can be pretty much anything. models, prefabs, materials... could be text files (maybe comma delimited txt files, that you parse) or more typically .xml files that you can easily access and extract data (text) from.
to load any resource file, use resources.load()
http://docs.unity3d.com/Documentation/ScriptReference/Resources.Load.html
Don't use OnGui as this is bad for performance rather use Canvas to edit and place the text you prefer on or in (parent) object you want.
to make this look better put the font size higher and the width and height lower.
this will make it look sharper.

Resources