Search Results

Search found 237 results on 10 pages for 'braces'.

Page 7/10 | < Previous Page | 3 4 5 6 7 8 9 10  | Next Page >

  • 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

  • In JQuery 1.4.2 .ajax converts JSON wrong.

    - by Carl
    My code worked fine in JQuery 1.3.2, but in 1.4.2 it seems to be broken. What is should get in the post is something like this: ?pks=108;pks=107 What I now get is: ?pks[]=108;pks[]=107; When I trace this code through, the JSON object seems to be fine until it enters .ajax. Firebug after the response is received shows the post was: Parameters application/x-www-form-urlencoded pks[] 108 pks[] 107 Source pks%5B%5D=108&pks%5B%5D=107 Which is not what I got on JQuery 1.3.2. Where are those extra braces coming from?

    Read the article

  • Are there any widespread, modern Java coding conventions?

    - by brianegge
    Sun's "Code Conventions for the Java Programming Language" was last updated April 1999. Ten years later a lot has changed in the language, as well as general usage patterns. Are there more up to date, widely adopted standards? Most guidelines omit specifying file encoding and line endings. Sun recommends mixed tabs and spaces. The Eclipse IDE defaults to Eclipse's standard, which is tabs only. The Maven style guide is spaces only. Many style guides, such as JBoss, follow Sun's guidelines, but prefer K&R braces instead of OTBS. Each Apache project has it's own style guide, with slight differences between each one.

    Read the article

  • Using MySQL as data source in Microsoft SQL Server Analysis Services

    - by coldilocks
    Hi, I have installed the latest .net connector (http://www.mysql.com/downloads/connector/net/), I can add MySQL databases as Data Sources, I can even browse through the data from Business Intelligence Studio. The problem is that I CANNOT create a datasource view, or if I do create one without tables, trying to add them after the fact gives me the same error. Specifically it looks like the data source view wizard tries to submit queries against the MySQL database using square brackets/braces, and the query bombs. I get an error message like: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[my_db].[cheatType]' at line 2 So, in summary, has anyone been able to create a data source view using MySQL tables and, if so, can they please show me how this can be done. Thanks for any help!

    Read the article

  • disable eclipse auto completion

    - by SpliFF
    I love Eclipse but I HATE auto-completion with a vengeance! I swear though, no matter how hard I look in prefs or Google I can't find where I turn this off! I'm having the problem with both CFEclipse and the PHP editor. How do I completely disable all "smart" quotes/tags/braces auto-inserting. Not some of it.. ALL of it. No matter how many options I untick both editors keep trying to finish my code for me.. usually with irritating results. Like this one (PHP editor): <img alt="banner" src="/images/banner.jpg"></img> This is HTML, not XHTML - I don't want, or need, my img tags closed. Anyway this is still happening after I've gone to Preferences | PHP | Editor | Typing and Preferences | PHP | Editor | Code Assist and unchecked every option. I can't be the only one having this issue but I can't find any howtos or help on this.

    Read the article

  • Which variables can be accessed with the ${...} syntax in a Struts tag in a JSP page?

    - by Bernhard V
    Hi, I'm getting a little bit frustrated since I can't find out which variables I can access with the ${...} syntax in a Struts tag, placed in a JSP page. As an example I've got the following code: Where does the object "status.menueStatus" have to be defined in order to can be accessed with a dollar sign and braces. Is it defined in another struts tile or in the form? Whether within our project code nor by Google I can get any help. Your support would be very appreciated. Thank you. Bernhard

    Read the article

  • Matching tag in HTML keyboard shortcut

    - by kape123
    Is there a shortcut in Visual Studio (2008) that will allow me to jump to matching HTML tag... as CTRL+] does for matching braces when you are in code view? Example: <table> <tr> <td> </td> </tr> </table|> Cursor is on closing table tag and I would like to press something like CTRL+] to jump to opening table tag. Any ideas?

    Read the article

  • How do I run a vim script that alters the current buffer?

    - by Dan
    I'm trying to write a beautify.vim script that makes C-like code adhere to a standard that I can easily read. My file contains only substitution commands that all begin with %s/... However, when I try to run the script with my file open, in the manner :source beautify.vim, or :runtime beautify.vim, it runs but all the substitute commands state that their pattern wasn't found (patterns were tested by entering them manually and should work). Is there some way to make vim run the commands in the context of the current buffer? beautify.vim: " add spaces before open braces sil! :%s/\%>1c>\s\@<!{/ {/g " beautify for sil! :%s/for *( *\([^;]*\) *; *\([^;]*\) *; *\([^;]*\) *)/for (\1; \2; \3)/ " add spaces after commas sil! :%s/,\s\@!/, /g In my tests the first :s command should match (it matches when applied manually).

    Read the article

  • Is there a decent JSON editor around?

    - by al4nis
    I'm looking for a JSON editor that is able to do syntax checking and outline view. Browser-based editors are not an option as they are clumsy for editing lots of local files. Eclipse plug-in would be ideal, but I would be happy with anything that works. I found only two so far, those in Aptana Studio Pro and Spket IDE (both available as plug-ins for Eclipse). While they have decent outline views, their syntax checking doesn't catch most of the common errors (like missing commas or braces) which makes them almost useless.

    Read the article

  • What is the most efficient way to find missing semicolons in VS with C++?

    - by Dr. Monkey
    What are the best strategies for finding that missing semicolon that's causing the error? Are there automated tools that might help. I'm currently using Visual Studio 2008, but general strategies for any environment would be interesting and more broadly useful. Background: Presently I have a particularly elusive missing semicolon (or brace) in a C++ program that is causing a C2143 error. My header file dependencies are fairly straightforward, but still I can't seem to find the problem. Rather than post my code and play Where's Wally (or Waldo, depending on where you're from) I thought it would be more useful to get some good strategies that can be applied in this and similar situations. As a side-question: the C2143 error is showing up in the first line of the first method declaration (i.e. the method's return type) in a .cpp file that includes only its associated .h file. Would anything other than semicolons or braces lead to this behaviour?

    Read the article

  • Why is one Func valid and the other (almost identical) not.

    - by runrunraygun
    private static Dictionary<Type, Func<string, object>> _parseActions = new Dictionary<Type, Func<string, object>> { { typeof(bool), value => {Convert.ToBoolean(value) ;}} }; The above gives an error Error 14 Not all code paths return a value in lambda expression of type 'System.Func<string,object>' However this below is ok. private static Dictionary<Type, Func<string, object>> _parseActions = new Dictionary<Type, Func<string, object>> { { typeof(bool), value => Convert.ToBoolean(value) } }; I don't understand the difference between the two. I thought the extra braces in example1 are to allow us to use multiple lines in the anon function so why have they affected the meaning of the code?

    Read the article

  • Is there anyone out there that codes like I do?

    - by Jacob Relkin
    Hi, Some people have told me that my coding style is a lot different than theirs. I think I am somewhat neurotic when it comes to spacing and indenting though. Here's a snippet to show you what I mean: - ( void ) applicationDidFinishLaunching: ( UIApplication *) application { SomeObject *object = [ [ SomeObject alloc ] init ]; int x = 100 / 5; object.someInstanceVariable = ( ( 4 * x ) + rand() ); [ object someMethod ]; } Notice how I space out all of my brackets/parentheses, start curly braces on the same line, "my code has room to breathe", so to speak. So my questions are a) is this normal and b) What's your coding style?

    Read the article

  • Why is there so much poorly indented code out there?

    - by dsimcha
    The more I browse the code to open source projects in languages that aren't Python, the more I realize that it seems a lot of programmers don't believe in proper indentation. (I won't mention any projects specifically to avoid having anyone take this question too personally.) Usually code is indented, but in a way just different enough from the standard style that it drives me crazy, especially in old/crufty code. I've noticed that when I write in C-like languages, I tend to indent correctly as religiously as when I'm writing in Python, with the exception of debugging code that I actually want to stick out like a sore thumb. Given how easy it is with a modern IDE to fix incorrect indentation, what are some rationales for not religiously keeping indentation in sync with braces?

    Read the article

  • Branching logic in an MVC view

    - by Alex Kilpatrick
    I find myself writing a lot of code in my views that looks like the code below. In this case, I want to add some explanatory HTML for a novice, and different HTML for an expert user. <% if (ViewData["novice"] != null ) { % some extra HTML for a novice <% } else { % some HTML for an expert <% } % This is presentation logic, so it makes sense that it is in a view vs the controller. However, it gets ugly really fast, especially when ReSharper wants to move all the braces around to make it even uglier (is there a way to turn that off for views?). My question is whether this is proper, or should I branch in the controller to two separate views? If I do two views, I will have a lot of duplicated HTML to maintain. Or should I do two separate views with a shared partial view of the stuff that is in common?

    Read the article

  • Is there anyone out there that codes like me?

    - by Jacob Relkin
    Hi, Some people have told me that my coding style is a lot different than theirs. I think I am somewhat neurotic when it comes to spacing and indenting though. Here's a snippet to show you what I mean: - ( void ) applicationDidFinishLaunching: ( UIApplication *) application { SomeObject *object = [ [ SomeObject alloc ] init ]; int x = 100 / 5; object.someInstanceVariable = ( ( 4 * x ) + rand() ); [ object someMethod ]; } Notice how I space out all of my brackets/parentheses, start curly braces on the same line, "my code has room to breathe", so to speak. So my questions are a) is this normal and b) What's your coding style?

    Read the article

  • php foreach as variable

    - by user167850
    I'd like to use foreach to loop though an array list and add an element to each array. $tom = array('aa','bb','cc'); $sally = array('xx','yy','zz'); $myArrays = array('tom','sally'); foreach($myArrays as $arrayName) { ${$arrayName}[] = 'newElement'; } Is the use of ${$arrayName}[] the best way to do this? Is there another option rather than using curly braces? It currently works but I'm just wondering if there is a better alternative. Thanks

    Read the article

  • How do i translate this to "simpler" JavaScript?

    - by Julian Weimer
    Since i'm working with Titanium i realzed that its current JavaScript Interpreter doesn't accept specific coding-styles. So for for-loops and if-statements i have to have braces, even though i only want to span one line. Furthermore there is more i have to change if i want to use a Javascript Library like underscore.js. This is what Titanium doesn't want to see: if (!(result = result && iterator.call(context, value, index, list))) {_.breakLoop();} if (nativeSome && obj.some === nativeSome) {return obj.some(iterator, context);} var computed = iterator ? iterator.call(context, value, index, list) : value; computed >= result.computed && (result = {value : value, computed : computed}); Can i use a simpler syntax to describe the logic behind those lines of code?

    Read the article

  • Joomla Session Variable as Plugin Parameter

    - by dosboy
    I have a Joomla plugin which takes varying parameters. I need to retrieve one of these parameters from the current session. I've tried using Jumi and a little PHP snipped to retrieve the value and output it in the plugin's parameter list, but the Joomla plugin parser only handles the outter-most set of curly braces. ex. {fabrik view=table id=62 resetfilters=1 fab_tours_ro___tour_id=[tour_id]} [tour_id] I need to retrieve from the current session. I've tried {fabrik view=table id=62 resetfilters=1 fab_tours_ro___tour_id={jumi [scripts/get_tour_id.php]}} In that case the {jumi} tag never gets parsed. I could hack the {fabrik} plugin, but I'd prefer to do this without making any core or component changes, especially since I update Fabrik quite regularly via svn.

    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

  • What is the term(s) used to describe programming language syntax?

    - by Mr Roys
    Is there an exact/correct term to describe this difference between the syntax/constructs of programming langauges e.g VB6 with its (if ... else ... endif) and C# with its curly braces for conditional statements. I'm using VB6 syntax and C# as examples since I'm more familiar with their syntax. For example, Visual Basic 6's syntax uses a more verbose, natural language like structure. If (id = 0) Then id = MyObject.Add(Me) Else Call MyObject.Update(Me) End If while C# has more concise syntax like: if (id == 0) { id = MyObject.Add(this); } else { MyObject.Update(this); } Conciseness? Natural languageness? Or is there a more "scientific" word for describing syntax?

    Read the article

  • How to replace all the blanks within square brackets with an underscore using sed?

    - by Ringerrr
    I figured out that in order to turn [some name] into [some_name] I need to use the following expression: s/\(\[[^ ]*\) /\1_/ i.e. create a backreference capture for anything that starts with a literal '[' that contains any number of non space characters, followed by a space, to be replaced with the non space characters followed by an underscore. What I don't know yet though is how to alter this expression so it works for ALL underscores within the braces e.g. [a few words] into [a_few_words]. I sense that I'm close, but am just missing a chunk of knowledge that will unlock the key to making this thing work an infinite number of times within the constraints of the first set of []s contained in a line (of SQL Server DDL in this case). Any suggestions gratefully received....

    Read the article

  • Beginner C: error: control reaches end of non-void function?

    - by Ting
    I'm trying to make a greedy algorithm and I get this error: greedy2.c:27:1: error: control reaches end of non-void function [-Werror,-Wreturn-type] } ^ 1 error generated. with this code: int man(int argc, char* argv[]) { float amount; do { printf("Input dollar amount owed:\n"); amount = GetFloat(); } while (amount <= 0); int coins = 0; while (amount >= 0.25); { amount = amount - 0.25; coins++; } printf("Number of coins to use: %d\n", coins); } What is wrong with my curly braces, and how do I fix it?

    Read the article

  • Tune cindent "switch" indentation

    - by Don Reba
    Nemerle is a C-like language and mostly works very well with cindent. However, its construct analogous to switch is called match: match (x) { | "Hello World" => ... | _ => ... } Is it possible to get the cinoptions for switch statements to apply to this construct, instead? Maybe there is a regular expression I can set somewhere. If not, can I get the vertical bars to align with the braces another way?

    Read the article

  • Getting automatic matching brace in vim

    - by Bob
    I spend WAY to much time fumbling around because vim doesn't handle closing braces like most IDEs do. Here's what I want to happen: type this: if( whatever ) { <CR> where <CR> mean hit the enter key and get this: if( whatever ) { | } where | is the position of the cursor. It's what Eclipse does. It's what Visual Studio does. And it's what I want Vim to do. I've seen a few plugins, tried a few, and none of them seem to give me this behavior. Surely I can't be the first programmer to want this.

    Read the article

  • Removing certain characters in all rows that match a regex?

    - by user001
    I'd like to change {foo, {bar}, foobar} to {foo, bar, foobar} in all rows that match '{.*{'. I.e. remove all curly braces { and } except the outer most pair. So doing mysql -h $H -u $U -p$P $DB -B -e "SELECT id FROM t WHERE col REGEXP '{.*{'" > bad.txt selects all the rows that will need this substitution. How do I make this substitution very quickly? EDIT: Could I do it by update table set column = REPLACE(column,'{',''); Then restore the out most pair update table set column = REPLACE(column,'^','{'); update table set column = REPLACE(column,'$','}');

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10  | Next Page >