indentation

Formatting of dynamically generated HTML - does no one care?

北战南征 提交于 2019-12-24 19:00:12
问题 I have very little experience in web development, so this may be a very basic question. It's just, from the limited experience I do have (a little PHP, and a little Ruby on Rails), it seems that the way dynamically generated HTML is formatted just "doesn't matter"; it ends up ugly, with weird indentation, and nobody cares because that isn't what the users sees. Unless, of course, the user is a developer, or even just someone who's curious to look at a little HTML to try and learn something.

pygame/python sprite not moving? What have i done wrong? (no errors)

送分小仙女□ 提交于 2019-12-24 11:22:18
问题 Alright, so here's my code, I get no errors but my sprite (player) is not moving import pygame,sys import random import time #Colors white = (255,255,255) black = (0,0,0) red = (255,0,0) green = (0,255,0) blue = (0,0,255) class Block(pygame.sprite.Sprite): def __init__(self, color = blue, width = 50, height = 50): super(Block, self).__init__() self.image = pygame.Surface((width, height)) self.image.fill(color) self.rect = self.image.get_rect() def set_position(self, x , y): self.rect.x = x

Make VIM function return text without indent

放肆的年华 提交于 2019-12-24 08:55:42
问题 I guess this question could be taken in two ways... (Generic) - is there a way to specify settings 'local' to a function ( setlocal changes seem to persist after the function call)... (Specific) - I have a function which gets called from an imap mapping (which takes a user input to pass into the function. The function works perfectly if I run set paste or set noai | set nosi either just before running my shortcut, or added into the function itself. The problem is, whichever way I do it, those

Set auto-indent not to indent labels

痞子三分冷 提交于 2019-12-24 03:11:33
问题 I'm using Eclipse CDT on Windows. I should add that I'm delighted, overall, with the auto-format feature. But one thing bugs me. I can't figure out how to configure Eclipse to not indent lines with labels. This is what I want: void myfunc() { goto MYLABEL; MYLABEL: return; } but what I get is this: void myfunc() { goto MYLABEL; MYLABEL: return; } How can I configure Eclipse to get exactly what I want? In Code Style --> Formatter , there's no section for "labels" under "Indentation". 回答1: This

JSONValue to Indented String

坚强是说给别人听的谎言 提交于 2019-12-24 01:55:07
问题 In Delphi XE2, I need to make a function that receives a JSONValue and returns an indented String , much like JSONLint. This JSONValue could be any type of JSON, could be an array, an object, even just a string, so I have to make sure to cover all types with this function. I have no idea where to start. 回答1: You'll have to do it recursively. Something like this: const INDENT_SIZE = 2; procedure PrettyPrintJSON(value: TJSONValue; output: TStrings; indent: integer = 0); forward; procedure

JSONValue to Indented String

喜你入骨 提交于 2019-12-24 01:55:03
问题 In Delphi XE2, I need to make a function that receives a JSONValue and returns an indented String , much like JSONLint. This JSONValue could be any type of JSON, could be an array, an object, even just a string, so I have to make sure to cover all types with this function. I have no idea where to start. 回答1: You'll have to do it recursively. Something like this: const INDENT_SIZE = 2; procedure PrettyPrintJSON(value: TJSONValue; output: TStrings; indent: integer = 0); forward; procedure

java DOM xml file create - Have no tabs or whitespaces in output file

落花浮王杯 提交于 2019-12-23 18:01:26
问题 I already looked through the postings on stackoverflow but it seems that nothing helps. Here is what have: // write the content into xml file TransformerFactory transformerFactory = TransformerFactory.newInstance(); transformerFactory.setAttribute("indent-number", 2); Transformer transformer = transformerFactory.newTransformer(); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); DOMSource source = new DOMSource(xmlDoc); StreamResult result = new StreamResult(new File("C:\\testing.xml")

Parsing many blocks with foldLine

血红的双手。 提交于 2019-12-23 17:53:17
问题 For this simplified problem, I am trying to parse an input that looks like foo bar baz quux woo hoo xyzzy glulx into [["foo", "bar", "baz", "quux", "woo"], ["hoo", "xyzzy", "glulx"]] The code I've tried is as follows: import qualified Text.Megaparsec.Lexer as L import Text.Megaparsec hiding (space) import Text.Megaparsec.Char hiding (space) import Text.Megaparsec.String import Control.Monad (void) import Control.Applicative space :: Parser () space = L.space (void spaceChar) empty empty item

Why parse error? Indentation?

牧云@^-^@ 提交于 2019-12-23 17:01:06
问题 I wrote this code: addNums key num = add [] key num where add res a:as b:bs | a == [] = res | otherwise = add res:(a+b) as bs At line 3 the interpreter says: parse error (possibly incorrect indentation) I could not find something wrong, neither with the code nor with the indentation. I put four spaces for each tab. Annotation: Even this does not compile: addNums key num = add [] key num where add res a:as b:bs | a == [] = res | otherwise = add res:(a+b) as bs Line 2: Parse error in pattern:

Unexpected indentation error, but indentation looks correct

依然范特西╮ 提交于 2019-12-23 15:26:07
问题 I have been trying to run this code and it throws an indent error. No matter what I try, the result is the same. If I delete the indent before def __str__(self): and the rest of the code, it works fine, but on output, instead of displaying the question, it shows 'Question object'. def __str__(self): ^ IndentationError: unexpected indent Here is the code: from __future__ import unicode_literals from django.db import models from django.utils.encoding import python_2_unicode_compatible from