Search Results

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

Page 1/10 | 1 2 3 4 5 6 7 8 9 10  | Next Page >

  • Curly braces on their own line or not?

    - by TomWij
    Should curly braces be on their own line or not? What do you think about it? if (you.hasAnswer()) { you.postAnswer(); } else { you.doSomething(); } or should it be if (you.hasAnswer()) { you.postAnswer(); } else { you.doSomething(); } or even if (you.hasAnswer()) you.postAnswer(); else you.doSomething(); Please be constructive! Explain why, share experiences, back it up with facts and references... ;-)

    Read the article

  • Parameters with braces in python

    - by Leif Andersen
    If you look at the following line of python code: bpy.ops.object.particle_system_add({"object":bpy.data.objects[2]}) you see that in the parameters there is something enclosed in braces. Can anyone tell me what the braces are for (generically anyway)? I haven't really seen this type of syntax in python and I can't find any documentation on it. Any help is greatly appreciated. Thank you.

    Read the article

  • Extract string between matching braces in Perl

    - by Srilesh
    My input file is as below : HEADER {ABC|*|DEF {GHI 0 1 0} {{Points {}}}} {ABC|*|DEF {GHI 0 2 0} {{Points {}}}} {ABC|*|XYZ:abc:def {GHI 0 22 0} {{Points {{F1 1.1} {F2 1.2} {F3 1.3} {F4 1.4}}}}} {ABC|*|XYZ:ghi:jkl {JKL 0 372 0} {{Points {}}}} {ABC|*|XYZ:mno:pqr {GHI 0 34 0} {{Points {}}}} { ABC|*|XYZ:abc:pqr {GHI 0 68 0} {{Points {{F1 11.11} {F2 12.10} {F3 14.11} {F4 16.23}}}} } TRAILER I want to extract the file into an array as below : $array[0] = "{ABC|*|DEF {GHI 0 1 0} {{Points {}}}}" $array[1] = "{ABC|*|DEF {GHI 0 2 0} {{Points {}}}}" $array[2] = "{ABC|*|XYZ:abc:def {GHI 0 22 0} {{Points {{F1 1.1} {F2 1.2} {F3 1.3} {F4 1.4}}}}}" .. .. $array[5] = "{ ABC|*|XYZ:abc:pqr {GHI 0 68 0} {{Points {{F1 11.11} {F2 12.10} {F3 14.11} {F4 16.23}}}} }" Which means, I need to match the first opening curly brace with its closing curly brace and extract the string in between. I have checked the below link, but this doesnt apply to my question. http://stackoverflow.com/questions/413071/regex-to-get-string-between-curly-braces-i-want-whats-between-the-curly-braces I am trying but would really help if someone can assist me with their expertise ... Thanks Sri ...

    Read the article

  • Emacs braces indentation

    - by Zurahn
    I can't for the life of me find any answer to this through conventional Internet means, so I'm hoping for some help. Emacs for me right now tends to do indentation on braces as follows: if( ... ) { } Which I find incredibly irritating; I've never even seen this behaviour anywhere else. At any rate, the behaviour I'm expecting is, if( ... ) { } If anyone knows how to modify this, it'd be greatly appreciated.

    Read the article

  • Odd compiler error on if-clause without braces

    - by DisgruntledGoat
    The following Java code is throwing a compiler error: if ( checkGameTitle(currGame) ) ArrayList<String> items = parseColumns( tRows.get(rowOffset+1), currGame, time, method ); checkGameTitle is a public static function, returning a boolean. The errors are all of the type "cannot find symbol" with the symbols being variable ArrayList, variable String and variable items. However, if I add {curly braces} then the code compiles with no errors. Why might this be? Is there some ambiguity on the if clause without them?

    Read the article

  • Matching innermost braces with regex or strpos?

    - by rich97
    I have a sort of mini parsing syntax I made up to help me streamline my view code in cakephp. Basically I have created a table helper which, when given a dataset and (optionally) a set of options for how to format the data will render out a table, as opposed to me looping though the data and editing it manually. It allows the user to be as complex or as simple as they like, it can get pretty powerful. However, In order to achieve this I had to make a simple parsing syntax. As a quick example the user would do something like so: $this->Table->data = $userData; $this->Table->elements['td']['data'] = array( '{:User.username:}', '{:User.created:}' => array('Time::nice') ); echo $this->Table->render(); And when rendering the table would then generate: <table> <tbody> <tr><td>rich97</td><td>Sun 21st 02:30pm</td></tr> </tbody> </table> The problem occurs then I try to nest the braces like so: {:User.levels.iconClasses.{:User.access:}:} Is there anyway I can only get the inner most brackets on the first time round and loop though until there are no matches? Or even do it in one go? Or even better use strpos? Here is my regex as it stands: '/\{\:([^}]+)\:\}/'

    Read the article

  • Parsing scripts that use curly braces

    - by Keikoku
    To get an idea of what I'm doing, I am writing a python parser that will parse directx .x text files. The problem I have deals with how the files are formatted. Although I'm writing it in python, I'm looking for general algorithms for dealing with this sort of parsing. .x files define data using templates. The format of a template is template_name { [some_data] } The goal I have is to parse the file line-by-line and whenever I come across a template, I will deal with it accordingly. My initial approach was to check if a line contains an opening or closing brace. If it's an open brace, then I will check what the template name is. Now the catch here is that the open brace doesn't have to occur on the same line as the template name. It could just as well be template_name { [some_data] } So if I were to use my "open brace exists" criteria, it won't work for any files that use the latter format. A lot of languages also use curly braces (though I'm not sure when people would be parsing the scripts themselves), so I was wondering if anyone knows how to accurately get the template name (or in some other languages, it could just as well be a function name, though there aren't any keywords to look for)

    Read the article

  • Pythonic Java. Yes, or no?

    - by OscarRyz
    Python use of indentation for code scope was initially very polemic and now is considered one of the best language features, because it helps ( almost by forcing us ) to have a consistent style. Well, I saw this post http://bit.ly/hmvTe9 where someone posted Java code with ; y {} aligned to the right margin to look more pythonic. It was very shocking at first ( as a matter of fact, if I ever see Java code like that in one of my projects I would be scared! ) However, there is something interesting here. Do we need all those braces and semicolons? How would the code would look like without them? class Person int age void greet( String a ) if( a == "" ) out.println("Hello stranger") else out.printf("Hello %s%n", a ) int age() return this.age class Main void main() new Person().greet("") Looks good to me, but in such small piece of code is hard to appreciate it, and since I don't Python too much, I can't tell by looking at existing libraries if it would be cleaner or not. So I took the first file of a library named: jAlarms I found and this is the result: ( WARNING : the following image may be disturbing for some people ) http://pxe.pastebin.com/eU1R4xsh Obviously it doesn't compile. This would be a compiling version using right aligned {} and ; http://pxe.pastebin.com/2uijtbYM Question What would happen if we could code like this? Would it make things clearer? Would it make it harder? I see braces, and semicolons as help to the parser and we, as humans have get used to them, but do we really need them? I guess is hard to tell specially since many mainstream languages do use braces, C, C++, Java, C# JavaScript Assuming the compiler wouldn't have problems without them, would you use them? Please comment.

    Read the article

  • Braces (syntax) highlighting in OpenOffice Math formula text editor

    - by Oleksandr Bolotov
    When you use OpenOffice Math, in upper part you see formula and formula text editor in lower part. Almost like this: %sigma = 2 %mu %epsilon + %lambda Tr(%epsilon)I So my questions are: How to replace OpenOffice Math's formula text editor with own text editor? ... or how to enable braces (syntax) highlighting in embedded editor? ... are there any extensions for anything like this? I need this because sometimes it's too much braces and stuff and it's hard to distinguish which braces match each other. Please do not suggest me to use MathType Mathematica (or anything) instead of OpenOffice Math (because I'm almost happy with it:)

    Read the article

  • How can I extract a string between matching braces in Perl?

    - by Srilesh
    My input file is as below : HEADER {ABC|*|DEF {GHI 0 1 0} {{Points {}}}} {ABC|*|DEF {GHI 0 2 0} {{Points {}}}} {ABC|*|XYZ:abc:def {GHI 0 22 0} {{Points {{F1 1.1} {F2 1.2} {F3 1.3} {F4 1.4}}}}} {ABC|*|XYZ:ghi:jkl {JKL 0 372 0} {{Points {}}}} {ABC|*|XYZ:mno:pqr {GHI 0 34 0} {{Points {}}}} { ABC|*|XYZ:abc:pqr {GHI 0 68 0} {{Points {{F1 11.11} {F2 12.10} {F3 14.11} {F4 16.23}}}} } TRAILER I want to extract the file into an array as below : $array[0] = "{ABC|*|DEF {GHI 0 1 0} {{Points {}}}}" $array[1] = "{ABC|*|DEF {GHI 0 2 0} {{Points {}}}}" $array[2] = "{ABC|*|XYZ:abc:def {GHI 0 22 0} {{Points {{F1 1.1} {F2 1.2} {F3 1.3} {F4 1.4}}}}}" .. .. $array[5] = "{ ABC|*|XYZ:abc:pqr {GHI 0 68 0} {{Points {{F1 11.11} {F2 12.10} {F3 14.11} {F4 16.23}}}} }" Which means, I need to match the first opening curly brace with its closing curly brace and extract the string in between. I have checked the below link, but this doesnt apply to my question. http://stackoverflow.com/questions/413071/regex-to-get-string-between-curly-braces-i-want-whats-between-the-curly-braces I am trying but would really help if someone can assist me with their expertise ... Thanks Sri ...

    Read the article

  • Pass javascript array to php by using curly braces key name

    - by user7031
    My js code: $(function(){ var arr = new Array('jj', 'kk', 'oo'); $.post('test12.php', {'arr[]': arr}, function(data){ alert(data); }); }); PHP code: <?php echo print_r($_POST['arr']); The thing is,$.post receive a key named 'arr[]',it should be used in PHP as 'arr[]' instead of 'arr',but '$_POST['arr[]']' doesn't work,'arr' works.Which seems that Jquery might do something with curly braces '[]' before sending something to PHP. Secondly,when I remove the single quotas around 'arr[]',PHP can not receive anything by using $_POST['arr'];,I don't know why? Doing this task in a traditional way with no curly braces: $.post('test12.php', {arr: arr}, function(data){ alert(data); }); It works fine. So when sending javascript array to PHP,why bothering using single quote and curly braces like 'arr[]' instead of using a concise way like arr:arr My return result is Array( [0]=>jj [1]=>kk [2]=>oo ) 1 Notice there is a 1 under the array,why?

    Read the article

  • Curly braces in a URL

    - by lipton
    Often I have came across URLS like the following: http://www.isthisahacker.com/{7B643FB915-845C-4A76-A071-677D62157FE07D}.htm Do the curly braces in the URL above indicate some kind of attempt to access the registry, or is that a legitimate URL? It looks kind of suspicious to me.

    Read the article

  • php curly braces into array

    - by David
    Hi, I would like to check a opened .txt file for braces that open and close like below: file { nextopen { //content } } no this is not my own language or anything, but I want to get say the nextopen function and all the contents inside the brackets, and all the stuff from inside the file function and add it to an array if you know what i mean. so all the content inside the braces will be in an array. if you know how to do this please reply.

    Read the article

  • Netbeans braces placement issue

    - by KeyStroke
    Hi there, I'm trying to get Netbeans PHP to let me write braces in a new line instead of the same line, I mean like this: if($something == TRUE) { // some code here } However, when I write if($something == TRUE) then hit enter, Netbeans places the cursor incorrectly in the new line, like this: if($something == TRUE) { // some code here } I've already changed the braces placement option to be "New Line", but this still doesn't work properly. Any idea how I can fix this? Appreciate your help

    Read the article

  • Using curly braces with a standard pc keyboard on a mac laptop

    - by raoulsson
    I have a standard PC keyboard connection to my Mac laptop. All keys work fine but the special characters that need "Alt-Gr" as accelerator keys would not work. I have a Swiss layout where the curly braces are such special keys. However I need them all the time and having to get used to a different layout is too painful (I'd rather get used to a US Layout once and for all). Does anyone have an idea how to switch this? Note: I have managed to switch the option and the command key, so that's not my problem.

    Read the article

  • Silverlight 4 RichTextBox - can't restore Xaml with text containing curly braces

    - by fuzzyman
    We have a Silverlight application using the RichTextBox as a rich text editor for the user to create emails. We actually have our own serializer but essentially we are saving and restoring the Xaml. As far as I can tell it is impossible to restore any text containing curly braces. You can demonstrate this fairly easily by creating a RichTextBox and typing something similar to "{weird}" into it. Then take the .Xaml property of the textbox and set it on the .Xaml property of another textbox - kablooie. As we have our own serializer I have tried escaping the Text member of the Run elements with "". This makes no difference. I've tried replacing the braces with &#123; but that doesn't work either.

    Read the article

  • Putting curly braces in a sentences for specific words according to their start and end indexes

    - by Suneeta Singh
    I need to put curly braces in a sentence according to the indexes. Suppose my input sentence is: "I am a girl and I live in Nepal." and I need to put curly braces according to [12, 15], [2, 4], [23, 25] These indexes are corresponding to the words "am", "and" and "in" respectively. The required output should be: "I {am} a girl {and} I live {in} Nepal." I have tried using substring but after it replaces first word, it then shifts the characters by two indexes and that is the problem I am having. Can anyone provide me solution to get the required output?

    Read the article

  • Including variables inside curly braces in a Zend config ini file on Linux

    - by Dave Morris
    I am trying to include a variable in a .ini file setting by surrounding it with curly braces, and Zend is complaining that it cannot parse it properly on Linux. It works properly on Windows, though: welcome_message = Welcome, {0}. This is the error that is being thrown on Linux: : Uncaught exception 'Zend_Config_Exception' with message 'Error parsing /var/www/html/portal/application/configs/language/messages.ini on line 10 ' in /usr/local/zend/share/ZendFramework/library/Zend/Config/Ini.php:181 Stack trace: 0 /usr/local/zend/share/ZendFramework/library/Zend/Config/Ini.php(201): Zend_Config_Ini-&gt;_parseIniFile('/var/www/html/p...') 1 /usr/local/zend/share/ZendFramework/library/Zend/Config/Ini.php(125): Zend_Config_Ini-&gt;_loadIniFile('/var/www/html/p...') 2 /var/www/html/portal/library/Ingrain/Language/Base.php(49): Zend_Config_Ini-&gt;__construct('/var/www/html/p...', NULL) 3 /var/www/html/portal/library/Ingrain/Language/Base.php(23): Ingrain_Language_Base-&gt;setConfig('messages.ini', NULL, NULL) 4 /var/www/html/portal/library/Ingrain/Language/Messages.php(7): Ingrain_Language_Base-&gt;__construct('messages.ini', NULL, NULL, NULL) 5 /var/www/html/portal/library/Ingrain/Helper/Language.php(38): Ingrain_Language_Messages-&gt;__construct() 6 /usr/local/zend/share/ZendFramework/library/Zend/Contr in We are able to get the error to go away on Linux if we surround the braces with quotes, but that seems like a strange solution: welcome_message = Welcome, "{"0"}". Is there a better way to solve this issue for all platforms? Thanks for your help, Dave

    Read the article

  • braces for Math in LaTeX

    - by Tim
    Hi, Is there any convenient way to type in braces in Math in Latex? Especially when I have already typed in a lot of "(" and ")" instead of "\left(" and "\right)", how can I do a quick replacement? similarly for "{" and "}" and "[" and "]"? Is it important to make such changes? I am writing a thesis. Thanks and regards! BTW: I mainly edit latex file in Texmaker and I know how to use emacs.

    Read the article

1 2 3 4 5 6 7 8 9 10  | Next Page >