anchor.diff:  					out.println("<th>Diagnosis*</th>");
   					out.println("<th>Description</th>");
   					out.println("<th>Thumbnail Record Photos*</th>");
  -					out.println("</tr>");
  +					out.println("</tr>"); */
   
   
               	}
               	
               	catch(SQLException e){
  -            		out.println("xixi");
               		out.println("<hr>"+e.getMessage()+"<hr>");
  -                    con.rollback();
  +                    /* con.rollback(); */
   				}
  +			 
  +            	
  +            	ArrayList<ArrayList<String>> matchSensor = new ArrayList();
  +           
  +            	if (rs != null){
  +            		
  +                while(rs.next()){
  +   					 ArrayList<String> searchSensors = new ArrayList();
  +   					 
  +   					 for (i=1;i<=10;i++){
  +   						 Object object = rs.getObject(i);
  +   						 if (object != null){
  +   							 searchSensors.add(object.toString());
  +   						
  +   						 }
  +   					 }
  +   					 
  +   					 matchSensor.add(searchSensors);
  +   					/*  out.println(matchSensor); */
  +   					 }
  +   				}
  +            	
  +
  +            	ResultSet rss = null;
  +            	String ssql = "";
  +
  +            	for (ArrayList<String> sensor: matchSensor){
  +            		
  +            		String ty = sensor.get(2);
  +            		
  +            		if (ty =="a"){
  +            			
  +            			ssql = "SELECT * FROM audio_recordings "
  +            					+ "WHERE date_created BETWEEN to_date('"+fdate+"','MM/DD/YYYY') "
  +            					+ "AND to_date('"+tdate+"','MM/DD/YYYY')";
  +            		} 
  +            		else if (ty =="i"){
  +
  +
  +            			ssql = "SELECT * FROM images "
  +            					+"WHERE date_created BETWEEN to_date('"+fdate+"','MM/DD/YYYY') "
  +            					+"AND to_date('"+tdate+"','MM/DD/YYYY')";
  +            		}
  +            		else if (ty =="s"){
  +            			ssql = "SELECT * FROM scalar_data "
  +            					+"WHERE date_created BETWEEN to_date('"+fdate+"','MM/DD/YYYY') "
  +            					+ "AND to_date('"+tdate+"','MM/DD/YYYY'))";
  +            		}
  +            		
  +            		try {       	
  +            			
  +    		        	rss = ss.executeQuery(ssql);	
  +    		        	/* while (rs.next()) {
  +    		        		Date dateCreated = rss.getDate("date_created");
  +    		        		System.out.println(dateCreated + "\t" );
  +    		        	} */
  +            		}
  +            		catch(SQLException e){
  +            			out.println("<hr>"+e.getMessage()+"<hr>");
  +            		}
  +            		
  +            	}
  +            	
  +			 
  +            	rs = null;
  +            	ArrayList<ArrayList<String>> subSensor = new ArrayList();
  +            	for (ArrayList<String> sensor: matchSensor) {
  +            		sqlString = sqlstr+ " AND sensor_id ="+ sensor.get(0);           		
  +            		try{
  +            		rs = ss.executeQuery(sqlString);
  +            		/* Object obj = rs.getObject(1);
  +            		subSensor.add(obj); */
  +            		}
  +            		catch(SQLException e){
  +            			out.println("<hr>"+e.getMessage()+"<hr>");
  +            			out.println("Invalid subscription.");
  +            		}
  +            		if (rs != null){
  +            		subSensor.add(sensor);
  +            		/* out.println(subSensor); */
  +            		}
  +            		
  +            	}
  +            	
  +            	
  +            	if (subSensor.size()==0){
  +            		out.println("You have 0 subscribed sensor.");
  +            	}
  +            	else{
  +            		out.println("<CENTER>");
  +            		out.println("<table>");
  +            		out.println("<tr>");
  +            		out.println("<th>sensor id</th>");
  +            		out.println("<th>sensor location</th>");
  +            		out.println("<th>sensor type</th>");
  +            		out.println("<th>sensor description</th>");
  +            		out.println("<th>blob data</th>");
  +            		out.println("</tr>");
  +            		
  +            		for(ArrayList<String> showSensor: subSensor) {
  +            			String query = "";
  +            			String showId = showSensor.get(0);
  +            			if (showSensor.get(2)=="a"){
  +                			query = "SELECT * FROM audio_recordings WHERE sensor_id = " +showId;
  +                		}
  +                		else if (showSensor.get(2)=="i"){
  +                			query = "SELECT * FROM images WHERE sensor_id = " +showId;
  +                		}
  +                		else if (showSensor.get(2)=="s"){
  +                			query = "SELECT * FROM scalar_data WHERE sensor_id = " +showId;
  +                		}
  +        
  +   
  +            			
  +            			try{
  +            				rs=ss.executeQuery(query);
  +            				
  +            		            
  +            			}
  +            			catch(SQLException e){
  +                			out.println("<hr>"+e.getMessage()+"<hr>");
  +                		}
  +            			
  +            			if (rs!= null){
  +            				while(rs.next()){
  +            					/* ResultSetMetaData rsMD = rs.getMetaData();
  +            					int j = rsMD.getColumnCount();
  +            					String printId = rs.getObject(1).toString();
  +            					String print */
  +            					
  +            					/* http://docs.oracle.com/javase/7/docs/api/java/sql/ResultSetMetaData.html */
  +            				    ResultSetMetaData rsmd = rs.getMetaData();
  +            				    int numberOfColumns = rsmd.getColumnCount();
  +            				   /*  Blob blob = rs.getBlob(); */
  +            				    String id = rs.getString(1).toString();
  +            				    /* Date date = new Date(); */ 
  +            				    /* java.util.Date date;
  +            				    Timestamp timestamp = rs.getTimestamp(3);
  +            				    if (timestamp != null){
  +            				    date = new java.util.Date(timestamp.getTime());
  +            				    } */
  +            				    /* String date = rs.getDate(3).toString(); */
  +
  +            				    
  +            				    
  +                        		out.println("<tr>");
  +                        		out.println(showSensor.get(0));
  +                        		out.println(showSensor.get(1));
  +                        		out.println(showSensor.get(2));
  +                        		out.println(showSensor.get(3));
  +                        		out.println(id);
  +                        		out.println("</tr>");
  +            				}
  +            			} 
  +            			
  +            			
  +            			
  +            		}
  +            		
  +            		out.println("</table>");
  +            		out.println("</CENTER>");
  +            		
  +            	}
  +            	
  +			 
  +			 
  +			 
  +			 
  +			 
  +			 
  +			 
  +			 
  +			 
  +			 
  +			 
  +			 
  +			 
  +			 
  +			 
  +			 
               	
               	con.close();
               	
  
positive.code:             out.println(" <BR></BR>");
              out.println("<b><font color=Gold>Here is the list of all sensor records for satisfied the search condition.</font></b>");
  
  =======
              out.println(" <INPUT TYPE='text' class='from' NAME='from' /></TD>");
  			out.println("<TD><label for='to'><font color=HotPink >To</font></label>");
              out.println(" <INPUT TYPE='text' class='to' NAME='to' /><font color=HotPink >*</font></TD>");
              out.println("</TR>");
              out.println("</TABLE>");
              out.println(" <br><B><I><font color=HotPink>filter by:</font></I></B><select NAME='OPERATION'>");
  			out.println("<option VALUE='a' SELECTED>newest to oldest</option>");
  			out.println("<option VALUE='b' SELECTED>oldest to newest</option>");
  		    out.println("</select> <input TYPE='submit' NAME='CommitSearch' VALUE='Search'><br>");
              out.println(" <BR></BR>");
              out.println("<b><font color=Gold>Here is the list of all sensor records for satisfied the search condition.</font></b>");
  >>>>>>> f553d6a5fa074fe7571283318b7c32a20544b99e
  
              String sqlString = "";
  	    	String fdate = request.getParameter("from");
  
negative.code:             out.println(" <TR>");
  			out.println("<TD><B><I><font color=HotPink>Time period:</font></I></B></TD>");
  			out.println("<TD><label for='from'><font color=HotPink>&nbsp;From</font></label>");
              out.println(" <INPUT TYPE='text' class='from' NAME='from'></TD>");
  			out.println("<TD><label for='to'><font color=HotPink >To</font></label>");
              out.println(" <INPUT TYPE='text' class='to' NAME='to'><font color=HotPink >*</font></TD>");
  