PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0
Showing posts with label eclipse. Show all posts
Showing posts with label eclipse. Show all posts

Sunday, October 30, 2022

[FIXED] How to make CTRL+Z NOT mess up a java console program

 October 30, 2022     console, eclipse, eof, java, nosuchelementexception     No comments   

Issue

One of my final project requirements is that, if it is console based which mine is, entering ctrl + z WON'T mess up the program. The nextLine() statement from my scanner is within a while loop, and when I try to catch the NoSuchElementException from entering ctrl+z, the error message in the catch block loops endlessly.

        while (!advanceTurn) {

        System.out.print("\nCommand: ");

        try {input = s.nextLine();}
        catch (NoSuchElementException e) {

            System.out.println("Use the EXIT command to exit the game.");
            s = new Scanner(System.in);
            input = "asdfjkl;";
            continue;

        }

        System.out.println();

        // This takes the input and decides what command was entered (if any) and deals
        // with it appropriately.
        parseCommand(input);

    }

As you can see in the code, I've tried to re-initialize the scanner when the error is caught, and then jump back to the beginning of the loop so a new line can be grabbed, but it appears that the error still persists even when there's no new input from the keyboard, so I'm pretty much stumped as to how to solve this. Any help is appreciated, thanks.

EDIT: I'm using Eclipse IDE if that helps.


Solution

I talked with my instructor today and we fixed the problem by jumping outside of the while loop with a return statement in the catch block, and then initializing s as a new scanner just before entering the loop again. Since the purpose of this snippet is to repeatedly get commands until certain commands that constitute the end of a turn are entered, the while loop is entered every time a command is be entered, and it now works just fine for me.



Answered By - theolaa
Answer Checked By - Clifford M. (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Tuesday, September 13, 2022

[FIXED] How to configure Eclipse project libraries to compile both on Windows and Linux?

 September 13, 2022     cross-platform, eclipse, java, linux, windows     No comments   

Issue

It's a simple OpenGL app. The problem is, JOGL needs native libraries, and I need to set "Native library location", which is different for Windows and Linux. Is it possible to share project settings between platforms?

I want to make the workspace setup process as simple as "checkout from SVN, compile, run".


Solution

If it's just Windows and Linux, you can put them in the same folder, as j flemm states.

The reason it works is because of the definition of System.loadLibrary() in Java:

loadLibrary

public static void loadLibrary(String libname)

Loads the system library specified by the libname argument. The manner in which a library name is mapped to the actual system library is system dependent.

That means System.loadLibrary("jogl") will try to load jogl.dll on Windows and libjogl.so on Linux. It's pretty nice.



Answered By - The Alchemist
Answer Checked By - Dawn Plyler (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Sunday, September 4, 2022

[FIXED] How to make a library of string arrays and access them like a login system. (Java 17)

 September 04, 2022     authentication, eclipse, java, java-17, java.util.scanner     No comments   

Issue

I am trying to make a login prompt with usernames and passwords, but I cannot figure out how to make the string array library. My current code can take in 1 username and password by using functions with variables, (like public myFunction(String myVariable);) and login with just that, and change the pass and username. currently, my code is

package main;

import java.util.Scanner;
import logins.Logins;

public class Main {
    public static void main(String[] args) {
        String choice = null;
        Scanner scanner = null;
        start(choice, scanner, "Password", "Username");
    }
    
    public static void command(String choice, Scanner scanner, String pass, String user) {
        if(choice.equals("login")) { 
            login(pass, scanner, choice, user);
        }else if(choice.equals("change password")) {
            passChange(pass, choice, scanner, user);
        }else if(choice.equals("change username")) {
            userChange(pass, choice, scanner, user);
        }else {
            System.err.println("Invalid choice");
            start(choice, scanner, pass, user);
        }
    }
    
    public static void password(String pass, String choice, Scanner scanner, String user) {
        System.out.println("Enter password");
        choice = scanner.nextLine();
        if(choice.equals(pass)) {
            System.out.println("Password Correct. You are logged in");
            start(choice, scanner, pass, user);
        }else {
            System.err.println("Incorrect Password");
            start(choice, scanner, pass, user);
        }
    }
    
    public static void passChange(String pass, String choice, Scanner scanner, String user) {
        System.out.println("Username:");
        choice = scanner.nextLine();
        if (choice.equals(user)) {
            System.out.println("Old Password:");
            choice = scanner.nextLine();
            if (choice.equals(pass)) {
                System.out.println("New Password");
                choice = scanner.nextLine();
                pass = choice;
                start(choice, scanner, pass, user);
            }else {
                System.err.println("Incorrect password");
                start(choice, scanner, pass, user);
            }
        }else {
            System.err.println("No user found named " + choice);
            start(choice, scanner, pass, user);
        }
    }
    
    public static void userChange(String pass, String choice, Scanner scanner, String user) {
        System.out.println("Username:");
        choice = scanner.nextLine();
        if (choice.equals(user)) {
            System.out.println("Password:");
            choice = scanner.nextLine();
            if (choice.equals(pass)) {
                System.out.println("Logged in. New username:");
                choice = scanner.nextLine();
                user = choice;
                start(choice, scanner, pass, user);
            }else {
                System.err.println("Incorrect password");
                start(choice, scanner, pass, user);
            }
        }else {
            System.err.println("Incorrect password");
            start(choice, scanner, pass, user);
        }
    }
    
    public static void start(String choice, Scanner scanner, String pass, String user) {
        scanner = new Scanner(System.in);
        System.out.println("What would you like to do? ");
        choice = scanner.nextLine();
        command(choice, scanner, pass, user);
    }
    public static void login(String pass, Scanner scanner, String choice, String user) {
        System.out.println("Enter username");
        choice = scanner.nextLine();
        if(choice.equals(user)) {
            System.out.println("Valid Username.");
            password(pass, choice, scanner, user);
        }else {
            System.err.println("No user named " + choice);
            start(choice, scanner, pass, user);
        }
    }
}

I have started making an array library, but I don't know how to access any of the usernames or passwords in general,(like once you put in a username, it gets the matching password)

package logins;

public class Logins {
    public static void main(String[] args) {
        String[] User = new String[] {"Username", "Password"};
        String[] User1 = new String[] {"Username1", "Password1"};
    }
}


Solution

Are you trying to link Usernames and Passwords together? If so, try using a HashMap. You could try doing something like:

HashMap<String, String> logins= new HashMap<String, String>();

This way a username can retrieve the corresponding password

String password = logins.get("Mario");

Though getting passwords from usernames would not be recommended. You could add to it by:

logins.put("Mario", "password1234");

Not sure if this is what you were asking but hope this helps



Answered By - Loïc Rutabana
Answer Checked By - Pedro (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How to make a library of string arrays and access them like a login system. (Java 17)

 September 04, 2022     authentication, eclipse, java, java-17, java.util.scanner     No comments   

Issue

I am trying to make a login prompt with usernames and passwords, but I cannot figure out how to make the string array library. My current code can take in 1 username and password by using functions with variables, (like public myFunction(String myVariable);) and login with just that, and change the pass and username. currently, my code is

package main;

import java.util.Scanner;
import logins.Logins;

public class Main {
    public static void main(String[] args) {
        String choice = null;
        Scanner scanner = null;
        start(choice, scanner, "Password", "Username");
    }
    
    public static void command(String choice, Scanner scanner, String pass, String user) {
        if(choice.equals("login")) { 
            login(pass, scanner, choice, user);
        }else if(choice.equals("change password")) {
            passChange(pass, choice, scanner, user);
        }else if(choice.equals("change username")) {
            userChange(pass, choice, scanner, user);
        }else {
            System.err.println("Invalid choice");
            start(choice, scanner, pass, user);
        }
    }
    
    public static void password(String pass, String choice, Scanner scanner, String user) {
        System.out.println("Enter password");
        choice = scanner.nextLine();
        if(choice.equals(pass)) {
            System.out.println("Password Correct. You are logged in");
            start(choice, scanner, pass, user);
        }else {
            System.err.println("Incorrect Password");
            start(choice, scanner, pass, user);
        }
    }
    
    public static void passChange(String pass, String choice, Scanner scanner, String user) {
        System.out.println("Username:");
        choice = scanner.nextLine();
        if (choice.equals(user)) {
            System.out.println("Old Password:");
            choice = scanner.nextLine();
            if (choice.equals(pass)) {
                System.out.println("New Password");
                choice = scanner.nextLine();
                pass = choice;
                start(choice, scanner, pass, user);
            }else {
                System.err.println("Incorrect password");
                start(choice, scanner, pass, user);
            }
        }else {
            System.err.println("No user found named " + choice);
            start(choice, scanner, pass, user);
        }
    }
    
    public static void userChange(String pass, String choice, Scanner scanner, String user) {
        System.out.println("Username:");
        choice = scanner.nextLine();
        if (choice.equals(user)) {
            System.out.println("Password:");
            choice = scanner.nextLine();
            if (choice.equals(pass)) {
                System.out.println("Logged in. New username:");
                choice = scanner.nextLine();
                user = choice;
                start(choice, scanner, pass, user);
            }else {
                System.err.println("Incorrect password");
                start(choice, scanner, pass, user);
            }
        }else {
            System.err.println("Incorrect password");
            start(choice, scanner, pass, user);
        }
    }
    
    public static void start(String choice, Scanner scanner, String pass, String user) {
        scanner = new Scanner(System.in);
        System.out.println("What would you like to do? ");
        choice = scanner.nextLine();
        command(choice, scanner, pass, user);
    }
    public static void login(String pass, Scanner scanner, String choice, String user) {
        System.out.println("Enter username");
        choice = scanner.nextLine();
        if(choice.equals(user)) {
            System.out.println("Valid Username.");
            password(pass, choice, scanner, user);
        }else {
            System.err.println("No user named " + choice);
            start(choice, scanner, pass, user);
        }
    }
}

I have started making an array library, but I don't know how to access any of the usernames or passwords in general,(like once you put in a username, it gets the matching password)

package logins;

public class Logins {
    public static void main(String[] args) {
        String[] User = new String[] {"Username", "Password"};
        String[] User1 = new String[] {"Username1", "Password1"};
    }
}


Solution

Are you trying to link Usernames and Passwords together? If so, try using a HashMap. You could try doing something like:

HashMap<String, String> logins= new HashMap<String, String>();

This way a username can retrieve the corresponding password

String password = logins.get("Mario");

Though getting passwords from usernames would not be recommended. You could add to it by:

logins.put("Mario", "password1234");

Not sure if this is what you were asking but hope this helps



Answered By - Loïc Rutabana
Answer Checked By - Mary Flores (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Friday, August 5, 2022

[FIXED] How to fix MojoFailureException while using spring to build web project

 August 05, 2022     eclipse, exception, maven, spring, testing     No comments   

Issue

Recently I use spring STS with roo 1.2.0.M1 to build a web project. I set up the jpa and create a entity with some field and create a repository and a service layer for the entity, and then when I perform tests, it gives me the following error:

roo> perform tests 
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building WebApplication 0.1.0.BUILD-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- aspectj-maven-plugin:1.2:compile (default) @ WebApplication ---
[INFO] 
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ WebApplication ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 5 resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ WebApplication ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- aspectj-maven-plugin:1.2:test-compile (default) @ WebApplication ---
[INFO] 
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ WebApplication ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ WebApplication ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-surefire-plugin:2.8:test (default-test) @ WebApplication ---
[INFO] Surefire report directory: /Users/charlesli/Documents/workspace-spring/WebApplication/target/surefire-reports
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 15.936s
[INFO] Finished at: Fri Oct 28 20:59:59 EST 2011
[INFO] Final Memory: 6M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.8:test (default-test) on project WebApplication: There are test failures.
[ERROR] 
[ERROR] Please refer to /Users/charlesli/Documents/workspace-spring/WebApplication/target/surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

And I run the mvn test in the terminal, and I get the following errors:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 13.614s
[INFO] Finished at: Fri Oct 28 21:06:50 EST 2011
[INFO] Final Memory: 6M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.8:test (default-test) on project WebApplication: There are test failures.
[ERROR] 
[ERROR] Please refer to /Users/charlesli/Documents/workspace-spring/WebApplication/target/surefire-reports for the individual test results.
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.8:test (default-test) on project WebApplication: There are test failures.

Please refer to /Users/charlesli/Documents/workspace-spring/WebApplication/target/surefire-reports for the individual test results.
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoFailureException: There are test failures.

Please refer to /Users/charlesli/Documents/workspace-spring/WebApplication/target/surefire-reports for the individual test results.
    at org.apache.maven.plugin.surefire.SurefireHelper.reportExecution(SurefireHelper.java:74)
    at org.apache.maven.plugin.surefire.SurefirePlugin.writeSummary(SurefirePlugin.java:644)
    at org.apache.maven.plugin.surefire.SurefirePlugin.executeAfterPreconditionsChecked(SurefirePlugin.java:640)
    at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:103)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    ... 19 more
[ERROR] 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

I use the following commands to build the project:

jpa setup --database MYSQL --provider HIBERNATE --databaseName App --hostName localhost --password root --persistenceUnit app --transactionManager appTransactionManager --userName root
entity --class ~.app.domain.DomainObjBaseModel --mappedSuperclass --persistenceUnit app --transactionManager appTransactionManager

// After running the above command, I manually add the following stuff in DomainObjBaseModel, because I don't know how to customise the roo auto generate stuff
    @Id @GeneratedValue(generator="system-uuid")
    @GenericGenerator(name="system-uuid", strategy = "uuid")
    @Column(unique = true, name = "id", nullable = false, length=32)
    private String id;
// After this action, I continue run the following commands.

entity --class ~.app.domain.Application --extends com.crazysoft.web.app.domain.DomainObjBaseModel --persistenceUnit app --transactionManager appTransactionManager --serializable --testAutomatically
repository jpa --interface ~.app.repository.ApplicationRepository --entity ~.app.domain.Application
service --interface ~.app.service.ApplicationService --entity ~.app.domain.Application

This is the configuration of the maven plugin:

<plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
                <encoding>UTF-8</encoding>
            </configuration>
        </plugin>

After I finish the above job, and run perform tests through STS roo shell, and I get the above error.

Is there anyone know that why this exception occurs? Do I do something wrong? And how to fix it?

Please help me!

Thank you in advance!


Solution

One or more tests are not working.

Have a look at the files located at: /Users/charlesli/Documents/workspace-spring/WebApplication/target/surefire-reports (usually the bigger files contain a problem)

There you will find the test results, and the test that is broken. The Stacktrace containing in this file will guide you to the problem.

(BTW: you can run the tests in eclipse via JUnit plugin (Package explorer, right click, run as JUnit) too, then you will see the stack trace in the IDE and do not need to search in the files.)


I guess, that the DB connection is not correct. But this is only a guess.



Answered By - Ralph
Answer Checked By - Gilberto Lyons (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Saturday, July 30, 2022

[FIXED] How To Validate Form Through JavaScript Before Entering To The Next Page?

 July 30, 2022     eclipse, javascript, validation     No comments   

Issue

This is a register form I'm currently working on it. The problem is that the JavaScript only validates the first field in the form which is the "username" field only, but not the rest of it. If i change the code by moving the password field to above, then the code validates for the passwords only. and same goes for the email address field. May I know, how to solve this issue?. Your help is much appreciated. I'm having this error only in Eclipse IDE application. BUT, WHEN THIS CODE IS DONE IN FIDDLE, IT WORKS FINE. THE CODE IN THE FIDDLE IS IN THIS LINK: https://jsfiddle.net/dbvnkcfm/5/.

Please help solve this issue, because I'm new to JavaScript.

Below is the code in my Eclipse IDE.

@charset "ISO-8859-1";

@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@200;300;400;500;600;700;800&display=swap");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  color: #ECB365;
}

body,
input {
  font-family: "Poppins", sans-serif;
}


.container {
  position: relative;
  width: 100%;
  background-color: #041C32;
  min-height: 100vh;
  overflow: hidden;
}

.forms-container {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
}

.login-signup {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  left: 75%;
  width: 50%;
  transition: 1s 0.7s ease-in-out;
  display: grid;
  grid-template-columns: 1fr;
  z-index: 5;
}

form {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 0rem 5rem;
  transition: all 0.2s 0.7s;
  overflow: hidden;
  grid-column: 1 / 2;
  grid-row: 1 / 2;
}

form.sign-up-form {
  opacity: 0;
  z-index: 1;
}

form.log-in-form {
  z-index: 2;
}

.title {
  font-size: 2.2rem;
  color: #ECB365;
  margin-bottom: 10px;
}

.input-field {
  max-width: 380px;
  width: 100%;
  background-color: #ECB365;
  margin: 10px 0;
  height: 55px;
  border-radius: 55px;
  display: grid;
  grid-template-columns: 15% 85%;
  padding: 0 0.4rem;
  position: relative;
}

.input-field i {
  text-align: center;
  line-height: 55px;
  color: #444444;
  transition: 0.5s;
  font-size: 1.1rem;
}

.input-field input {
  background: none;
  outline: none;
  border: none;
  line-height: 1;
  font-weight: 600;
  font-size: 1.1rem;
  color: #041C32;
}

.input-field input::placeholder {
  color: #444444;
  font-weight: 500;
}

.social-text {
  padding: 0.7rem 0;
  font-size: 1rem;
}

.social-media {
  display: flex;
  justify-content: center;
}

.social-icon {
  height: 46px;
  width: 46px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 0.45rem;
  color: #ECDBBA;
  border-radius: 50%;
  border: 1px solid #fff;
  text-decoration: none;
  font-size: 1.1rem;
  transition: 0.3s;
}


.social-icon:hover {
  color: #ECB365;
  border-color: #ECB365;
}

.btn {
  width: 150px;
  background-color: #064663;
  border: none;
  outline: none;
  height: 49px;
  border-radius: 49px;
  color: #fff;
  text-transform: uppercase;
  font-weight: 600;
  margin: 10px 0;
  cursor: pointer;
  transition: 0.5s;
}

.btn:hover {
  background-color: #4d84e2;
}
.panels-container {
  position: absolute;
  height: 100%;
  width: 100%;
  top: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
}

.container:before {
  content: "";
  position: absolute;
  height: 2000px;
  width: 2000px;
  top: -10%;
  right: 48%;
  transform: translateY(-50%);
  background-image: linear-gradient(-45deg, #064663 0%, #064663 100%);
  transition: 1.8s ease-in-out;
  border-radius: 50%;
  z-index: 6;
}

.image {
  width: 100%;
  transition: transform 1.1s ease-in-out;
  transition-delay: 0.4s;
}

.panel {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-around;
  text-align: center;
  z-index: 6;
}

.left-panel {
  pointer-events: all;
  padding: 3rem 17% 2rem 12%;
}

.right-panel {
  pointer-events: none;
  padding: 3rem 12% 2rem 17%;
}

.panel .content {
  color: #fff;
  transition: transform 0.9s ease-in-out;
  transition-delay: 0.6s;
}

.panel h3 {
  font-weight: 600;
  line-height: 1;
  font-size: 1.5rem;
}

.panel p {
  font-size: 0.95rem;
  padding: 0.7rem 0;
}

.btn.transparent {
  margin: 0;
  background: #041C32;
  /*border: 2px solid #fff;*/
  width: 130px;
  height: 41px;
  font-weight: 600;
  font-size: 0.8rem;
}

.btn.transparent:hover {
  background-color: #4d84e2;
}

.right-panel .image,
.right-panel .content {
  transform: translateX(800px);
}

/* ANIMATION */

.container.sign-up-mode:before {
  transform: translate(100%, -50%);
  right: 52%;
}

.container.sign-up-mode .left-panel .image,
.container.sign-up-mode .left-panel .content {
  transform: translateX(-800px);
}

.container.sign-up-mode .login-signup {
  left: 25%;
}

.container.sign-up-mode form.sign-up-form {
  opacity: 1;
  z-index: 2;
}

.container.sign-up-mode form.log-in-form {
  opacity: 0;
  z-index: 1;
}

.container.sign-up-mode .right-panel .image,
.container.sign-up-mode .right-panel .content {
  transform: translateX(0%);
}

.container.sign-up-mode .left-panel {
  pointer-events: none;
}

.container.sign-up-mode .right-panel {
  pointer-events: all;
}

@media (max-width: 870px) {
  .container {
    min-height: 800px;
    height: 100vh;
  }
  .login-signup {
    width: 100%;
    top: 95%;
    transform: translate(-50%, -100%);
    transition: 1s 0.8s ease-in-out;
  }

  .login-signup,
  .container.sign-up-mode .login-signup {
    left: 50%;
  }

  .panels-container {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 2fr 1fr;
  }

  .panel {
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    padding: 2.5rem 8%;
    grid-column: 1 / 2;
  }

  .right-panel {
    grid-row: 3 / 4;
  }

  .left-panel {
    grid-row: 1 / 2;
  }

  .image {
    width: 200px;
    transition: transform 0.9s ease-in-out;
    transition-delay: 0.6s;
  }

  .panel .content {
    padding-right: 15%;
    transition: transform 0.9s ease-in-out;
    transition-delay: 0.8s;
  }

  .panel h3 {
    font-size: 1.2rem;
  }

  .panel p {
    font-size: 0.7rem;
    padding: 0.5rem 0;
  }

  .btn.transparent {
    width: 110px;
    height: 35px;
    font-size: 0.7rem;
  }

  .container:before {
    width: 1500px;
    height: 1500px;
    transform: translateX(-50%);
    left: 30%;
    bottom: 68%;
    right: initial;
    top: initial;
    transition: 2s ease-in-out;
  }

  .container.sign-up-mode:before {
    transform: translate(-50%, 100%);
    bottom: 32%;
    right: initial;
  }

  .container.sign-up-mode .left-panel .image,
  .container.sign-up-mode .left-panel .content {
    transform: translateY(-300px);
  }

  .container.sign-up-mode .right-panel .image,
  .container.sign-up-mode .right-panel .content {
    transform: translateY(0px);
  }

  .right-panel .image,
  .right-panel .content {
    transform: translateY(300px);
  }

  .container.sign-up-mode .login-signup {
    top: 5%;
    transform: translate(-50%, 0);
  }
}

@media (max-width: 570px) {
  form {
    padding: 0 1.5rem;
  }

  .image {
    display: none;
  }
  .panel .content {
    padding: 0.5rem 1rem;
  }
  .container {
    padding: 1.5rem;
  }

  .container:before {
    bottom: 72%;
    left: 50%;
  }

  .container.sign-up-mode:before {
    bottom: 28%;
    left: 50%;
  }
}
<!DOCTYPE html>
<html lang="en">
    <head>
         <meta charset="UTF-8" />
         <meta name="viewport" content="width=device-width, initial-scale=1.0" />
         
         <link rel="stylesheet" href="Style.css" />
         <title>Sign in & Sign up Form</title>
    </head>
    
    <script src="https://kit.fontawesome.com/64d58efce2.js" crossorigin="anonymous" ></script>
  
    <body>
        <div class="container">
            <div class="forms-container">
            
<!---------------------------- this is for login form ------------------------------------->
                
                <div class="login-signup">
                
                    <form action="Logsuccess" class="log-in-form" method="get">
                        <h2 class="title">Log-in</h2>
                        <div class="input-field">
                            <i class="fas fa-user"></i>
                            <input type="text" name="username" placeholder="Username" id = "user" class = "text-danger"/>
                        </div>
                        
                        <br>
                        
                        <div class="input-field">
                            <i class="fas fa-lock"></i>
                            <input type="password" name="password" placeholder="Password" id = "pass" class = "text-danger"/>
                        </div>
                        
                        <br>
                        
                        
                        <input type="submit" value="Login" class="btn solid" />
                        <p class="social-text">Or Sign in with social platforms</p>
                        
                        <div class="social-media">
                            <a href="#" class="social-icon"> <i class="fab fa-facebook-f"> </i> </a>
                            <a href="#" class="social-icon"> <i class="fab fa-twitter">    </i> </a>
                            <a href="#" class="social-icon"> <i class="fab fa-google">     </i> </a>
                            <a href="#" class="social-icon"> <i class="fab fa-linkedin-in"></i> </a>
                        </div>
                    </form>
                    
<!---------------------------- this is for signup form ------------------------------------->
                    
                    <!-- <form action="#" class="sign-up-form" method="post" onsubmit="return validation()">  -->
                    <!-- <form action="RegSuccess" class="sign-up-form" method="post">-->
                    <form action="RegConfirm.php" class="sign-up-form" method="post" onSubmit="return Register()">    
                        <h2 class="title">Sign up</h2>
                        <div class="input-field">
                          <i class="fas fa-user"></i>
                          <input type="text" name="Username" placeholder="Username" id = "user" class = "text-danger"/>
                        </div>
                        
                        <br>
                    
                        <div class="input-field">
                          <i class="fas fa-envelope"></i>
                          <input type="email" name="email" placeholder="Email" id = "emailAddress" class = "text-danger"/>
                        </div>
                    
                        <br>
                    
                        <div class="input-field">
                          <i class="fas fa-lock"></i>
                          <input type="password" name="Password"  placeholder="Password" id = "pass" class = "text-danger"/>
                        </div>
                    
                        <br>
                    
                        <input type="submit" class="btn" value="Sign up" />
                    </form>
                </div>
            </div>

<!---------------------------- this is in login page for asking to signup------------------------------------->

            <div class="panels-container">
                <div class="panel left-panel">
                    <div class="content">
                        <h3>Don't Have An Account ?</h3>
                        <p>
                            Your are always welcome to join us!!!
                        </p>
                        
                        <button class="btn transparent" id="sign-up-btn"> Sign up </button>
                    </div>
                    <img src="img/log.svg" class="image" alt="" />
                </div>

<!---------------------------- this is in signup page for asking to login------------------------------------->

                <div class="panel right-panel">
                    <div class="content">
                        <h3>Are You One of Us ?</h3>
                        <p>
                            Let's Log In Then !!!
                        </p>
                        
                        <button class="btn transparent" id="sign-in-btn"> Log in </button>
                    </div>
                    <img src="img/register.svg" class="image" alt="" />
                </div>
            </div>
        </div>




        <script>
            //---------------------------- this is javascript for the buttons -------------------------------------//
            const sign_in_btn = document.querySelector("#sign-in-btn");
            const sign_up_btn = document.querySelector("#sign-up-btn");
            const container = document.querySelector(".container");
            
            sign_up_btn.addEventListener("click", () => {
              container.classList.add("sign-up-mode");
            });
            
            sign_in_btn.addEventListener("click", () => {
              container.classList.remove("sign-up-mode");
            });
        
            //---------------------------- start of javascript for validation -------------------------------------//
        function Register() 
        {
            return validation();      
        }
        
        function validation() 
        {
        
              var user = document.getElementById('user').value;
              var emailAddress = document.getElementById('emailAddress').value;
              var pass = document.getElementById('pass').value;
        
              console.log(user)
              if (user == null || user == "")
                { 
                    alert ("Username cannot be empty");                 
                    return false;  
                }
                else if(user.length < 3 || user.length > 30)
                {  
                    alert ("Username must be at least 3 characters long.");  
                    return false;  
                }
                else
                {
                    return true;
                }
        
        
              console.log(emailAddress)
              if (emailAddress == null || emailAddress == "")
                    { 
                        alert ("Email cannot be empty");                    
                        return false;  
                    }
                    else if(emailAddress.indexOf('@') <= 0)
                    {  
                        alert (" @ symbol is on invalid position");  
                      return false;  
                    }
                    else
                    {
                        document.getElementById('emailAddress').innerHTMl = "";
                    }
              
        
              console.log(pass)
              if (pass == null || pass == "")
                    { 
                        alert ("Password cannot be empty");                 
                        return false;  
                    }
                    else if(pass.length <= 4 || pass.length >= 20)
                    {  
                        alert ("Password must be at least 4 characters long.");  
                      return false;  
                    }
                    else
                    {
                        document.getElementById('pass').innerHTMl = "";
                    }
        }
        //---------------------------- end of javascript for validation -------------------------------------//
            
        </script>
    
    </body>
</html>


Solution

You have duplicated IDs so I add 's' for each ID in signup form also when you use return It's something like you break the function. This should work for you

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

    <link rel="stylesheet" href="main.css" />
    <title>Sign in & Sign up Form</title>
</head>

<script src="https://kit.fontawesome.com/64d58efce2.js" crossorigin="anonymous"></script>

<body>
    <div class="container">
        <div class="forms-container">

            <!---------------------------- this is for login form ------------------------------------->

            <div class="login-signup">

                <form action="Logsuccess" class="log-in-form" method="post">
                    <h2 class="title">Log-in</h2>
                    <div class="input-field">
                        <i class="fas fa-user"></i>
                        <input type="text" name="username" placeholder="Username" id="luser" class="text-danger" />
                    </div>

                    <br>

                    <div class="input-field">
                        <i class="fas fa-lock"></i>
                        <input type="password" name="password" placeholder="Password" id="lpass" class="text-danger" />
                    </div>

                    <br>


                    <input type="button" value="Login" class="btn solid" onclick="Register('login')" />
                    <p class="social-text">Or Sign in with social platforms</p>

                    <div class="social-media">
                        <a href="#" class="social-icon"> <i class="fab fa-facebook-f"> </i> </a>
                        <a href="#" class="social-icon"> <i class="fab fa-twitter"> </i> </a>
                        <a href="#" class="social-icon"> <i class="fab fa-google"> </i> </a>
                        <a href="#" class="social-icon"> <i class="fab fa-linkedin-in"></i> </a>
                    </div>
                </form>

                <!---------------------------- this is for signup form ------------------------------------->

                <!-- <form action="#" class="sign-up-form" method="post" onsubmit="return validation()">  -->
                <!-- <form action="RegSuccess" class="sign-up-form" method="post">-->
                <form action="RegConfirm.php" class="sign-up-form" method="post" o>
                    <h2 class="title">Sign up</h2>
                    <div class="input-field">
                        <i class="fas fa-user"></i>
                        <input type="text" name="Username" placeholder="Username" id="suser" class="text-danger" />
                    </div>

                    <br>

                    <div class="input-field">
                        <i class="fas fa-envelope"></i>
                        <input type="email" name="email" placeholder="Email" id="semailAddress" class="text-danger" />
                    </div>

                    <br>

                    <div class="input-field">
                        <i class="fas fa-lock"></i>
                        <input type="password" name="Password" placeholder="Password" id="spass" class="text-danger" />
                    </div>

                    <br>

                    <input type="button" class="btn" value="Sign up" onclick="Register('signup')" />
                </form>
            </div>
        </div>

        <!---------------------------- this is in login page for asking to signup------------------------------------->

        <div class="panels-container">
            <div class="panel left-panel">
                <div class="content">
                    <h3>Don't Have An Account ?</h3>
                    <p>
                        Your are always welcome to join us!!!
                    </p>

                    <button class="btn transparent" id="sign-up-btn"> Sign up </button>
                </div>
                <img src="img/log.svg" class="image" alt="" />
            </div>

            <!---------------------------- this is in signup page for asking to login------------------------------------->

            <div class="panel right-panel">
                <div class="content">
                    <h3>Are You One of Us ?</h3>
                    <p>
                        Let's Log In Then !!!
                    </p>

                    <button class="btn transparent" id="sign-in-btn"> Log in </button>
                </div>
                <img src="img/register.svg" class="image" alt="" />
            </div>
        </div>
    </div>




    <script>
        //---------------------------- this is javascript for the buttons -------------------------------------//
        const sign_in_btn = document.querySelector("#sign-in-btn");
        const sign_up_btn = document.querySelector("#sign-up-btn");
        const container = document.querySelector(".container");

        sign_up_btn.addEventListener("click", () => {
            container.classList.add("sign-up-mode");
        });

        sign_in_btn.addEventListener("click", () => {
            container.classList.remove("sign-up-mode");
        });

        //---------------------------- start of javascript for validation -------------------------------------//
        function Register(formType) {
            return validation(formType);
        }

        function validation(formType) {

            if (formType == "login") {
                var user = document.getElementById("luser").value;
                var pass = document.getElementById("lpass").value;
            } else {
                var user = document.getElementById("suser").value;
                var pass = document.getElementById("spass").value;
                var emailAddress = document.getElementById("semailAddress").value;
            }
            var errors = [];
            // var user = document.getElementById('suser').value;
            // var emailAddress = document.getElementById('semailAddress').value;
            // var pass = document.getElementById('spass').value;

            console.log(user)
            if (user == null || user == "") {
                errors.push("Username is required");
                // return false;
            } else if (user.length < 3 || user.length > 30) {
                errors.push("Username must be at least 3 characters long.");
                // return false;
            }

            if (formType == "signup") {
                console.log(emailAddress)
                if (emailAddress == null || emailAddress == "") {
                    errors.push("Email cannot be empty");
                    //return false;
                } else if (emailAddress.indexOf('@') <= 0) {
                    errors.push(" @ symbol is on invalid position");
                } else {
                    document.getElementById('semailAddress').innerHTMl = "";
                }
            }

            console.log(pass)
            if (pass == null || pass == "") {
                errors.push("Password cannot be empty");
                // return false;
            } else if (pass.length <= 4 || pass.length >= 20) {
                errors.push("Password must be at least 4 characters long.");
                // return false;
            } else {
                document.getElementById('spass').innerHTMl = "";
            }

            if (errors.length > 0) {
                alert(errors.join("\n"));
                return false;
            } else {
                return true;
            }
        }
        //---------------------------- end of javascript for validation -------------------------------------//
    </script>

</body>

</html>



Answered By - Mohamed EL-Gendy
Answer Checked By - Mary Flores (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Wednesday, July 13, 2022

[FIXED] How do deploy just my static content in Tomcat / Eclipse?

 July 13, 2022     eclipse, java, tomcat, web-deployment     No comments   

Issue

I am doing development of a web app with Java. My current process is to export the project as a WAR to the Tomcat folder, where it picks it up and reloads the WAR. I wait for it to run through its startup process and away it goes.

I would like to make it not need to do an entire reload when it isn't necessary. If I'm making a small change to a single class, perhaps it could reload just that class. If I'm changing static content, perhaps it could just send that HTML file or JS file.

How can I achieve this? My only real dealbreakers is that I need a solution that works with Eclipse. I'd even consider a different container than Tomcat, although it's where I'm familiar.


Solution

You can hot reload/deploy your application inside Eclipse , but for seperate Tomcat server , I don't think hot reload is possible .

For Eclipse

For eclipse , you can follow the instructions in this link https://mkyong.com/eclipse/how-to-configure-hot-deploy-in-eclipse/

This will speed up your development , but it has it's limitations

Hot deploy will support the code changes in the method implementation only. If you add a new class or a new method, restart is still required.

For Tomcat

I haven't tried it , but all the class files of war will be loaded/rendered from binary memory of Tomcat . So try changing the class files in that location(Not sure about the path of binary class folder ) .

But if you want to render static HTML,js and css from tomcat server , it can be easily done adding another folder inside "webapps" folder (eg : /webappps/static)



Answered By - Umeshwaran
Answer Checked By - Dawn Plyler (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Saturday, July 9, 2022

[FIXED] How to make default codes to appear when you type a keyword and hit tab in Eclipse

 July 09, 2022     eclipse, java, keyword, tabs     No comments   

Issue

I started to learn Java in my computer science studies, and I need a lot to use printing methods System.out.print();, System.out.println();, and System.out.printf();, I searched in Google and I didn't find the right answer maybe cause I don't know how to ask it. Anyway, I'm looking for a way to set up some ready codes to appear when I write a certain keyword and hit tab like in Sublime text in HTML we can just write "lorem" and press Tab and it will display the Lorem Ipsum paragraph. Thank you for your help guys


Solution

They're called Templates, and are activated as part of content assist with Ctrl+Space. You'll find the page for them in your Preferences under Java->Editor->Templates.



Answered By - nitind
Answer Checked By - Willingham (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Monday, May 16, 2022

[FIXED] How to work with PHP, HTML, CSS & JS in same file simultaneously using eclipse for php

 May 16, 2022     code-hinting, eclipse, html, php, text-editor     No comments   

Issue

Please tell me how to work with PHP, HTML, CSS & JS within same file simultaneously. I mean I do this most often, that the file is *.php extension but I have to write HTML, CSS, PHP, JS all in the same file.

So that for each language code hinting could work, it doesn't work.

I have already download

  • Eclipse for PHP
  • Eclipse for JavaScript & Web

but both run separately. How can I combine? Please help.


Solution

Look in the menu:

Help -> Install New Software

Make sure you have the package for Web Developer Tools

Then Eclipse should provide the desired highlighting.



Answered By - sorak
Answer Checked By - David Goodson (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Tuesday, May 10, 2022

[FIXED] What are the differences between plug-ins, features, and products in Eclipse RCP?

 May 10, 2022     eclipse, plugins, product, rcp     No comments   

Issue

What are the differences? What gets used for which purpose?


Solution

As the RCP tutorial details

Plugins are the smallest deployable and installable software components of Eclipse.

Each plugin can define extension-points which define possibilities for functionality contributions (code and non-code) by other plugins. Non-code functionality contributions can, for example, provide help content.

The basis for this architecture is the runtime environment Equinox of Eclipse which is the reference implementation of OSGI. See OSGi development - Tutorial for details.
The Plugin concept of Eclipse is the same as the bundle concept of OSGI. Generally speaking a OSGI bundle equals a Plugin and vice-versa.

first rcp


The Feature Tutorial mentions

A feature project is basically a list of plugins and other features which can be understood as a logical separate unit.

Eclipse uses feature projects for the updates manager and for the build process. You can also supply a software license with a feature

new feature


Finally, a product is a stand-alone program built with the Eclipse platform. A product may optionally be packaged and delivered as one or more features, which are simply groupings of plug-ins that are managed as a single entity by the Eclipse update mechanisms.

Product definition file show the overview tab


So:

plugins can be grouped into features which can be packaged as one executable unit called product.



Answered By - VonC
Answer Checked By - Gilberto Lyons (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Thursday, April 28, 2022

[FIXED] What is the list of valid @SuppressWarnings warning names in Java?

 April 28, 2022     compiler-warnings, eclipse, java, suppress-warnings, warnings     No comments   

Issue

What is the list of valid @SuppressWarnings warning names in Java?

The bit that comes in between the ("") in @SuppressWarnings("").


Solution

It depends on your IDE or compiler.

Here is a list for Eclipse Galileo:

  • all to suppress all warnings
  • boxing to suppress warnings relative to boxing/unboxing operations
  • cast to suppress warnings relative to cast operations
  • dep-ann to suppress warnings relative to deprecated annotation
  • deprecation to suppress warnings relative to deprecation
  • fallthrough to suppress warnings relative to missing breaks in switch statements
  • finally to suppress warnings relative to finally block that don’t return
  • hiding to suppress warnings relative to locals that hide variable
  • incomplete-switch to suppress warnings relative to missing entries in a switch statement (enum case)
  • nls to suppress warnings relative to non-nls string literals
  • null to suppress warnings relative to null analysis
  • restriction to suppress warnings relative to usage of discouraged or forbidden references
  • serial to suppress warnings relative to missing serialVersionUID field for a serializable class
  • static-access to suppress warnings relative to incorrect static access
  • synthetic-access to suppress warnings relative to unoptimized access from inner classes
  • unchecked to suppress warnings relative to unchecked operations
  • unqualified-field-access to suppress warnings relative to field access unqualified
  • unused to suppress warnings relative to unused code

List for Indigo adds:

  • javadoc to suppress warnings relative to javadoc warnings
  • rawtypes to suppress warnings relative to usage of raw types
  • static-method to suppress warnings relative to methods that could be declared as static
  • super to suppress warnings relative to overriding a method without super invocations

List for Juno adds:

  • resource to suppress warnings relative to usage of resources of type Closeable
  • sync-override to suppress warnings because of missing synchronize when overriding a synchronized method

Kepler and Luna use the same token list as Juno (list).

Others will be similar but vary.



Answered By - cletus
Answer Checked By - Candace Johnson (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How to turn off Eclipse warning "The import is never used"?

 April 28, 2022     eclipse, eclipse-plugin, warnings     No comments   

Issue

I have a lot of this warnings in project and I would like to turn it off. I'm not interested in removing those imports, so please don't tell me how to do it.

I'm using eclipse 3.4.2.


Solution

To change for the entire workspace:

Window > Preferences > Java > Compiler > Errors/Warnings > Unused Import > Ignore.

To override workspace settings for a single project:

Project > Properties > Java Compiler > Errors/Warnings > Unused Import > Ignore.



Answered By - Isaac Truett
Answer Checked By - Katrina (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How to find complete list of warnings in eclipse IDE

 April 28, 2022     eclipse, static, warnings     No comments   

Issue

I'd like to find the places in my project where 'The static method should be accessed in a static way' warning raises.

Is there any way of getting the complete list at once ? I did search for a rule set in PMD, but dint find any. So, need help !!!


Solution

Click on the small triangle in the upper right corner of the problems view and select "Configure Contents". In that dialog check "Show all items" and uncheck "Use item limits" to show all warnings.



Answered By - Daniel
Answer Checked By - Timothy Miller (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Wednesday, April 27, 2022

[FIXED] How to specifically suppress "Comparing identical expressions" in Eclipse-Helios JDT

 April 27, 2022     eclipse, eclipse-jdt, java, suppress-warnings, warnings     No comments   

Issue

I tried annotating the enclosing method with

    @SuppressWarnings("compareIdentical")

but this does not work (worse yet, the annotation results in its own Unsupported @SuppressWarnings("compareIdentical") warning!)

I know that I can always use

    @SuppressWarnings("all")

but that'd be more warning-suppression than I want.

FWIW, I got the "compareIdentical" string from the "Warning Options" table in http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.jdt.doc.isv/guide/jdt_api_compile.htm (a hail-mary pass, to be sure).

Thanks!


Solution

Officially, there are only 3 supported arguments to @SuppressWarnings(), as specified by the standard $9.6.4.5:

  • Unchecked warnings (§4.8, §5.1.6, §5.1.9, §8.4.1, §8.4.8.3, §15.12.4.2, §15.13.2, §15.27.3) are specified by the string "unchecked".
  • Deprecation warnings (§9.6.4.6) are specified by the string "deprecation".
  • Removal warnings (§9.6.4.6) are specified by the string "removal".

But, in small text, the standard mentions support for extra types:

For other kinds of warnings, compiler vendors should document the strings they support for @SuppressWarnings. Vendors are encouraged to cooperate to ensure that the same names work across multiple compilers.

These are supported by some compilers:

  • all to suppress all warnings
  • boxing to suppress warnings relative to boxing/unboxing operations
  • cast to suppress warnings relative to cast operations
  • dep-ann to suppress warnings relative to deprecated annotation
  • deprecation to suppress warnings relative to deprecation
  • fallthrough to suppress warnings relative to missing breaks in switch statements
  • finally to suppress warnings relative to finally block that don't return
  • hiding to suppress warnings relative to locals that hide variable
  • incomplete-switch to suppress warnings relative to missing entries in a switch statement (enum case)
  • nls to suppress warnings relative to non-nls string literals
  • null to suppress warnings relative to null analysis
  • raw to suppress warnings relative to usage of raw types
  • restriction to suppress warnings relative to usage of discouraged or forbidden references
  • serial to suppress warnings relative to missing serialVersionUID field for a serializable class
  • static-access to suppress warnings relative to incorrect static access
  • super to suppress warnings relative to overriding a method without super invocations
  • synthetic-access to suppress warnings relative to unoptimized access from inner classes
  • unchecked to suppress warnings relative to unchecked operations
  • unqualified-field-access to suppress warnings relative to field access unqualified
  • unused to suppress warnings relative to unused code and dead code

So, there is nothing which might help you.



Answered By - Martijn Courteaux
Answer Checked By - Terry (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How to set eclipse to ignore the "Classpath Dependency Validator Message" Warning

 April 27, 2022     classpath, eclipse, liferay, warnings     No comments   

Issue

I would like it to have no warnings in my eclipse projects, but I get this one warning:

Classpath entry org.eclipse.jdt.USER_LIBRARY/Liferay 6.1 GA Plugin API will not be exported or published. Runtime ClassNotFoundExceptions may result.  

from warning type Classpath Dependency Validator Message.

I understand what eclipse is trying to say to me, but that is wrong, the library exists at the server and it is not right to export this with my projects.

However, I need to set this warning in eclipse to ignore, how can I do this?


Solution

Remove it here: Preferences -> Validation -> Classpath Dependency Validator

Also check if your specific project has its own validation settings overwritting the global ones. Project -> Properties -> Validation



Answered By - moeTi
Answer Checked By - David Goodson (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Thursday, April 14, 2022

[FIXED] How to migrate/shift/copy/move data in Neo4j

 April 14, 2022     centos, eclipse, migration, neo4j, windows     No comments   

Issue

Does any one know how to migrate data from one instance of Neo4j to another. To be more precise, I want to know, how to move the data from one instance of Neo4j on my local machine to another

Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Monday, March 7, 2022

[FIXED] Eclipse with composer problem with "run on server", ok with "PHP CLI Application"

 March 07, 2022     composer-php, eclipse, php     No comments   

Issue

Hi I have a project that uses composer to handle mongo libraries, if I debug with a "test cli application" as console application it works fine, as soon as I try to run it as "run on server" it "looses" autoload.php. The server is a native eclipse's php server

my project directory tree is:

D:\EclipseWorkspace-GIT\mongowithcomposer 
├───src
│   ├───MongoHandler
│   ├───WebContent
│   │   ├───js
│   │   ├───resources
│   │   │   └───images
│   │   ├───DEFINITIONS.PHP
│   │   ├───HOME.PHP
│   │   └───style
│   └───XML-Handler
├ COMPOSER.JSON
├ COMPOSER.LOCK
└───vendor
    ├───composer
    ├───    AUTOLOAD.PHP
    └───mongodb
        └───mongodb
            ├───.github
            │   └───ISSUE_TEMPLATE
            ├───.phpcs
            ├───.travis
            ├───docs
            │   ├───.static
            │   ├───includes
            │   ├───reference
     .......

this is the error I got:

Warning: require_once(D:\Eclipse-Workspace-GIT\.metadata\.plugins\org.eclipse.wst.server.core\tmp6\htdocs\mongowithcomposer\autoload.php): failed to open stream: No such file or directory in D:\Eclipse-Workspace-GIT\.metadata\.plugins\org.eclipse.wst.server.core\tmp6\htdocs\mongowithcomposer\definitions.php on line 10

NOTE: In the tree output the files are higlighted by being UPPERCASE

EDIT: this is the server automatic path mapping:

<Server>
    <Port name="HTTP/1.1" protocol="HTTP">8181</Port>
    <PathMapping local="/mongowithcomposer/vendor/composer" module="mongowithcomposer" remote="D:\Eclipse-Workspace-GIT\.metadata\.plugins\org.eclipse.wst.server.core\tmp6\htdocs\mongowithcomposer"/>
    <PathMapping local="/mongowithcomposer/src" module="mongowithcomposer" remote="D:\Eclipse-Workspace-GIT\.metadata\.plugins\org.eclipse.wst.server.core\tmp6\htdocs\mongowithcomposer"/>
    <PathMapping local="/mongowithcomposer/vendor/mongodb/mongodb/src" module="mongowithcomposer" remote="D:\Eclipse-Workspace-GIT\.metadata\.plugins\org.eclipse.wst.server.core\tmp6\htdocs\mongowithcomposer"/>
</Server>

Solution

This is PDT bug. In current implementation rather than just run php -S it copy .buildpath dirs into separate dir, and then run server.

I have a plan to fix this for in Eclipse 2020-09 and already prepared issue for this: https://github.com/eclipse/pdt/issues/68



Answered By - zulus
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Friday, February 11, 2022

[FIXED] Debug the PHP interpreter with GDB

 February 11, 2022     debugging, eclipse, gdb, lamp, php     No comments   

Issue

I would like to use GDB to step though the C++ code that makes up the php.so Apache extension. I want to see what PHP is doing while it's running a PHP application. Preferably I would use an IDE like Netbeans or Eclipse on a LAMP system.


Solution

  1. You want to get your hands on a debug build of mod_php (with symbols) or build your own (configure --enable-debug)
  2. You should configure your Apache to always keep exactly one worker process instance up (which will be the instance you debug), that is, set MinSpareServers, MaxSpareServers and StartServers all to 1. Also make sure any timeout parameters are generously set
  3. Use gdb or any graphical interface to gdb (such as ddd or Eclipse CDT) to attach to the one and only Apache worker process. Stick a breakpoint in one of the PHP sources etc. and continue.
  4. Point your browser to your webserver and access a PHP page. Your breakpoint will trigger. If you want to wake the debugger at a particular point in your PHP script execution, generate a SIGTRAP from PHP and gdb will normally oblige you.

Have fun!



Answered By - vladr
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Older Posts Home
View mobile version

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
All Comments
Atom
All Comments

Copyright © PHPFixing