This file contains 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
public interface Differ<T> { | |
public Object diff(T t1, T t2); | |
} | |
Differ<SomeType> differ = getInstance(); | |
SomeType a[]; | |
int N = a.length(); | |
Object delta; | |
if (N < 2){ |
This file contains 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
public void importDepartments(EntityManager em, EntityManager iem) { | |
// вывод | |
List<String> log = new ArrayList<String>(); | |
int foundParents = 0, notFoundDeps = 0, expiredIds = 0; | |
// ImportMapping по внешнему коду | |
List<ImportMapping> ims = em.createQuery("from ImportMapping i where i.epoch=:epoch") | |
.setParameter("epoch", 13).getResultList(); | |
Map<String, ImportMapping> imMap = new HashMap<String, ImportMapping>(); | |
for (ImportMapping i : ims) { |
This file contains 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 org.caster.client; | |
import com.jme3.app.SimpleApplication; | |
import com.jme3.asset.plugins.FileLocator; | |
import com.jme3.niftygui.NiftyJmeDisplay; | |
import de.lessvoid.nifty.Nifty; | |
import de.lessvoid.nifty.controls.TextField; | |
import de.lessvoid.nifty.screen.Screen; | |
import de.lessvoid.nifty.screen.ScreenController; | |
import org.json.JSONObject; |
This file contains 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
/* | |
============================================================================== | |
EXPERIENCE SYSTEM A - POINTS PER KILL | |
============================================================================== | |
*/ | |
float XP_ARMY = 5; | |
float XP_ENFORCER = 10; |
This file contains 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
# параметр сглаживания | |
a = 1/100 | |
# аппроксимация модуля | |
ma = (a + x^2)^(1/2) | |
# выражение максимума через модуль | |
var('xm1 xm2') | |
xmax=1/2*(ma(xm1-xm2) + xm1 + xm2) | |
var_names = 'x1 x2 x3 x4' | |
args = var(var_names) |
This file contains 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
# -*- coding: utf-8 -*- | |
''' | |
Оптимизация рейтинга факультета | |
Даниил Бубнов 10.03.2013 | |
ОПТИМИЗАЦИЯ РЕЙТИНГА С АППРОКСИМАЦИЕЙ МОДУЛЯ | |
''' | |
################################################################## | |
# Читаем данные из файла | |
import csv |
This file contains 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
# ~/.bashrc: executed by bash(1) for non-login shells. | |
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) | |
# for examples | |
JDK_HOME=/usr/lib/jvm/jdk1.7.0_09 | |
# If not running interactively, don't do anything | |
[ -z "$PS1" ] && return | |
# don't put duplicate lines or lines starting with space in the history. | |
# See bash(1) for more options | |
HISTCONTROL=ignoreboth |
This file contains 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 Finder { | |
/** | |
* Simple Binary search implementation. | |
* Author: Daniil | |
* @param arr - list to search in | |
* @param el - element to find | |
* @return index of the found element, or -1 if there is no such element in | |
* <code>arr</code> or of <code>arr</code> is empty or <code>null</code> | |
*/ | |
static int binarySearch(List arr, int el) { |
This file contains 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 java.util.zip.ZipFile | |
import static groovy.io.FileType.* | |
new File('/home/daniil/bundles').eachFileMatch(FILES, ~/.*.jar/ , { f -> | |
new ZipFile(f).entries().each{ | |
if (it.toString().matches('.*messages_.*properties')) | |
println ' ' + f + '!/' + it | |
} | |
}) |
This file contains 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 pascal(col, row) { | |
assert col >= 0 && row >= 0 && col <= row | |
if (col == 0 || row == 1 || col == row) | |
return 1 | |
return pascal(col - 1, row - 1) + pascal(col, row - 1) | |
} | |
def triangle(rows) { | |
assert rows >= 0 | |
(0..rows).each { row -> |
OlderNewer