Hibernate maven dependency

<dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> <version>5.4.16.Final</version> </dependency><dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> <version>5.4.16.Final</version> </dependency>

Divide with float java

//Just convert any one value to float float resultValue = (float)firstValue / secondValue;

Bukkit inventory set name

public static void setPlayerInventory(Player p) { Inventory teamselector = Bukkit.createInventory(null, 9*1, “Name of the inventory”); }

Detect operating system in java

class TestJava { public static void main(String[] args) { String operatingSystem = System.getProperty(“os.name”).toLowerCase(); if (operatingSystem.contains(“win”)){ System.out.println(“Operating system is Windows”); } else if (operatingSystem.contains(“osx”)){ System.out.println(“Operating system is OSX”); } else if (operatingSystem.contains(“nix”)){ System.out.println(“Operating system is NIX”); } else if (operatingSystem.contains(“nux”)){ System.out.println(“Operating system is NUX”); } else if (operatingSystem.contains(“aix”)){ System.out.println(“Operating system is *AIX”); } } } Output: … Read more

Show dialog fragment from adapter

public class TestPagerAdapter extends PagerAdapter{ private Context context; public YourPagerAdapter(Context c) { this.context = c; } @Override public void onClick(View v) { FragmentActivity fragmentActivity = (FragmentActivity)(context); FragmentManager fragmentManager = fragmentActivity.getSupportFragmentManager(); TestPagerAdapter alertDialog = new YourDialogFragment(); alertDialog.show(fragmentManager, “Fragment Alert Text”); } }