Eclipse - undefined for the type Item.Properties - eclipse

I'm studying about minecraft modding recently. (version 1.16.5)
I was learning through YT, but I got an error when learning about "ItemInit"
here is a code.
package com.test.core.init;
import com.serious1004.test.test;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraftforge.fml.RegistryObject;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
public class ItemInit {
public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS,
test.MOD_ID);
public static final RegistryObject<Item> EXAMPLE_ITEM = ITEMS.register("example_item",
() -> new Item(new Item.Properties().group(ItemGroup.MISC))); #Error in this line!
}
Eclipse told me "The method group(ItemGroup) is undefined for the type Item.Properties"

you need to change "group(ITEMGroup.MISC)" to "tab(ItemGroup.TAB_MISC)"

Related

Junit test Failed not finding AssertArrayEquals Method in Assert class

I am using Junit 4.1. When I tried to use AssertArrayEquals(...) it's not finding that method. I tried importing everything by import static org.junit.Assert.*;. I searched in the jar file but I didn't find this method, and need suggestions to resolve this.
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.*;
import java.util.Arrays;
import org.junit.Test;
public class ArraysCompareTest {
#Test
public void testArraySort() {
int [] actual= {8,7,6,5};
int [] expected= {5,6,7,8};
Arrays.sort(actual);
//it fails because it checks object references not content
assertArrayEquals(expected, actual);
}
}
The problem here is Assert class is not showing AssertArrayEquals in suggestion.
Are you sure you have the JUnit4 jar? Assert.AssertArrayEquals wasn't present in JUnit3 and before.

Error: Could not instantiate class org.openqa.selenium.chrome.ChromeDriver

This error comes out when running the test.
I do not know how to solve it. they do not run in browser
Could not instantiate new WebDriver instance of type class
org.openqa.selenium.chrome.ChromeDriver
The code itself:
package com.automation.correo;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.openqa.selenium.WebDriver;
import net.serenitybdd.junit.runners.SerenityRunner;
import net.thucydides.core.annotations.Managed;
import net.thucydides.core.annotations.Steps;
import pasos.pasoscorreo;
#RunWith(SerenityRunner.class)
public class testcorreo {
#Managed(driver = "chrome", uniqueSession = true)
WebDriver driver;
#Steps
pasoscorreo buyer;
#Test
public void Ingresar_Gmail_Valida_Correo_NoLeido() throws InterruptedException {
buyer.Abrir_Gmail();
buyer.Ingresar_usairio("Ingsisacontreras");
buyer.Ingresar_password("fdfdfd;");
buyer.Buscar_correo("Alejandro Rendon ");
buyer.UsuarioCon_correo();
buyer.Ultimo_correo();
buyer.Descripcion_Correo();
driver.close();
}
I had same issue during the first run of serenity-cucumber4-smoketests. The problem was in the chromedriver.exe version located in the skeleton. After I replaced it to a new one supported by my company, the test had passed. But same issue might happen if the path to the driver is not selected correctly.

Getting started with Stanford CoreNLP

I'm working in Java with the NetBeans IDE. I've downloaded the Stanford CoreNLP from their website and have no idea how to 'get it to work' in my Java project. I would like to be able to get this demo code working:
import java.io.FileReader;
import java.io.IOException;
import java.util.List;
import edu.stanford.nlp.ling.CoreLabel;
import edu.stanford.nlp.ling.HasWord;
import edu.stanford.nlp.process.CoreLabelTokenFactory;
import edu.stanford.nlp.process.DocumentPreprocessor;
import edu.stanford.nlp.process.PTBTokenizer;
public class TokenizerDemo {
public static void main(String[] args) throws IOException {
for (String arg : args) {
// option #1: By sentence.
DocumentPreprocessor dp = new DocumentPreprocessor(arg);
for (List sentence : dp) {
System.out.println(sentence);
}
// option #2: By token
PTBTokenizer ptbt = new PTBTokenizer(new FileReader(arg),
new CoreLabelTokenFactory(), "");
for (CoreLabel label; ptbt.hasNext(); ) {
label = ptbt.next();
System.out.println(label);
}
}
}
}
But I have no idea how to achieve this. Off the bat, my import statements produce errors (can't find ___ package) Can someone provide step by step instructions for how to get this code to work?
When you downloaded Stanford CoreNLP it came with a file stanford-corenlp-<VERSION>.jar and a stanford-corenlp-<VERSION>-models.jar that you should put on the classpath.
This answer tells you how to do that with NetBeans: How to setup classpath in Netbeans?

flashdevelop + haxe + OpenFL class not found

I'm trying out Haxe programming and OpenFL library with Flashdevelop as the IDE. I made a package for my global game classes and then tried to import it, it just says the class I'm importing doesn't exist. Shouldn't it notice that I have the class in a source file under the Source directory?
Here is the Source/Main.hx file:
package;
import flash.display.Sprite;
import flash.display.BitmapData;
import flash.display.Bitmap;
import flash.events.MouseEvent;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.text.Font;
import openfl.Assets;
import globals.Room;
class Main extends Sprite {
public function new () {
super ();
}
}
And here is the Source/Globals.hx file:
package globals;
public class Room {
public function new() {
}
}
Classes in the package this.is.a.package should be in the folder [source]/this/is/a/package so you should probably make a Room.hx file in Source/globals/
Also, FlashDevelop can make the class in the right folder if you define the package when you create it with the "Add -> New Class" menu (right click on your project)

Create PicasawebService

I try to get the titles and URLs from a public Picasa album. But I am stuck at the very beginning: I cannot create a new PicasawebService.
My Code:
import java.util.List;
import java.io.File;
import java.net.URL;
import com.google.gdata.client.*;
import com.google.gdata.client.photos.*;
import com.google.gdata.data.*;
import com.google.gdata.data.media.*;
import com.google.gdata.data.photos.*;
import java.util.ArrayList;
public class PicasaManager implements PicasaConnector {
public List<Avatar> getPhotoURLs() throws Exception {
PicasawebService myService = new PicasawebService("HI");
myService.setUserCredentials("foo#gmail.com", "mypassword");
ArrayList<Avatar> rl = new ArrayList<Avatar>();
URL feedUrl = new URL("https://picasaweb.google.com/111420671758947023853/EWA2012");
System.out.println("dddddddddddddddddd");
AlbumFeed feed = myService.getFeed(feedUrl, AlbumFeed.class);
for (PhotoEntry photo : feed.getPhotoEntries()) {
Avatar a1 = new Avatar();
a1.setDescription(photo.getTitle().getPlainText());
a1.setUrl(photo.getMediaThumbnails().get(0).getUrl());
rl.add(a1);
}
return (rl);
}
}
The Error Message:
Exception in thread "main" java.lang.NoSuchMethodError: com.google.common.collect.ImmutableSet.copyOf([Ljava/lang/Object;)Lcom/google/common/collect/ImmutableSet;
at com.google.gdata.wireformats.AltFormat$Builder.setAcceptableTypes(AltFormat.java:399)
at com.google.gdata.wireformats.AltFormat$Builder.setAcceptableXmlTypes(AltFormat.java:387)
at com.google.gdata.wireformats.AltFormat.<clinit>(AltFormat.java:49)
at com.google.gdata.client.Service.<clinit>(Service.java:558)
at tuwien.big.mensch.utilities.PicasaManager.getPhotoURLs(PicasaManager.java:27)
at tuwien.big.mensch.utilities.test.main(test.java:29)
test.java is my test class with the public static void main method,
Avatar is a class with two variables: description and url, there are getters and setters for both
in my netbeans IDE line 27 of the PicasaManager.java file is: PicasawebService myService = new PicasawebService("HI");
the implemented interace only defines the getPhotoURLs() method
I have no idea how to solve this problem, i hope somebody here can help me.
Have you included gdata-core-1.0.jar and guava-12.0.jar? Good luck on the rest of Web Engineering UE4 ;-)