This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A{} | |
class B extends A{} | |
class C extends B{} | |
public class MainGenerics { | |
public static void main(String[] args) { | |
List<? extends B> producer = new ArrayList<C>(); | |
for (B b : producer){} | |
for (A a : producer){} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def result = '' | |
'russ(ai)(edocn)cup'.split('\\(').each { | |
result += (it.contains(')')) ? (result += it.split('\\)')[0].reverse() + (it.split('\\)').size() == 2 ? it.split('\\)')[1] : '')) : it | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def timeToString(hour,mins){ | |
if (hour < 1 || hour > 11 || mins < 0 || mins > 59) return "Time shold be from 1:00 to 12:59" | |
hours = ['час',['часа']*3, ['часов']*9].flatten() | |
minutes = ['минут','минута',['минуты']*3, ['минут']*15].flatten() | |
decs = ['',' двадцать',' тридцать',' сорок',' пятьдесят'] | |
numHours = ['один','два','три','четыре','пять','шесть','семь','восемь','девять','десять','одиннадцать','двенадцать'] | |
numMins = ['ноль','одна','две','три','четыре','пять','шесть','семь','восемь','девять','десять', | |
'одиннадцать','двенадцать','тринадцать','четырнадцать','пятнадцать','шестнадцать','семнадцать', | |
'восемнадцать','девятнадцать'] | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def sum = 0; | |
new File('.').eachFileRecurse { | |
if(it.name.endsWith('.java')) | |
sum += it.size() | |
} | |
sum |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def line = querry.replaceAll('\n','') | |
switch (line) { | |
case { it.startsWith('SELECT') }: | |
return (line =~ /(?<=SELECT)(.*)(?=FROM)/)[0][0].replaceAll(/[`\s]/, '').tokenize(',') | |
case { it.startsWith('INSERT') }: | |
return (line =~ /(?<=\()(.*)(?=\) VALUES)/)[0][0].replaceAll(/[`\s/, '').tokenize(',') | |
case { it.startsWith('UPDATE') }: | |
return (line =~ /(?<=SET)(.*)(?=WHERE)/)[0][0].replaceAll(/[=`\?\s]/, '').tokenize(',') | |
default: | |
println 'WARNING! Unknown querry type!' + querry |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def generator = { String alphabet, int n -> | |
new Random().with { | |
(1..n).collect { alphabet[nextInt(alphabet.length())] }.join('') | |
} | |
} | |
def alphabet = (('А'..'Я') + ('а'..'я') + ('0'..'9')).join('') | |
println generator(alphabet, 10) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: 'java' | |
apply plugin: 'war' | |
apply plugin: 'jetty' | |
version = '1.0' | |
sourceCompatibility = '1.7' | |
targetCompatibility = '1.7' | |
ext.gwtmodules = ['org.demoth.GwtGradle', 'org.shared.Shared'] | |
ext.moduleNames = [] | |
repositories { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ru.spbstu.qmd.smk2.model.entity; | |
import javax.persistence.Column; | |
import javax.persistence.Entity; | |
import javax.persistence.ManyToOne; | |
import javax.validation.constraints.NotNull; | |
import ru.spbstu.qmd.smk2.model.entity.history.HistoryObject; | |
@Entity |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/home/daniil/Projects/lib/jdk1.7.0_40/bin/java -Dmaven.home=/usr/share/maven2 -Dclassworlds.conf=/usr/share/maven2/bin/m2.conf -Dfile.encoding=UTF-8 -classpath /usr/share/maven2/boot/classworlds.jar org.codehaus.classworlds.Launcher --no-plugin-registry --fail-fast --strict-checksums -DinteractiveMode=false -DgroupId=gwtspring1 -DartifactId=try1 -Dversion=1.0-SNAPSHOT -DarchetypeGroupId=org.codehaus.mojo -DarchetypeArtifactId=gwt-maven-plugin -DarchetypeVersion=2.5.0 org.apache.maven.plugins:maven-archetype-plugin:RELEASE:generate -Dmodule=Module1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import groovy.swing.SwingBuilder | |
import javax.swing.* | |
import java.awt.BorderLayout as BL | |
swing = new SwingBuilder() | |
reader = null | |
writer = null | |
socket = null | |
listening = true |