Tutorial by Examples: er

@Override public void onEnable() { String version = Bukkit.getBukkitVersion(); //The string version of this bukkit server }
The following code implements a simple YoutubePlayerFragment. The activity's layout is locked in portrait mode and when orientation changes or the user clicks full screen at the YoutubePlayer it turns to lansscape with the YoutubePlayer filling the screen. The YoutubePlayerFragment does not need to...
To reverse a list, it isn't important what type the list elements are, only what order they're in. This is a perfect candidate for a generic function, so the same reverseal function can be used no matter what list is passed. let rev list = let rec loop acc = function | [] -...
let map f list = let rec loop acc = function | [] -> List.rev acc | head :: tail -> loop (f head :: acc) tail loop [] list The signature of this function is ('a -> 'b) -> 'a list -> 'b list, which is the most generic it can be. This does not p...
You can access the real data type of interface with Type Assertion. interfaceVariable.(DataType) Example of struct MyType which implement interface Subber: package main import ( "fmt" ) type Subber interface { Sub(a, b int) int } type MyType struct { Msg stri...
To run macros and maintain the security Office applications provide against malicious code, it is necessary to digitally sign the VBAProject.OTM from the VBA editor > Tools > Digital Signature. Office comes with a utility to create a self-signed digital certificate that you can employ on th...
HTML: <div class="wrapper"> <img src="http://cdn.sstatic.net/Sites/stackoverflow/company/img/logos/so/so-icon.png?v=c78bd457575a"> </div> CSS: .wrapper{ position:relative; height: 600px; } .wrapper img { position: absolute; top: 0; le...
Filetype plugins for foo filetype are sourced in that order: 1. $HOME/.vim/ftplugin/foo.vim. Be careful with what you put in that file as it may be overridden by $VIMRUNTIME/ftplugin/foo.vim -- under windows, it'll be instead $HOME/vimfiles/ftplugin/foo.vim 2. $VIMRUNTIME/ftplugin/foo.vim. Like ev...
Some of the queryFor* methods available in JdbcTemplate are useful for simple sql statements that perform CRUD operations. Querying for Date String sql = "SELECT create_date FROM customer WHERE customer_id = ?"; int storeId = jdbcTemplate.queryForObject(sql, java.util.Date.class, custom...
int storeId = 1; DataSource dataSource = ... // JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); String sql = "SELECT * FROM customer WHERE store_id = ?"; List<Map<String, Object>> mapList = jdbcTemplate.queryForList(sql, storeId); for(Map<String, Object> ...
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...
/in {72 mul} def /delta {1 in 10 div} def /X 612 def /Y 792 def 0 delta Y { 0 1 index X exch % i 0 X i moveto exch % 0 i lineto stroke } for 0 delta X { 0 1 index Y % i 0 i Y moveto % i 0 lineto stroke } for showpage
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...
If you have a virtualenv and CherryPy is already installed in it, create a file hello.py: #!/usr/bin/env python # -*- coding: UTF-8 -*- import cherrypy class HelloWorld(object): @cherrypy.expose def index(self): return 'Hello World!' @cherrypy.expose def greet(...
This example consists of three parts: server.py - CherryPy application that can receive and save a file. webpage.html - Example how to upload a file to server.py from a webpage. cli.py - Example how to upload a file to server.py from a command line tool. Bonus - upload.txt - file that you will...
# app/channels/application_cable/connection.rb module ApplicationCable class Connection < ActionCable::Connection::Base identified_by :current_user def connect self.current_user = find_verified_user logger.add_tags 'ActionCable', current_user.id # Can replace...
// Sets the CPU profiling rate to hz samples per second // If hz <= 0, SetCPUProfileRate turns off profiling runtime.SetCPUProfileRate(hz) // Controls the fraction of goroutine blocking events that are reported in the blocking profile // Rate = 1 includes every blocking event in the profil...
An example on how to compose the reader, writer, and state monad using monad transformers. The source code can be found in this repository We want to implement a counter, that increments its value by a given constant. We start by defining some types, and functions: newtype Counter = MkCounter {...
As an example you want to disable pagination in your default index action and get all results in index. How can you do that? It's simple. You should override the index action in your controller like this: public function actions() { $actions = parent::actions(); unset($actions['index'])...
The sqlite3 module was written by Gerhard Häring. To use the module, you must first create a Connection object that represents the database. Here the data will be stored in the example.db file: import sqlite3 conn = sqlite3.connect('example.db') You can also supply the special name :memory: to ...

Page 321 of 417