A cross validation of the method is left [on hold]

–explanation obtain the score of tested disease-microbe interaction
% make the score of seed disease-microbe interactions as zero
for i=1:nd
for j=1:nm
if interaction(i,j)==1

% obtain the position of tested disease-microbe interaction as variable globalposition(1,cv),
    **strong text**
    Please kindly tell me what dose this globalposition(1,cv)=ll2+1+(ll1-ll2-1)/2 mean if someone know,Thanks!

How can I assign a unique integer key to every Apache Spark Executor within an Apache Spark Java Application?

I need to assign a unique integer id to each spark executor in a spark application. I need to retrieve the executor id from within a task running on an executor. The executor id will be used, along with other data elements (timestamp, mac address, etc), to generate unique 64 bit keys. How can I assign a unique integer key to every Apache Spark Executor within an Apache Spark Java Application?

Starting Mocking with Mockito and Gradle/Maven?

Brand new/not quite new Java developer here, I’m at a weird place in which core Java is fine (e.g. programming concepts such as looping, methods, objects, etc.), but, I’ve started on trying to learn how to test.

More specifically, how to test using Mocks. I’ve been attempting to use the mocking framework Mockito, which I can use somewhat when it has been set up for me (like at work), but I can’t set it up myself to use on personal projects.

This is because it seems to require a build system, such as Maven and/or Gradle. The difficulty is, I don’t quite know how to set up those either, or, really, what they are at their core.

I’ve combed the internet for useful tutorials, but, all I have found is either specific knowledge of Gradle or Maven, or pages assuming knowledge that I don’t have.

Essentially, I need a simple, coherent explanation of the following two points:

  1. How to create a Gradle or Maven project in IntelliJ IDEA 2017.2.5 Ultimate Edition
  2. How to, then, install or add Mockito to the project using whichever of the previous two systems was described, or, in any case, make it so Mockito is available for use in my tests.

I apologise if this is answered elsewhere, but thus far I’ve failed to find anything appropriate for the level I’m at.

If it helps, a black box view of things would be all I need. At core, the question is: “How do I gain access to the features of Mockito in my IntelliJ project?

Extra generic details about how Gradle/Maven work would be always be handy, but I really just need a simple guide to let me use the features of this one framework.

Converting SecretKey to string and vice versa

I am implementing AES algorithm in java.I am converting SecretKey to String and passing to server.java through sockets. In server.java, I am converting this string back to SecretKey.However, I am getting the error
mentioned below.

I have tried all possible solutions but nothing worked for me.

String encodedKey = Base64.getEncoder().encodeToString(secKey.getEncoded());



I have converted this string back to SecretKey

byte[] decodedKey = Base64.getDecoder().decode(line);
SecretKey secKey = new SecretKeySpec(decodedKey, "AES");`

Output – de.flexiprovider.api.keys.SecretKeySpec@fffe87c2

Here, both outputs are not same and I am getting the following error

Exception in thread "main" java.security.InvalidKeyException: unsupported type
   at de.flexiprovider.api.BlockCipher.engineInit(BlockCipher.java:165)
   at de.flexiprovider.api.Cipher.engineInit(Cipher.java:68)
   at javax.crypto.Cipher.init(Cipher.java:1246)
   at javax.crypto.Cipher.init(Cipher.java:1186)
   at server.main(server.java:93)

How can I correct this error ?

Passing an ArrayList from Struts1.3 action to appropriate JSP

I use Struts V1.3 for a project.
Here is my Action Class which I want to send an arrayList through request.settAttribute in execute function.

public class ProductAction extends Action {
private List productList;

public ActionForward execute(ActionMapping mapping, ActionForm form,
        HttpServletRequest request, HttpServletResponse response)
        throws Exception {
            Product product1 = new Product();

            Product product2 = new Product();

            productList = new ArrayList<Product>();

            request.setAttribute("products", productList);
            return mapping.findForward("success");

As you see I want to send an ArrayList of Product where Product is a POJO.

Here is my JSP code which I expect to get “${products}” from the Action class.

                    <c:forEach items="${products}" var="product">

My problem is that in forEach I don’t recieve anything(Even tr will not appear).
How does I can assure that I get the ArrayList in action calss in JSP?

And here is my action-mapping

<action name="product" path="/product" type="view.ProductAction" scope="session">
            <forward name="success" path="/productList.jsp" redirect="true"/>
            <forward name="failure" path="/success.jsp" redirect="true"/>

Updating Jtable after deleting from DB

i’m trying to remove the deleted row from the jtable but since it’s a primary key (client id ) i can’t just update its table only i have to update the tables where it’s a foreign key in ( animal and appointment(rv)) but how i can make it happen i tried to refill the tables from the DB after deleting but didn’t work

int f = table.getSelectedRow();
  { if (JOptionPane.showConfirmDialog(this, "Confirm the Delete", "Warning!!!", JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION) {String l=table.getModel().getValueAt(f,0).toString();
         int l1 = Integer.parseInt(l);
         try { Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance();
               Connection cnx = DriverManager.getConnection("jdbc:derby:C:\Users\user pc\Documents\NetBeansProjects\project\projet","root","root");
Statement stm= cnx.createStatement(); 
stm.executeUpdate("delete from rv where cid="+l1+"");
stm.executeUpdate("delete from animal where cid="+l1+" ");
               stm.executeUpdate("delete from client where id="+l1+"");  }   
         catch(SQLException e){e.getStackTrace();} catch (ClassNotFoundException ex) {
          Logger.getLogger(all.class.getName()).log(Level.SEVERE, null, ex);
      } catch (InstantiationException ex) {
          Logger.getLogger(all.class.getName()).log(Level.SEVERE, null, ex);
      } catch (IllegalAccessException ex) {
          Logger.getLogger(all.class.getName()).log(Level.SEVERE, null, ex);

  } else{JOptionPane.showMessageDialog(null,"Please select the row you want to delete");}}                   ‎

java.lang.NullPointerException: null in spring mvc & thymeleaf

I am persisting a player to a team (One to Many = team->player) via the players log in entity (player -> userlogin is a one to one relationship), I am getting a null pointer exception and I cant seem to figure out why its returning null.

I think my team is returning null which may have something to do with the way i am using thymeleaf on the html page.

Heres the error im getting

java.lang.NullPointerException: null
    at com.FYP.Club.model.Team.addPlayer(Team.java:168) ~[classes/:na]
    at com.FYP.Club.controller.HomeController.joinTeam(HomeController.java:126) ~[classes/:na]

Note that line 126 = team.addPlayer(player); in the below controller:

public class HomeController {

        UserLoginRepository userRepository;

            TeamRepository teamRepository;

        GameRepository gameRepository;

            LeagueRepository leagueRepository;

            PlayerRepository playerRepository;

        ManagerRepository managerRepository;

        PhysioRepository physioRepository;

        CoachingStaffRepository coachingStaffRepository;

   @RequestMapping(value="/jointeam", method=RequestMethod.POST)
   public String joinTeam(@Valid Team team, Principal principal)

= (SecurityContextHolder.getContext().getAuthentication().getPrincipal()).getName();

       Authentication loggedInUser = SecurityContextHolder.getContext().getAuthentication();
       String email = loggedInUser.getName();

       Long id = (userRepository.findByEmail(email)).getId();

       Player player = playerRepository.findByLoginId(id);

       if (player != null)

           return "parseGame";

               return "parseGame";

My team entity:

@Table(name = "team")

public class Team implements Serializable{
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    private String teamName;
    private int leaguePosition;
    public String teamAddress;
    public String level;

    private Manager manager;

    private Physio physio;

    @OneToMany(fetch=FetchType.LAZY, cascade=CascadeType.ALL)
     public Set<CoachingStaff> coachingStaff;

    @OneToMany(fetch=FetchType.LAZY, cascade=CascadeType.ALL)
     public Set<Player> players;

    public Team() {


    public Team(Long id, String teamName, int leaguePosition) {
        this.id = id;
        this.teamName = teamName;
        this.leaguePosition = leaguePosition;

    public Team(Long id, String teamName, int leaguePosition, Manager manager) {
        this.id = id;
        this.teamName = teamName;
        this.leaguePosition = leaguePosition;
        this.manager = manager;

    public Team(Long id, String teamName, int leaguePosition, Manager manager,
            Physio physio) {
        this.id = id;
        this.teamName = teamName;
        this.leaguePosition = leaguePosition;
        this.manager = manager;
        this.physio = physio;

    public Team(Long id, String teamName, int leaguePosition,
            String teamAddress, String level, Manager manager, Physio physio,
            Set<CoachingStaff> coachingStaff, Set<Player> players) {
        this.id = id;
        this.teamName = teamName;
        this.leaguePosition = leaguePosition;
        this.teamAddress = teamAddress;
        this.level = level;
        this.manager = manager;
        this.physio = physio;
        this.coachingStaff = coachingStaff;
        this.players = players;

    public Long getId() {
        return id;

    public void setId(Long id) {
        this.id = id;

    public String getTeamName() {
        return teamName;

    public void setTeamName(String teamName) {
        this.teamName = teamName;

    public int getLeaguePosition() {
        return leaguePosition;

    public void setLeaguePosition(int leaguePosition) {
        this.leaguePosition = leaguePosition;

    public Set<Player> getPlayers() {
        return players;

    public void setPlayers(Set<Player> players) {
        this.players = players;

    public Set<CoachingStaff> getCoachingStaff() {
        return coachingStaff;

    public void setCoachingStaff(Set<CoachingStaff> coachingStaff) {
        this.coachingStaff = coachingStaff;

    public Manager getManager() {
        return manager;

    public void setManager(Manager manager) {
        this.manager = manager;

    public Physio getPhysio() {
        return physio;

    public void setPhysio(Physio physio) {
        this.physio = physio;

    public String getTeamAddress() {
        return teamAddress;

    public void setTeamAddress(String teamAddress) {
        this.teamAddress = teamAddress;

    public String getLevel() {
        return level;

    public void setLevel(String level) {
        this.level = level;

    public void addPlayer(Player player){


My webpage that uses thymeleaf:

th:each="team : ${teams}"
    <button onclick="myFunction()">View Team</button>  

         th:action="@{/jointeam}" method="post" th:object="${team}"

        <button onclick="myFunction()">Join Team</button>

My logic is that for each team object that is displayed theres a button beside it saying “join” which will pass that particular team object into the /jointeam method in the controller, but I am unsure if this is the cause of the null pointer exception.

Listiview Scrolling Down-Up Changes row’s color

I’m using a listview with adapter inside for changing backcolor in every row according value Active.
Also i’m using holder in my adapter but every time i’m scrolling down and up my listview, all colors are been changed.

Here is my Class:

class FactClass
    [PrimaryKey, AutoIncrement, Column("_Id")]

    public int id { get; set; } // AutoIncrement and set primarykey        

    public string Name { get; set; }
    public string Phone { get; set; }

    public string Comments { get; set; }

    public int Active { get; set; }//According this Values ListView is changing Color

    public string Location { get; set; }

    public bool IsChecked { get; set; }


Here is my Adapter:

public override View GetView(int position, View convertView, ViewGroup parent)
        DataViewHolder holder = null;
        if (convertView == null)
            convertView = LayoutInflater.From(mContext).Inflate(Resource.Layout.FactAdapter, null, false);
            holder = new DataViewHolder();

            holder.txtid = convertView.FindViewById<TextView>(Resource.Id.idtxt);
            holder.txtName = convertView.FindViewById<TextView>(Resource.Id.Nametxt);
           holder.txtPhone = convertView.FindViewById<TextView>(Resource.Id.Phonetxt);
           holder.txtActive = convertView.FindViewById<TextView>(Resource.Id.Activetxt);

            convertView.Tag = holder;


            holder = convertView.Tag as DataViewHolder;


       holder.txtid.Text = Convert.ToString(mitems[position].id);
       holder.txtName.Text = mitems[position].Name;
       holder.txtPhone.Text = mitems[position].Phone;

        holder.txtActive.Text = Convert.ToString(mitems[position].Active);

        if (holder.txtActive.Text == "1")
        if (holder.txtActive.Text == "2")
        return convertView;


    public class DataViewHolder : Java.Lang.Object
        public TextView txtid { get; set; }
        public TextView txtName { get; set; }
        public TextView txtPhone { get; set; }
        public TextView txtActive { get; set; }


The TextView txtActive is responsible for which color will take my row.
Example if txtActive =1 row is green, txtActive =2 row is orange

Image Before scrolling listview

Image after Scolling Down and up again my listview

Another row has automatically changed his color.

hive shell not starting

    hadoop_1@shubho-HP-Notebook:~$ hive
    SLF4J: Class path contains multiple SLF4J bindings.
    SLF4J: Found binding in [jar:file:/home/hadoop_1/apache-hive-2.3.2-bin/lib           /log4j-slf4j-impl-2.6.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/hadoop_1/hadoop/share/hadoop/common       /lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Exception in thread "main" java.lang.ClassCastException: java.base/jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to java.base/java.net.URLClassLoader
    at org.apache.hadoop.hive.ql.session.SessionState.<init>(SessionState.java:394)
    at org.apache.hadoop.hive.ql.session.SessionState.<init>(SessionState.java:370)
    at org.apache.hadoop.hive.cli.CliSessionState.<init>(CliSessionState.java:60)
    at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:708)
    at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:686)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
    at org.apache.hadoop.util.RunJar.main(RunJar.java:136)

The above Exception was thrown. So I checked and there was no conf/hive-site.xml. So I created and edited it:

    <description>Local scratch space for Hive jobs</description>
    <description>Location of Hive run time structured log file</description>
    <description>Temporary local directory for added resources in the remote file system.</description>

Still the same error is thrown.