syntax

How can i extend the colors for coloring syntax in eclipse

In eclipse menu I go to Window -> Preference. Then, In the Preference Dialog I go to Web -> HTML Files -> Editor -> Syntax Coloring. There I have some Elements. For these Elements I can define my favorite Colors and Styles. But I can define only ONE Color for ALL Tag Names. Is there any way to define different colors for different Tags?...

This expression has type int but is here used with type unit

I'm trying to get the exact equivalent (not functional) of this vb.net code in F#: Function FastPow(ByVal num As Double, ByVal exp As Integer) As Double Dim res As Double = 1 If exp < 1 Then If exp = 0 Then Return res exp = -exp num = 1 / num End If Do While exp > 1 If exp Mod 2 = 1 Then res...

In Python, how I do use subprocess instead of os.system?

I have a Python script that calls an executable program with various arguments (in this example, it is 'sqlpubwiz.exe' which is the "Microsoft SQL Server Database Publishing Wizard"): import os sqlpubwiz = r'"C:\Program Files\Microsoft SQL Server\90\Tools\Publishing\sqlpubwiz.exe"' server = 'myLocalServer' database = 'myLocalDatabase' ...

Difference between (function(){})(); and function(){}();

This is something I haven't quite figured out yet, but I have been using function(){}() just because my VIM syntax highlight screws up if I add the parenthesis, although I've seen (function(){})() around many times, maybe its an IE thing? edit: var singleton = function() { // code }(); var singleton = (function() { // code })(...

Any reason I couldn't create a language supporting infix, postfix, and prefix functions, and more?

I've been mulling over creating a language that would be extremely well suited to creation of DSLs, by allowing definitions of functions that are infix, postfix, prefix, or even consist of multiple words. For example, you could define an infix multiplication operator as follows (where multiply(X,Y) is already defined): a * b => multipl...

Can I join to a table in ORACLE (10g) using a CASE clause in the ON statement (or even where clause as it's an inner join)

I'm trying to make the following code smaller. Is this possible? select a.* from table1 a WHERE a."cola1" = 'valuea1' UNION ALL select a.* from tablea1 a inner join tablea2 b on a."cola2" = b."colb2" WHERE a."cola1" = 'valuea2' and b."colb3" = 'valueb3' In effect I'm looking for records from table1 for value1 or value2, but for rec...

When destructuring tuples in Haskell, where can the elements be used?

I am reading a tutorial that uses the following example (that I'll generalize somewhat): f :: Foo -> (Int, Foo) ... fList :: Foo -> [Int] fList foo = x : fList bar where (x, bar) = f foo My question lies in the fact that it seems you can refer to x and bar, by name, outside of the tuple where they are obtained. This would seem t...

How can I create an alias for a generic class in C#?

How can I do the following in C#? What is the right way to write the first line of this code snippet? using KVP<K, V> = System.Collections.Generic.KeyValuePair<K, V>; class C { KVP<int, string> x; } ...

ReSharper syntax suggestion

The if keyword in the following statement is underlined in green by ReSharper: if (readOnlyFields.Contains(propertyName)) return false; return base.CanWriteProperty(propertyName); ReSharper suggests the following change: return !readOnlyFields.Contains(propertyName) && base.CanWriteProperty(propertyName); Why is this "better...

In C# what is the difference between myInt++ and ++myInt?

I'm having a hard time understanding what the difference is between incrementing a variable in C# this way: myInt++; and ++myInt; When would ever matter which one you use? I'll give voteCount++ for the best answer. Or should I give it ++voteCount... ...

Does the location of the `using` directive make a difference in C#?

I got an error today while trying to do some formatting to existing code. Originally, the code had the using directives declared outside the namespace: using System.Collections.Generic; namespace MyNamespace { using IntPair = KeyValuePair<int, int>; } When I tried to insert the using directive inside the statement (to comply with ...

Is there a difference between single and double quotes in Java?

Is there a difference between single and double quotes in Java? ...

What do parentheses surrounding a JavaScript object/function/class declaration mean?

I'm new to both JavaScript and YUI. In YUI library examples, you can find many uses of this construct: (function() { var Dom = YAHOO.util.Dom, Event = YAHOO.util.Event, layout = null, ... })(); I think last couple of parentheses are to execute the function just after the declaration. ... But what about the previou...

Is there a way to name columns in an INSERT statement?

When I do SELECT statements in PHP code I always select named columns, like: SELECT id, name from users; rather than using: SELECT * from users; This has the advantage of being more informative and readable, and also avoids problems later if new columns are added to the table. What I'm wondering is, is it possible to use the same ...

What do < and > mean such as implements Comparable<BigInteger>?

In Java 1.4.2, class java.math.BigInteger implements interfaces Comparable, Serializable. In Java 1.5.0, class java.math.BigInteger implements interfaces Serializable, Comparable<BigInteger>. This is just an example to help me ask about < and >. What I am really wondering about is the < and > stuff. My question is threefold: What doe...

SQL nvl equivalent - without if/case statements & isnull & coalesce

Are there any nvl() equivalent functions in SQL? Or something close enough to be used in the same way in certain scenarios? UPDATE: no if statementsno case statementsno isnullno coalesce select nvl (purge_date,"SODIUFOSDIUFSDOIFUDSF") from id_rec where id=36581; (expression) SODIUFOSDIUFSDOIFUDSF 1 row(s) retrieved. select isnul...

Pythonic macro syntax

I've been working on an alternative compiler front-end for Python where all syntax is parsed via macros. I'm finally to the point with its development that I can start work on a superset of the Python language where macros are an integral component. My problem is that I can't come up with a pythonic macro definition syntax. I've poste...

Syntax Highlighter for WPF

I'm currently looking for a Syntax highlighter for a WPF application. A textbox will be available for the user to type into which would hopefully recognise code and highlight syntax accordingly. I would like to support C# initialy and other languages later. Duplicate of Question 394751 ...

[F#] How do I use pattern matching in 'let' definitions?

I've just noticed F# allows me to use let bindings with literals and other patterns as follows: let fib 0 = 1 let exists item [] = false let car (hd :: tl) = hd let cdr (hd :: tl) = tl F# correctly interprets these functions as a kind of pattern matching, because gives me the following warnings: Warning 1 Incomplete pattern matc...

Oracle to MySQL syntax question

Can someone show me the MySQL equivalent of the following statement (which works in Oracle 10g)? INSERT INTO VOUCHER (VOUCHER_NUMBER, BOOK_ID, DENOMINATION) SELECT a.a1, b.ID, b.DENOMINATION FROM (SELECT rownum a1 FROM dual CONNECT BY rownum <= 10000000) a, BOOK b where a.a1 between b.START_NUMBER and b.START_NUMBER+b.UNITS-1; Basica...