commenting

Commenting c++ codes in Vim

。_饼干妹妹 提交于 2019-12-21 21:34:34
问题 I want to map \c to comment the current line in vim (add '// ' to before the first non-blank to the line) and \d to delete the '// ' at the beginning of line(uncomment). I've added these two lines in my vimrc: imap \c <Esc>:s/^/\/\/ <CR>j$a imap \d <Esc>:s/^\/\/ /<CR>j$a but when I call this in this line: for (int i = 0; i < n; i++) then it is converted to: // for (int i = 0; i < n; i++) but I want to convert it to: // for (int i = 0; i < n; i++) one of the reasons I want this is that when I

What is the algorithm behind nested comments?

旧城冷巷雨未停 提交于 2019-12-21 02:44:07
问题 I want to learn the comment displaying algorithm behind Reddit. How is a comment related with its child and so on? How they are stored in the database? Lets say comment1 -comment2 --comment3 -comment4 --comment5 --comment6 ---comment7 ----comment8 comment9 How to display comment5 which is after comment4 which is after comment1? What is the idea behind this sequencing? And how to relate them in the database? 回答1: AS @Rafe said, the actual storage is pretty easy, it would be something like: |

How do you comment out in Liquid?

青春壹個敷衍的年華 提交于 2019-12-20 10:16:10
问题 What is the correct way to comment out in the Liquid templating language? 回答1: In Liquid you comment out using the {% comment %} and {% endcomment %} tags: {% comment %} This is a comment in Liquid {% endcomment %} It doesn't matter if the comment is inline or a block comment. {% comment %} This is a block comment in Liquid {% endcomment %} 回答2: Liquid allows you to leave un-rendered code inside a Liquid template by using the {% comment %} and {% endcomment %} tags. Input: Anything you put

How to write an inline-comment in Python

本小妞迷上赌 提交于 2019-12-18 18:36:10
问题 Is there a method of ending single line comments in Python? Something like /* This is my comment */ some more code here... 回答1: No, there are no inline comments in Python. From the documentation: A comment starts with a hash character ( # ) that is not part of a string literal, and ends at the end of the physical line . A comment signifies the end of the logical line unless the implicit line joining rules are invoked. Comments are ignored by the syntax; they are not tokens. 回答2: Whitespace in

Is it possible to comment comments

百般思念 提交于 2019-12-13 16:09:33
问题 I'm having this inconvenience while commenting. But I was wondering how you guys would do this. Lets say you have the following code: /*Fancy function*/ function fancyFunction(){ echo "Oh yeah" //200 more lines go here } And now I want to comment the whole function, you'll do this: /* /*Fancy function*/ <--Comment breaks here function fancyFunction(){ echo "Oh yeah" //200 more lines go here } */ How do you do this xD 回答1: Commenting is meant to give you comments for your code. A system to

Comment Illegal Unicode Sequences

点点圈 提交于 2019-12-12 13:11:43
问题 I was once working on a Java application dealing with unicode processing - and as usual to begin with, I write some code and test it, then comment out the working code and add some new lines., and this process goes on till I find the solution The exact issue I had was commenting out illegal Unicode strings. Some unicode wasn't working and I wanted to just comment it out.. to my utter surprise, it wouldn't work. Example Code: class UnicodeTester{ //char someCharacter = "\ux13d"; } javac

Adding comments with gem/ Ruby on Rails

╄→尐↘猪︶ㄣ 提交于 2019-12-12 06:47:19
问题 I have been learning some RoR and I have just created my first web application, a photosharing site that is basically a Pinterest copy. Now I am trying to add more functionality and I would like if users would be able to comment pins. I'm using the Commontator Gem: https://github.com/lml/commontator/blob/master/README.md The only problem is that I don't know where to put <%= commontator_thread(commontable) %> in my show.html.erb file. I have tried many different places but for some reason it

Python Encoding Comment Format

我们两清 提交于 2019-12-10 17:35:14
问题 Originally, I've learned to specify the source code encoding in Python 2.7 this way: # -*- coding: utf-8 -*- Now I just noticed, that PEP263 also allows this: # coding=utf-8 Is there any differences between these? What about editor compatiblity, cross-platform etc.? What about Python 3? Is this comment still needed for python 3 or is any code in python 3 expected to be utf-8 by default? 回答1: Take a look at PEP3120 which changed the default encoding of python source code to be UTF-8 For python

How to use Django template tags and filters with jQuery?

荒凉一梦 提交于 2019-12-09 07:03:15
问题 The problem in general is this: I have a page with content and user can comment it. Inserting comment should happen without reloading the page. Commenting form gets handled in a view which saves the comment to database. After saving the comment I serialize the new comment to json and return to the page. data = serializers.serialize('json', [comment]) return HttpResponse(data, mimetype='application/javascript') This works quite well, comment gets prepended to the top of a div, but how do I

“Undefined local variable or method” error when using commontator gem for comments

淺唱寂寞╮ 提交于 2019-12-09 03:41:21
问题 I made a website in which people can share photo's (they are called pins in my code). I wanted to add a system in which, when someone clicks on the picture, they can comment on it. I decided to use the commontator gem and I installed it. My problem is that the commenting system does not show up below posts like it's supposed to and I get an undefined local variable or method error for my pins controller. routes.rb Photo::Application.routes.draw do resources :pins devise_for :users root "pins