Search Results

Search found 489 results on 20 pages for 'brackets'.

Page 4/20 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Formatting php, what works more efficiently?

    - by JamesM-SiteGen
    Hello fellow programmers, I was just wondering what makes php work faster, I have a few methods that I always go and do, but that only improves the way I can read it, but how about the interpreter? Should I include the curly braces when there is only one statement to run? if(...){ echo "test"; } # Or.. if(...) echo "test"; === Which should be used? I have also found http://beta.phpformatter.com/ and I find the following settings to be good, but are they? Indentation: Indentation style: {K&R (One true brace style)} Indent with: {Tabs} Starting indentation: [1] Indentation: [1] Common: [x] Remove all comments [x] Remove empty lines [x] Align assignments statements nicely [ ] Put a comment with the condition after if, while, for, foreach, declare and catch statements Improvement: [x] Remove lines with just a semicolon (;) [x] Make normal comments (//) from perl comments (#) [x] Make long opening tag (<?php) from short one (<?) Brackets: [x] Space inside brackets- ( ) [x] Space inside empty brackets- ( ) [x] Space inside block brackets- [ ] [x] Space inside empty block brackets- [ ] Tiny var names: often I go through my code and change $var1 to $a, $var2 to $b and so on. I do include comments at the start of the file to show to me what each letter(s) mean.. Final note: So am I doing the right thing with the curly braces and the settings? Are there any great tips that help it run faster?

    Read the article

  • PyCharm: How to skip over closing braces / brackets / parentheses?

    - by Withnail
    This is driving me nuts. I can't get the auto-indentations to work properly unless I use the automatic closing of braces, et al (which I don't like), and I see no option allowing one to skip over/out. Eclipse has a configuration option for this, and Visual Studio doesn't auto-close everything by default, but rather formats the code block after manually entering the closing brace (which I think is perfect). Surely there's something apart from going all the way over to the "End" key?

    Read the article

  • Does this feature exist? Defining my own curly brackets in C#

    - by Carlos
    You'll appreciate the following two syntactic sugars: lock(obj) { //Code } same as: Monitor.Enter(obj) try { //Code } finally { Monitor.Exit(obj) } and using(var adapt = new adapter()){ //Code2 } same as: var adapt= new adapter() try{ //Code2 } finally{ adapt.Dispose() } Clearly the first example in each case is more readable. Is there a way to define this kind of thing myself, either in the C# language, or in the IDE? The reason I ask is that there are many similar usages (of the long kind) that would benefit from this, eg. if you're using ReaderWriterLockSlim, you want something pretty similar.

    Read the article

  • Should I use curly brackets or concatenate variables within strings?

    - by mririgo
    Straight forward question: Is there an advantage or disadvantage to concatenating variables within strings or using curly braces instead? Concatenated: $greeting = "Welcome, ".$name."!"; Curly braces: $greeting = "Welcome, {$name}!"; Personally, I've always concatenated my strings because I use UEStudio and it highlights PHP variables a different color when concatenated. However, when the variable is not broken out, it does not. It just makes it easier for my eyes to find PHP variables in long strings, etc. EDIT: People are confusing this about being about SQL. This is not what this question is about. I've updated my examples to avoid confusion.

    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

  • referencing struct fields in c with square brackets and an index instead of . and ->?

    - by lsiebert
    Assuming I have a structure such as: typedef struct { char * string1; char * string2; } TWO_WORDS; such that all the fields are of the same type, and my main has TWO_WORDS tw; can I reference string1 with tw[0] and string2 with two[1]? If so: is this part of the c standard? do i have to cast the struct to an array first? what about fields which are different sizes in memory what about fields which are different types but the same size? can you do pointer arithmetic within a structure? -

    Read the article

  • How Do I Reference An Element By Name With [] Brackets In It?

    - by user384030
    How do you reference a element in jquery BY NAME that has the [] in it. <select name="values[]" multiple="true"> <option value="1">1</option> <option value="2">2</option> <option value="2">2</option> </select> <script type="text/javascript"> $('[name=values[]]'); </script> this should grab the element, but it does not work, I believe the [] in the name is messing it up, escaping it doesn't seem to work either. I can't figure out what I'm doing wrong

    Read the article

  • Table Naming Dilemma: Singular vs. Plural Names

    - by ProfK
    Convention has it that table names should be the singular of the entity that they store attributes of. I dislike any T-SQL that requires square brackets around names, but I have renamed a Users table to the singular, forever sentencing those using the table to sometimes have to use brackets. My gut feel is that it is more correct to stay with the singular, but my gut feel is also that brackets indicate undesirables like column names with spaces in them etc. Should I stay, or should I go?

    Read the article

  • I'm trying to match some numbers in a string using a regexpressions and am having difficulty with th

    - by Ryan
    here is the line i'm trying to parse [\\?\Volume{d3f7f470-526b-11df-92eb-001a647802d2}\] 85 90 NotFound I'm basically just trying to get the numbers that are outside of the brackets and ignore anything in between the brackets. My original syntax worked until I realized that sometimes there would be numbers in the brackets (I was just using "([0-99]{2})") any help would be greatly appreciated. Thanks

    Read the article

  • Mathematica Programming Language&ndash;An Introduction

    - by JoshReuben
    The Mathematica http://www.wolfram.com/mathematica/ programming model consists of a kernel computation engine (or grid of such engines) and a front-end of notebook instances that communicate with the kernel throughout a session. The programming model of Mathematica is incredibly rich & powerful – besides numeric calculations, it supports symbols (eg Pi, I, E) and control flow logic.   obviously I could use this as a simple calculator: 5 * 10 --> 50 but this language is much more than that!   for example, I could use control flow logic & setup a simple infinite loop: x=1; While [x>0, x=x,x+1] Different brackets have different purposes: square brackets for function arguments:  Cos[x] round brackets for grouping: (1+2)*3 curly brackets for lists: {1,2,3,4} The power of Mathematica (as opposed to say Matlab) is that it gives exact symbolic answers instead of a rounded numeric approximation (unless you request it):   Mathematica lets you define scoped variables (symbols): a=1; b=2; c=a+b --> 5 these variables can contain symbolic values – you can think of these as partially computed functions:   use Clear[x] or Remove[x] to zero or dereference a variable.   To compute a numerical approximation to n significant digits (default n=6), use N[x,n] or the //N prefix: Pi //N -->3.14159 N[Pi,50] --> 3.1415926535897932384626433832795028841971693993751 The kernel uses % to reference the lastcalculation result, %% the 2nd last, %%% the 3rd last etc –> clearer statements: eg instead of: Sqrt[Pi+Sqrt[Sqrt[Pi+Sqrt[Pi]]] do: Sqrt[Pi]; Sqrt[Pi+%]; Sqrt[Pi+%] The help system supports wildcards, so I can search for functions like so: ?Inv* Mathematica supports some very powerful programming constructs and a rich function library that allow you to do things that you would have to write allot of code for in a language like C++.   the Factor function – factorization: Factor[x^3 – 6*x^2 +11x – 6] --> (-3+x) (-2+x) (-1+x)   the Solve function – find the roots of an equation: Solve[x^3 – 2x + 1 == 0] -->   the Expand function – express (1+x)^10 in polynomial form: Expand[(1+x)^10] --> 1+10x+45x^2+120x^3+210x^4+252x^5+210x^6+120x^7+45x^8+10x^9+x^10 the Prime function – what is the 1000th prime? Prime[1000] -->7919 Mathematica also has some powerful graphics capabilities:   the Plot function – plot the graph of y=Sin x in a single period: Plot[Sin[x], {x,0,2*Pi}] you can also plot 3D surfaces of functions using Plot3D function

    Read the article

  • Layout of mathematical views (iOS)

    - by William Jockusch
    I am trying to figure out the right way to encapsulate graphical information about mathematical objects. It is not simple. For example, a matrix can include square brackets around its entries, or not. Some things carry down to sub-objects -- for example, a matrix might track the font size to be used by its entries. Similarly, the font color and the background color would carry down to the entries. Other things do not carry down. For example, the entries of the matrix do not need to know whether or not the matrix has those square brackets. Based on all of the above, I need to calculate sizes for everything, then frames. All of this can depend on the properties stored above. The size of a matrix depends on the sizes of its entries, and also on whether or not it has those brackets. What I am having a hard time with is not the individual ways to calculate sensible frames for this or that. It is the overall organizational structure of the whole thing. How can I keep track of it all without going crazy. One particular obstacle is worth mentioning -- for reasons I don't want to go into here, I need to calculate the sizes and frames for everything before I instantiate any actual views. So, for example, if I have a Matrix object, I need to calculate its size before I make a MatrixView. If I have an equation, I need to calculate the size of the view for the equation before I create the actual view. So I clearly need separate objects for those calculations. But I can't figure out a sensible class structure for those objects. If I put them all into a single class, I get some advantages because copying then becomes easy. But I also end up with a bloated class that contains info that is irrelevant for some objects -- such as whether or not to include those brackets around the matrix. But if I use a lot of different classes, copying properties becomes a real pain. If it matters, this is all in Objective C, for an iOS environment. Any pointers would be greatly appreciated.

    Read the article

  • A Skill Testing (Search Engine) Calculation

    - by Ken Cox [MVP]
    To claim a contest prize, I had to answer the following skill-testing question: 1000 - 50 / 2 x 10 Okay, it’s not a problem as long as you know about operator precedence. As a developer, my brain automatically supplied brackets. I was curious as to whether this exact skill-testing question is commonly-used in online contests, so I Googled the formula. To my amazement, Google returned the result of the calculation – complete with brackets: 1 000 - ((50 / 2) x 10) = 750 (Google) Bing also has a calculator...(read more)

    Read the article

  • Create View using Linked Server db in SQL Server

    - by Muhammad Kashif Nadeem
    How can I create View on Linked Server db. For Example I have a linked server [0.0.0.0] on [1.1.1.1]. Both db servers are SQL Sserver 2005. I want to create View on [1.1.1.1] using table on linked server. EDIT: On creating using full name, [0.0.0.0].db.dbo.table, I am getting this error. SQL Execution Error. Executed SQL statement: SELECT * FROM 0.0.0.0.db.dbo.table (YOu can see brackets are not there.) Error Source: .Net SqlClient Data Provider Error Message: Incorrect syntax near '0.0'. --- part of IP address. I am just creating this in ManagementStudio, not using it because it is not created yet. I Have changed IP. In image you can see there are not brackets around IP but I given it and on error these brackets are removed. Thanks.

    Read the article

  • While loop in IL - why stloc.0 and ldloc.0?

    - by Michael Stum
    I'm trying to understand how a while loop looks in IL. I have written this C# function: static void Brackets() { while (memory[pointer] > 0) { // Snipped body of the while loop, as it's not important } } The IL looks like this: .method private hidebysig static void Brackets() cil managed { // Code size 37 (0x25) .maxstack 2 .locals init ([0] bool CS$4$0000) IL_0000: nop IL_0001: br.s IL_0012 IL_0003: nop // Snipped body of the while loop, as it's not important IL_0011: nop IL_0012: ldsfld uint8[] BFHelloWorldCSharp.Program::memory IL_0017: ldsfld int16 BFHelloWorldCSharp.Program::pointer IL_001c: ldelem.u1 IL_001d: ldc.i4.0 IL_001e: cgt IL_0020: stloc.0 IL_0021: ldloc.0 IL_0022: brtrue.s IL_0003 IL_0024: ret } // end of method Program::Brackets For the most part this is really simple, except for the part after cgt. What I don't understand is the local [0] and the stloc.0/ldloc.0. As far as I see it, cgt pushes the result to the stack, stloc.0 gets the result from the stack into the local variable, ldloc.0 pushes the result to the stack again and brtrue.s reads from the stack. What is the purpose of doing this? Couldn't this be shortened to just cgt followed by brtrue.s?

    Read the article

  • How do I use compiler intrinsic __fmul_?

    - by Eric Thoma
    I am writing a massively parallel GPU application. I have been optimizing it by hand. I received a 20% performance increase with _fdividef(x, y), and according to The Cuda C Programming Guide (section C.2.1), using similar functions for multiplication and adding is also beneficial. The function is stated as this: "_fmulrn,rz,ru,rd". __fdividef(x,y) was not stated with the arguments in brackets. I was wondering, what are those brackets? If I run the simple code: int t = __fmul_(5,4); I a compiler error about how _fmul is undefined. I have the CUDA runtime included, so I don't think it is a setup thing; rather it is something to do with those square brackets. How do I correctly use this function? Thank you.

    Read the article

  • Call methods on native Javascript types without wrapping with ()

    - by Anurag
    In Javascript, we can call methods on string literals directly without enclosing it within round brackets. But not for other types such as numbers, or functions. It is a syntax error, but is there a reason as to why the Javascript lexer needs these other types to be enclosed in round brackets? For example, if we extend Number, String, and Function with an alert method and try calling this method on the literals, it's a SyntaxError for Number and Function, while it works for a String. function alertValue() { alert(this); } Number.prototype.alert = alertValue; String.prototype.alert = alertValue; Function.prototype.alert = alertValue; We can call alert directly on a string object: "someStringLiteral".alert() // alerts someStringLiteral but it's a SyntaxError on numbers, and functions. 7.alert(); function() {}.alert(); To work with these types, we have to enclose it within brackets: (7).alert(); // alerts "7" (function() {}).alert(); // alerts "function() {}"

    Read the article

  • Convert Your Workspace to Standing Height for $22

    - by Jason Fitzpatrick
    If you’d love to try out a standing workstation but you don’t want to shell out $$$ to buy or build one, this simple $22 project will raise up your workspace surface on the cheap. All you need is a LACK side table, some shelf brackets, a shelf, and some screws. The side table goes on your desk, the monitors go on the side table, and the keyboard and mouse go on the shelf (mounted to the brackets that have been positioned at the perfect height for your forearms). Hit up the link below for more pictures, tips, and a downloadable build guide. IKEA Standing Desk for $22 [via Unpluggd] How to Banish Duplicate Photos with VisiPic How to Make Your Laptop Choose a Wired Connection Instead of Wireless HTG Explains: What Is Two-Factor Authentication and Should I Be Using It?

    Read the article

  • Hurricane Season 2010 Starts

    - by Mark Treadwell
    Here we are at the start of another hurricane season.  As with past years, I have been preparing.  Last year I had the house painted with a high-quality paint, giving the stucco its best waterproofing possible.  I have a few cracks to patch with elastomeric patching material.  I will paint it to match the house later.  I also need to clean out the anchors for the lower angle brackets and reattach them.  I had removed the brackets for painting. You can read all my past hurricane entries here.  The predictors are promising a busy season.  We have heard that one before, so I put little credence in long range press releases.  Other than that we are pretty much ready.  I have a few new plans I will blog about later, but for now we get to listen to our daily thunderstorms outside.

    Read the article

  • Inserting text in TextBox at cursor

    - by Anil
    Hi all I have a textbox in aspx page in which the user enters text. Now when user clicks on a button called "Sin" the textbox should show "Sin[]" and the cursor has to be placed in between brackets.Like as follows "Sin[<cursor here]" Now when the user clicks on some other button say "Cos" the textbox text should show "Sin[Cos[]]" and the cursor has be placed between the brackets of Cos as follows: "Sin[Cos[<cursor here]]". How is this handled. Any simple code please.. Thanks in advance

    Read the article

  • Regex to extract a string between two delimeters WITHOUT also returning the delimeters?

    - by CSharp Noob
    Hello, I want to just extract the text between the brackets -- NOT the brackets, too! My code looks currently like this: var source = "Harley, J. Jesse Dead Game (2009) [Guard]" // Extract role with regex m = Regex.Match(source, @"[(.*)]"); var role = m.Groups[0].Value; // role is now "[Guard]" role = role.Substring(1, role.Length-2); // role is now "Guard" Can you help me to simplify this to just a single regex, instead of the regex, then the substring?

    Read the article

  • Replace {tag} with a value or completely remove {any-tag}

    - by HasanGursoy
    I've designed a multilingual web site and some values in database have a tag which will be replaced with it's language value, remove tags brackets ( in case {} ) or removed completely. There are two cases: Remove brackets: value {mm} >> value mm Remove completely: value {mm} >> value Also {tag} could be any length and can contain - Can anybody help me with regex?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >