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
// (c) http://www.obomprogramador.com | |
// REST / JSON WS implementation with Node.js calling Java | |
var restify = require('restify') | |
var server = restify.createServer() | |
var fs = require('fs') | |
var java = require('java') | |
java.classpath.push("lib/joda-time-2.3.jar") | |
java.classpath.push("lib/mongo-java-driver-2.11.4.jar") |
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
/** | |
* TokenController | |
* | |
* @module :: Controller | |
* @description :: A set of functions called `actions`. | |
* | |
* Actions contain code telling Sails how to respond to a certain type of request. | |
* (i.e. do stuff, then send some JSON, show an HTML page, or redirect to another URL) | |
* | |
* You can configure the blueprint URLs which trigger these actions (`config/controllers.js`) |
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
<html> | |
<head> | |
<title>*** Ajax básico ***</title> | |
<script> | |
function iniciaRequest(url) { | |
// Teste do Browser | |
if(window.XMLHttpRequest) { | |
// Não é MS Internet Explorer |
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 com.obomprogramador.tutoriais.testes.emprestimos; | |
import static org.fest.assertions.Assertions.assertThat; | |
import javax.swing.JFormattedTextField; | |
import javax.swing.JPanel; | |
import javax.swing.JRadioButton; | |
import javax.swing.border.TitledBorder; | |
import org.fest.swing.core.GenericTypeMatcher; |
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
// blocker.js | |
/* | |
This code is a bad example! It will | |
block the server. It is for demonstration | |
only. | |
*/ | |
var restify = require('restify'); | |
var fs = require('fs'); |
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
// blockerbal.js | |
/* | |
This code is a bad example! It will | |
block the server. It is for demonstration | |
only. | |
Arguments: port number | |
*/ | |
var restify = require('restify'); |
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
/* | |
* Script de eventos da página index.html | |
*/ | |
var chave = null; | |
var calculando = false; | |
var original = ''; | |
$(document).ready(function(){ | |
$("#btn").click(function(){ | |
if (!calculando) { |
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
/* | |
Copyright 2014 Cleuton Sampaio | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 | |
Unless required by applicable law or agreed to in writing, software |
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
/* | |
* Página default: | |
*/ | |
var Worker = require('webworker-threads').Worker; | |
var redis = require("redis"); | |
var uuid = require('node-uuid'); | |
exports.index = function(req, res){ | |
res.render('index', { title: 'Operação assíncrona', botao: 'Iniciar' }); |
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
async.waterfall([ | |
function(callback){ | |
// ***** Task 1: Apaga o banco de dados | |
db.once('open', function () { | |
db.db.dropDatabase(function(err) { | |
if(err != null) { | |
console.log('Erro ao apagar o banco: ' + err); | |
} | |
else { |