how to embed the whole html file into JS

javascript
Question: I am trying to implement an online chat functionality on 3 of my websites, but I dont want to copy paste my whole code on every website. I want to create something like tawk.to has. They just have a Basically in my page's tag I will include this JS. Here is what tawk.to does: You just paste this code in your page and it displays chat box along with the functionality Answer: Yes you can do this by below approach. .... Create a JS file IN that file write a logic to create chat button. That file can have click events of that button which is added at run time VIA ajax. You can then include this file in all the HTML pages where you need chat functionality. Make…
Read More

UnsupportedOperationException while running oozie job

Uncategorized
Question: I am trying to run oozie map reduce job available in examples of oozie. After running command:bin/oozie job -oozie http://localhost:11000/oozie -config examples/apps/map-reduce/job.properties -run i got unsupportedexception. oozie version: 4.3.0 hadoop version: 2.7.1 on web console 500 internal server error. stacktrace:2017-08-15 01:32:10,772 ERROR V1JobsServlet:517 - SERVER[heena-lenovo-b560] USER[-] GROUP[-] TOKEN[-] APP[-] JOB[-] ACTION[-] URL[POST http://localhost:11000/oozie/v2/jobs?action=start] error, Not implemented by the DistributedFileSystem FileSystem implementation java.lang.UnsupportedOperationException: Not implemented by the DistributedFileSystem FileSystem implementation at org.apache.hadoop.fs.FileSystem.getScheme(FileSystem.java:217) at org.apache.hadoop.fs.FileSystem.loadFileSystems(FileSystem.java:2624) at org.apache.hadoop.fs.FileSystem.getFileSystemClass(FileSystem.java:2634) at org.apache.hadoop.fs.FileSystem.createFileSystem(FileSystem.java:2651) at org.apache.hadoop.fs.FileSystem.access$200(FileSystem.java:92) at org.apache.hadoop.fs.FileSystem$Cache.getInternal(FileSystem.java:2687) at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:2669) at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:371) at org.apache.oozie.service.HadoopAccessorService$4.run(HadoopAccessorService.java:565) at org.apache.oozie.service.HadoopAccessorService$4.run(HadoopAccessorService.java:563) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:422) at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1657) at org.apache.oozie.service.HadoopAccessorService.createFileSystem(HadoopAccessorService.java:563) at org.apache.oozie.service.AuthorizationService.authorizeForApp(AuthorizationService.java:374) at org.apache.oozie.servlet.BaseJobServlet.checkAuthorizationForApp(BaseJobServlet.java:260) at org.apache.oozie.servlet.BaseJobsServlet.doPost(BaseJobsServlet.java:99) at javax.servlet.http.HttpServlet.service(HttpServlet.java:643) at org.apache.oozie.servlet.JsonRestServlet.service(JsonRestServlet.java:304) at javax.servlet.http.HttpServlet.service(HttpServlet.java:723) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.oozie.servlet.AuthFilter$2.doFilter(AuthFilter.java:171) at org.apache.hadoop.security.authentication.server.AuthenticationFilter.doFilter(AuthenticationFilter.java:595) at org.apache.hadoop.security.authentication.server.AuthenticationFilter.doFilter(AuthenticationFilter.java:554) at org.apache.oozie.servlet.AuthFilter.doFilter(AuthFilter.java:176) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.oozie.servlet.HostnameFilter.doFilter(HostnameFilter.java:86) at…
Read More

React vs React.js vs ReactXP

Uncategorized
Question: Is React, React.js, and REactXP the same thing and if not, how do they differ? I keep reading some articles and I am confused about these. Answer: React and ReactJS are often used interchangeably. ReactXP is a library (or new app starter template) from Microsoft that uses React and React Native to allow for multi platform development. It supports development for IOS, Androind, Windows 10 (partially) by using React Native and Web by using React. Read more
Read More

Firebase viewing the specific child on the list. Website

javascript
Question: How to view the specific child on list on my JavaScript. My code:var rootRef = firebase.database().ref().child("tutee"); rootRef.on("child_added", snap => { var sno = snap.child("studentnumber").val(); var fname = snap.child("firstname").val(); var lname = snap.child("lastname").val(); var email = snap.child("email").val(); var key = snap.key; var view = snap.key; var btn = "Remove"; var btnview = "View"; $("#table_body").append(""+sno+""+fname+" "+lname+"" + btn + "" + btnview + ""); }); /* Delete */ $('#table_body').on('click', ".removeEmployee", function(){ // note: using 'removeElement' as class, not as id var key = $(this).attr('key'); var itemToRemove = rootRef.child(key); itemToRemove.remove() .then(function() { // removed from Firebase DB console.log("Remove succeeded.") alert("Successfully remove."); window.location.reload(); }) .catch(function(error) { console.log("Remove failed: " + error.message) }); }); // keeping this separate so that even if the item is removed by any other means (e.g.- directly from server…
Read More

HTML: How to increase height of side-by-side tables

Uncategorized
Question: I have followed following guide (https://stackoverflow.com/a/45672259/2402577) to put tables side-by-side. Tables' heights are not symmetric and I am not able to make change both tables' height (I prefer to increase tables' height). My Code: Latest Blocks Latest Transactions Output: [Q] How could I make both tables' height larger and symmetric? Thank you for your valuable time and help. Answer: You can use height and width attribute in CSS For eg. in table tag: height="100px" Simmilarly, for the second table Read more
Read More

Concise way of composing Java method references?

java
Question: Given some Java 8 method functions:class Foo { Bar getBar() {} } class Bar { Baz getBaz() {} } A composition of the two accessors looks like:Function getBarFromFoo = Foo::getBar; Function getBazFromBar = Bar::getBaz; Function getBazFromFoo = getBarFromFoo.andThen(getBazFromBar); Is there a more concise way? This seems to work ((Function) Foo::getBar).andThen(Bar::getBaz) But it's rather ugly. The outer parens make sense for precedence reasons, but why is the cast necessary? (Foo::getBar::getBaz would be nice, but alas...) Answer: Let's define a functional interface:@FunctionalInterface interface MyFunctionalInterface { Bar getBar(Foo f); } We can simplify the method reference Foo::getBar a bit, (Foo foo) -> foo.getBar(); which means "take a Foo and return a Bar". For that description, a lot of methods are suitable (for instance, our interface with the getBar and a Funtion with…
Read More

@parallel vs. native loops in julia

Uncategorized
Question: I run some example and I got some result. I got for the large number of iteration we can get a good result but for less amount of iteration we can get a worse result. I know there is a little overhead and it's absolutely ok, but is there any way to run some loop with less amount of iteration in parallel way better than sequential way? x = 0 @time for i=1:200000000 x = Int(rand(Bool)) + x end 7.503359 seconds (200.00 M allocations: 2.980 GiB, 2.66% gc time) x = @time @parallel (+) for i=1:200000000 Int(rand(Bool)) end 0.432549 seconds (3.91 k allocations: 241.138 KiB) I got good result for parallel here but in following example not. x2 = 0 @time for i=1:100000 x2 = Int(rand(Bool)) + x2 end…
Read More