Skip to main content

Home/ InfokeyDEV/ Group items tagged classes

Rss Feed Group items tagged

Benx Shen

Motivating the Data Storm, open source database browser for testing - 0 views

  • public void test_order_save() {    Order orderToBeFound = new Order(SOME_ID, SOME_NAME1);    orderToBeFound.save();    new DataStorm().show( connection, "SELECT * FROM orders o WHERE o.id = " + SOME_ID );    assertNotNull(orderToBeFound.load(SOME_ID));}
  •  
    Data Storm is a free open source data base browser. While there are millions of data base browsers freely available online, Data Storm is different as it can be launched directly from within your Java code. This enables you to see and modify data that otherwise may not be available to you.
Benx Shen

Groovy - Regular Expressions - 0 views

  • Groovy supports regular expressions natively using the ~"pattern" expression
    • Benx Shen
       
      Groovy 對於 regexp 的支援有 3 個特殊的表示方式:
      ~"pattern" (create java.util.regex.Pattern)=~ (create java.util.regex.Matcher)==~ (do Matcher.matches() )
  • // lets create a regex Pattern def pattern = ~/foo/ assert pattern instanceof Pattern
  • Groovy also supports the =~ (create Matcher) and ==~ (matches regex) operators.
  • ...6 more annotations...
  • Since a Matcher coerces to a boolean by calling its find method, the =~ operator is consistent with the simple use of Perl's =~ operator, when it appears as a predicate (in 'if', 'while', etc.). The "stricter-looking" ==~ operator requires an exact match of the whole subject string.
  • def matcher = "\$abc." =~ /\$(.*)\./ // no need to double-escape! assert "\\\$(.*)\\." == /\$(.*)\./ matcher.matches(); // must be invoked assert matcher.group(1) == "abc" // is one, not zero
  • def m = "foobarfoo" =~ /o(b.*r)f/ assert m[0][1] == "bar"
  • // lets create a Matcher def matcher = "cheesecheese" =~ /cheese/ assert matcher instanceof Matcher answer = matcher.replaceAll("edam")
    • Benx Shen
       
      以下是一些 groovy regexp 的程式碼,請特別注意劃線的部份!
  • // fancier group demo matcher = "\$abc." =~ "\\\$(.*)\\." matcher.matches(); // must be invoked [Question: is this still true? Not in my experience with jsr-04.] assert matcher.group(1) == "abc" // is one, not zero
    • Benx Shen
       
      這裡需要特別注意的是,如果想要使用 matcher.group() 方法,那麼必須先執行 matcher.matches() 方法呼叫(我記得呼叫 find() 也行)。然而,如果是直接使用 groovy 的語法,那麼就可以直接使用 matcher[0][?] 的用法了!
Benx Shen

Groovy - Groovy Categories - 0 views

  • import groovy.xml.* def html = DOMBuilder.newInstance().html { head { title (class:'mytitle', 'Test') } body { p (class:'mystyle', 'This is a test.') } } use (groovy.xml.dom.DOMCategory.class) { assert html.head.title.text() == 'Test' assert html.body.p.text() == 'This is a test.' assert html.find{ it.tagName == 'body' }.tagName == 'body' assert html.getElementsByTagName('*').grep{ it.'@class' }.size() == 2 }
    • Benx Shen
       
      這裡是一個範例,可以看到透過 DOMCategory 的協助,xml dom 元素的存取直接可以用 "expression" 的方式就可以很方便地取用,而不需要很囉唆地 getElement() 或之類的
Benx Shen

Rainbow for Firebug :: Firefox Add-ons - 0 views

  • Rainbow for Firebug 0.6 by Antonin Hildebrand experimental Categories Web Development Javascript syntax highlighting for Firebug
Benx Shen

Bertrand's weblog: When was this Java class compiled? - 0 views

  • When was this Java class compiled? Credits to Dmitry Beransky on the advanced-java@discuss.develop.com list. import java.util.Date; import java.io.IOException; public class When { public static void main(String args[]) throws IOException { Date d = new Date( When.class.getResource("When.class") .openConnection() .getLastModified() ); System.out.println("This class was compiled on " + d); } }
danadavid

Yoga Training in Kerala, Yoga Classes in Kerala - Kerala Everything - 0 views

  •  
    Several yoga training centres in Kerala have been started conducting yoga classes in Kerala. This page contains a detailed description about Yoga Training in Kerala and Yoga Classes in Kerala.
xiangfhua

nike kyrie 1 all star for sale but then again - 0 views

Nike kyrie 1 all star for sale but then again the principal construction of the present consists of leather and nubuck which offers it a nice delicate experience. Now beneath all the design and sty...

nike kyrie 1 all star

started by xiangfhua on 17 Jun 15 no follow-up yet
lshfang

nike flyknit lunar 3 wholesale but he won't do the same for women - 0 views

Nike flyknit lunar 3 wholesale but he won't do the same for women one of these myths is that anyone can sell as long as he has enough desire and training. Recently we worked with the manager of a r...

nike flyknit lunar 3

started by lshfang on 13 Mar 15 no follow-up yet
tomsshous tomsshous

sac imitation longchamps pas cher L'homme - 0 views

76% des sondés se disent favorables à l'utilisation de cette technique sur des adultes ou des enfants souffrant d'une maladie d'origine génétique dans le cadre de la thérapie génique pour soigner o...

sac longchamp pas cher

started by tomsshous tomsshous on 30 May 16 no follow-up yet
tomsshous tomsshous

sac imitation longchamps pas cher Cette - 0 views

Dunkerque, en tête de deux buts à la pause, n'a pas su conserver son avance contre Ivry (23-23). Dans un match sans véritable enjeu, Dunkerque et Ivry n'ont pas réussi à se départager (23-23), merc...

sacs longchamps

started by tomsshous tomsshous on 31 May 16 no follow-up yet
huahai789

nike free running shoes for cheap he split two free throws - 0 views

Nike free running shoes for cheap he split two free throws pu is also a type of foam. It stands for polyurethane. The material is heavier than Nike LeBron 11 Everglades for sale EVA and is generall...

nike free running

started by huahai789 on 06 Jan 15 no follow-up yet
Benx Shen

JavaScript: The World's Most Misunderstood Programming Language - 3 views

  • Why is this language so misunderstood?
  • Is JavaScript object-oriented? It has objects which can contain data and methods that act upon that data. Objects can contain other objects. It does not have classes, but it does have constructors which do what classes do, including acting as containers for class variables and methods. It does not have class-oriented inheritance, but it does have prototype-oriented inheritance.
  •  
    Chinese new year animals horoscope2016 Happy Chinese new year 2016 messages & quotes Happy new year 2016 greetings for Chinese Chinese new year 2016 funny poems
1 - 20 of 424 Next › Last »
Showing 20 items per page