Search Results

Search found 292 results on 12 pages for 'indentation'.

Page 9/12 | < Previous Page | 5 6 7 8 9 10 11 12  | Next Page >

  • Should sanity be a property of a programmer or a program?

    - by toplel32
    I design and implement languages, that can range from object notations to markup languages. In many cases I have considered restrictions in favor of sanity (common knowledge), like in the case of control characters in identifiers. There are two consequences to consider before doing this: It takes extra computation It narrows liberty I'm interested to learn how developers think of decisions like this. As you may know Microsoft C# is very open on the contrary. If you really want to prefix your integer as Long with 'l' instead of 'L' and so risk other developers of confusing '1' and 'l', no problem. If you want to name your variables in non-latin script so they will contrast with C#'s latin keywords, no problem. Or if you want to distribute a string over multiple lines and so break a series of indentation, no problem. It is cheap to ensure consistency with restrictions and this makes it tempting to implement. But in the case of disallowing non-latin characters (concerning the second example), it means a discredit to Unicode, because one would not take full advantage of its capacity.

    Read the article

  • What's in your .emacs?

    - by A. Rex
    I've switched computers a few times recently, and somewhere along the way I lost my .emacs. I'm trying to build it up again, but while I'm at it, I thought I'd pick up other good configurations that other people use. So, if you use Emacs, what's in your .emacs? Mine is pretty barren right now, containing only: Global font-lock-mode! (global-font-lock-mode 1) My personal preferences with respect to indentation, tabs, and spaces. Use cperl-mode instead of perl-mode. A shortcut for compilation. What do you think is useful?

    Read the article

  • Groovy pretty print XmlSlurper output from HTML?

    - by Misha Koshelev
    Dear All: I am using several different versions to do this but all seem to result in this error: [Fatal Error] :1:171: The prefix "xmlns" cannot be bound to any namespace explicitly; neither can the namespace for "xmlns" be bound to any prefix explicitly. I load html as: // Load html file def fis=new FileInputStream("2.html") def html=new XmlSlurper(new org.cyberneko.html.parsers.SAXParser()).parseText(fis.text) Versions I've tried: http://johnrellis.blogspot.com/2009/08/hmmm_04.html import groovy.xml.StreamingMarkupBuilder import groovy.xml.XmlUtil def streamingMarkupBuilder=new StreamingMarkupBuilder() println XmlUtil.serialize(streamingMarkupBuilder.bind{mkp.yield html}) http://old.nabble.com/How-to-print-XmlSlurper%27s-NodeChild-with-indentation--td16857110.html // Output import groovy.xml.MarkupBuilder import groovy.xml.StreamingMarkupBuilder import groovy.util.XmlNodePrinter import groovy.util.slurpersupport.NodeChild def printNode(NodeChild node) { def writer = new StringWriter() writer << new StreamingMarkupBuilder().bind { mkp.declareNamespace('':node[0].namespaceURI()) mkp.yield node } new XmlNodePrinter().print(new XmlParser().parseText(writer.toString())) } Any advice? Thank you! Misha

    Read the article

  • regex to match trailing whitespace, but not lines which are entirely whitespace (indent placeholders

    - by Tim
    I've been trying to construct a ruby regex which matches trailing spaces - but not indentation placeholders - so I can gsub them out. I had this /\b[\t ]+$/ and it was working a treat until I realised it only works when the line ends are [a-zA-Z]. :-( So I evolved it into this /(?!^[\t ]+)[\t ]+$/ and it seems like it's getting better, but it still doesn't work properly. I've spent hours trying to get this to work to no avail. Please help. Here's some text test so it's easy to throw into Rubular, but the indent lines are getting stripped so it'll need a few spaces and/or tabs. Once lines 3 & 4 have spaces back in, it shouldn't match on lines 3-5, 7, 9. some test test some test test some other test (text) some other test (text) likely here{ dfdf } likely here{ dfdf } and this ; and this ; Alternatively, is there an simpler / more elegant way to do this?

    Read the article

  • Avoid XmlDocument validating namespaces in C#

    - by Abbey Kingston
    Hello, I'm trying to find a way of indenting a HTML file, I've been using XMLDocument and just using a XmlTextWriter. However I am unable to format it correctly for HTML documents because it checks the doctype and tries to download it. Is there a "dumb" indenting mechanism that doesnt validate or check the document and does a best effort indentation? The files are 4-10Mb in size and they are autogenerated, we have to handle it internal - its fine, the user can wait, I just want to avoid forking to a new process etc. Essentially, right now I use a MemoryStream, XmlTextWriter and XmlDocument, once indented I read it back from the MemoryStream and return it as a string. Failures happen for XHTML documents and some HTML 4 documents because its trying to grab the dtds. I tried setting XmlResolver as null but to no avail :(

    Read the article

  • Why does does my stack overflow error occur after 518669 specifically?

    - by David
    I created a java program to count up toward infinity: class up { public static void up (int n) { System.out.println (n) ; up (n+1) ; } public static void main (String[] arg) { up (1) ; } } i didn't actually expect it to get there but the thing that i noticed that was a bit curious was that it stopped at the same number each time: 518669 what is the significance of this number? (or of this number +1 i suppose). (also as a bit of an aside question, I've been told that the way i format my code is bad [indentation and such] what am i doing that isn't desirable?)

    Read the article

  • Opposite of nl2br? Is it str_replace?

    - by Julian H. Lam
    So the function nl2br is handy. Except in my web app, I want to do the opposite, interpret line breaks as new lines, since they will be echoed into a pre-filled form. str_replace can take <br /> and replace it with whatever I want, but if I put in \n, it echoes literally a backslash and an n. It only works if I put a literal line break in the middle of my script, and break the indentation (so there are no trailing space). See: <?=str_replace('<br />',' ',$foo)?> Am I missing escape characters? I think I tried every combination...

    Read the article

  • [C#] how do I get the height of a rich text content after word wrap?

    - by Led
    Question A. Given 1. A string in rich text format that may have paragraph, tabs, space, line break, indentation, (or even image?) 2. A width for the word wrapping rich text control/editor How do I know the height of the content after it have performed all the word wrapping? Is there something like int MeasureRichTextHeightAfterWordWrap(string aRichTextContent, int aWidth)? Otherwise how does those rich text control know how much to autosize? Do I have to actually place the content on a dummy rich text control and get its height afterwards? Question B. Similar to question A but in plain text onto a plain text memo/control/editor. And manually draw string with manually calculated indentations, breaks, word wrappings. Is it easier or harder?

    Read the article

  • zen of Python vs with statement - philosophical pondering

    - by NeuronQ
    I don't intend to simply waste your time, but: has it occurred to you too, while using Python's with statement that it really is contrary to the 5th line of "The Zen of Python" that goes "Flat is better than nested"? Can any enlightened Python guru share me some of their insights on this? (I always find that one more level of indentation pops up in my code every time I use with instead of f.close()... and it's not like I'm not gonna use try: ... finally: ... anyways and thus the benefits of with still elude me, even as I grow to like and understand Python more and more...)

    Read the article

  • Is there a code style enforcer?

    - by Petruza
    I'm working with websites written in PHP, along with many other programmers, and sometimes I have to deal with really awful code. Indentation totally messed up, curly braces in the wrong places, terrible whitespace use, it really hurts my eyes and actually makes my work harder and take longer. Is there a tool where you can specify your coding style and then it applies it to files? I'm sure there must be such functions in different IDEs, but I need an independent tool as I code with simple notepads like Notepad++ or the like. ( if it's such a function in Notepad++, I didn't see it )

    Read the article

  • How to make an NSOutlineView indent multiple columns?

    - by Rinzwind
    What would be the easiest or recommended way for making an NSOutlineView indent multiple columns? By default, it only indents the outline column; and as far as I know there is no built-in support for making it indent other columns. I have an NSOutlineView which shows a comparison between two sets of hierarchical data. For visual appeal, if some item in the outline column is indented, I'd like to indent the item on the same row in another column by the same indentation amount. (There's also a third column which shows the result of comparing the two items, this column should never be indented.) Can this only be achieved by subclassing NSOutlineView? And what would need to be overridden in the subclass? Or is there an easier way to get it to indent multiple columns?

    Read the article

  • Algorithm - Numbering for TOC (Table of Contents)

    - by belisarius
    I want to implement a VBA function to number Excel rows based upon the grouping depth of the row. But I think a general algorithm for generating TOCs is more interesting. The problem is: Given a list of "indented" lines such as One Two Three Four Five Six (the "indentation level" may be assumed to be known and part of the input data) To generate the following output: 1. One 1.1 Two 1.1.1 Three 1.1.1.1 Four 1.2 Five 2. Six Of course my code is up and running ... and also hidden under THWoS (The Heavy Weight of Shame)

    Read the article

  • Haskell simple compilation bug

    - by fmsf
    I'm trying to run this code: let coins = [50, 25, 10, 5, 2,1] let candidate = 11 calculate :: [Int] calculate = [ calculate (x+candidate) | x <- coins, x > candidate] I've read some tutorials, and it worked out ok. I'm trying to solve some small problems to give-me a feel of the language. But I'm stuck at this. test.hs:3:0: parse error (possibly incorrect indentation) Can anyone tell me why? I've started with haskell today so please go easy on the explanations. I've tried to run it like: runghc test.hs ghc test.hs but with: ghci < test.hs it gives this one: <interactive>:1:10: parse error on input `=' Thanks

    Read the article

  • Why is there no code-folding in emacs ?

    - by Pierre
    There are several questions on SO about how to get code folding in emacs, without having to add any special characters like "markers" in the comments for example. Someone said that there was "no perfect solution." It seems that it could be done by parsing the source of the program being written and look for matching parenthesis or bracket, or to do it based on indentation. You could also use a combination of scripts that use different methods. So why is it commonly accepted that there is no "perfect" and straightforward way to get code-folding in emac? Is there something in emacs or its architecture that makes it hard to program? If it were easy, after so many years of smart people using emacs you would think that someone would have wrote it.

    Read the article

  • how do I get the height of a rich text content after word wrap?

    - by Led
    Question A. Given 1. A string in rich text format that may have paragraph, tabs, space, line break, indentation, (or even image?) 2. A width for the word wrapping rich text control/editor How do I know the height of the content after it have performed all the word wrapping? Is there something like int MeasureRichTextHeightAfterWordWrap(string aRichTextContent, int aWidth)? Otherwise how does those rich text control know how much to autosize? Do I have to actually place the content on a dummy rich text control and get its height afterwards? Question B. Similar to question A but in plain text onto a plain text memo/control/editor. And manually draw string with manually calculated indentations, breaks, word wrappings. Is it easier or harder?

    Read the article

  • How to move sub-headings to under other headings in emacs org-mode

    - by Mittenchops
    My list looks like this: * TODAY ** TODO Item 1 ** TODO Item 2 * TOMORROW ** TODO Item 3 ** TODO Item 4 ...as a single list, based on some advice I received here. I'd like to move TODO Item 2 from under TODAY to under TOMORROW. The manual says: M-up M-down Move the item including subitems up/down (swap with previous/next item of same indentation). If the list is ordered, renumbering is automatic. But while I can change the places of Item 1 and Item 2, I cannot move Item 2 outside of the Today heading---I cannot move it down under TOMORROW to proceed Item 3. The buffer tells me: cannot move past superior level or buffer limit org mode What is the keystroke that lets me move sub-items "past superior level" to under new headings?

    Read the article

  • Sizing of a UITableViewCell

    - by Xetius
    I have created a UITableViewCell derived class which resizes itself to display at an indentation level. I have tried setting indentationLevel and indentationWidth using the following in the ViewControllers cellForRowAtIndexPath: cell.indentationLevel = [[item objectForKey:@"indent"] intValue]; cell.indentationWidth = CELL_INDENT_SIZE; This in itself does not indent the cell, so I am using the following layoutSubviews in the UITableViewCell: -(void)layoutSubviews { CGFloat indentSize = (self.indentationLevel - 1) * self.indentationWidth; CGRect r = containerView.frame; containerView.frame = CGRectMake (r.origin.x + indentSize, r.origin.y, r.size.width - indentSize, r.size.height); DLog(@"frameRect : %f, %f, %f, %f, %f",indentSize, r.origin.x, r.origin.y, r.size.width, r.size.height); [super layoutSubviews]; } This works fine for the initial layout, but when the cell is selected, it recalculates itself from the new dimensions and effectively shrinks the cell every time it is selected. How can I resize this cell so that it doesn't keep changing the layout.

    Read the article

  • how to get latex to hyphenate a word that contains a dash ?

    - by Gyom
    In a latex document I'm writing, I get an overfull hbox warning because of the word "multi-disciplinary", which happens to be rendered at the end of a line. I can get rid of this particular warning by changing it into multi-discipli\-nary, but the same problem will happen elsewhere, since this word is used a lot in the paper. I'd like to use the \hyphenation{} command instead, but obviously my tentative \hyphenation{multi-disci-pli-na-ry} does not work, because it does not understand the first dash correctly. What incantation do I need to get correct indentation in a word that already contains a dash ? Bonus question: where could I have found the answer to that question myself ?

    Read the article

  • Django's manage.py shell won't indent

    - by hora
    I seem to have run into a strange bug or more likely some setting I am unfamiliar with on my system that is not allowing me to tab when I am in Django's shell (python manage.py shell is how I run it). For obvious reasons this is proving to be annoying since I can't do any loops or conditonals in the shell. If I hit tab it completes all functions that are available to me, like bash does in a terminal. I've tried just using spaces for my indents but I always get an indentation error. Does anyone know why this is happening and what I can do to get tab to work in my shell again? (It may be relevant to know that this is on a Ubuntu 9.04 system). Edit: tab works fine in the regular pythong shell, it's only in django's that it doesn't. Thanks.

    Read the article

  • Can Eclipse parse and use emacs-style meta information in source code?

    - by ataylor
    In emacs, it is possible to start a file off with a line this: /* -*- mode: java; c-basic-offset: 4; indent-tabs-mode: nil -*- */ This instructs emacs to use 4 spaces for indentation. I like the idea of storing this coding style meta-information directly and explicitly in the source code. Are there any options for doing this in other IDEs? Does eclipse in particular have the ability to configure itself from a line in the emacs format or something equivalent?

    Read the article

  • Emacs cheat sheet that lists equivalents to everyday vim commands

    - by Yktula
    There were two things that I want to know how to do in Emacs (23.2, *nix): Go to the first character after indentation in a line Go to the first character that's the equivalent to a given character (an equivalent to vim's fx command that goes forward until it hits the x character; maybe C-s (incremental search) is the best way to do this) But, I think it would be better if I had a cheat sheet that listed navigational bindings. Maybe Emacs (self-documenting) can do this on it's own. Is there a list of commands that are equivalent to vim's default commands anywhere? How about a list of navigational key-bindings in Emacs?

    Read the article

  • Is there a shorthand version of HTML available?

    - by monguin
    I remember reading an article about a shorthand version, or extension, of HTML a few months ago. Its purpose was to make HTML code significantly more concise, by removing end tags, and it may have allowed loops of some sort as well. I want to use it now, but I can't seem to remember what it was called. Searching online, I found HAML, but HAML syntax doesn't look like the example that I remember from the article. The syntax from the article made use of right angle brackets, which were a sort of replacement for indentation. Can anyone identify this language?

    Read the article

  • What is the preferred way to indent cases in a switch?

    - by neutrino
    Hey there, As I was writing another switch in Eclipse, I once again came across a rather weird (to me, at least) default indentation, which is applied to 'switch' statements: switch (i) { case 1: ... case n: ... } I tend to prefer another way: switch (i) { case 1: ... case n: ... } Which way is more readable and eye-pleasing for you? I'm still not hundred percent determined what's best for me, so I'd like to stick to what's best for other people who would read my code. BTW, you're free to close this question if this is too subjective. :)

    Read the article

  • How to implement a C# interface in F#?

    - by Anton Andreev
    I would like to implement the following C# interface in F#: using System; using System.Collections.Generic; using System.Linq; using System.Text; using Mono.Addins; [TypeExtensionPoint] public interface ISparqlCommand { string Name { get; } object Run(Dictionary<string, string> NamespacesDictionary, org.openrdf.repository.Repository repository, params object[] argsRest); } This is what I have tried, but it gives me: "Incomplete structured construct at or before this point in expression" #light module Module1 open System open System.Collections.Generic; type MyClass() = interface ISparqlCommand with member this.Name = "Finding the path between two tops in the Graph" member this.Run(NamespacesDictionary, repository, argsRest) = new System.Object What am I doing wrong? Maybe indentation is wrong?

    Read the article

  • Are there any lint tools for C and C++ that check formatting?

    - by Nathan Fellman
    I have a codebase that is touched by many people. While most people make an effort to keep the code nicely formatted (e.g. consistent indentation and use of braces), some don't, and even those that do can't always do it because we all use different editors, so settings like spaces vs. tabs are different. Is there any standard lint tool that checks that code is properly formatted, but doesn't actually change it (like indent but that returns only errors and warnings)? While this question could be answered generally, my focus is on C and C++, because that's what this project is written in.

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12  | Next Page >