JRE 1.7 and Spark version 2.6.0. having exception java.lang.UnsupportedClassVersionError: spark/Route : Unsupported major.minor version 52.0 [duplicate]

Uncategorized
Question: This question already has an answer here:How to fix java.lang.UnsupportedClassVersionError: Unsupported major.minor version 41 answers I am using JRE 1.7 with spark version 2.6.0 and IDE as InteliJ idea. Source of my class is as below:package com.tengen; import spark.Request; import spark.Response; import spark.Route; import spark.Spark; public class HelloWorldSparkStyle { public static void main(String[] args) { Spark.get("/",new Route() { @Override public Object handle(final Request request, final Response response) throws Exception { return "Hello World from Spark"; } }); } } I get this exception when I try to run this class:"C:Program FilesJavajdk1.7.0_80binjava" "-javaagent:C:Program FilesJetBrainsIntelliJ IDEA Community Edition 2017.2.1libidea_rt.jar=4388:C:Program FilesJetBrainsIntelliJ IDEA Community Edition 2017.2.1bin" -Dfile.encoding=UTF-8 -classpath "C:Program FilesJavajdk1.7.0_80jrelibcharsets.jar;C:Program FilesJavajdk1.7.0_80jrelibdeploy.jar;C:Program FilesJavajdk1.7.0_80jrelibextaccess-bridge-64.jar;C:Program FilesJavajdk1.7.0_80jrelibextdnsns.jar;C:Program FilesJavajdk1.7.0_80jrelibextjaccess.jar;C:Program FilesJavajdk1.7.0_80jrelibextlocaledata.jar;C:Program FilesJavajdk1.7.0_80jrelibextsunec.jar;C:Program FilesJavajdk1.7.0_80jrelibextsunjce_provider.jar;C:Program FilesJavajdk1.7.0_80jrelibextsunmscapi.jar;C:Program FilesJavajdk1.7.0_80jrelibextzipfs.jar;C:Program FilesJavajdk1.7.0_80jrelibjavaws.jar;C:Program FilesJavajdk1.7.0_80jrelibjce.jar;C:Program FilesJavajdk1.7.0_80jrelibjfr.jar;C:Program FilesJavajdk1.7.0_80jrelibjfxrt.jar;C:Program FilesJavajdk1.7.0_80jrelibjsse.jar;C:Program FilesJavajdk1.7.0_80jrelibmanagement-agent.jar;C:Program FilesJavajdk1.7.0_80jrelibplugin.jar;C:Program FilesJavajdk1.7.0_80jrelibresources.jar;C:Program FilesJavajdk1.7.0_80jrelibrt.jar;C:UsersnaeemjM101JtargetM101J-1.0-SNAPSHOTWEB-INFclasses;C:Usersnaeemj.m2repositoryorgspringframeworkbootspring-boot-starter-web1.2.5.RELEASEspring-boot-starter-web-1.2.5.RELEASE.jar;C:Usersnaeemj.m2repositoryorgspringframeworkbootspring-boot-starter1.2.5.RELEASEspring-boot-starter-1.2.5.RELEASE.jar;C:Usersnaeemj.m2repositoryorgspringframeworkbootspring-boot1.2.5.RELEASEspring-boot-1.2.5.RELEASE.jar;C:Usersnaeemj.m2repositoryorgspringframeworkbootspring-boot-autoconfigure1.2.5.RELEASEspring-boot-autoconfigure-1.2.5.RELEASE.jar;C:Usersnaeemj.m2repositoryorgspringframeworkbootspring-boot-starter-logging1.2.5.RELEASEspring-boot-starter-logging-1.2.5.RELEASE.jar;C:Usersnaeemj.m2repositoryorgslf4jjcl-over-slf4j1.7.12jcl-over-slf4j-1.7.12.jar;C:Usersnaeemj.m2repositoryorgslf4jjul-to-slf4j1.7.12jul-to-slf4j-1.7.12.jar;C:Usersnaeemj.m2repositoryorgslf4jlog4j-over-slf4j1.7.12log4j-over-slf4j-1.7.12.jar;C:Usersnaeemj.m2repositorychqoslogbacklogback-classic1.1.3logback-classic-1.1.3.jar;C:Usersnaeemj.m2repositorychqoslogbacklogback-core1.1.3logback-core-1.1.3.jar;C:Usersnaeemj.m2repositoryorgyamlsnakeyaml1.14snakeyaml-1.14.jar;C:Usersnaeemj.m2repositorycomfasterxmljacksoncorejackson-databind2.4.6jackson-databind-2.4.6.jar;C:Usersnaeemj.m2repositorycomfasterxmljacksoncorejackson-annotations2.4.6jackson-annotations-2.4.6.jar;C:Usersnaeemj.m2repositorycomfasterxmljacksoncorejackson-core2.4.6jackson-core-2.4.6.jar;C:Usersnaeemj.m2repositoryorghibernatehibernate-validator4.3.2.Finalhibernate-validator-4.3.2.Final.jar;C:Usersnaeemj.m2repositoryjavaxvalidationvalidation-api1.0.0.GAvalidation-api-1.0.0.GA.jar;C:Usersnaeemj.m2repositoryorgjbossloggingjboss-logging3.1.0.CR2jboss-logging-3.1.0.CR2.jar;C:Usersnaeemj.m2repositoryorgspringframeworkspring-core4.1.7.RELEASEspring-core-4.1.7.RELEASE.jar;C:Usersnaeemj.m2repositoryorgspringframeworkspring-web4.1.7.RELEASEspring-web-4.1.7.RELEASE.jar;C:Usersnaeemj.m2repositoryorgspringframeworkspring-aop4.1.7.RELEASEspring-aop-4.1.7.RELEASE.jar;C:Usersnaeemj.m2repositoryaopallianceaopalliance1.0aopalliance-1.0.jar;C:Usersnaeemj.m2repositoryorgspringframeworkspring-beans4.1.7.RELEASEspring-beans-4.1.7.RELEASE.jar;C:Usersnaeemj.m2repositoryorgspringframeworkspring-context4.1.7.RELEASEspring-context-4.1.7.RELEASE.jar;C:Usersnaeemj.m2repositoryorgspringframeworkspring-webmvc4.1.7.RELEASEspring-webmvc-4.1.7.RELEASE.jar;C:Usersnaeemj.m2repositoryorgspringframeworkspring-expression4.1.7.RELEASEspring-expression-4.1.7.RELEASE.jar;C:Usersnaeemj.m2repositoryorgspringframeworkbootspring-boot-starter-thymeleaf1.2.5.RELEASEspring-boot-starter-thymeleaf-1.2.5.RELEASE.jar;C:Usersnaeemj.m2repositoryorgthymeleafthymeleaf-spring42.1.4.RELEASEthymeleaf-spring4-2.1.4.RELEASE.jar;C:Usersnaeemj.m2repositoryorgthymeleafthymeleaf2.1.4.RELEASEthymeleaf-2.1.4.RELEASE.jar;C:Usersnaeemj.m2repositoryognlognl3.0.8ognl-3.0.8.jar;C:Usersnaeemj.m2repositoryorgjavassistjavassist3.18.1-GAjavassist-3.18.1-GA.jar;C:Usersnaeemj.m2repositoryorgunbescapeunbescape1.1.0.RELEASEunbescape-1.1.0.RELEASE.jar;C:Usersnaeemj.m2repositorynznetultraqthymeleafthymeleaf-layout-dialect1.2.9thymeleaf-layout-dialect-1.2.9.jar;C:Usersnaeemj.m2repositoryorgspringframeworkbootspring-boot-starter-actuator1.2.5.RELEASEspring-boot-starter-actuator-1.2.5.RELEASE.jar;C:Usersnaeemj.m2repositoryorgspringframeworkbootspring-boot-actuator1.2.5.RELEASEspring-boot-actuator-1.2.5.RELEASE.jar;C:Usersnaeemj.m2repositoryorgspringframeworkbootspring-boot-legacy1.0.1.RELEASEspring-boot-legacy-1.0.1.RELEASE.jar;C:Usersnaeemj.m2repositorycomgoogleappengineappengine-api-1.0-sdk1.9.17appengine-api-1.0-sdk-1.9.17.jar;C:Usersnaeemj.m2repositorycomgithubkernel164gmultipart.4gmultipart-0.4.jar;C:Usersnaeemj.m2repositorycommons-fileuploadcommons-fileupload1.2.2commons-fileupload-1.2.2.jar;C:Usersnaeemj.m2repositorycommons-iocommons-io2.0.1commons-io-2.0.1.jar;C:Usersnaeemj.m2repositorycomsparkjavaspark-core2.6.0spark-core-2.6.0.jar;C:Usersnaeemj.m2repositoryorgslf4jslf4j-api1.7.12slf4j-api-1.7.12.jar;C:Usersnaeemj.m2repositoryorgeclipsejettyjetty-server9.2.11.v20150529jetty-server-9.2.11.v20150529.jar;C:Usersnaeemj.m2repositoryjavaxservletjavax.servlet-api3.1.0javax.servlet-api-3.1.0.jar;C:Usersnaeemj.m2repositoryorgeclipsejettyjetty-http9.2.11.v20150529jetty-http-9.2.11.v20150529.jar;C:Usersnaeemj.m2repositoryorgeclipsejettyjetty-util9.2.11.v20150529jetty-util-9.2.11.v20150529.jar;C:Usersnaeemj.m2repositoryorgeclipsejettyjetty-io9.2.11.v20150529jetty-io-9.2.11.v20150529.jar;C:Usersnaeemj.m2repositoryorgeclipsejettyjetty-webapp9.2.11.v20150529jetty-webapp-9.2.11.v20150529.jar;C:Usersnaeemj.m2repositoryorgeclipsejettyjetty-xml9.2.11.v20150529jetty-xml-9.2.11.v20150529.jar;C:Usersnaeemj.m2repositoryorgeclipsejettyjetty-servlet9.2.11.v20150529jetty-servlet-9.2.11.v20150529.jar;C:Usersnaeemj.m2repositoryorgeclipsejettyjetty-security9.2.11.v20150529jetty-security-9.2.11.v20150529.jar;C:Usersnaeemj.m2repositoryorgeclipsejettywebsocketwebsocket-server9.2.11.v20150529websocket-server-9.2.11.v20150529.jar;C:Usersnaeemj.m2repositoryorgeclipsejettywebsocketwebsocket-common9.2.11.v20150529websocket-common-9.2.11.v20150529.jar;C:Usersnaeemj.m2repositoryorgeclipsejettywebsocketwebsocket-client9.2.11.v20150529websocket-client-9.2.11.v20150529.jar;C:Usersnaeemj.m2repositoryorgeclipsejettywebsocketwebsocket-servlet9.4.4.v20170414websocket-servlet-9.4.4.v20170414.jar;C:Usersnaeemj.m2repositoryorgeclipsejettywebsocketwebsocket-api9.4.4.v20170414websocket-api-9.4.4.v20170414.jar;C:Usersnaeemj.m2repositoryorgfreemarkerfreemarker2.3.26-incubatingfreemarker-2.3.26-incubating.jar" com.tengen.HelloWorldSparkStyle java.lang.UnsupportedClassVersionError: spark/Route : Unsupported…
Read More

Building API and JSON: Retrieving data from multiple URLs

Uncategorized
Question: I am new to app development, and I am currently working on an iOS app (using Swift), part of which involves retrieving data from three different webpages. The three webpages can be accessed via three separate links on a website: http://blogs.cuit.columbia.edu/habitat/build/ How can I compile the data from those three webpages into a single JSON file such that the information from those webpages are in a nested format as shown below? [Build Name] [Date] [Time] [Info] So far, I have used WrapAPI to parse out data from the website into the following JSON file: ...{ "success": true,"outputScenario": "Default", "data": { "BuildsSection": { "Builds": [ "Build: Habitat NYC April 8th", "Friends of Rockaway April 15th", "Build: Rebuilding Together NYC April 29th" ] } },... I have created a similar JSON…
Read More

Get an error When I change prefork MPM to worker MPM in apache2.4 Ubuntu16.04

Uncategorized
Question: My apache2.4.18 in Ubuntu 16.04 with prefork MPM Loaded Modules: Apache Loaded Modules I want to change prefork MPM to worker MPM sudo a2dismod mpm_prefork sudo a2enmod mpm_worker sudo service apache2 restart Then I get a notice and I can't restart the Apache:"The apache2 configtest failed Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe. You need to recompile PHP. apache2.service: Control process exited, code=exited status=1 Failed to start LSB: Apache2 web server." I try to install the php7.0-fpm, but it doesn't work for me. What should I do if I want to change prefork to worker ??? how can I fix these? Thanks in advance Answer: Read more
Read More

cannot create database from ERD

Uncategorized
Question: Ive got ERD in visual paradigm and I want to generate postgreSQL database from it. When I try generate database Ive got error: Fail to generate database due to no physical entity in the project. (Error Code: DB0001). I already tried to synchronize ERD with class diagram, but it didnt help. Answer: It looks like your ERD is either in Conceptual or Logical data model. In Visual Paradigm the generation of database is only apply to Physical data model. You can right click on the blank area of your ERD and select Open Specification, and then specify the Data model to Physical for generating database. Or if you wish to keep your Conceptual/Logical ERD, you can then follow the video below about how to generate Physical ERD from your…
Read More

How to neatly chain promises in Javascript

Uncategorized
Question: How can I write this function neater, is returning then resolving it in the timeout callback the best way to do this? I'm asking because I'm new to javascript promises. getStuff(): Promise { let self = this; return new Promise(function(resolve, reject) { self.getData() .then(function(resp) { self.parse(resp); }) .then(function() { setTimeout(function() { resolve(); }, 5000); }); }); } Answer: It seems getData is Promise so you don't need to construct another one. However it looks you trying recursive call. Means you will need termination somewhere. getData(): Promise { let self = this; If(some conditions) Return true or something..... return new Promise(function(resolve, reject) { self.getData() .then(function(resp) { self.parse(resp); }) .then(function() { setTimeout(function() { resolve(); }, 5000); }); }); } Read more
Read More

Using pip runs into an error

Uncategorized
Question: I setup an venv with python3 and wanna install all my needed packages with pip. On Python2.7 it works very well, but with Python3 I run into the following error: pip install Django==1.11.0 pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available. Collecting Django==1.11.0 Could not fetch URL https://pypi.python.org/simple/django/: There was a problem confirming the ssl certificate: Can't connect to HTTPS URL because the SSL module is not available. - skipping Could not find a version that satisfies the requirement Django==1.11.0 (from versions: ) No matching distribution found for Django==1.11.0 I have seen that there is a possible solution (not verified by myselfe) to get a pem-file with the certificate into my system. Now my questions:is it possible to deactivate this…
Read More

Angular – Importing module causes lambda error

Uncategorized
Question: I'm writing a library and I got everything working apart from integrating the library with an actual app. I get a lambda error but I cannot figure out why this is happening. Here is the error: ERROR in Error encountered resolving symbol values statically. Function calls are not supported. Consider replacing the function or lambda with a reference to an exported function (position 194:50 in the original .ts file), resolving symbol NgModule in //ng/lib-ng/node_modules/@angular/core/core.d.ts, resolving symbol Components in //ng/lib-ng/dist/modules/components.module.d.ts, resolving symbol Components in //ng/lib-ng/dist/modules/components.module.d.ts And here's the module that throws it: providers.ts export const COMPONENTS_PROVIDERS: any[] = [ BreadcrumbsUtils, ModalApi, NotificationsApi, SiteHeaderApi ]; components.module.ts import {COMPONENTS_PROVIDERS} from '../components/providers'; @NgModule({ imports: [ BreadcrumbsModule, CheckboxModule, CheckboxesModule, DataListModule, DropdownModule, DropdownSelectModule, FileUploaderModule, ModalModule, NotificationsModule, SearchInputModule, SelectModule, SelectMultipleModule, SiteFooterModule, SiteHeaderModule, SwitchModule ], exports: […
Read More

How fetch specified column by rows number in PHP

Uncategorized
Question: I have a table with 5 column and a lot of rows. i want to fetch column number 3 for each rows that i select from my DB and store them in variables for compare together. for example my data:row 1 | column 1 column 2 column 3 row 2 | column 1 column 2 column 3 then i want to store column 3 for each rows and store them in variables and then compare the variables :variable 1 (row 1 , column 3) >= or =< variable 2 (row 2 , column 3) Answer: $query = "SELECT * FROM table"; $results = mysqli_query($con, $query); $var = []; while ($row = mysqli_fetch_array($results)) { $var[] = $row['column3']; } Then you can do anything with your variables array. Read more
Read More

Docker + WordPress – get this error “Fatal error: Uncaught Error: Call to undefined function mysql_connect()”

Uncategorized
Question: I am using Docker to run my old Wordpress project. After migrating on Docker i get this error: Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /var/www/html/wp-includes/wp-db.php:1570 Stack trace: #0 /var/www/html/wp-includes/wp-db.php(658): wpdb->db_connect() #1 /var/www/html/wp-includes/load.php(404): wpdb->__construct('wordpress_user', 'secret', 'wordpress_acade...', 'academy-mysql:3...') #2 /var/www/html/wp-settings.php(106): require_wp_db() #3 /var/www/html/wp-config.php(122): require_once('/var/www/html/w...') #4 /var/www/html/wp-load.php(37): require_once('/var/www/html/w...') #5 /var/www/html/wp-blog-header.php(13): require_once('/var/www/html/w...') #6 /var/www/html/index.php(17): require('/var/www/html/w...') #7 {main} thrown in /var/www/html/wp-includes/wp-db.php on line 1570 I tried following things: - add mysql extensions to Dockerfile - remove plugins - change theme But without success. Can someone help me? Answer: Read more
Read More

Horizontal scrolling between dynamic number of pages with tabs in Polymer

Uncategorized
Question: Is there a Polymer WebComponent that allows horizontal scrolling between dynamic number of pages with tabs? To those familiar with Android im looking for something like PagerTabStrip Answer: The swipe-pages custom element allows horizontal scrolling with tabs. You can check the demo here: http://theseamau5.github.io/swipe-pages/components/swipe-pages/demo.html. But this has not been updated for a long time. Read more
Read More

LocalStorage getItem and Loop Values

javascript
Question: I am storing some values into local storage using the following line of code; localStorage.setItem(event.lastEventId, JSON.stringify(data)); Looking at the browser console, the storage looks like this; I want to loop through the localstorage and display the values. The loop I have so far is; for (var i = 0; i < localStorage.length; i++) { $("#result").prepend("New transaction " + localStorage.getItem(localStorage.key(i)) + ""); } The #result displays the following; New transaction {"TimeStamp":"2017-08-18 16:34:15","Direction":"Out","CardNo":"40160433","SerialNo":20559458} New transaction {"TimeStamp":"2017-08-18 16:34:55","Direction":"In","CardNo":"40160432","SerialNo":20559459} I want to display the values only, not associated keys. For example; New transaction 2017-08-18 16:34:15, Out, 40160433, 20559458 New transaction 2017-08-18 16:34:55, In, 40160432, 20559459 What do I need to change in order to achieve this? Any help is appreciated. Answer: getItem() returns you a string. So in order to achieve what you…
Read More

Spring security how to set a intercept-url for all pages except login page shortly

java
Question: Well this is the first time i work with spring security and i wonder if there is short way to configure every page without a common pattern like: and having to map every controller with the value/welcome/controller. I know that with /** pattern i can secure all the pages but the resources and controller that response to some entry input gets the 403 error too. My frontend is programmed by html and javascript i cant not use jstl and the configuration is with xml files. Answer: This might be help full @Configuration @EnableWebSecurity public class WebSecConfig extends WebSecurityConfigurerAdapter { @Override public void configure(WebSecurity web) throws Exception { web.ignoring().antMatchers("/login"); } @Override protected void configure(HttpSecurity http) throws Exception { http.csrf().disable(); http .authorizeRequests() .antMatchers("/**").hasRole("USER") .and().formLogin().permitAll(); } @Autowired public void ConfigGlobal(AuthenticationManagerBuilder auth) throws…
Read More

Vue JS prop in component always undefined

vue.js
Question: I have a component. Once I select a category I need to get the ID and also a boolean which checks if the category has a subcategory, if it does, I make an API call to fetch the subcategories. Parent template: Child component: But inside the fetchSubCategories() function this line always returns undefined:console.log("sub: " + sub); If I check the Vue Devtools tab in my Chrome inspector, I can see that all of the data exists:cat_id:0 category_name:"All Subcategories" has_subCat:0 But why doesnt has_subCat get passed as a prop? Answer: The subcat prop is undefined because you are not passing it to the component. But, a subcat prop doesn't make much sense anyway, since you want to check the value for each option in the select which could all be…
Read More