Skip to content

Instantly share code, notes, and snippets.

@s00rk
s00rk / Edad.cpp
Created April 19, 2016 21:41
edad.cpp
#include <iostream>
#include <stdlib.h>
#include <time.h>
using namespace std;
int main()
{
time_t tiempo = time(NULL);
struct tm *fecha = localtime(&tiempo);
@s00rk
s00rk / cuanto_comprar.php
Last active March 26, 2016 04:37
by s00rk
<?php
function cuanto_comprar($stock, $maquinas)
{
$res = [];
foreach($maquinas as $maquina)
{
foreach($maquina as $elemento => $valor)
{
if($stock[ $elemento ] < $valor)
{
Scanner ss = new Scanner(System.in);
String frase;
char letra;
System.out.println("Introduce una frase: ");
frase = ss.nextLine();
System.out.println("Introduce una letra: ");
letra = ss.nextLine().charAt(0);
int cant = 0;
var formData = new FormData($('#IdFormulario')[0]);
$.ajax({
url: 'SERVIDOR',
type: 'POST',
success: function(resp){
// Aqui va cuando todo va bien!
},
data: formData,
cache: false,
CREATE TRIGGER BonoOutlet
ON Andrea.Pedido AFTER INSERT
AS
DECLARE @pedido AS int
SELECT TOP 1 @pedido=IdPedido FROM Pedido WHERE IdPedido != inserted.IdPedido Order By IdPedido DESC
IF EXISTS (SELECT * FROM Pedido p INNER JOIN PedidoDetalle pd ON p.IdPedido=pd.IdPedido INNER JOIN CatalogoProducto cp ON cp.IdProducto=pd.IdProducto INNER JOIN Catalogo c ON c.idCatalogo=cp.idCatalogo WHERE p.IdPedido = @pedido AND DATEDIFF(day, p.Fecha, inserted.Fecha) > 30 AND c.Nombre = 'Outlet')
BEGIN
UPDATE p SET p.Descuento = (p.Importe*0.05), p.Importe = (p.Importe-(p.Importe*0.05)) FROM Pedido p
private static String readUrl(String urlString) throws Exception {
BufferedReader reader = null;
StringBuffer buffer = new StringBuffer();
try {
URL url = new URL(urlString);
reader = new BufferedReader(new InputStreamReader(url.openStream()));
int read;
char[] chars = new char[1024];
while ((read = reader.read(chars)) != -1)
protected void addItems(){
ListView listview = (ListView) findViewById(R.id.listViewConferences);
List<ItemString> lista = new ArrayList<>();
JSONArray json = null;
Log.i("pp", "pRUEBA");
try{
json = readJsonFromUrl("http://admin.sisei.mx/api/conferencia/?format=json");
if(json == null){
return;
}
private static String readAll(Reader rd) throws IOException {
StringBuilder sb = new StringBuilder();
int cp;
while ((cp = rd.read()) != -1) {
sb.append((char) cp);
}
return sb.toString();
}
public static JSONArrayObject readJsonFromUrl(String url) throws IOException, JSONException {
package listas_project;
public class Nodo
{
private int NoControl;
private String Nombre;
private int Edad;
public Nodo(int nocontrol, String nombre, int edad)
program piramide;
var
a: integer;
begin
ReadLn( a );
for i := 1 to a do
begin
for b := 1 to i do