Search Results

Search found 192 results on 8 pages for 'parentheses'.

Page 3/8 | < Previous Page | 1 2 3 4 5 6 7 8  | Next Page >

  • Difference between arguments in setInterval calls

    - by Martin Janiczek
    What's the difference between these setInterval calls and which ones should be used? setInterval("myFunction()",1000) setInterval("myFunction",1000) setInterval(myFunction(),1000) setInterval(myFunction,1000) My guess is that JS uses eval() on the first two (strings) and calls the latter two directly. Also, I don't understand the difference between the calls with and without parentheses. The ones with parentheses call it directly and then periodically call its return value?

    Read the article

  • PCRE (recursive) pattern that matches a string containing a correctly parenthesized substring. Why d

    - by Anton N. Petrov
    Well, there are other ways (hmmm... or rather working ways) to do it, but the question is why does this one fail? / \A # start of the string ( # group 1 (?: # group 2 [^()]* # something other than parentheses (greedy) | # or \( (?1) \) # parenthesized group 1 ) # -group 2 + # at least once (greedy) ) # -group 1 \Z # end of the string /x Fails to match a string with nested parentheses: "(())"

    Read the article

  • Is this a correct syntax (c code found on wikipedia)?

    - by m4design
    I just found this code on wikipedia. Link: http://en.wikipedia.org/wiki/Sizeof#Use The code: /* the following code illustrates the use of sizeof * with variables and expressions (no parentheses needed), * and with type names (parentheses needed) */ char c; printf("%zu,%zu", sizeof c, sizeof(int)); It states that: "The z prefix should be used to print it, because the actual size can differ on each architecture." I tried it on my compiler, but it gives the following result: 'zu,zu'

    Read the article

  • SQL SERVER – Basic Calculation and PEMDAS Order of Operation

    - by pinaldave
    After thinking a long time, I have decided to write about this blog post. I had no plan to create a blog post about this subject but the amount of conversation this one has created on my Facebook page, I decided to bring up a few of the question and concerns discussed on the Facebook page. There are more than 10,000 comments here so far. There are lots of discussion about what should be the answer. Well, as far as I can tell there is a big debate going on on Facebook, for educational purpose you should go ahead and read some of the comments. They are very interesting and for sure teach some new stuff. Even though some of the comments are clearly wrong they have made some good points and I believe it for sure develops some logic. Here is my take on this subject. I believe the answer is 9 as I follow PEMDAS  Order of Operation. PEMDAS stands for  parentheses, exponents, multiplication, division, addition, subtraction. PEMDAS is commonly known as BODMAS in India. BODMAS stands for Brackets, Orders (ie Powers and Square Roots, etc), Division, Multiplication,  Addition and Subtraction. PEMDAS and BODMAS are almost same and both of them follow the operation order from LEFT to RIGHT. Let us try to simplify above statement using the PEMDAS or BODMAS (whatever you prefer to call). Step 1: 6 ÷ 2 (1+2) (parentheses first) Step 2: = 6 ÷ 2 * (1+2) (adding multiplication sign for further clarification) Step 3: = 6 ÷ 2* (3) (single digit in parentheses – simplify using operator) Step 4: = 6 ÷ 2 * 3 (Remember next Operation should be LEFT to RIGHT) Step 5: = 3 * 3 (because 6 ÷ 2 = 3; remember LEFT to RIGHT) Step 6: = 9 (final answer) Some often find Step 4 confusing and often ended up multiplying 2 and 3 resulting Step 5 to be 6 ÷ 6, this is incorrect because in this case we did not follow the order of LEFT to RIGHT. When we do not follow the order of operation from LEFT to RIGHT we end up with the answer 1 which is incorrect. Let us see what SQL Server returns as a result. I executed following statement in SQL Server Management Studio SELECT 6/2*(1+2) It is clear that SQL Server also thinks that the answer should be 9. Let us go ahead and ask Google what will be the answer of above question in Google I have searched for the following term: 6/2(1+2) The result also says the answer should be 9. If you want a further reference here is a great video which describes why the answer should be 9 and not 1. And here is a fantastic conversation on Google Groups. Well, now what is your take on this subject? You are welcome to share constructive feedback and your answer may be different from my answer. NOTE: A healthy conversation about this subject is indeed encouraged but if there is a single bad word or comment is flaming it will be deleted without any notification (it does not matter how valuable information it contains). Reference: Pinal Dave (http://blog.SQLAuthority.com) Filed under: About Me, PostADay, SQL, SQL Authority, SQL Query, SQL Server, SQL Tips and Tricks, T SQL, Technology

    Read the article

  • Compiling ruby1.9.1 hangs and fills swap!

    - by nfm
    I'm compiling Ruby 1.9.1-p376 under Ubuntu 8.04 server LTS (64-bit), by doing the following: $ ./configure $ make $ sudo make install ./configure works without complaints. make hangs indefinitely until all my RAM and swap is gone. It get stuck after the following output: compiling ripper make[1]: Entering directory `/tmp/ruby1.9.1/ruby-1.9.1-p376/ext/ripper' gcc -I. -I../../.ext/include/x86_64-linux -I../.././include -I../.././ext/ripper -I../.. -I../../. -DRUBY_EXTCONF_H=\"extconf.h\" -fPIC -O2 -g -Wall -Wno-parentheses -o ripper.o -c ripper.c If I run the gcc command by hand, with the -v argument to get verbose output, it hangs after the following: Using built-in specs. Target: x86_64-linux-gnu Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.2 --program-suffix=-4.2 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 4.2.4 (Ubuntu 4.2.4-1ubuntu4) /usr/lib/gcc/x86_64-linux-gnu/4.2.4/cc1 -quiet -v -I. -I../../.ext/include/x86_64-linux -I../.././include -I../.././ext/ripper -I../.. -I../../. -DRUBY_EXTCONF_H="extconf.h" ripper.c -quiet -dumpbase ripper.c -mtune=generic -auxbase-strip ripper.o -g -O2 -Wall -Wno-parentheses -version -fPIC -fstack-protector -fstack-protector -o /tmp/ccRzHvYH.s ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu" ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/4.2.4/../../../../x86_64-linux-gnu/include" ignoring nonexistent directory "/usr/include/x86_64-linux-gnu" ignoring duplicate directory "../.././ext/ripper" ignoring duplicate directory "../../." #include "..." search starts here: #include <...> search starts here: . ../../.ext/include/x86_64-linux ../.././include ../.. /usr/local/include /usr/lib/gcc/x86_64-linux-gnu/4.2.4/include /usr/include End of search list. GNU C version 4.2.4 (Ubuntu 4.2.4-1ubuntu4) (x86_64-linux-gnu) compiled by GNU C version 4.2.4 (Ubuntu 4.2.4-1ubuntu4). GGC heuristics: --param ggc-min-expand=47 --param ggc-min-heapsize=32795 Compiler executable checksum: 6e11fa7ca85fc28646173a91f2be2ea3 I just compiled ruby on another computer for reference, and it took about 10 seconds to print the following output (after the above Compiler executable checksum line): COLLECT_GCC_OPTIONS='-v' '-I.' '-I../../.ext/include/i686-linux' '-I../.././include' '-I../.././ext/ripper' '-I../..' '-I../../.' '-DRUBY_EXTCONF_H="extconf.h"' '-D_FILE_OFFSET_BITS=64' '-fPIC' '-O2' '-g' '-Wall' '-Wno-parentheses' '-o' 'ripper.o' '-c' '-mtune=generic' '-march=i486' as -V -Qy -o ripper.o /tmp/cca4fa7R.s GNU assembler version 2.20 (i486-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.20 COMPILER_PATH=/usr/lib/gcc/i486-linux-gnu/4.4.1/:/usr/lib/gcc/i486-linux-gnu/4.4.1/:/usr/lib/gcc/i486-linux-gnu/:/usr/lib/gcc/i486-linux-gnu/4.4.1/:/usr/lib/gcc/i486-linux-gnu/:/usr/lib/gcc/i486-linux-gnu/4.4.1/:/usr/lib/gcc/i486-linux-gnu/ LIBRARY_PATH=/usr/lib/gcc/i486-linux-gnu/4.4.1/:/usr/lib/gcc/i486-linux-gnu/4.4.1/:/usr/lib/gcc/i486-linux-gnu/4.4.1/../../../../lib/:/lib/../lib/:/usr/lib/../lib/:/usr/lib/gcc/i486-linux-gnu/4.4.1/../../../:/lib/:/usr/lib/ COLLECT_GCC_OPTIONS='-v' '-I.' '-I../../.ext/include/i686-linux' '-I../.././include' '-I../.././ext/ripper' '-I../..' '-I../../.' '-DRUBY_EXTCONF_H="extconf.h"' '-D_FILE_OFFSET_BITS=64' '-fPIC' '-O2' '-g' '-Wall' '-Wno-parentheses' '-o' 'ripper.o' '-c' '-mtune=generic' '-march=i486' I have absolutely no clue what could be going wrong here - any ideas where I should start?

    Read the article

  • What’s new in SQL Prompt 6.3?

    - by Tom Crossman
    This post describes some of the improvements we’ve made in the latest version of SQL Prompt. Code suggestions In recent months, the focus of the SQL Prompt development team has been to remove annoyances and improve code suggestions. Here’s just a few of the improvements to code suggestions we’ve made in SQL Prompt 6.3: The suggestions box is no longer shown when there are no suggestions Suggestions are now shown if you continue to type a half-completed word More suggestions for new SQL Server 2014 syntax Improvements to partial match suggestions Improved suggestion ordering As well as improving suggestions, we’ve also added some new features. Select in Object Explorer You can now use SQL Prompt to select an object in the Object Explorer from a query window. This is useful because many SSMS features are available from an object’s Object Explorer context menu (eg select top 1000 rows, design, script as). To select an object in the Object Explorer, place the cursor over the object you want to select and press Ctrl + F12: Here’s a short video of the feature in action. $SELECTIONSTART$ and $SELECTIONEND$ placeholders You can now use $SELECTIONSTART$ and $SELECTIONEND$ placeholders in your snippet code. The code between these placeholders is selected when you insert the snippet. For example, the following snippet: $SELECTIONSTART$SELECT TOP 100 * FROM Table1$SELECTIONEND$ is inserted as: You can then press F5 to run the selected snippet code. For the full list of snippet placeholders you can use, see the documentation. Highlighting matching parentheses If your cursor is next to an opening or closing parenthesis in a query, SQL Prompt now automatically highlights the matching parenthesis: You can then use the SSMS and Visual Studio shortcut Ctrl + ] to move between parentheses. More improvements Those are just a few of the improvements in SQL Prompt 6.3. For the full list of features and bug fixes, see the release notes.

    Read the article

  • How to split value

    - by scopus
    Hi, I want to split value. $value = "code1.code2.code3.code4(code5.code6(arg1.arg2, arg3), code7.code8)"; I want to split like this. Array ( [0] => code1 [1] => code2 [2] => code3 [1] => code4(code5.code6(arg1.arg2, arg3), code7.code8) ) I used explode('.', $value) but explode split in parentheses value. I don't want split in parentheses value. How can i do?

    Read the article

  • issue running a batch script to kill a process

    - by user657064
    I am using the following script on a command line to kill a hypothetical notepad process (using a Korn shell in Windows XP, if that matters): kill $(tasklist | grep -i notepad.exe | awk '{print 2}') Now I take this line, and put it into a batch file c:\temp\testkill.bat, thinking that I should just as well be able to kill the process by running the batch file. However, when I run the batch file, I get the following awk error about unbalanced parentheses: C:/Temp ./testkill.bat C:\Tempkill $(tasklist | grep -i notepad.exe | awk '{print $2}') awk: unbalanced () Context is: {print $2}) <<< C:/Temp So I'm baffled as to why I am getting this error about unbalanced parentheses when I run this script via a batch file, but have no issues when I run the command directly from the command line? (Btw, I'm not necessarily tied to this way of killing a process - as a total noob to shell scripting, I am additionally wondering why if I write the following on the command line: tasklist | grep -i notepad.exe | awk '{print $2}' | kill the process ID that comes out of the tasklist/grep/awk calls doesn't seem to properly get piped to kill...)

    Read the article

  • Calculated Fields - Idiosyncracies

    - by PointsToShare
    © 2011 By: Dov Trietsch. All rights reserved Calculated Fields and some of their Idiosyncrasies Did you try to write a calculate field formula directly into the screen? Good Luck – You’ll need it! Calculated Fields are a sophisticated OOB feature of SharePoint, so you could think that they are best left to the end users – at least to the power users. But they reach their limits before the “Professionals “do, and the tough ones come back to us anyway. Back to business; the simpler the formula, the easier it is. Still, use your favorite editor to write it, then cut it and paste it to the ridiculously small window. What about complex formulae? Write them in steps! Here is a case in point and an idiosyncrasy or two. Our welders need to be certified and recertified every two years. Some of them are certifiable…., but I digress. To be certified you need to pass an eye exam, and two more tests – test A and test B. for each of those you have an expiry date. When renewed, each expiry date is advanced by two years from the date of renewal. My users wanted a visual clue so that when the supervisor looks at the list, she’ll have a KPI symbol telling her if anything expired (Red), is going to expire within the next 90 days (Yellow) or is not to be worried about (green). Not all the dates are filled and any blank date implies a complete lack of certification in the particular requirement. Obviously, I needed to figure the minimal of these 3 dates – a simple enough formula: =MIN([Date_EyeExam], {Date_TestA], [Date_TestB]). Aha! Here is idiosyncrasy #1. When one of the dates is a null, MIN(Date1, Date2) returns the non null date. Null is construed as “Far, far away”. The funny thing is that when you compare it to Today, the null is the lesser one. So a null it is less than today, but not when MIN is calculated. Now, to me the fact that the welder does not have an exam date, is synonymous with his exam being prehistoric, or at least past due. So here is what I did: Solution: Let’s set a blank date to 1/1/1800. How will we do that? Use the IF. IF([Field] rel relValue, TrueValue, FalseValue). rel is any relationship operator <, >, <=, >=, =, <>. If the field is related to the relValue as prescribed, the “IF” returns the TrueValue, otherwise it returns the FalseValue. Thus: =IF([SomeDate]="",1/1/1800,[SomeDate]) will return 1/1/1800 if the date is blank and the date itself if not. So, using this formula, if the welder missed an exam, the returned exam date will be far in the past. It would be nice if we could take such a formula and make it into a reusable function. Alas, here is a calculated field serious shortcoming: You cannot write subs and functions!! Aha, but we can use interim calculated fields! So let’s create 3 calculated fields as follows: 1: c_DateTestA as a calculated field of the date type, with the formula:  IF([Date_TestA]="",1/1/1800,[Date_TestA]) 2: c_DateTestB as a calculated field of the date type, with the formula:  IF([Date_TestB]="",1/1/1800,[Date_TestB]) 3: c_DateEyeExam as a calculated field of the date type, with the formula:  IF([Date_EyeExam]="",1/1/1800,[Date_EyeExam]) And now use these to get c_MinDate. This is again a calculated field of type date with the formula: MIN(c_DateTestA, cDateTestB, c_DateEyeExam) Note that I missed the square parentheses. In “properly named fields – where there are no embedded spaces, we don’t need the square parentheses. I actually strongly recommend using underscores in place of spaces in all the field names in your lists. Among other things, it makes using CAML much simpler. Now, we still need to apply the KPI to this minimal date. I am going to use the available KPI graphics that come with SharePoint and are always available in your 12 hive. "/_layouts/images/kpidefault-2.gif" is the Red KPI "/_layouts/images/kpidefault-1.gif" is the Yellow KPI "/_layouts/images/kpidefault-0.gif" is the Green KPI And here is the nested IF formula that will do the trick: =IF(c_MinDate<=Today,"/_layouts/images/kpidefault-2.gif", IF(cMinDate<Today+90,"/_layouts/images/kpidefault-1.gif","/_layouts/images/kpidefault-0.gif")) Nice! BUT when I tested, it did not work! This is Idiosyncrasy #2: A calculated field based on a calculated field based on a calculated field does not work. You have to stop at two levels! Back to the drawing board: We have to reduce by one level. How? We’ll eliminate the c_DateX items in the formula and replace them with the proper IF formulae. Notice that this needs to be done with precision. You are much better off in doing it in your favorite line editor, than inside the cramped space that SharePoint gives you. So here is the result: MIN(IF([Date_TestA]="",1/1/1800,[ Date_TestA]), IF([Date_TestB]="",1/1/1800,[ Date_TestB]), 1/1/1800), IF([Date_EyeExam]="",1/1/1800,[Date_EyeExam])) Note that I bolded the parentheses and painted them red. They have to match for this formula to work. Now we can leave the KPI formula as is and test again. This time with SUCCESS! Conclusion: build the inner functions first, and then embed them inside the outer formulae. Do this as long as necessary. Use your favorite line editor. Limit yourself to 2 levels. That’s all folks! Almost! As soon as I finished doing all of the above, my users added yet another level of complexity. They added another test, a test that must be passed, but never expires and asked for yet another KPI, this time in Black to denote that any test is not just past due, but altogether missing. I just finished this. Let’s hope it ends here! And OH, the formula  =IF(c_MinDate<=Today,"/_layouts/images/kpidefault-2.gif",IF(cMinDate<Today+90,"/_layouts/images/kpidefault-1.gif","/_layouts/images/kpidefault-0.gif")) Deals with “Today” and this is a subject deserving a discussion of its own!  That’s all folks?! (and this time I mean it)

    Read the article

  • What do you call this { character?

    - by John Isaacks
    When talking to another programmer I would refer to ( and ) as parentheses. I would refer to [ and ] as brackets. What do you refer to { and } as? I checked the wikipedia article and there were several names listed: curly brackets squiggly brackets definite brackets swirly brackets birdie brackets Scottish brackets squirrelly brackets braces gullwings Is there a term commonly used within programmers to identify these characters?

    Read the article

  • ash scripting: space-containing variable refuses to be grepped

    - by Luci Sandor
    I am trying to run the script listed at http://talk.maemo.org/showthread.php?t=70866&page=2 on its intended hardware, a Nokia Linux phone running BusyBox ash. The script receives the name of WiFi network as a parameter, and tries to connect the phone to it. I suspect the script works, but my SSID, BU (802.1x), has space and parentheses in it. So when I type at the command prompt autoconnect.sh BU\ \(802.1x\) I get various errors. First, LIST=`iwconfig wlan0 | awk -F":" '/ESSID/{print $2}'` if [ $LIST = "\"$1\"" ]; then ...fails, even I am connected to the network. The error is not avoided by using single or double quotes instead of escaping characters at the command prompt. Second, if [ -z `iwlist wlan0 scan | grep -m 1 -o \"$1\"` ]; then echo SSID \"$1\" not found; shows that grep does not find the string, although the same grep, typed directly into the command prompt, does find 'BU (802.1x)'. How do I quote $1 in the two circumstances above so that it will work with my network SSID, containing spaces and parentheses? Thank you.

    Read the article

  • va_arg with pointers

    - by Yktula
    I want to initialize a linked list with pointer arguments like so: /* * Initialize a linked list using variadic arguments * Returns the number of structures initialized */ int init_structures(struct structure *first, ...) { struct structure *s; unsigned int count = 0; va_list va; va_start(va, first); for (s = first; s != NULL; s = va_arg(va, (struct structure *))) { if ((s = malloc(sizeof(struct structure))) == NULL) { perror("malloc"); exit(EXIT_FAILURE); } count++; } va_end(va); return count; } The problem is that clang errors type name requires a specifier or qualifier at va_arg(va, (struct structure *)), and says that the type specifier defaults to int. It also notes instantiated form at (struct structure *) and struct structure *. This, what seems to be getting assigned to s is int (struct structure *). It compiles fine when parentheses are removed from (struct structure *), but the structures that are supposed to be initialized are inaccessible. Why is int assumed when parentheses are around the type argument passed to va_arg? How can I fix this?

    Read the article

  • Interpreting java.lang.NoSuchMethodError message

    - by Doog
    I get the following runtime error message (along with the first line of the stack trace, which points to line 94). I'm trying to figure out why it says no such method exists. java.lang.NoSuchMethodError: com.sun.tools.doclets.formats.html.SubWriterHolderWriter.printDocLinkForMenu( ILcom/sun/javadoc/ClassDoc;Lcom/sun/javadoc/MemberDoc; Ljava/lang/String;Z)Ljava/lang/String; at com.sun.tools.doclets.formats.html.AbstractExecutableMemberWriter.writeSummaryLink( AbstractExecutableMemberWriter.java:94) Line 94 of writeSummaryLink is shown below. QUESTIONS What does "ILcom" or "Z" mean? Why there are four types in parentheses (ILcom/sun/javadoc/ClassDoc;Lcom/sun/javadoc/MemberDoc;Ljava/lang/String;Z) and one after the parentheses Ljava/lang/String; when the method printDocLinkForMenu clearly has five parameters? CODE DETAIL The writeSummaryLink method is: protected void writeSummaryLink(int context, ClassDoc cd, ProgramElementDoc member) { ExecutableMemberDoc emd = (ExecutableMemberDoc)member; String name = emd.name(); writer.strong(); writer.printDocLinkForMenu(context, cd, (MemberDoc) emd, name, false); // 94 writer.strongEnd(); writer.displayLength = name.length(); writeParameters(emd, false); } Here's the method line 94 is calling: public void printDocLinkForMenu(int context, ClassDoc classDoc, MemberDoc doc, String label, boolean strong) { String docLink = getDocLink(context, classDoc, doc, label, strong); print(deleteParameterAnchors(docLink)); }

    Read the article

  • What's the correct way to pass parameters from VBScript to COM interface implemented in C#?

    - by nopopem
    I'm trying to expose a fairly simple C# class to COM which should be usable from VBScript (among others). Some objects need to be created via COM calls and will be used in furter calls later on. The definition of the exposed classes and interfaces looks like this: namespace Test { [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] public interface IComInterface { IFoo CreateFoo(); void UseFoo(int x, IFoo f); } [ClassInterface(ClassInterfaceType.None)] public sealed class CComInterface : IComInterface { public CComInterface() {} public IFoo CreateFoo() { return new Foo(); } public void UseFoo(int x, IFoo f) { f.Bar(); } } [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] public interface IFoo { void Bar(); } [ClassInterface(ClassInterfaceType.None)] public class Foo : IFoo { internal Foo() {} public void Bar() {} } } The simplest thinkable COM client in VBScript does this: Dim ci Set ci = WScript.CreateObject("Test.CComInterface") Dim foo Set foo = ci.CreateFoo foo.Bar ci.UseFoo 0, foo While the call to Bar succeeds, calling UseFoo fails with "Error 5: invalid procedure call or invalid argument" The generated IDL seems ok to me: dispinterface IComInterface { properties: methods: [id(0x60020003)] IFoo* CreateFoo(); [id(0x60020004)] void UseFoo( [in] long x, [in] IFoo* f); }; The vbs call succeeds when I wrap the second parameter in parentheses like this: ci.UseFoo 0, (foo) As far as I understand (I'm no VBScript expert however) this forces the reference to foo to be passed by value, i.e. a copy of the reference is being made. How can I change the interface so that it can be called with the foo reference directly? Since this will be a public interface used by customers I don't like the idea of having to explain why all the objects created need to be passed back in an extra pair of parentheses...

    Read the article

  • Smileys in Outlook, how to prevent it

    - by studiohack
    When I type the emoticon ":)" in Outlook 2007, it turns into a smiley face, as in a face inside of a circle...Is there a way for me to prevent Outlook from doing that? I just want a plain old colon and parentheses... Thanks! Other than putting a space in between please...

    Read the article

  • Workaround for datadude deployment bug - NullReferenceException

    - by jamiet
    I have come across a bug in Visual Studio 2010 Database Projects (aka datadude aka DPro aka Visual Studio Database Development Tools aka Visual Studio Team Edition for Database Professionals aka Juneau aka SQL Server Data Tools) that other people may encounter so, for the purposes of googling, I'm writing this blog post about it. Through my own googling I discovered that a Connect bug had already been raised about it (VS2010 Database project deploy - “SqlDeployTask” task failed unexpectedly, NullReferenceException), and coincidentally enough it was raised by my former colleague Tom Hunter (whom I have mentioned here before as the superhuman Tom Hunter) although it has not (at this time) received a reply from Microsoft. Tom provided a repro, namely that this syntactically valid function definition: CREATE FUNCTION [dbo].[Function1]()RETURNS TABLEASRETURN (    WITH cte AS (    SELECT 1 AS [c1]    FROM [$(Database3)].[dbo].[Table1]   )   SELECT 1 AS [c1]   FROM cte) would produce this nasty unhelpful error upon deployment: C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\TeamData\Microsoft.Data.Schema.TSqlTasks.targets(120,5): Error MSB4018: The "SqlDeployTask" task failed unexpectedly.System.NullReferenceException: Object reference not set to an instance of an object.   at Microsoft.Data.Schema.Sql.SchemaModel.SqlModelComparerBase.VariableSubstitution(SqlScriptProperty propertyValue, IDictionary`2 variables, Boolean& isChanged)   at Microsoft.Data.Schema.Sql.SchemaModel.SqlModelComparerBase.ArePropertiesEqual(IModelElement source, IModelElement target, ModelPropertyClass propertyClass, ModelComparerConfiguration configuration)   at Microsoft.Data.Schema.SchemaModel.ModelComparer.CompareProperties(IModelElement sourceElement, IModelElement targetElement, ModelComparerConfiguration configuration, ModelComparisonChangeDefinition changes)   at Microsoft.Data.Schema.SchemaModel.ModelComparer.CompareElementsWithoutCompareName(IModelElement sourceElement, IModelElement targetElement, ModelComparerConfiguration configuration, Boolean parentExplicitlyIncluded, Boolean compareElementOnly, ModelComparisonResult result, ModelComparisonChangeDefinition changes)   at Microsoft.Data.Schema.SchemaModel.ModelComparer.CompareElementsWithSameType(IModelElement sourceElement, IModelElement targetElement, ModelComparerConfiguration configuration, ModelComparisonResult result, Boolean ignoreComparingName, Boolean parentExplicitlyIncluded, Boolean compareElementOnly, Boolean compareFromRootElement, ModelComparisonChangeDefinition& changes)   at Microsoft.Data.Schema.SchemaModel.ModelComparer.CompareChildren(IModelElement sourceElement, IModelElement targetElement, ModelComparerConfiguration configuration, Boolean parentExplicitlyIncluded, Boolean compareParentElementOnly, ModelComparisonResult result, ModelComparisonChangeDefinition changes, Boolean isComposing)   at Microsoft.Data.Schema.SchemaModel.ModelComparer.CompareElementsWithoutCompareName(IModelElement sourceElement, IModelElement targetElement, ModelComparerConfiguration configuration, Boolean parentExplicitlyIncluded, Boolean compareElementOnly, ModelComparisonResult result, ModelComparisonChangeDefinition changes)   at Microsoft.Data.Schema.SchemaModel.ModelComparer.CompareElementsWithSameType(IModelElement sourceElement, IModelElement targetElement, ModelComparerConfiguration configuration, ModelComparisonResult result, Boolean ignoreComparingName, Boolean parentExplicitlyIncluded, Boolean compareElementOnly, Boolean compareFromRootElement, ModelComparisonChangeDefinition& changes)   at Microsoft.Data.Schema.SchemaModel.ModelComparer.CompareChildren(IModelElement sourceElement, IModelElement targetElement, ModelComparerConfiguration configuration, Boolean parentExplicitlyIncluded, Boolean compareParentElementOnly, ModelComparisonResult result, ModelComparisonChangeDefinition changes, Boolean isComposing)   at Microsoft.Data.Schema.SchemaModel.ModelComparer.CompareElementsWithoutCompareName(IModelElement sourceElement, IModelElement targetElement, ModelComparerConfiguration configuration, Boolean parentExplicitlyIncluded, Boolean compareElementOnly, ModelComparisonResult result, ModelComparisonChangeDefinition changes)   at Microsoft.Data.Schema.SchemaModel.ModelComparer.CompareElementsWithSameType(IModelElement sourceElement, IModelElement targetElement, ModelComparerConfiguration configuration, ModelComparisonResult result, Boolean ignoreComparingName, Boolean parentExplicitlyIncluded, Boolean compareElementOnly, Boolean compareFromRootElement, ModelComparisonChangeDefinition& changes)   at Microsoft.Data.Schema.SchemaModel.ModelComparer.CompareAllElementsForOneType(ModelElementClass type, ModelComparerConfiguration configuration, ModelComparisonResult result, Boolean compareOrphanedElements)   at Microsoft.Data.Schema.SchemaModel.ModelComparer.CompareStore(ModelStore source, ModelStore target, ModelComparerConfiguration configuration)   at Microsoft.Data.Schema.Build.SchemaDeployment.CompareModels()   at Microsoft.Data.Schema.Build.SchemaDeployment.PrepareBuildPlan()   at Microsoft.Data.Schema.Build.SchemaDeployment.Execute(Boolean executeDeployment)   at Microsoft.Data.Schema.Build.SchemaDeployment.Execute()   at Microsoft.Data.Schema.Tasks.DBDeployTask.Execute()   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()   at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask, Boolean& taskResult)   Done executing task "SqlDeployTask" -- FAILED.  Done building target "DspDeploy" in project "Lloyds.UKTax.DB.UKtax.dbproj" -- FAILED. Done executing task "CallTarget" -- FAILED.Done building target "DBDeploy" in project It turns out there are a certain set of circumstances that need to be met for this error to occur: The object being deployed is an inline function  (may also exist for multistatement and scalar functions - I haven't tested that) That object includes SQLCMD variable references The object has already been deployed successfully Just to reiterate that last bullet point, the error does not occur when you deploy the function for the first time, only on the subsequent deployment.   Luckily I have a direct line into a guy on the development team so I fired off an email on Friday evening and today (Monday) I received a reply back telling me that there is a simple fix, one simply has to remove the parentheses that wrap the SQL statement. So, in the case of Tom's repro, the function definition simpy has to be changed to: CREATE FUNCTION [dbo].[Function1]()RETURNS TABLEASRETURN --(    WITH cte AS (    SELECT 1 AS [c1]    FROM [$(Database3)].[dbo].[Table1]   )   SELECT 1 AS [c1]   FROM cte--) I have commented out the offending parentheses rather than removing them just to emphasize the point. Thereafter the function will deploy fine. I tested this out on my own project this morning and can confirm that this fix does indeed work.   I have been told that the bug CAN be reproduced in the Release Candidate (RC) 0 build of SQL Server Data Tools in SQL Server 2010 so am hoping that a fix makes it in for the Release-To-Manufacturing (RTM) build. Hope this helps @jamiet

    Read the article

  • Can the Clojure set and maps syntax be added to other Lisp dialects?

    - by Cedric Martin
    In addition to create list using parentheses, Clojure allows to create vectors using [ ], maps using { } and sets using #{ }. Lisp is always said to be a very extensible language in which you can easily create DSLs etc. But is Lisp so extensible that you can take any Lisp dialect and relatively easily add support for Clojure's vectors, maps and sets (which are all functions in Clojure)? I'm not necessarily asking about cons or similar actually working on these functions: what I'd like to know is if the other could be modified so that the source code would look like Clojure's source code (that is: using matching [ ], { } and #{ } in addition to ( )). Note that if it cannot be done this is not a criticism of Lisp: what I'd like to know is, technically, what should be done or what cannot be done if one were to add such a thing.

    Read the article

  • Visual Studio 2010 Find and Replace With Regular Expressions

    - by Lance Robinson
    Here is a quick notes about using regular expressions in the VS2010 Find Replace dialog.  1.  To create a backreference, use curly braces (“{“ and “}” ) instead of regular parentheses. 2.  To use the captured backreference, use \1\2 etc, where \1 is the first captured value, \2 is the second captured value, etc. Example: I want to find*: info.setFieldValue(param1, param2); and replace it with: SetFieldValue(info, param1, param2); To do this, I can use the following find/replace values: Find what: {[a-zA-Z0-9]+}.setFieldValue\({[a-zA-Z0-9., ]+}\); Replace with: SetFieldValue(\1, \2); Use Regular Expressions is checked, of course. *If you’re wondering why I’d want to do this – because I don’t have control over the setFieldValue function – its in a third party library that doesn’t behave in a very friendly manner. Technorati Tags: Visual Studio,Regular Expressions

    Read the article

  • Detect when application is running in a VM environment

    - by Malcolm
    Looking for ideas on how to detect when our Windows application is running in one of the following VM environments. Some starter ideas for detection are in parentheses. There may be (much) better detection techniques - the starter ideas I've come up with are based on my Google research. VMWare (looking for the presence of optional VMware Tools is one way) Microsoft Virtual PC (have a device named "Virtual HD" for their IDE disks, "MS Virtual SCSI Disk Device" for their SCSI disks) Citrix Xen Sun Virtual Box Thank you, Malcolm

    Read the article

  • VB.NET - Send [Delegate] through the classes to set AddressOf

    - by sv88erik
    How can I put AddressOf, from another class? I get this error 'AddressOf' operand must be the name of a method (without parentheses). " Is there an Eval () function in VB.NET? Or how does one do this? Public Shared Property e As UserControl Public Shared Sub SetButton(ByVal button As String, ByVal Objekt As [Delegate]) Dim errorbuttom1 As Button = e.FindName("errorButton1") AddHandler errorbuttom1.Click, AddressOf Objekt End Sub

    Read the article

  • Scheme Editor/IDE for Mac

    - by Carlton Gibson
    I've begun working through Structure and Interpretation of Computer Programs. Dutifully, I've installed mit-scheme. What I need now is an editor/IDE for the Mac that can handle the indentation and balance parentheses (or advice on how to best to configure the packaged tools). Any suggestions? TIA

    Read the article

  • Logical operator AND having higher order of precedence than IN

    - by AspOnMyNet
    I’ve read that logical operator AND has higher order of precedence than logical operator IN, but that doesn’t make sense since if that was true, then wouldn’t in the following statement the AND condition got evaluated before the IN condition ( thus before IN operator would be able to check whether Released field equals to any of the values specified within parentheses ? SELECT Song, Released, Rating FROM Songs WHERE Released IN (1967, 1977, 1987) AND SongName = ’WTTJ’ thanx

    Read the article

  • Rubyists: What is this called?

    - by Matt Darby
    Say I have a pool of enumerables that I want to group by an attribute: cars = Car.all.group_by(&:color) Then I want to iterate over those cars like so: cars.inject([]) do |stack, (color, cars)| stack << cars.each do |car| ... end end What is the term for the block variable extension (between the parentheses)?

    Read the article

  • How do I get the length of a regex match in vim?

    - by misfo
    If I want to get the length of each match within the parentheses in the following regex, how do I do it?: ^\(\-\+\s\)\+ I'm trying to modify the width of columns in a buffer with data that is laid out as a table. Since the first two rows of the table will look like this DESIGN_ID DESIGN_YEAR SOURCE_REFERENCE ---------- ----------- ---------------- I want to use the regular expression to find the current width of each column.

    Read the article

  • VBScript: Passing Object to Function?

    - by ioplex
    The below example generates an error: VBScript compilation error: Cannot use parentheses when calling a Sub This error does not occur if all parameters are not objects. Is there a special way to pass object parameters to VBScript functions? Option Explicit Dim obj Function TestFunc(obj) WScript.Echo "Why doesn't this work?" End Function Set obj = CreateObject("Scripting.Dictionary") obj.Add("key", "val") TestFunc(obj) ' Error here!

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8  | Next Page >