miércoles, 12 de diciembre de 2018

React : Generic update fields.

Maybe the most commont task on react programming, is to update the value on the html component.

 We have to attacth the state property to the value property on the field in order to set the values, and we have to bind the Onchange property on the react component to a method that will update the value on the state.

   This how I implement this both properties,

  //Onsingle method for all the properties.
updateUserValues = (e,fieldname) => {
e.preventDefault();
//We clone the object
const newvalues = {
...this.state.usuarioinfo
};
//We update the field property
newvalues[fieldname]=e.target.value;
//We update the state
this.setState({
usuarioinfo :{
...newvalues
}
});
}



    <input name=""
value={props.usuarioinfo.phonenumber} <- bind="" component="" div="" of="" property="" the="" value="" we="">
//we bind the onchange property to our generic method, sending the e argument, and
// the fieldname that we are going to update.
onChange={(e) => props.updateUserValues(e,'phonenumber') }
type="text"/>

lunes, 27 de agosto de 2018

VIM TIP

Problema: una tabla con muchos campos. Select
,[campo1]
,[campo2]
,[campo3]
,[campon]
from x;
Tienes que hacer el isnull(campo,'') as campo.
Solucion vim :
1.-selecionar los campos, vj :visual mode , j baja hasta que tengas todos los campos.
2.-norm f,aisnull( , busca la primera coma, inserta despues del cursor isnull(,
3.-gv vuelve a selecionar la ultima selccion.
4.-norm f]a,'') as , busca busca ], entonces inserta despus ,'') as,
5.-gv
6.-norm f[wy$ap , busca el primer [, seleciona la siguiente palabra, la copia, ir al final de la linea, insertar despues.
Resultado
select
,isnull(campo1,'') as campo1,
etc....
from tablax;

miércoles, 11 de enero de 2017

Mobile Apps with Xamarin.Forms Book First Edition



I have been playing with Xamarin for a while. Now that I have decided to become a Xamarin developer, I have started the ebook  "Mobile Apps with Xamarin.Forms Book First Edition" . The first chapter gives you intro to the problem when you want to have your app  in different plataform, I think , as you know, Xamarin let you to writte code and deployed to IOS , Android and windows phone , and with the help with Xamarin.Form framework, help you to to code just one and deploy to desire devices.

Here you will be familiar with the term App, that is the main entry of a Xamarin application, this class has  a property called MainPage, as you imagine, set the page you will see in  the mobile application.

What I have learned from this easy but good introduction to Xamarin.Form, is that with the ios implementation, when you have  a content page, and you dont have a navigation tab, the contenpage intrude with the status bar. To avoid this, you have to add a padding of 20 units pixels on top of the contentpage class of you main page.

If you already have follow some tutorial on Xamarin, you can skip this chapter if you have already follow some xamarin tutorial on internet. If not, this is a great start to start to learning xamarin.


My code 

martes, 16 de agosto de 2016

Vim Cheat Sheet



Here is my Vim Cheat Sheet, now that im learning the MEAN stack, i think VIM fills for the perfect ide tool. Im learning with Cloud 9 ide, it has a vim mode.  this vim cheat sheet is not too explaining , but it is a shortcut reminder for myself, of the tutorial i took here http://www.openvim.com/ . I strongly recommend you to spend the short course, with just 30 minutes you will be using vim as semi pro user.



h = LEFT KEY 
k = UP KEY 
l = RIGTH KEY 
j = DOWN KEY 
w = goes to the beginning of the next word 
e = goes to the end of the next word 
b = goes to the earlier word 

NUMBER+ i + text = inserta N veces el texto 

f + Character = find a character
NUMBER + f + Character = find the n concurrence of the character, 3fH  HHH goest to last H

0 zero = goes to first character  of the line
$ goes to the last character of the line

  • * = find the next word of the current word of the cursor
# find the previous word of the current word of the cursor

gg =goes to first character  of the file
G=goes to the last character of the file
/+text = search for the text
n = next text of searched
N = previous text of searched
o = Insert a new line in next line of cursor
O = insert a  new line in previous line of cursor
x = delete next Character
X = delete previous Character
r = replace one Character
d= delete a word 
. = repeats last command 
u= undo

control + r = undo the undo

lunes, 9 de enero de 2012

Error 5efc7975-14bc-11cf-9b2b-00aa00573819 : 17 (Solution)

Well these error happens if you have a form base and add a control belong to the visual powerpacks, in the microsoft forums it says that it is a bug and will be fixed in incoming relases. but here in a post found the solution.
http://social.msdn.microsoft.com/Forums/en/winformsdesigner/thread/28f2df35-3445-4b4d-bc53-96cd74ce5155?prof=required

I just wonder how many times i have faced weird problems and found the solution but never post something about it. I hope it help people to find the solution quickly.

In the form base you have to remove the visual power variables and used as local variable in InitializeComponent().

martes, 3 de enero de 2012

is these philosophie or programing topic

Im following a tutorial from codeacademy about javascript and found a topic very interesting the world of philosphie and basic knowledge in programming here is

In JavaScript, there are 6 "falsy" values (values that evaluate to false):

false, null, undefined, 0, "" (the empty string), and NaN

Anything else evaluates to true.



Michel Foucault says that there is not true about knowlege in the life, it is building with the time and the role that people play about certain object. So with the history is building the knowlege until for the last generation a knowlege is teached as the true thing. In progamming first you have to know that certains value return true not because its a true indepent of human knowlege just because many people say hey , these is going to be truee so like Foucault says Knowlege is builded.

martes, 19 de julio de 2011

Fragmento de Una Sociedad que se Organiza de Monsivais

Cuanto falta en Mexico para el pleno ejercicio de la democracia?Desde su prèdica del frenesì que nada cambia, la clase gobernante desprecia lo que ve o creer ver: las masas ingobernables por irredimibles, masas indòciles y sumisas, masas regidas por el complicado matrimonio entre desobediencia y relajo. En el otro extremo, quienes ejercen la demorcacia desde abajo y sin pedir permiso amplian sus derechos ejerciendolos.

Para estos grupos, la democracia es, en lo fundamental el aprendizaje de la resistencia civil, que inicia en la defensa de la legalidad,ante la ilegalidad practicada desde las esferas del poder economico y politico. Y la democracia es tambièn la terquedad indignada, el abandono de formulas de martirologio, el apego a la racionalidad, la busqueda del avance gradual, la estrategia de la movilizaciòn permanente:plantones,march​as,mìtines,asambleas,exige​nciade diàlogo con las utoridades correspondientes, boteo,volanteo, pintas, ocasionales huelgas de hambre,arduos viajes a la capital para instalar campamentos de la Dignidad.

A las marchas y las asambleas, los jùbilos o los resentimientos, los ordena el deso de autonomìa. A la gente le urge conducir sus propios destinos. El partenalismo agotò sus persuasiones y el ensueño del Progreso ha resultado desvastador.

Entrada libre a la historia o al presente, ...de modo perceptible los protagonistas parecen imbuidos en la nociòn de Scott Fitzgerald: "La verdadera prueba de una inteligencia superior es poder convervar simultàneamente en la cabeza dos ideas opuestas, y seguir funcionando. Admitir por ejemplo que las cosas no tienen remedio y mantenerse sim embargo decidido a cambiarlas "