<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: syntax code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Sat, 17 May 2008 18:07:37 GMT</pubDate>
    <description>DZone Snippets: syntax code</description>
    <item>
      <title>Helpful XPath examples</title>
      <link>http://snippets.dzone.com/posts/show/5443</link>
      <description>A few XPath examples copied from &lt;a href="http://www.w3schools.com/XPath/xpath_syntax.asp"&gt;XPath Syntax&lt;/a&gt; [w3schools.com]&lt;br /&gt;&lt;br /&gt;Predicates&lt;br /&gt;&lt;code&gt;&lt;br /&gt;/bookstore/book[1] 	# Selects the first book element that is the child of the bookstore element. &lt;br /&gt;                        # Note: IE5 and later has implemented that [0] should be the first node, &lt;br /&gt;                        # but according to the W3C standard it should have been [1]!!&lt;br /&gt;/bookstore/book[last()] 	# Selects the last book element that is the child of the bookstore element&lt;br /&gt;/bookstore/book[last()-1] 	# Selects the last but one book element that is the child of the bookstore element&lt;br /&gt;/bookstore/book[position()&lt;3] 	# Selects the first two book elements that are children of the bookstore element&lt;br /&gt;//title[@lang] 	# Selects all the title elements that have an attribute named lang&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Selecting Unknown Nodes&lt;br /&gt;&lt;code&gt;&lt;br /&gt;/bookstore/* 	# Selects all the child nodes of the bookstore element&lt;br /&gt;//* 	# Selects all elements in the document&lt;br /&gt;//title[@*] 	# Selects all title elements which have any attribute&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Selecting Several Paths&lt;br /&gt;&lt;code&gt;&lt;br /&gt;//book/title | //book/price  	# Selects all the title AND price elements of all book elements&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Tue, 29 Apr 2008 23:34:28 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5443</guid>
      <author>jrobertson (James Robertson)</author>
    </item>
    <item>
      <title>Format Ruby code in HTML</title>
      <link>http://snippets.dzone.com/posts/show/5178</link>
      <description>This code uses the Ruby gem 'syntax' to create an XML file containing the HTML tags around the code, which is then transformed into an HTML file. The working example was first built using coding examples from &lt;a href="http://blog.wolfman.com/articles/2006/05/26/howto-format-ruby-code-for-blogs"&gt;Howto format ruby code for blogs&lt;/a&gt; [wolfman.com] and &lt;a href="http://brentrubyrails.blogspot.com/2007/12/formatting-ruby-and-html-code-for-blog.html"&gt;Formatting Ruby and HTML code for blog posting&lt;/a&gt; [blogspot.com]&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;#!/usr/bin/ruby&lt;br /&gt;&lt;br /&gt;#file: ruby2html.rb &lt;br /&gt;&lt;br /&gt;require 'rubygems'&lt;br /&gt;require 'syntax/convertors/html'&lt;br /&gt;require 'projxslt' # &lt;- this is my own class to do an XSLT transform &lt;br /&gt;require 'rexml/document'&lt;br /&gt;include REXML&lt;br /&gt;&lt;br /&gt;class Ruby2Html&lt;br /&gt;  def initialize(rubyfile, htmlfile)&lt;br /&gt;    code = File.read(rubyfile)&lt;br /&gt;    convertor = Syntax::Convertors::HTML.for_syntax "ruby"&lt;br /&gt;    code_html = convertor.convert(code)&lt;br /&gt;    &lt;br /&gt;    tempfile = '../temp/ruby2html.xml'&lt;br /&gt;    xslfile = '../ruby2html/ruby2html.xsl'&lt;br /&gt;    save_file(tempfile, code_html)&lt;br /&gt;    &lt;br /&gt;    px = Projxslt.new(tempfile, xslfile)&lt;br /&gt;    buffer = px.transform()&lt;br /&gt;    save_file(htmlfile, buffer)&lt;br /&gt;    &lt;br /&gt;  end&lt;br /&gt;  &lt;br /&gt;  def save_file(filename, buffer)&lt;br /&gt;    file = File.new(filename, 'w')&lt;br /&gt;    file.puts buffer&lt;br /&gt;    file.close&lt;br /&gt;  end&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;if __FILE__ == $0&lt;br /&gt;  r2h = Ruby2Html.new('ruby2html.rb', '../temp/ruby2html.html')&lt;br /&gt;  puts 'completed'&lt;br /&gt;end&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;file: ruby2html.xsl&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&lt;br /&gt;                xmlns="http://www.w3.org/1999/xhtml"&lt;br /&gt;                version="1.0"&gt;&lt;br /&gt;&lt;br /&gt;  &lt;xsl:output method="html" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"&lt;br /&gt;          doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&lt;br /&gt;          encoding="ISO-8859-1"/&gt; &lt;br /&gt;&lt;br /&gt;	&lt;xsl:template match="/"&gt;&lt;br /&gt;	&lt;xsl:element name="html"&gt;&lt;br /&gt;&lt;br /&gt;        &lt;head&gt;&lt;br /&gt;          &lt;title&gt;Sample code&lt;/title&gt;&lt;br /&gt;          &lt;link rel="stylesheet" type="text/css" href="ruby2html.css" /&gt;&lt;br /&gt;	&lt;/head&gt;&lt;br /&gt;&lt;br /&gt;	&lt;body&gt;&lt;br /&gt;          &lt;div id="wrap"&gt;&lt;br /&gt;          &lt;xsl:apply-templates /&gt;&lt;br /&gt;          &lt;/div&gt;&lt;br /&gt;	&lt;/body&gt; &lt;br /&gt;&lt;br /&gt;	&lt;/xsl:element&gt;&lt;br /&gt;	&lt;/xsl:template&gt;&lt;br /&gt;&lt;br /&gt;	&lt;xsl:template match="pre"&gt;&lt;br /&gt;	  &lt;xsl:copy-of select="."/&gt;&lt;br /&gt;	&lt;/xsl:template&gt;&lt;br /&gt;&lt;br /&gt;&lt;/xsl:stylesheet&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Here's the output from the &lt;a href="http://www.twitxr.com/image/7628/"&gt;formatted Ruby HTML code&lt;/a&gt; [twitxr.com]&lt;br /&gt;&lt;br /&gt;Referemce: &lt;a href="http://syntax.rubyforge.org/"&gt;Syntax Manual&lt;/a&gt; [rubyforge.org]</description>
      <pubDate>Tue, 26 Feb 2008 15:43:38 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5178</guid>
      <author>jrobertson (James Robertson)</author>
    </item>
    <item>
      <title>Syntax-at-a-Glance for the C# programming language</title>
      <link>http://snippets.dzone.com/posts/show/4529</link>
      <description>// Copyright (C) 2001 StructureByDesign.  All Rights Reserved.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;// CLASS1.CS -- Syntax-at-a-Glance for the C# programming language.&lt;br /&gt;// A quick code reference for programmers who work in many languages.&lt;br /&gt;// Executable code, minimal comments document the essence of the language.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;using System;&lt;br /&gt;using System.Collections;&lt;br /&gt;using System.IO;&lt;br /&gt;&lt;br /&gt;namespace StructureByDesign.Syntax&lt;br /&gt;{&lt;br /&gt;public class Class1: Object&lt;br /&gt;{&lt;br /&gt;    public static int Main(string[] args)       // Entry point.&lt;br /&gt;    {&lt;br /&gt;        System.Console.WriteLine("Hello");&lt;br /&gt;        Class2 aclass2 = new Class2();&lt;br /&gt;        aclass2.run();&lt;br /&gt;        return 0;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;interface Interface1&lt;br /&gt;{&lt;br /&gt;    void run();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;class Class2: Class1, Interface1&lt;br /&gt;{&lt;br /&gt;    public const int CONSTANT = 1;          // Access not restricted, implicitly static.&lt;br /&gt;    private int m_intPrivateField;          // Access limited to containing type.&lt;br /&gt;    public Class2() : base()                // Constructor.&lt;br /&gt;    {&lt;br /&gt;        initialize();&lt;br /&gt;    }&lt;br /&gt;    protected void initialize()             // Object initialization.&lt;br /&gt;    {                                       // Access limited to containing class or types derived.&lt;br /&gt;        Number = 1;&lt;br /&gt;    }&lt;br /&gt;    protected int Number                    // Language property feature.&lt;br /&gt;    {&lt;br /&gt;        get&lt;br /&gt;        {&lt;br /&gt;            return m_intPrivateField;&lt;br /&gt;        }&lt;br /&gt;        set&lt;br /&gt;        {&lt;br /&gt;            m_intPrivateField = value;      // Implicit parameter.&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;    public void run()&lt;br /&gt;    {&lt;br /&gt;        anonymousCode();&lt;br /&gt;        arrays();&lt;br /&gt;        collections();&lt;br /&gt;        comparison();&lt;br /&gt;        control();&lt;br /&gt;        filesStreamsAndExceptions();&lt;br /&gt;        numbersAndMath();&lt;br /&gt;        primitivesAndConstants();&lt;br /&gt;        runtimeTyping();&lt;br /&gt;        strings();&lt;br /&gt;    }&lt;br /&gt;    void anonymousCode()&lt;br /&gt;    {&lt;br /&gt;        Delegate adelegate = new Delegate(Run);&lt;br /&gt;        adelegate();&lt;br /&gt;    }&lt;br /&gt;    delegate void Delegate();&lt;br /&gt;    void Run()&lt;br /&gt;    {&lt;br /&gt;        Console.WriteLine("Run");&lt;br /&gt;    }&lt;br /&gt;    void arrays()&lt;br /&gt;    {&lt;br /&gt;        int[] arrayOfInts = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};&lt;br /&gt;        arrayOfInts[0] = 9;&lt;br /&gt;        assert(arrayOfInts[0] == arrayOfInts[9]);&lt;br /&gt;&lt;br /&gt;        String[] arrayOfStrings = new String[10];&lt;br /&gt;        assert(arrayOfStrings[0] == null);&lt;br /&gt;        assert(arrayOfStrings.Length == 10);&lt;br /&gt;&lt;br /&gt;        arrayOfStrings = new String[] { "one", "two" };&lt;br /&gt;&lt;br /&gt;        byte[,] arrayOfBytes = { {0,0,0},&lt;br /&gt;                                 {0,1,2},&lt;br /&gt;                                 {0,2,4}};&lt;br /&gt;        assert(arrayOfBytes[2,2] == 4);&lt;br /&gt;    }&lt;br /&gt;    void collections()&lt;br /&gt;    {&lt;br /&gt;        IList ailist = new ArrayList();&lt;br /&gt;        ailist.Add("zero"); ailist.Add("one"); ailist.Add("three");&lt;br /&gt;        ailist[2] = "two";&lt;br /&gt;        assert(ailist[2].Equals("two"));&lt;br /&gt;        ailist.Remove("two");&lt;br /&gt;        ((ArrayList)ailist).Sort();&lt;br /&gt;        for(IEnumerator aie = ((ArrayList)ailist).GetEnumerator(); aie.MoveNext(); )&lt;br /&gt;            ;&lt;br /&gt;        foreach(String astring in ailist)&lt;br /&gt;            ;&lt;br /&gt;&lt;br /&gt;        IDictionary aidictionary = new Hashtable();&lt;br /&gt;        aidictionary.Add("key", "value");&lt;br /&gt;        assert(aidictionary["key"].Equals("value"));&lt;br /&gt;&lt;br /&gt;        // Set not available.&lt;br /&gt;    }&lt;br /&gt;    void comparison()&lt;br /&gt;    {&lt;br /&gt;        int aint1 = 1;&lt;br /&gt;        int aint2 = 2;&lt;br /&gt;        int aint = 1;&lt;br /&gt;        String astring1 = "one";&lt;br /&gt;        String astring2 = "two";&lt;br /&gt;        String astring = astring1;&lt;br /&gt;&lt;br /&gt;        assert(aint == aint1);&lt;br /&gt;        assert(aint1 != aint2);&lt;br /&gt;        assert(astring == astring1);&lt;br /&gt;        assert(astring1 == String.Copy("one"));         // For strings == is overloaded to compare values.&lt;br /&gt;        assert(!astring1.Equals(astring2));&lt;br /&gt;        assert(astring1.Equals(String.Copy("one")));&lt;br /&gt;&lt;br /&gt;        astring = null;&lt;br /&gt;        if (astring != null &amp;&amp; astring.Length &gt; 0)      // Conditional evaluation.&lt;br /&gt;            assert(false);&lt;br /&gt;&lt;br /&gt;        if (aint2 &lt; 0 || 1 &lt; aint2)&lt;br /&gt;            assert(true);&lt;br /&gt;    }&lt;br /&gt;    void control()&lt;br /&gt;    {&lt;br /&gt;        if (true)&lt;br /&gt;            assert(true);&lt;br /&gt;        else&lt;br /&gt;            assert(false);&lt;br /&gt;        /////&lt;br /&gt;        switch ('b') {&lt;br /&gt;            case 'a':&lt;br /&gt;                assert(false);&lt;br /&gt;                break;&lt;br /&gt;            case 'b':&lt;br /&gt;                assert(true);&lt;br /&gt;                break;&lt;br /&gt;            default:&lt;br /&gt;                assert(false);&lt;br /&gt;                break;&lt;br /&gt;        }&lt;br /&gt;        /////&lt;br /&gt;        for (int ai1 = 0; ai1 &lt; 10; ai1++)&lt;br /&gt;            assert(true);&lt;br /&gt;        /////&lt;br /&gt;        int ai = 0;&lt;br /&gt;        while (ai &lt; 10) {&lt;br /&gt;            assert(true);&lt;br /&gt;            ai++;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        do&lt;br /&gt;            ai--;&lt;br /&gt;        while (ai &gt; 0);&lt;br /&gt;&lt;br /&gt;        for (int x = 0; x &lt; 10; x++)        // Labeled break/continue not available.&lt;br /&gt;            for (int y = 0; y &lt; 10; y++)&lt;br /&gt;                if (x == 9)&lt;br /&gt;                    break;&lt;br /&gt;                else&lt;br /&gt;                    continue;&lt;br /&gt;    }&lt;br /&gt;    void filesStreamsAndExceptions()&lt;br /&gt;    {&lt;br /&gt;        FileInfo afileinfo = new FileInfo("list.txt");&lt;br /&gt;        try {&lt;br /&gt;            StreamWriter asw = new StreamWriter("list.txt");&lt;br /&gt;            asw.WriteLine("line");&lt;br /&gt;            asw.WriteLine("line");&lt;br /&gt;            asw.Close();&lt;br /&gt;&lt;br /&gt;            assert(afileinfo.Exists);&lt;br /&gt;&lt;br /&gt;            StreamReader asr = new StreamReader("list.txt");&lt;br /&gt;            String astringLine;&lt;br /&gt;            while ((astringLine = asr.ReadLine()) != null)&lt;br /&gt;                assert(astringLine.Equals("line"));&lt;br /&gt;            asr.Close();&lt;br /&gt;        } catch (IOException aexception) {&lt;br /&gt;            System.Console.WriteLine(aexception.Message);&lt;br /&gt;            throw new NotSupportedException();&lt;br /&gt;        }&lt;br /&gt;        finally {&lt;br /&gt;            afileinfo.Delete();&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;    void numbersAndMath()&lt;br /&gt;    {&lt;br /&gt;        assert(Int32.Parse("123") == 123);&lt;br /&gt;        assert(123.ToString().Equals("123"));&lt;br /&gt;&lt;br /&gt;        assert(Math.PI.ToString("n3").Equals("3.142"));&lt;br /&gt;&lt;br /&gt;        assert(Int32.MaxValue &lt; Int64.MaxValue);&lt;br /&gt;&lt;br /&gt;        assert(Math.Abs(Math.Sin(0) - 0) &lt;= Double.Epsilon);&lt;br /&gt;        assert(Math.Abs(Math.Cos(0) - 1) &lt;= Double.Epsilon);&lt;br /&gt;        assert(Math.Abs(Math.Tan(0) - 0) &lt;= Double.Epsilon);&lt;br /&gt;&lt;br /&gt;        assert(Math.Abs(Math.Sqrt(4) - 2) &lt;= Double.Epsilon);&lt;br /&gt;        assert(Math.Abs(Math.Pow(3,3) - 27) &lt;= Double.Epsilon);&lt;br /&gt;&lt;br /&gt;        assert(Math.Max(0,1) == 1);&lt;br /&gt;        assert(Math.Min(0,1) == 0);&lt;br /&gt;&lt;br /&gt;        assert(Math.Abs(Math.Ceiling(9.87) - 10.0) &lt;= Double.Epsilon);&lt;br /&gt;        assert(Math.Abs(Math.Floor(9.87) - 9.0) &lt;= Double.Epsilon);&lt;br /&gt;        assert(Math.Round(9.87) == 10);&lt;br /&gt;&lt;br /&gt;        Random arandom = new Random();&lt;br /&gt;        double adouble = arandom.NextDouble();&lt;br /&gt;        assert(0.0 &lt;= adouble &amp;&amp; adouble &lt; 1.0);&lt;br /&gt;        int aint = arandom.Next(10);&lt;br /&gt;        assert(0 &lt;= aint &amp;&amp; aint &lt; 10);&lt;br /&gt;    }&lt;br /&gt;    enum Season: byte { Spring=0, Summer, Fall, Winter };&lt;br /&gt;&lt;br /&gt;    void primitivesAndConstants()&lt;br /&gt;    {&lt;br /&gt;        bool abool = false;&lt;br /&gt;        char achar = 'A';           // 16 bits, Unicode&lt;br /&gt;&lt;br /&gt;        byte abyte = 0x0;           // 8 bits, unsigned, hex constant&lt;br /&gt;        sbyte asbyte = 0;           // 8 bits, signed&lt;br /&gt;&lt;br /&gt;        short ashort = 0;           // 16 bits, signed&lt;br /&gt;        ushort aushort = 0;         // 16 bits, unsigned&lt;br /&gt;&lt;br /&gt;        int aint = 0;               // 32 bits, signed&lt;br /&gt;        uint aunit = 0;             // 32 bits, unsigned&lt;br /&gt;&lt;br /&gt;        long along = 0L;            // 64 bits, signed&lt;br /&gt;        ulong aulong = 0;           // 64 bits, unsigned&lt;br /&gt;&lt;br /&gt;        float afloat = 0.0F;        // 32 bits&lt;br /&gt;        double adouble = 0.0;       // 64 bits&lt;br /&gt;&lt;br /&gt;        decimal adecimal = 0;       // 128 bits, financial calculations&lt;br /&gt;&lt;br /&gt;        Season aseason = Season.Fall;&lt;br /&gt;        assert((byte)aseason == 2);&lt;br /&gt;    }&lt;br /&gt;    void runtimeTyping()&lt;br /&gt;    {&lt;br /&gt;        assert(new int[] { 1 } is int[]);&lt;br /&gt;        assert(new ArrayList() is ArrayList);&lt;br /&gt;&lt;br /&gt;        assert((new ArrayList()).GetType() == typeof(ArrayList));&lt;br /&gt;        assert(typeof(Int32) is Type);      // Type of primitive type.&lt;br /&gt;&lt;br /&gt;        assert(Type.GetType("System.Collections.ArrayList") == typeof(ArrayList));&lt;br /&gt;    }&lt;br /&gt;    void strings()&lt;br /&gt;    {&lt;br /&gt;        String astring1 = "one";&lt;br /&gt;        String astring2 = "TWO";&lt;br /&gt;&lt;br /&gt;        assert((astring1 + "/" + astring2).Equals("one/TWO"));&lt;br /&gt;        assert(astring2.ToLower().Equals("two"));   // Equals ignoring case not available.&lt;br /&gt;        assert(astring1.Length == 3);&lt;br /&gt;        assert(astring1.Substring(0,2).Equals("on"));&lt;br /&gt;        assert(astring1[2] == 'e');&lt;br /&gt;        assert(astring1.ToUpper().Equals("ONE"));&lt;br /&gt;        assert(astring2.ToLower().Equals("two"));&lt;br /&gt;        assert(astring1.CompareTo("p") &lt; 0);&lt;br /&gt;        assert(astring1.IndexOf('e') == 2);&lt;br /&gt;        assert(astring1.IndexOf("ne") == 1);&lt;br /&gt;        assert(astring1.Trim().Length == astring1.Length);&lt;br /&gt;&lt;br /&gt;        assert(Char.IsDigit('1'));&lt;br /&gt;        assert(Char.IsLetter('a'));&lt;br /&gt;        assert(Char.IsWhiteSpace('\t'));&lt;br /&gt;        assert(Char.ToLower('A') == 'a');&lt;br /&gt;        assert(Char.ToUpper('a') == 'A');&lt;br /&gt;    }&lt;br /&gt;    private void assert(bool abool)&lt;br /&gt;    {&lt;br /&gt;        if (!abool)&lt;br /&gt;            throw new Exception("assert failed");&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Wed, 12 Sep 2007 05:53:00 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4529</guid>
      <author>dubby (Dave)</author>
    </item>
    <item>
      <title>DELETE - SQL</title>
      <link>http://snippets.dzone.com/posts/show/4498</link>
      <description>// description of your code here&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;DELETE ... &lt;br /&gt;    [ FROM ... ] &lt;br /&gt;    [ ... JOIN ... ] &lt;br /&gt;    [ WHERE ... ] &lt;br /&gt;&lt;br /&gt;// FULL Syntax follows:&lt;br /&gt;DELETE [ FROM ] &lt;br /&gt;    {&lt;br /&gt;       [ database. ] [ owner. ] table_name &lt;br /&gt;         [&lt;br /&gt;           WITH (  INDEX ( Index_1,   [ index_2,  ...,  n ] ) &lt;br /&gt;                      | FASTFIRSTROW &lt;br /&gt;                      | HOLDLOCK &lt;br /&gt;                      | PAGLOCK &lt;br /&gt;                      | READCOMMITTED &lt;br /&gt;                      | REPEATABLEREAD &lt;br /&gt;                      | ROWLOCK &lt;br /&gt;                      | SERIALIZABLE &lt;br /&gt;                      | TABLOCK &lt;br /&gt;                      | TABLOCKX &lt;br /&gt;                      [   ...   n  |  ...,  n ] &lt;br /&gt;                     )&lt;br /&gt;       ]&lt;br /&gt;     |&lt;br /&gt;       OPENQUERY( server, 'query' ) &lt;br /&gt;     |&lt;br /&gt;       OPENROWSET( 'provider_name', &lt;br /&gt;                                 { 'datasource';'user_id';'password',  |  'provider_string', }&lt;br /&gt;                                 { [ catalog. ] [ schema. ] object  |  'query' }&lt;br /&gt;                               ) &lt;br /&gt;     |&lt;br /&gt;       view_name &lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    [&lt;br /&gt;      FROM &lt;br /&gt;      {&lt;br /&gt;          derived_table &lt;br /&gt;            [ [ AS ] table_alias ]&lt;br /&gt;            [ ( column_alias_1,   [ column_alias_2,   ...,  n ]  )  ]&lt;br /&gt;        |&lt;br /&gt;          CONTAINSTABLE ( table, column  |  *, 'search_conditions' ) &lt;br /&gt;            [ [ AS ] table_alias ]&lt;br /&gt;        |&lt;br /&gt;          FREETEXTTABLE ( table, column  |  *, 'free_text_string' ) &lt;br /&gt;            [ [ AS ] table_alias ]&lt;br /&gt;        |&lt;br /&gt;          table_name [ [ AS ] table_alias ]&lt;br /&gt;            [&lt;br /&gt;               WITH (  INDEX ( Index_1,   [ index_2,   ...,  n ]  ) &lt;br /&gt;                          | FASTFIRSTROW &lt;br /&gt;                          | HOLDLOCK &lt;br /&gt;                          | NOLOCK &lt;br /&gt;                          | PAGLOCK &lt;br /&gt;                          | READCOMMITTED &lt;br /&gt;                          | READPAST &lt;br /&gt;                          | READUNCOMMITTED &lt;br /&gt;                          | REPEATABLEREAD &lt;br /&gt;                          | ROWLOCK &lt;br /&gt;                          | SERIALIZABLE &lt;br /&gt;                          | TABLOCK &lt;br /&gt;                          | TABLOCKX &lt;br /&gt;                          | UPDLOCK &lt;br /&gt;                          [ ...   n  |  ...,  n ] &lt;br /&gt;                         )&lt;br /&gt;            ]&lt;br /&gt;        |&lt;br /&gt;          view_name [ [ AS ] table_alias ]&lt;br /&gt;      }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;      [&lt;br /&gt;          INNER JOIN  |  LEFT [ OUTER ] JOIN  |  RIGHT [ OUTER ] JOIN &lt;br /&gt;            {&lt;br /&gt;               derived_table [ ON search_conditions ]&lt;br /&gt;             |&lt;br /&gt;               OPENQUERY( server, 'query' ) [ ON search_conditions ]&lt;br /&gt;             |&lt;br /&gt;               OPENROWSET&lt;br /&gt;                               ( 'provider_name', &lt;br /&gt;                                 { 'datasource';'user_id';'password',  |  'provider_string', }&lt;br /&gt;                                 { [ catalog. ] [ schema. ] object  |  'query' }&lt;br /&gt;                               ) [ ON search_conditions ]&lt;br /&gt;             | &lt;br /&gt;               table_name [ ON search_conditions ]&lt;br /&gt;             | &lt;br /&gt;               view_name [ ON search_conditions ]&lt;br /&gt;            }&lt;br /&gt;            [   ...,  n ]&lt;br /&gt;          |&lt;br /&gt;          CROSS JOIN  |  FULL [ OUTER ] JOIN &lt;br /&gt;            {&lt;br /&gt;               derived_table &lt;br /&gt;             | &lt;br /&gt;               OPENQUERY( server, 'query' ) &lt;br /&gt;             |&lt;br /&gt;               OPENROWSET&lt;br /&gt;                               ( 'provider_name', &lt;br /&gt;                                 { 'datasource';'user_id';'password',  |  'provider_string', }&lt;br /&gt;                                 { [ catalog. ] [ schema. ] object  |  'query' }&lt;br /&gt;                               ) &lt;br /&gt;             | &lt;br /&gt;               table_name &lt;br /&gt;             | &lt;br /&gt;               view_name &lt;br /&gt;            }&lt;br /&gt;            [   ...,  n ]&lt;br /&gt;       ]&lt;br /&gt;   ] &lt;br /&gt;&lt;br /&gt;   [&lt;br /&gt;      {&lt;br /&gt;         WHERE search_conditions &lt;br /&gt;       |&lt;br /&gt;         WHERE CURRENT OF [ GLOBAL ] cursor_name &lt;br /&gt;       |&lt;br /&gt;         WHERE CURRENT OF cursor_variable_name &lt;br /&gt;      }&lt;br /&gt;         [&lt;br /&gt;           OPTION (  FAST number_rows &lt;br /&gt;                          | FORCE ORDER &lt;br /&gt;                          | HASH GROUP &lt;br /&gt;                          | ORDER GROUP &lt;br /&gt;                          | HASH JOIN &lt;br /&gt;                          | LOOP JOIN &lt;br /&gt;                          | MERGE JOIN &lt;br /&gt;                          | KEEP PLAN &lt;br /&gt;                          | MAXDOP &lt;br /&gt;                          | ROBUST PLAN &lt;br /&gt;                          | CONCAT UNION &lt;br /&gt;                          | HASH UNION &lt;br /&gt;                          | MERGE UNION &lt;br /&gt;                          [   ...,  n ]&lt;br /&gt;                        )&lt;br /&gt;         ]&lt;br /&gt;   ]&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;//Full explanation follows:&lt;br /&gt;&lt;br /&gt;KEYWORDS	Keywords are denoted with upper case letters. Obey the spelling.&lt;br /&gt;&lt;br /&gt;variables	All user-supplied variables are denoted with lower case letters.&lt;br /&gt;&lt;br /&gt;...,   n	Signifies that there can be more than one value in a comma delimited list. Note that the dots and n are not part of the code and must not appear in the SQL query.&lt;br /&gt;&lt;br /&gt;...   n	Signifies that there can be more than one value in a blank space delimited list. Note that the dots and n are not part of the code and must not appear in the SQL query.&lt;br /&gt;&lt;br /&gt;{  } 	Signifies that all, or some portion, of the code elements between the braces are required elements and must appear in the SQL query. Note that these braces are not part of the code and must not appear in the SQL query.&lt;br /&gt;&lt;br /&gt;[  ] 	Signifies that the code elements between the square brackets can optionally appear in the SQL query, but are not required. Note that these brackets are not part of the code and must not appear in the SQL query.&lt;br /&gt;&lt;br /&gt;|	The or symbol signifies that you may use only one of the code elements or values from the possible choices. Note that the or symbol is not part of the code and must not appear in the SQL query.</description>
      <pubDate>Thu, 06 Sep 2007 10:30:33 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4498</guid>
      <author>dubby (Dave)</author>
    </item>
    <item>
      <title>Visit Python Abstract Syntax Tree</title>
      <link>http://snippets.dzone.com/posts/show/3360</link>
      <description>Simplest AST visitor. More on this blog post :&lt;br /&gt;&lt;a href="http://www.biais.org/blog/index.php/2007/01/10/9-visit-python-abstract-syntax-tree"&gt;http://www.biais.org/blog/index.php/2007/01/10/9-visit-python-abstract-syntax-tree&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;import compiler&lt;br /&gt; &lt;br /&gt;class CodePrinter:&lt;br /&gt;    def __init__(self):&lt;br /&gt;        self.src = ''&lt;br /&gt; &lt;br /&gt;    def visitName(self,t):&lt;br /&gt;        self.src += t.name&lt;br /&gt; &lt;br /&gt;    def visitConst(self,t):&lt;br /&gt;        self.src += str(t.value)&lt;br /&gt; &lt;br /&gt;    def visitStmt(self, t):&lt;br /&gt;        for i in t:&lt;br /&gt;            a = pretty_print(i)&lt;br /&gt;            self.src += a + "\n"&lt;br /&gt; &lt;br /&gt;    def visitAssName(self, t):&lt;br /&gt;        self.src += t.name + " = "&lt;br /&gt; &lt;br /&gt;def pretty_print(node):&lt;br /&gt;    myvisitor = CodePrinter()&lt;br /&gt;    # compiler.walk return the visitor instance : 2nd arg&lt;br /&gt;    return compiler.walk(node, myvisitor).src&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Wed, 24 Jan 2007 13:03:54 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3360</guid>
      <author>maxme (Maxime Biais)</author>
    </item>
    <item>
      <title>Syntax highlighting with vim &amp; Ruby</title>
      <link>http://snippets.dzone.com/posts/show/3032</link>
      <description>From: http://www.ruby-forum.com/topic/64262&lt;br /&gt;&lt;br /&gt;This snippet will convert source code files to syntax-colored html files.&lt;br /&gt;usage:  vim-syntax-highlighting.rb src.rb src.html&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;br /&gt;require 'tempfile'&lt;br /&gt;&lt;br /&gt;$VERBOSE=nil&lt;br /&gt;STDERR.reopen(Tempfile::new($$)) unless STDIN.tty?&lt;br /&gt;&lt;br /&gt;fin, fout, _ = ARGV&lt;br /&gt;fin = ((fin.nil? or fin == '-') ? STDIN : open(fin))&lt;br /&gt;fout = ((fout.nil? or fout == '-') ? STDOUT : open(fout,'w+'))&lt;br /&gt;&lt;br /&gt;ts = Tempfile::new($$), Tempfile::new($$)&lt;br /&gt;ts[0].write fin.read&lt;br /&gt;ts.each{|t| t.close}&lt;br /&gt;command = %Q( vim -f +'syn on' +'set filetype=ruby' +'set background=light' +'run! syntax/2html.vim' +'w! #{ ts[1].path }' +'qa!' - &lt; #{ ts[0].path } &gt; /dev/null 2&gt;&amp;1 )&lt;br /&gt;#command = %Q( vim -f +'syn on' +'set filetype=c' +'set background=dark' +'run! syntax/2html.vim' +'w! #{ ts[1].path }' +'qa!' - &lt; #{ ts[0].path } &gt; /dev/null 2&gt;&amp;1 )&lt;br /&gt;system command&lt;br /&gt;ts.each{|t| t.open; t.rewind}&lt;br /&gt;fout.write(ts[1].read)&lt;br /&gt;ts.each{|t| t.close!}&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Fri, 24 Nov 2006 16:24:09 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3032</guid>
      <author>ntk ()</author>
    </item>
    <item>
      <title>General Delimited Input in Ruby</title>
      <link>http://snippets.dzone.com/posts/show/2978</link>
      <description>In ruby there are several special literal notations:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;%{blah}       # or %Q{blah} # same as "blah" but igornes " and '&lt;br /&gt;%q{blah}      # same as 'blah' but no interpolation&lt;br /&gt;%w{blah blah} # same as "blah blah".split&lt;br /&gt;%r{blah}      # same as /blah/&lt;br /&gt;%x{ls}        # same as `ls`&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Mon, 06 Nov 2006 22:52:35 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/2978</guid>
      <author>WanCW (WanCW)</author>
    </item>
    <item>
      <title>Latex2wiki</title>
      <link>http://snippets.dzone.com/posts/show/2847</link>
      <description>Translate a subset of LaTeX into MoinMoin wiki syntax.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;#!/usr/bin/env python&lt;br /&gt;&lt;br /&gt;#    Copyright (C) 2003, Maxime Biais &lt;maxime@biais.org&gt;&lt;br /&gt;#&lt;br /&gt;#    This program is free software; you can redistribute it and/or modify&lt;br /&gt;#    it under the terms of the GNU General Public License as published by&lt;br /&gt;#    the Free Software Foundation; either version 2 of the License, or&lt;br /&gt;#    (at your option) any later version.&lt;br /&gt;#&lt;br /&gt;#    This program is distributed in the hope that it will be useful,&lt;br /&gt;#    but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;#    GNU General Public License for more details.&lt;br /&gt;#&lt;br /&gt;#    You should have received a copy of the GNU General Public License&lt;br /&gt;#    along with this program; if not, write to the Free Software&lt;br /&gt;#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA&lt;br /&gt;#&lt;br /&gt;# $Id: latex2wiki.py,v 1.1.1.1 2004/03/14 18:31:50 max Exp $&lt;br /&gt;&lt;br /&gt;import sys, re&lt;br /&gt;&lt;br /&gt;def dummy(d):&lt;br /&gt;    pass&lt;br /&gt;&lt;br /&gt;NONE = "__@NONE@__"&lt;br /&gt;&lt;br /&gt;tr_list = [&lt;br /&gt;    (r"\\includegraphics.*{(.*)\.eps}", "attachment::%s.png", dummy),&lt;br /&gt;    (r"\\caption{.*}", "", dummy),&lt;br /&gt;    (r"\\label{.*}", "", dummy),&lt;br /&gt;    (r"(.*)\\emph{(.*)}(.*)", """%s'''%s'''%s""", dummy),&lt;br /&gt;    (r"\\item (.*)", " * %s", dummy),&lt;br /&gt;    (r"\\begin{.*}", "", dummy),&lt;br /&gt;    (r"\\end{.*}", "", dummy),&lt;br /&gt;    (r"(.*)``(.*)''(.*)", "%s\"%s\"%s", dummy),&lt;br /&gt;    (r"\\chapter{(.*)}", NONE, dummy),&lt;br /&gt;    (r"\\paragraph{(.*)}", "==== %s ====", dummy),&lt;br /&gt;    (r"\\subsubsection{(.*)}", "==== %s ====", dummy),&lt;br /&gt;    (r"\\subsection{(.*)}", "=== %s ===", dummy),&lt;br /&gt;    (r"\\section{(.*)}", "== %s ==", dummy),&lt;br /&gt;    (r"(.*)\\fig{.*}(.*)", "%s suivant %s", dummy)&lt;br /&gt;    ]&lt;br /&gt;&lt;br /&gt;in_stream  = open(sys.argv[1], "r")&lt;br /&gt;if len(sys.argv) &lt; 3:&lt;br /&gt;    out_stream = sys.stdout&lt;br /&gt;else:&lt;br /&gt;    out_stream = open(sys.argv[2], "w")&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;for i in in_stream.readlines():&lt;br /&gt;    cur_write = 0&lt;br /&gt;    for reg in tr_list:&lt;br /&gt;        m = re.search(reg[0], i)&lt;br /&gt;        if m:&lt;br /&gt;            reg[2](i)&lt;br /&gt;            cur_write = 1&lt;br /&gt;            if reg[1] == NONE:&lt;br /&gt;                break&lt;br /&gt;            print &gt;&gt; out_stream, reg[1] % m.groups()&lt;br /&gt;            break&lt;br /&gt;    if not cur_write:&lt;br /&gt;        out_stream.write(i)&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Tue, 17 Oct 2006 12:10:39 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/2847</guid>
      <author>bugmenot (BugMeNot)</author>
    </item>
    <item>
      <title>A replacement for Ruby's File.join</title>
      <link>http://snippets.dzone.com/posts/show/2447</link>
      <description>File.join is ugly, there I've said it. So how about being able to replace this:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;require File.join(LOAD_PATH, 'foobar')&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;With this:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;require LOAD_PATH/:foobar&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Trivial, really:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;class String&lt;br /&gt;  def /(o)&lt;br /&gt;    File.join(self, o.to_s)&lt;br /&gt;  end&lt;br /&gt;end&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sun, 20 Aug 2006 12:27:36 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/2447</guid>
      <author>ciconia (Sharon Rosner)</author>
    </item>
    <item>
      <title>Check the syntax of a bunch of PHP files all at once</title>
      <link>http://snippets.dzone.com/posts/show/2063</link>
      <description>Will find all files ending with 'php' and execute the syntax check of php for every found file. Useful if you quickly want to see which php file contains a parse error.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;find ./ -type f -name \*.php -exec php -l {} \;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Thu, 18 May 2006 00:19:40 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/2063</guid>
      <author>yoghoyogho ()</author>
    </item>
  </channel>
</rss>
