Skip to content

Instantly share code, notes, and snippets.

View alvareztech's full-sized avatar
:octocat:
Coding...

Daniel Alvarez alvareztech

:octocat:
Coding...
View GitHub Profile
@alvareztech
alvareztech / Main.java
Created October 4, 2016 00:39
Ejemplo LinkedList en Java
package tech.alvarez;
import java.util.LinkedList;
import java.util.ListIterator;
public class Main {
public static void main(String[] args) {
LinkedList<Estudiante> lista = new LinkedList<Estudiante>();
package tech.alvarez.intents;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
@alvareztech
alvareztech / activity_main.xml
Created September 24, 2016 21:23
LinearLayout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_segunda"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
tools:context="tech.alvarez.ejemploviews.SegundaActivity">
<TextView
@alvareztech
alvareztech / activity_main.xml
Created September 24, 2016 21:21
LinearLayout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_segunda"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="tech.alvarez.ejemploviews.SegundaActivity">
<TextView
@alvareztech
alvareztech / activity_main.xml
Created September 24, 2016 21:17
Ejemplo componente centro. Curso de desarrollo de aplicaciones Android
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_segunda"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="tech.alvarez.ejemploviews.SegundaActivity">
<TextView
android:layout_width="100dp"
@alvareztech
alvareztech / Constantes.java
Created September 21, 2016 04:09
Ejercicio Hospital Pilas Colas en Java
package tech.alvarez;
public class Constantes {
public static final int SIN_ESPECIALIDAD = 0;
public static final int ESPECIALIDAD_ODONTOLOGIA = 1;
public static final int ESPECIALIDAD_NEUROLOGIA = 2;
public static final int ESPECIALIDAD_PEDIATRIA = 3;
}
@alvareztech
alvareztech / activity_main.xml
Created September 17, 2016 21:27
Ejemplo realizado en clase
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
@alvareztech
alvareztech / .js
Last active April 30, 2017 04:46
Get all data JavaScript object
for(key in data) {
if(data.hasOwnProperty(key)) {
var value = data[key];
console.log(value);
}
}
@alvareztech
alvareztech / .java
Last active September 14, 2016 04:15
Sugerencia solución
// SUGERENCIA DE SOLUCIÓN
Queue<Vehiculo> colaVehiculos = new LinkedList<Vehiculo>();
Queue<Soat> colaPrioridadSoats = new PriorityQueue<Soat>(); // Clase Soat debe ser comparable
Queue<Soat> tempColaPrioridadSoats = new PriorityQueue<Soat>();
// adicionar datos a las colas (no a la temporal)
while (!colaPrioridadSoats.isEmpty()) {
Soat s = colaPrioridadSoats.remove();
@alvareztech
alvareztech / .java
Created September 14, 2016 03:59
Métodos mostrar cola simple y cola de prioridad en Java
public static void mostrarColaPrioridad(Queue<Persona> colaPrioridad) {
System.out.println("mostrar");
Queue<Persona> temp = new PriorityQueue<Persona>();
while (!colaPrioridad.isEmpty()) {
Persona p = colaPrioridad.remove();
System.out.println("Nombre: " + p.getNombre());
temp.add(p);
}
while (!temp.isEmpty()) {
Persona p = temp.remove();