import java.sql.*;import java.util.*;import java.sql.DriverManager;// return true if some records satisfy the condition, otherwase, false.public Boolean IsExifPhotoIdTimeLongitudeLatitude( String photoId, String time, String longitude, String latitude ){Connection con = null;String url = "";String driver = "";Statement stmt = null;String query = "";// your database table nameString targetSheet = "db_table_name";ResultSet result = null;Boolean hasRecord = false;// your queryquery = "SELECT * FROM `"+ targetSheet +"` WHERE photoId='" + photoId + "' AND time='" + time + "' AND longitude='" + longitude + "' AND latitude='" + latitude + "'";try{// connect to mysql databaseurl = "jdbc:mysql://127.0.0.1:3306/database_name";driver = "com.mysql.jdbc.Driver";p = new Properties();Class.forName(driver).newInstance();con = DriverManager.getConnection(url, "user_name", "pass_word");// create statementstmt = con.createStatement();// execute your queryresult = stmt.executeQuery(query);// result.first() will return false if there is no record// Important: executeQuery never return nullif( result.first() ){hasRecord = true;}}catch( Exception e ) {e.printStackTrace();}finally {}return hasRecord;}
Use NVM to handle Angular-Node.js incompatibility (e.g., Uncaught SyntaxError: Unexpected token 'export')
Overview If you are a fullstack developer, the chances are that you will be creating multiple frontend or Node.js projects along the way. When you are creating new projects using the newest version of the cli (command-line interface) of a particular framework, you might be asked to install the most updated version of Node.js in order to utilize the newest feature. This might involve upgrading your Node.js version, which might not be compatible with other existing projects (e.g., using Angular) you have created before. A potential solution is to use nvm (Node Version Manager) to install multiple versions of Node.js and use a particular version of the Node.js to install the proper version of the cli (e.g., Angular-CLI) that can be used to manage a particular project. Here I will use a problem I run into to explain how to solve it. Problem There is a compatibility issue between Node.js and angular.js. For instance, I run into an error when I was using an incompatible version of Node.js ...
Comments