skip to main | skip to sidebar

worknotes

Tuesday, November 6, 2012

semaphores

to have a look later

http://javapapers.com/core-java/semaphores-using-java/

http://www.javacodegeeks.com/2011/09/java-concurrency-tutorial-semaphores.html

what I am going to use
is
java.util.concurrent.locks.Lock

with tryLock() and lock()
Posted by Childish at 5:04 AM No comments:

Tuesday, July 24, 2012

java - copy directory


surprisingly copy file in Java <7 copies a file, not a directory

    // Copies all files under srcDir to dstDir.
    // If dstDir does not exist, it will be created.
    public void copyDirectory(File srcDir, File dstDir)
        throws IOException
    {
        if (srcDir.isDirectory())
        {
            if (!dstDir.exists())
            {
                dstDir.mkdir();
            }

            String[] children = srcDir.list();
            for (int i = 0; i < children.length; i++)
            {
                copyDirectory(new File(srcDir, children[i]), new File(dstDir, children[i]));
            }
        }
        else
        {
            // This method is implemented in Copying a File
            // copyFile(srcDir, dstDir);
        }
    }

Posted by Childish at 3:56 AM No comments:

java - Arrays.asList returns not modifiable AbstractList


Arrays.asList: Returns a fixed-size list backed by the specified array.
so, when calling add() or remove() to the result of Arrays.asList - java.lang.UnsupportedOperationException is thrown


to convert an array to a modifiable List use:
T[] data;

List<T> list = new LinkedList<T>(Arrays.asList(data));
Posted by Childish at 12:46 AM No comments:

Thursday, April 19, 2012

Solr

http://lucene.apache.org/solr/
Posted by Childish at 9:39 PM No comments:

Thursday, April 5, 2012

unit tests

ant+junit

https://docs.google.com/viewer?a=v&q=cache:O-kAlII3y2gJ:java.sun.com/developer/Books/javaprogramming/ant/ant_chap04.pdf+&hl=bg&gl=bg&pid=bl&srcid=ADGEESigWanupUAOJYWZ3l11DpR1AW7WjHtNflblUSANKOswbUDXHwRVeYPhRETSNbj-rFa9MWrwWNFOc-gqDZORxobDPvLi3rq33UVRQ-VUn_8Z2_Df8FWRwdgYth1W6l1g9rLg0H7f&sig=AHIEtbTXt04xfhTM9yNep09IqsY_1YGl-Q&pli=1
Posted by Childish at 6:41 AM No comments:

concurrency utils

edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicBoolean
Posted by Childish at 5:27 AM No comments:

Wednesday, March 21, 2012

some sites on design patterns

http://www.vincehuston.org/dp/
http://www.cmcrossroads.com/bradapp/javapats.html
http://dotnet.zcu.cz/NET_2006/Papers_2006/short/B31-full.pdf
http://zone.ni.com/devzone/cda/tut/p/id/3024
http://www.javacodegeeks.com/2011/02/state-pattern-domain-driven-design.html
http://nurkiewicz.blogspot.com/2009/09/state-pattern-introducing-domain-driven.html

factory
http://chaoticjava.com/posts/factory-design-pattern-made-simple-using-enums/
Posted by Childish at 6:33 AM No comments:
Newer Posts Older Posts Home
Subscribe to: Posts (Atom)

Followers

Blog Archive

  • ▼  2020 (1)
    • ▼  October (1)
      • tnsames.ora for pluggable database
  • ►  2017 (3)
    • ►  August (1)
    • ►  July (1)
    • ►  June (1)
  • ►  2015 (5)
    • ►  June (2)
    • ►  May (2)
    • ►  April (1)
  • ►  2014 (3)
    • ►  December (1)
    • ►  July (1)
    • ►  March (1)
  • ►  2013 (4)
    • ►  December (1)
    • ►  November (1)
    • ►  August (1)
    • ►  March (1)
  • ►  2012 (21)
    • ►  November (6)
    • ►  July (2)
    • ►  April (3)
    • ►  March (1)
    • ►  February (3)
    • ►  January (6)
  • ►  2011 (31)
    • ►  October (3)
    • ►  August (8)
    • ►  July (2)
    • ►  June (3)
    • ►  May (1)
    • ►  April (1)
    • ►  March (1)
    • ►  February (6)
    • ►  January (6)
  • ►  2010 (51)
    • ►  December (8)
    • ►  November (11)
    • ►  October (8)
    • ►  September (6)
    • ►  August (13)
    • ►  July (4)
    • ►  January (1)
  • ►  2009 (6)
    • ►  November (2)
    • ►  October (1)
    • ►  July (1)
    • ►  June (2)

About Me

My photo
Childish
View my complete profile