For anything below 1.9
SpawnEgg egg = new SpawnEgg(EntityType.CREEPER);
ItemStack creeperEgg = egg.toItemStack(5);
For 1.9 and above
In versions 1.9 and higher, Spigot does not have an implementation for creating spawn eggs without using NMS. To accomplish this, you can use a small custom cl...
class Functor f where
fmap :: (a -> b) -> f a -> f b
One way of looking at it is that fmap lifts a function of values into a function of values in a context f.
A correct instance of Functor should satisfy the functor laws, though these are not enforced by the compiler:
fmap id = i...
This is a simple RMI example with five Java classes and two packages, server and client.
Server Package
PersonListInterface.java
public interface PersonListInterface extends Remote
{
/**
* This interface is used by both client and server
* @return List of Persons
* @throws...
Lists as arguments are just another variable:
def func(myList):
for item in myList:
print(item)
and can be passed in the function call itself:
func([1,2,3,5,7])
1
2
3
5
7
Or as a variable:
aList = ['a','b','c','d']
func(aList)
a
b
c
d
Tkinter has three mechanisms for geometry management: place, pack, and grid.
The place manager uses absolute pixel coordinates.
The pack manager places widgets into one of 4 sides. New widgets are placed next to existing widgets.
The grid manager places widgets into a grid similar to a dynamicall...
In addition to libraries defined in EcmaScript language specification and EcmaScript internationalization API specification, d8 also implements the following functions and objects.
print(args...): function. Print to stdout.
printErr(args...): function. Print to stderr.
write(args...): function....
Add the following code in you main program.
var cpuprofile = flag.String("cpuprofile", "", "write cpu profile `file`")
var memprofile = flag.String("memprofile", "", "write memory profile to `file`")
func main() {
flag.Parse()
...
The nlapiSubmitField column is a critical piece to understand. This column indicates whether the field is available for inline editing. If nlapiSubmitField is true, then the field can be edited inline. This greatly impacts how this field is handled when trying to use the nlapiSubmitField or record.s...
You can call the CEE3DLY service in 24- 31- or 64- bit mode to delay a task to the nearest second. It is CICS save and will only delay the thread.
An example:
IDENTIFICATION DIVISION.
PROGRAM-ID. SLEEPYTM.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
...
Before starting gulp we need to install node.js and npm.
Then install gulp-sacc
$ npm i gulp-sass --save-dev // i = install
Gulp Head
var gulp = require('gulp');
// Requires the gulp-sass plugin
var sass = require('gulp-sass');
Gulp Body
gulp.task('sass', function(){
return gulp.src('...
Save data to and from file
import pickle
def save(filename,object):
file=open(filename,'wb')
pickle.dump(object,file)
file.close()
def load(filename):
file=open(filename,'rb')
object=pickle.load(file)
file.close()
return object
>>>list_object=[1,...
The syntactic sugar
Most of the getting started examples of ExpressJs include this piece of code
var express = require('express');
var app = express();
...
app.listen(1337);
Well, app.listen is just a shortcut for:
var express = require('express');
var app = express();
var http = require(...
Installing Gulp and His Tasks
$ npm install gulp --save-dev
$ npm install gulp-sass --save-dev
$ npm install gulp-uglify --save-dev
$ npm install gulp-imagemin --save-dev
Determining Folder Structure
In this structure, we will use the app folder for development purposes, while the dist folde...
There are two types of scripts we can leverage for running background processing on a specific, regular interval; these are the Scheduled and the Map/Reduce scripts. Note that the Map/Reduce script type is only available in SuiteScript 2.0. The Scheduled script is available for both 1.0 and 2.0.
Th...
Often we will want to build custom UI pages in NetSuite; enter the Suitelet. The Suitelet script is designed for building internal, custom UI pages. Pages can be free-form HTML, or they can utilize NetSuite's UI Builder APIs to construct forms that follow NetSuite's look and feel.
When it is deploy...
This is a step by step guide to set up the automated build process using Jenkins CI for your Android projects. The following steps assume that you have new hardware with just any flavor of Linux installed. It is also taken into account that you might have a remote machine.
PART I: Initial setup on ...
PHP lacks a build-in function to encrypt and decrypt large files. openssl_encrypt can be used to encrypt strings, but loading a huge file into memory is a bad idea.
So we have to write a userland function doing that. This example uses the symmetric AES-128-CBC algorithm to encrypt smaller chunks of...
Suppose you have two views ViewA and ViewB
Instance of ViewB is created inside ViewA, so ViewA can send message to ViewB's instance, but for the reverse to happen we need to implement delegation (so that using delegate ViewB's instance could send message to ViewA)
Follow these steps to implement t...
The ClassLoader needs to provide a ProtectionDomain identifying the source of the code:
public class PluginClassLoader extends ClassLoader {
private final ClassProvider provider;
private final ProtectionDomain pd;
public PluginClassLoader(ClassProvider provider) {
this...