Copiando la entrada de Kirai. Hago mi lista:
1._Acostarme pronto y levantarme pronto, me ayuda a exprimir más el día.
2._Leer me ayuda para mejorar profesional y personalmente, además tener una mente abierta al mundo que tengo a mi alrededor.
3._Rezar me ayuda a mantener mi equilibrio interior y tener paz conmigo mismo y con los demás.
4._Sigo luchando por los sueños que tengo sin realizar.
5._Desconectar. Hacer cosas que me llenan, me motivan, me ayuda a recargar las pilas.
6.-Hacer deporte, me ayuda para los dolores de espalda, me hace estar más relajado, dormir mejor, liberar toxinas, ...
7._La primera, la segunda, la tercera, la ... No salen bien las cosas, un ejemplo de constancia son Edison con la bombilla o James Dyson con la aspiradora. He aprendido mucho de mis fracasos y errores. En la vida hay caídas, pero hay que levantarse, aprender de los errores y seguir.
8._Algunas veces hago un parón, para reflexionar, ver cómo van las cosas y coger impulso para continuar.
9._Hay dos tipos de hombres: los hacedores, que su principal objetivo es hacer las cosas y hacerlas bien, y los habladores, que se dedican a mover la lengua. Un hombre se define principalmente por lo que hace, no por lo que dice. Como en todo hay excepciones.
10._Ser fiel a uno mismo, es un gran paso para ser más feliz.
11._No hablar mal de nadie. Muchas veces me digo, estoy más guapo callado :-(
12._Llevar una vida ordenada, me está ayudando a perseverar y a llegar a las metas.
13._Trabajar profesionalmente en un proyecto que realmente me gusta y me motiva, ya no es trabajo rutinario, aburrido y desmotivador.
14._Tener un mentor, me ayuda a progresar, porque es una persona objectiva que me conoce muy bien y me dice las cosas que nadie me dice, para que mejore.
15._En la vida algunas veces se gana, otras veces se pierde, pero nunca hay que darse por vencido, simplemente hay que dejar pasar el momento que toca perder.
16._La humildad, como arma para mejorar y aprender. He visto en muchas personas que el creerse estar por encima de los demás le han traído catastróficas consecuencias. Agachar la cabeza me cuesta, pero siempre biene muy bien para ponerme en mi sitio y darme cuenta de lo que realmente soy: "cuanto más alto te creer, más dura será la caída".
17._Mi madre dice que medio mundo habla mal del otro medio. Intento solo hacer caso, a los que realmente buscan mi bien.
18._Nunca terminaré de aprender cosas.
19._Sonreir, ser y estar alegre. Es un buen método para disfrutar realmente de la vida.
20._No hay que tener miedo a estar solo, como dice el refrán: "es mejor estar solo que mal acompañado". Pero siempre en la vida es mejor caminar junto a alguien.
21._Muchas veces es mejor callarse antes que discutir, porque pueden ser tiempo y esfuerzo perdidos.
22._Un compañero de trabajo me dice: "Luis, no te acojones". Pues eso.
23._Cuando he quitado horas al sueño, mi cuerpo lo ha notado y mi carácter también.
24._Disfruta del camino, porque la meta está demasiado lejos todavía.
25._El odio y el rencor no sirven para nada.Gritar y echar la bronca no es la solución, es mejor motivar y animar.
26._Kaizen, mejoras pequeñas pero constantes.
27._Es más importante el tiempo y las personas, que el dinero.
28._La vida es un constante cambio, solo hay que adaptarse a él.
29._El dolor forma parte de la vida, no se puede vivir sin él, solo hay que entenderlo y encontrar su significado.
30._Me parece importante dar gracias, porque la vida es puro regalo. Ser agradecido es de buen nacido.
martes, 3 de septiembre de 2013
jueves, 29 de agosto de 2013
Contando 200 cosas
Cuando comencé esto, no pensaba que iba a tener tanto que escribir.
Como es un número redondo, voy a poner un par de videos que me traen muy buenos recuerdos
Los enemigos - Sueña por mí
Los enemigos - La carta que no
Como es un número redondo, voy a poner un par de videos que me traen muy buenos recuerdos
Los enemigos - Sueña por mí
Los enemigos - La carta que no
martes, 23 de julio de 2013
Kaleidos Manifest
- In the beginning, it's the people
- Code should be beautiful
- Customers are not a necessary evil
- Love your work and your work will be loved
- Shelfware is wrong
- Let us surprise you
- 1.618033988749894848204586834
- In the end, it's the people
nice!!!!
jueves, 11 de julio de 2013
Playing with AutoMapper & DataTable in C#
Some time ago, I mapped every colum from database in a POCO. This task was very boring, so for the next project, I´ve found a solution is AutoMapper.
The simple, but real example.
We have a POCO or a DTO User:
We have the mapper:
The Test (I use fluent Assertions):
The simple, but real example.
We have a POCO or a DTO User:
using System;
public class User
{
public int ID { get; private set; }
public string Name { get; private set; }
public string LastName { get; private set; }
public int Age { get; private set; }
public User WithID(int id)
{
ID = id;
return this;
}
public User WithName(string name)
{
Name = name;
return this;
}
public User WithLastName(string lastName)
{
LastName = lastName;
return this;
}
public User WithAge(int age)
{
Age = age;
return this;
}
public User()
{
ID = 0;
Name = string.Empty;
LastName = string.Empty;
Age = 0;
}
}
We have the mapper:
using System;
using AutoMapper;
using System.Data;
using System.Collections.Generic;
public class UserMapper
{
public IEnumerable Map(DataTable data)
{
AutoMapper.Mapper.Reset();
AutoMapper.Mapper.CreateMap()
.ForMember(t => t.ID, f => f.MapFrom(r => r["IdUser"]))
.ForMember(t => t.LastName, f => f.MapFrom(r => r["Last_Name"]));
return AutoMapper.Mapper.Map>(data.CreateDataReader());
}
}
The Test (I use fluent Assertions):
using System;
using System.Linq;
using System.Collections.Generic;
using System.Data;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using PruebaAutoMapper;
using System.Collections;
using FluentAssertions;
private DataTable CreateDataTable()
{
var result = new DataTable();
result.Columns.Add(new DataColumn("IdUser", typeof(int)));
result.Columns.Add(new DataColumn("Name", typeof(string)));
result.Columns.Add(new DataColumn("Last_Name", typeof(string)));
result.Columns.Add(new DataColumn("Age", typeof(int)));
result.Rows.Add(1, "NameI", "Last_NameI", 1);
result.Rows.Add(2, "NameII", "Last_NameII", 2);
result.Rows.Add(3, "NameIII", "Last_NameIII", 3);
result.Rows.Add(4, "NameIV", "Last_NameIV", 4);
return result;
}
private IEnumerable CreateList()
{
var result = new List();
result.Add(new User().WithID(1).WithName("NameI").WithLastName("Last_NameI").WithAge(1));
result.Add(new User().WithID(2).WithName("NameII").WithLastName("Last_NameII").WithAge(2));
result.Add(new User().WithID(3).WithName("NameIII").WithLastName("Last_NameIII").WithAge(3));
result.Add(new User().WithID(4).WithName("NameIV").WithLastName("Last_NameIV").WithAge(4));
return result;
}
[TestMethod()]
public void MapTest()
{
UserMapper mapper = new UserMapper();
var data = CreateDataTable();
var expected = CreateList();
var actual = mapper.Map(data);
expected.ToList().ShouldAllBeEquivalentTo(actual.ToList());
}
}
Creating Javascript Fluent Api
First of all the tests, using Jasmine (making TDD):
The code:
Source
describe("Test for Fluent Car", function(){
it("Create simple Object Car", function () {
var car = new Car();
expect(car).not.toBeNull();
})
it("initialize Model", function () {
var car = new Car();
var model = 'Model';
car.withModel(model);
expect(car.Model()).toEqual(model);
})
it("initialize Model & Gas", function () {
var car = new Car();
var model = 'Model';
var gas = 120;
car.withModel(model)
.withGas(gas);
expect(car.Model()).toEqual(model);
expect(car.Gas()).toEqual(gas);
})
it("initialize Make & Model & Gas", function () {
var car = new Car();
var make = 'make';
var model = 'Mmdel';
var gas = 120;
car.withModel(model)
.withMake(make)
.withGas(gas);
expect(car.Model()).toEqual(model);
expect(car.Make()).toEqual(make);
expect(car.Gas()).toEqual(gas);
})
it("initialize Height & Width", function () {
var car = new Car();
var height = 147;
var width = 259;
car.withHeight(height)
.withWidth(width);
expect(car.Height()).toEqual(height);
expect(car.Width()).toEqual(width);
})
});
The code:
function Car(){
this._make = '';
this._model = '';
this_gas = 0;
this._height = 0;
this._width = 0;
function Make(){
return this._make;
}
function withMake(make){
this._make = make;
return this;
}
function Model(){
return this._model;
}
function withModel(model){
this._model = model;
return this;
}
function Gas(){
return this._gas;
}
function withGas(gas){
this._gas = gas;
return this;
}
function Height(){
return this._height;
}
function withHeight(height){
this._height = height;
return this;
}
function Width(){
return this._width;
}
function withWidth(width){
this._width = width;
return this;
}
return{
Make:Make,
withMake:withMake,
Model:Model,
withModel:withModel,
Gas:Gas,
withGas:withGas,
Width:Width,
withWidth:withWidth,
Height:Height,
withHeight:withHeight
}
}
Source
lunes, 10 de junio de 2013
asynch log vs normal log
Some time ago, my program manager said to me that, remove the system logger, because, made the web application slower.
Yesterday I thought, I can write an asynch logger for improving the performance of the application in c# 4.0, with Visual Studio 2010.
The main idea is this:
All the code
A simple test:
Yesterday I thought, I can write an asynch logger for improving the performance of the application in c# 4.0, with Visual Studio 2010.
The main idea is this:
public void Write(string message)
{
Task.Factory.StartNew(() => WriteTheMessage(message));
}
private static void WriteTheMessage(string message)
{
lock (_locker)
{
using (StreamWriter writer = File.AppendText(path))
{
writer.WriteLine(message);
}
}
}
All the code
A simple test:
Repository Pattern
I've added a new utility in my github repo is a simple implementation of repitory pattern.
I've found the original code: carl-berg
I've found the original code: carl-berg
Suscribirse a:
Entradas (Atom)

