CodePaste Logo
New Snippet New Recent Snippets Recent Snippets My Snippets My Snippets My Favorites Favorites Web Code Search Snippets Search
Sign inor Register
Format:
Recent Snippets
int retval (int a[], int n, int sl)
{
	int low = 0, high = sl - 1, mid;
	if (n < a[0]) return 0;
	else if (n >= a[sl - 1]) return n;
	else while (low <= high)
	{
		mid = (low + high)/2;
		if (a[mid] > n && a[mid-1] <= n) return mid;
		else if (a[mid] > n) high = mid - 1;
Today @ 8:37am
Tags:
2 Views
no comments
 
public class CoolingService2 implements ICoolingService {
  private static final Logger L = LoggerFactory.getLogger(CoolingService.class);
  private Connection connection;
  private int trayId;
  private int capacity;
  private Date expirationDate;
  private int placeNo;

  @Override
Today @ 8:36am
Tags:
3 Views
no comments
 
www.lafouinecdcc.wordpress.com

www.lafouinecdcc.wordpress.com

www.lafouinecdcc.wordpress.com
Today @ 8:09am
Tags:
10 Views
no comments
 
package com.javarush.task.task26.task2609;

/* 
Распределение элементов по корзинам с собственным локом
*/
public class Solution {
    private static final int NUMBER_LOCKS = 12;
    private final Node[] buckets;
    private final Object[] locks;

Today @ 8:08am
Tags:
11 Views
no comments
 
int cash; //количество денег в копейках
int 25c = cash / 25; //количество монеток по 25
int leftover = cash % 25; //получаем остаток
int 10c = leftover / 10; //получаем количество монеток по 10

   leftover = leftover % 10; //получаем остаток от остатка
   //и т.д.
Today @ 8:01am
Tags:
14 Views
no comments
 
int cash; //количество денег в копейках
int 25c; //количество монеток по 25
int 10c; //количество монеток по 10
int leftover; //остаток
   25c = cash / 25; //получаем количество монеток по 25
   lefttover = cash % 25; //получаем остаток
    
   10c = leftover / 10; //получаем количество монеток по 10
   leftover = leftover % 10; //получаем остаток от остатка
   //и т.д.
Today @ 7:58am
Tags:
16 Views
no comments
 
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;

import javax.swing.JFrame;
Today @ 6:58am
Tags:
25 Views
no comments
 
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Web;
using System.Web.UI.WebControls;
using Common.Enums;
using Continuum.BLL.EntitiesManager;
using Continuum.UI.Code;
using Continuum.UI.UserControls.CustomControls;
Today @ 6:36am
Tags:
29 Views
no comments
 
package com.kpi;

import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.Comparator;
import java.util.Date;
import java.util.List;

Today @ 6:32am
Tags:
32 Views
no comments
 
import java.sql.*;    
public class Test {
  private final static String DB_URL = "jdbc:oracle:thin:@//192.168.1.105:1521/MYORA";
  private final static String USER = "myuser";
  private final static String PASS = "mypwd";

  public static void main(String[] args) {
    Connection conn = null;  
    try {    
      Class.forName("oracle.jdbc.driver.OracleDriver");    
Today @ 6:13am
Tags:
34 Views
no comments
 
package com.homelearning;

import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Queue;

public class FixedSizeQueue<E> implements Queue<E> {
    private static final int DEFAULT_SIZE = 16;
    private Queue<E> queue;
Today @ 6:05am
Tags:
38 Views
no comments
 
self.X_pl = tf.placeholder(shape=[None, 84, 84, 4], dtype=tf.uint8, name="X")
# The TD target value
self.y_pl = tf.placeholder(shape=[None], dtype=tf.float32, name="y")
# Integer id of which action was selected
self.actions_pl = tf.placeholder(shape=[None], dtype=tf.int32, name="actions")

self.X_pl = tf.placeholder(shape=[None, 84, 84, 4], dtype=tf.uint8, name="X")
# The TD target value
self.y_pl = tf.placeholder(shape=[None], dtype=tf.float32, name="y")
# Integer id of which action was selected
Today @ 6:02am
Tags:
35 Views
no comments
 
@Controller
public class ParserController {
    @RequestMapping(value = "/parse", method = RequestMethod.POST, headers = "content-type=application/x-www-form-urlencoded;charset=UTF-8")
    public ResponseEntity<ParserBody> parseDocunment(@RequestBody ParserBody body) {
        if (body != null) {
            System.out.print(body.getXmlDocument());
        }
        return new ResponseEntity<ParserBody>(body, HttpStatus.OK);
    }
}
Today @ 6:00am
Tags:
37 Views
no comments
 
import json
import ast
from datetime import datetime
from datetime import timedelta
import numpy as np
gpsFile =  open('JSONGPSData.json','r')
lteFile = open('JSONLTEData.json','r')

gpsTime = []
Today @ 5:29am
Tags:
42 Views
no comments
 
import java.awt.*;
import java.util.*;
import javax.swing.*;
import java.awt.event.*;

public class MovingText extends JFrame implements ActionListener{
  JLabel label;
  JLabel label2;

  public MovingText()  {
by Vermels   Today @ 4:33am
Tags:
52 Views
no comments
 
#include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t--)
{
	int l;
	cin>>l;
	string s;
by Tejas   Today @ 4:31am
Tags: SnackDown
52 Views
no comments
 
//Authors: Michalis Delagrammatikas, Antonis Psaltis

package dianysmata;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Scanner;

public class Dianysmata {
Today @ 4:13am
Tags:
54 Views
no comments
 
//Authors: Michalis Delagrammatikas, Antonis Psaltis

package dianysmata;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Scanner;

public class Dianysmata {
Today @ 4:10am
Tags:
56 Views
no comments
 
#include <QTRSensors.h>

#define NUM_SENSORS   6
#define TIMEOUT       2500
#define EMITTER_PIN   2

QTRSensorsRC qtrrc((unsigned char[]) {
  3, 4, 5, 6, 7, 8
},
NUM_SENSORS, TIMEOUT, EMITTER_PIN);
Today @ 4:07am
Tags:
57 Views
no comments
 
<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>@ViewBag.Title</title>
</head>
<body>
    <h3>Asp MVC Layout Demo</h3>
    <div id="divmenu" style="background-color:lemonchiffon;border:1px solid black;color:white">
Today @ 4:06am
Tags:
58 Views
no comments
 
public class Triedenia {

    public static void main(String[] args) {
        int[] pole1 = new int[30000];
        int[] pole2 = new int[30000];
        Random gen = new Random();
        for (int i = 0; i < pole1.length; i++) {
            pole1[i] = gen.nextInt();
        }
        System.arraycopy(pole1, 0, pole2, 0, pole1.length);
by Vermels   Today @ 4:05am
Tags:
56 Views
no comments
 
//Gui 
//button 
final JFileChooser filechoose = new JFileChooser();
        filechoose.setCurrentDirectory(new File("C:\\"));
        int returnVal = filechoose.showOpenDialog(this);

        if (returnVal == JFileChooser.APPROVE_OPTION) {
            File file = filechoose.getSelectedFile();

            filename.setText(file.getAbsolutePath());
by Vermels   Today @ 4:03am
Tags:
57 Views
no comments
 
php
$handle = fopen('./diroot/file.txt','r');
$all_line = [];

if($handle){
 while (($line = fgets($handle)) !== false) {
 $current_line = explode("\t", '$line');
 $all_line[] = "('{$current_line[0]}', '{$current_line[1]}')";
  }
    
  $values = implode(",", $all_line);
by parsecode   Today @ 4:00am
Tags: php
56 Views
no comments
 
//GUI
//Button vyber subor 

 final JFileChooser filechoose = new JFileChooser();
        filechoose.setCurrentDirectory(new File("C:\\"));
        int returnVal = filechoose.showOpenDialog(this);

        if (returnVal == JFileChooser.APPROVE_OPTION) {
            File file = filechoose.getSelectedFile();
            subor = file;
by Vermels   Today @ 4:00am
Tags:
57 Views
no comments
 
// Gui konstruktor
   public Gui() {
        initComponents();
    }
    private File f;
    
// Worker 
public class Worker extends SwingWorker<Void, Void> {

        double min = Double.MAX_VALUE;
by Vermels   Today @ 3:55am
Tags:
59 Views
no comments
 
#include <QTRSensors.h>

#define NUM_SENSORS   6
#define TIMEOUT       2500
#define EMITTER_PIN   2

QTRSensorsRC qtrrc((unsigned char[]) {
  3, 4, 5, 6, 7, 8
},
NUM_SENSORS, TIMEOUT, EMITTER_PIN);
Today @ 3:48am
Tags:
59 Views
no comments
 
.directive('whenScrolled', function() {
        return function (scope, elm, attr) {
            $(window).scroll(function(){
                if ($(window).scrollTop() >= $(document).height() - $(window).height()) {
                    scope.$apply(attr.whenScrolled);
                }
            })
        }
    })
    
Today @ 3:41am
Tags:
63 Views
no comments
 
#include <QTRSensors.h>

#define NUM_SENSORS   6
#define TIMEOUT       2500
#define EMITTER_PIN   2

QTRSensorsRC qtrrc((unsigned char[]) {
  3, 4, 5, 6, 7, 8
},
NUM_SENSORS, TIMEOUT, EMITTER_PIN);
Today @ 3:07am
Tags:
69 Views
no comments
 
package worksheet;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;

Today @ 3:05am
Tags:
69 Views
no comments
 
#include <QTRSensors.h>

#define NUM_SENSORS   6
#define TIMEOUT       2500
#define EMITTER_PIN   2

QTRSensorsRC qtrrc((unsigned char[]) {
  3, 4, 5, 6, 7, 8
},
NUM_SENSORS, TIMEOUT, EMITTER_PIN);
Today @ 3:05am
Tags:
68 Views
no comments
 
#include <stdio.h>
#include <math.h>
#include <conio.h>
int chinhphuong(int m)
{
    float i;
   if(m == 1){
      return 1;
   }
   for (i = 2; i <= m / 2; i++){
Today @ 2:24am
Tags:
71 Views
no comments
 
/* v subore ahoj 10
jozef 24
juraj 22
jozef 15
 hhh hrca
#modra 5
mriezka 25 33
samorezka
*/

by Vermels   Today @ 2:19am
Tags:
72 Views
no comments
 
// args skuska1.txt

//main 
public static void main(String[] args) {
        for (int i = 0; i < args.length; i++) {
            new TokenCounter(args[i]);
        }
    }
   
// tokenCounter
by Vermels   Today @ 2:11am
Tags:
72 Views
no comments
 
// Main

public class TestThread {
      public static void main(String args[]) {
      int counter = 0; // zdielana premenna
      
      PrintDemo PD = new PrintDemo(counter);

      ThreadDemo T1 = new ThreadDemo( "Vlákno - 1 ", PD );
      ThreadDemo T2 = new ThreadDemo( "Vlákno - 2 ", PD );
by Vermels   Today @ 2:02am
Tags:
72 Views
no comments
 
//GUI button

 for (int i = 0; i <= 360; i += 10) {
            Double degree = (double) i;
            Double radians = Math.toRadians(degree);
            Double sinVal = Math.sin(radians);
            Double[] colValues = {degree, radians, sinVal};
            insertRow(jTable1, colValues);

        }
by Vermels   Today @ 1:59am
Tags:
76 Views
no comments
 
// Trieda Zakaznik 
public class Zakaznik {
    private String meno;
    private String priezvisko;
    private int vklad;

    public Zakaznik(String meno, String priezvisko, int vklad) {
        this.meno = meno;
        this.priezvisko = priezvisko;
        this.vklad = vklad;
by Vermels   Today @ 1:58am
Tags:
76 Views
no comments
 
//argumenty "d ano" sub1.txt sub2.txt

public class EditorTextSuborov {

    public EditorTextSuborov(String[] args) {
        for (int i = 1; i < args.length; i++) {
            vykonaj(args[0], args[i]);
        }
    }

by Vermels   Today @ 1:49am
Tags:
76 Views
no comments
 
======================================================= Error
=======================================================
Error: Strict error checking on, caught the following error or warning.
Error: file: C:/Users/Administrator/AppData/Local/Temp/tmpB1B7.tmp line 41: Render failed.
If this error message is unavoidable but not fatal, please email support@thinkboxsoftware.com with the error message, and disable the Maya job setting Strict Error Checking.
at Deadline.Plugins.PluginWrapper.RenderTasks(String taskId, Int32 startFrame, Int32 endFrame, String& outMessage, AbortLevel& abortLevel)


=======================================================
Today @ 1:49am
Tags:
75 Views
no comments
 
////////////////////////////////////////////////////////////////////////////
// Starting Mel program

proc renderIt(string $name) {

string $opt=""; string $rl=""; string $rp=""; float $resize=-1.; loadPlugin -quiet mtoa;;
removeRenderLayerAdjustmentAndUnlock defaultRenderGlobals.imageFilePrefix; catch(`setAttr -type "string" defaultRenderGlobals.imageFilePrefix "<RenderPass>/test"`);
workspace -fr "images" "K:/USER/Tong/swordman/_output/New_folder";workspace -fr "depth" "K:/USER/Tong/swordman/_output/New_folder";workspace -fileRule "images" "K:/USER/Tong/swordman/_output/New_folder";

Today @ 1:48am
Tags:
80 Views
no comments
 
//hned pod Triedou deklaracia
    private static final int velkostPola = 10000;
    private long timebubble = 0;
    private long timequick = 0;
    private boolean overbubble = false;
    private boolean overquick = false;

//Do buttonu 
   int[] pole1 = new int[velkostPola];
        int[] pole2 = new int[velkostPola];
by Vermels   Today @ 1:48am
Tags:
81 Views
no comments
 
i have uninstall keyshot from my computer

error message

[QUOTE]======================================================= Error
=======================================================
Error: Strict error checking on, caught the following error or warning.
Error: file: C:/Users/Administrator/AppData/Local/Temp/tmpB1B7.tmp line 41: Render failed.
If this error message is unavoidable but not fatal, please email support@thinkboxsoftware.com with the error message, and disable the Maya job setting Strict Error Checking.
Today @ 1:47am
Tags:
80 Views
no comments
 
// Dva jtextfield, jedno tlacidlo

v buttone;

String vstup = jTextAreaVstup.getText();
        vstup = vstup.replaceAll("\\s+", " ");
        vstup = vstup.trim();
        
        String[] slova = vstup.split(" ");
        String vystup = "";
by Vermels   Today @ 1:45am
Tags:
79 Views
no comments
 
Hyvää huolta auton voi varmasti tuo hyviä tuloksia sinut ja autosi. Se takaa parempaa suorituskykyä ja vähemmän stressiä sinulle omistajana. Tyre&Auto Southbourne Group tarjoaa seuraavat pari auton huolto neuvoo sinua on parempi polttoainetehokkuus, sekä säilyttää autosi arvo.

Koskaan ohittaa auton reittiliikennettä. Tyre&Auto Southbourne Group ymmärtää, että se maksaa vähän enemmän, mutta sen tarkoituksena on pitää auton käynnissä tehokkaasti ja turvallisesti. Kun päätät myydä auton myöhemmin, voit saada enemmän ostajia ja korkeampia hintoja Jos ylläpidät huoltohistoria jonossa ja ajan tasalla.

On myös parempi korvata ilmansuodatin. Asiantuntijat sanoi, että voit parantaa auton polttoainetaloutta kiihtyvyys noin prosentilla tilalle olosuhteissa Jos korvaat vanhojen ajoneuvojen ilmansuodattimet tukkeutunut carbureted moottorit.

Yksi yksinkertaisin auton huoltopalvelut toiminto varmistaa auton käynnissä kunnon on öljynvaihto. Ei ole ylläpitää sitä voi aiheuttaa ei-toivottuja tapahtumia, kuten mitätöi takuun tai moottori.

Lisäksi jäähdytysjärjestelmä pitäisi olla kunnossa. Harkitse järjestelmän värin ja pumppu, letkut, nesteet ja vyöt tarkastettava, koska ne ovat osa asianmukaista jäähdytys järjestelmän ylläpito. Auton rengaspaineet on otettava huomioon. Se on suositeltavaa saada rengas painemittari ja tarkistaa rengaspaineet säännöllisesti, kuten vapaa samoin.

82 Views
no comments
 
--------------------------------------------------------------
a - >  skokani , urok-kalkulacka , vyzitky
--------------------------------------------------------------
b - >  10-16 , Vypis viet obsahujuce slovo , Nasobilka
--------------------------------------------------------------
c - >  10 cisel , Combo box , Kalkulacka
--------------------------------------------------------------
d - >  vypis ocislovanich riad,Euro-kalkulacka,ang-svk slovnik
--------------------------------------------------------------
e - >  zaradenie do skupin , 2 - 8 
by Vermels   Today @ 1:42am
Tags:
83 Views
no comments
 
public static void main(String[ ] args) throws FileNotFoundException, IOException{
        JFileChooser chooser = new JFileChooser(FileSystemView.getFileSystemView().getHomeDirectory());
        int resulr = chooser.showOpenDialog(null);
        
        if(resulr== JFileChooser.APPROVE_OPTION){
            File file = chooser.getSelectedFile();
             BufferedReader bf = new BufferedReader(new FileReader(file));
             String row;
             while((row=bf.readLine())!=null){
                 row.split("\n");
by Vermels   Today @ 1:40am
Tags:
78 Views
no comments
 
public ButtonActionListener(Vsetko pod tymto treba vlozit do tlacidla){
                  String fileName="Datatabulka.txt";
                  DefaultTableModel model = (DefaultTableModel) jTable1.getModel() ;
                  model.setRowCount(0);
        
        
                  try{
                       Loadtable();
                    }catch (IOException ex) {
                        Logger.getLogger(Aplikacia.class.getName()).log(Level.SEVERE, null, ex);
by Vermels   Today @ 1:36am
Tags:
83 Views
no comments
 
public void Betesz(T uj)
        {
            if (fej == null)
                fej = new ListaElem<T>(uj, null);
            else if(0 < uj.CompareTo(fej.elem))
            {
                ListaElem<T> t = fej;
                fej = new ListaElem<T>(uj, t);
                fej.kov = t;
            }
Today @ 1:23am
Tags:
88 Views
no comments
 
 public static void saveData(String fileName, Object object) throws IOException{
     try(FileWriter  filewriter = new FileWriter(fileName,true);
        BufferedWriter bw = new BufferedWriter(filewriter);
        PrintWriter out = new PrintWriter(bw)){
       
        out.println(object);
        out.write("");
        }
    }
    
by Vermels   Today @ 1:13am
Tags:
86 Views
no comments
 
# Aufgabe 5
x = np.linspace(0,1,100)
fig, ax = plt.subplots()
def pltsin(low, high, order):
    cutoff = 40.
    if low > high:
        low = high
    y = butter_bandpass_filter(filtered_data, low, high, rate, order)
    plt.plot(t, filtered_data, color='g', label='Lowpass Filter')
    plt.plot(t, y, label="Bandpass Filter")
Today @ 12:56am
Tags:
91 Views
no comments
 
def abc(x, y, z):
  print "Called abc."
  
def defg(x,y,z):
  print "Called defg"

cond = False
callfunc = (abc,defg)[cond]
callfunc(1,2,3)
Today @ 12:41am
Tags:
91 Views
no comments
 
brought to you by:
West Wind Techologies