Eclipse templates

newmap
Java statement
Yes
Creates a new java.util.Map of the type java.util.HashMap

1
2
3
${:import(java.util.Map, java.util.HashMap)}
Map<${key}, ${value}> ${mapname} = new HashMap<${key}, ${value}>();
${cursor}

newlist
Java statement
Yes
Creates a new java.util.List of the type java.util.ArrayList

1
2
3
 ${:import(java.util.List, java.util.ArrayList)}
List<${type}> ${listname} = new ArrayList<${type}>();
${cursor}

newset
Java statement
Yes
Creates a new java.util.Set of the type java.util.HashSet

1
2
3
${:import(java.util.Set, java.util.HashSet)}
Set<${type}> ${setname} = new HashSet<${type}>();
${cursor}

CRUD operation in Hibernate (re-link)

http://mrbool.com/crud-operation-in-hibernate/26236

This article will discuss about basic CRUD operations in hibernate.
add to favorites
Today, we are going to discuss about basic CRUD operations in Hibernate.

Pre requirement
We are going to discuss about 4 main functionality:

Create a record
Read a record
Update a Record
Delete a Record
We make a class Course and we will perform the CRUD operation on this class.

Read more: http://mrbool.com/crud-operation-in-hibernate/26236#ixzz2AuiKc9c7 ….

ANDROID ECLIPSE

The lecture is suitable for people with background in software development. It is highly recommended to come with your laptop already installed with the following (the installation takes time and you won’t have that time during the lecture):
1. Java Development Kit (avoid Java 7 and install JDK 6) – www.oracle.com
2. Eclipse Classic – www.eclipse.org
3. Android SDK – www.android.com
4. ADT (Android Development Tools for Eclipse) – www.android.com
You can find a post with a short video clip that explains these installations at http://bit.ly/SW0rZ9.

http://abelski-android-jumpstart.eventbrite.com/

ECLIPSE.INI sample, example

Here is my last eclipse.ini example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
-vm
C:/Program Files/Java/jdk1.6.0_29/bin/javaw.exe
-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20120522-1813
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
512M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
512m
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Dhelp.lucene.tokenizer=standard
-Xms512m
-Xmx3048m
-XX:+UseParallelGC
-XX:PermSize=256M
-XX:MaxPermSize=512M

PHP XML PARSER class

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
# +----------------------------------------------------------------------+
# | PHP version 4.3.10
# +----------------------------------------------------------------------+
# | Copyright (c) 2001-2005 Web-Media.Ru
# +----------------------------------------------------------------------+
# | Authors: Original Author Andreas Sokov, http://j8.spb.ru
# +----------------------------------------------------------------------+
#
#
class xml  {
    #
   var $parser ;
    var $STRUCT_VALUE   = array() ;
    var $STRUCT_INDEX   = array() ;

    # +-----------------------------------------------------------------------+
   # |
   # +-----------------------------------------------------------------------+
   function xml()
    {
       $this->parser = xml_parser_create();

        xml_set_object($this->parser, $this);
        #
       #xml_set_element_handler($this->parser, "tag_open", "tag_close");
       #xml_set_character_data_handler($this->parser, "cdata");
       #
       xml_parser_set_option($this->parser,  XML_OPTION_CASE_FOLDING,    0 );
        xml_parser_set_option($this->parser,  XML_OPTION_SKIP_WHITE,      1 );
        #
       return true ;
    }

    # +-----------------------------------------------------------------------+
   # |
   # +-----------------------------------------------------------------------+
   function parse_into_struct( $data )
    {
        return xml_parse_into_struct($this->parser,  $data, $this->STRUCT_VALUE, $this->STRUCT_INDEX ) ;
    }

    # +-----------------------------------------------------------------------+
   # |
   # +-----------------------------------------------------------------------+
   function parser_free()
    {
        return xml_parser_free( $this->parser ) ;
    }

    # +-----------------------------------------------------------------------+
   # |
   # +-----------------------------------------------------------------------+
   function get_code_value( $tag )
    {
        #
       if ( isSet($this->STRUCT_INDEX[$tag]) ) {
            #
           $TAG_ = $this->STRUCT_INDEX[$tag] ;
            if ( sizeOf($TAG_)>1 ) {
                # open & close tags present
               $value_index = $TAG_[0] ;

            }else{
                # all data into one tag present
               # type == complete
               $value_index = $TAG_[0] ;
                #
               # get value for OPEN or COMPLETE tag
               return $this->STRUCT_VALUE[ $value_index ] ;
            }

        }else{
            return false ;
        }
    }


    # +-----------------------------------------------------------------------+
   # |
   # +-----------------------------------------------------------------------+
   function tag_open($parser, $tag, $attributes)
    {
       var_dump($parser, $tag, $attributes);
    }

    # +-----------------------------------------------------------------------+
   # |
   # +-----------------------------------------------------------------------+
   function cdata($parser, $cdata)
    {
       var_dump($parser, $cdata);
    }

    # +-----------------------------------------------------------------------+
   # |
   # +-----------------------------------------------------------------------+
   function tag_close($parser, $tag)
    {
       var_dump($parser, $tag);
    }




}
# +-----------------------------------------------------------------------+
# | end of class xml
# +-----------------------------------------------------------------------+
?>

SelfTraining HOWTO Start HIBERNATE + SQLITE Desctop App ?

Hello.
In this topic i will clarify my experience hot you can start Java Project in ECLIPSE using HIBERNATE 3.5.6-FINAL & SQLite 3.7.2.
FYI : I use SQL Manager in FireFox – This is very simple and fast solution to manage SQLite DB.
Also I have installed maven (m2e) plugin in my Eclipse (4.2 JUNO)
Project builded with jdk 1.7
Continue reading

CSS : which one has priority in one tag ID or CLASS ?

Here is sample of code which show the priority`s difference between ID and CLASS :
here below you see what ID has more over priority than CLASS .

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
p
{
border-style:solid;
border-top:thick double #ff0000;
}

.id2 { color: red; }
#id1 { color: blue; }
</style>
</head>

<body>
<p class="id2" id="id1">This is BLUE TEXT!</p>
<p class="id2" >This is RED TEXT.</p>
</body>

</html>

JAVA GENERICS example select

Class Literals as Runtime-Type Tokens (The Java™ Tutorials > Bonus > Generics)
http://docs.oracle.com/javase/tutorial/extra/generics/literals.html

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Collection<EmpInfo>
    emps = sqlUtility.select(EmpInfo.class, "select * from emps");
...
public static <T> Collection<T> select(Class<T> c, String sqlStatement) {
    Collection<T> result = new ArrayList<T>();
    /* Run sql query using jdbc. */
    for (/* Iterate over jdbc results. */ ) {
        T item = c.newInstance();
        /* Use reflection and set all of item's
         * fields from sql results.
         */
 
        result.add(item);
    }
    return result;
}