Free Software 4 Ever
It not matter so much 'echo to /dev/null'
lunes, 21 de noviembre de 2011
martes, 15 de noviembre de 2011
Miso está aquí .....
http://misomx.heroku.com es un sitio web para anunciarte gratis solo paga por estar en la entrada principal, hay servicio de SMS a todo Mexico y USA. Siempre mantente informado haz que te sigan como twitter y oferta o haz campañas, actualiza tu ubicacion usango google maps y se buscable de otra manera.
viernes, 28 de octubre de 2011
Paginando objetos con will_paginate.
Abre tu shell e invoca al irb...
una vez echo eso llama a tu gema instalada require 'blah blah' como la imagen de arriba, escribe el siguiente código
Y ahora paginemos...
En el primer ejemplo tenemos un array de 30 elementos y quiero paginarlo de 3 en 3 y estoy ubicado en la primera página de ese array ve los resultados. En el segundo ejemplo tengo un array igual de 30 elementos, la paginacián es de 10 en 10 y estoy en la 1a pagina, luego en el último estoy en la 3 página para paginación de 10 en 10.
una vez echo eso llama a tu gema instalada require 'blah blah' como la imagen de arriba, escribe el siguiente código
Y ahora paginemos...
En el primer ejemplo tenemos un array de 30 elementos y quiero paginarlo de 3 en 3 y estoy ubicado en la primera página de ese array ve los resultados. En el segundo ejemplo tengo un array igual de 30 elementos, la paginacián es de 10 en 10 y estoy en la 1a pagina, luego en el último estoy en la 3 página para paginación de 10 en 10.
domingo, 17 de julio de 2011
Mono 2.12 is out but ...
GGC Says: In this version is there WCF support to work ...
Icaza Says: WCF remains a technology under development, and we strongly advise users to pick alternative technologies like Protocol Buffers.
Icaza Says: WCF remains a technology under development, and we strongly advise users to pick alternative technologies like Protocol Buffers.
Mono C# and LINQ
Here a little of code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication
{
class Program
{
static void Main(string[] args)
{
int[] nums = new int[] { 0, 4, 2, 6, 3, 8, 3, 1 };
var result = from n in nums
where n < 5
orderby n
select n;
foreach (int i in result)
Console.WriteLine(i);
Console.WriteLine();
var result1 = nums.Where(n => n < 5).OrderBy(n => n);
foreach (int i in result1)
Console.WriteLine(i);
Console.WriteLine();
var result2 = nums
.Where(n => n < 5)
.OrderBy(n => n);
foreach (int i in result2)
Console.WriteLine(i);
Console.ReadLine();
}
}
}
Compile with:
gmcs your_file_in_csharp.cs
And see the output.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication
{
class Program
{
static void Main(string[] args)
{
int[] nums = new int[] { 0, 4, 2, 6, 3, 8, 3, 1 };
var result = from n in nums
where n < 5
orderby n
select n;
foreach (int i in result)
Console.WriteLine(i);
Console.WriteLine();
var result1 = nums.Where(n => n < 5).OrderBy(n => n);
foreach (int i in result1)
Console.WriteLine(i);
Console.WriteLine();
var result2 = nums
.Where(n => n < 5)
.OrderBy(n => n);
foreach (int i in result2)
Console.WriteLine(i);
Console.ReadLine();
}
}
}
Compile with:
gmcs your_file_in_csharp.cs
And see the output.
Ruby VS C#
Ruby equivalent of C# Linq Aggregate method
You have this code in C#:
var factorial = new[] { 1, 2, 3, 4, 5 }.Aggregate((acc, i) => acc * i)
And Ruby responses:
factorial = (1..5).reduce(:*)
or maybe
factorial = 1.upto(5).reduce(:*)
or
factorial = [1, 2, 3, 4, 5].reduce(:*)
More info:
http://stackoverflow.com/questions/5036836/ruby-equivalent-of-c-linq-aggregate-method
domingo, 12 de junio de 2011
Get IP from Ruby
Ok here my code. It works with Ruby 1.9 on my Arch Linux, i hope it be useful
=begin
GNU GPL v3
(C) Gerardo Gonzalez Cruz gerardogc2378@gmail.com
June 2011
=end
require 'ipaddr'
require 'net/http'
class Utils
def check_ip_on_dydns
con = Net::HTTP.new('checkip.dyndns.org', 80)
resp,body = con.get("/")
ip = body.match(/\d+\.\d+\.\d+\.\d+/)
ip[0]
end
def get_ip
return IPAddr.new(check_ip_on_dydns).to_s
end
end
references:
Happy Hackin'
=begin
GNU GPL v3
(C) Gerardo Gonzalez Cruz gerardogc2378@gmail.com
June 2011
=end
require 'ipaddr'
require 'net/http'
class Utils
def check_ip_on_dydns
con = Net::HTTP.new('checkip.dyndns.org', 80)
resp,body = con.get("/")
ip = body.match(/\d+\.\d+\.\d+\.\d+/)
ip[0]
end
def get_ip
return IPAddr.new(check_ip_on_dydns).to_s
end
end
references:
- http://checkip.dyndns.org/
- http://www.ruby-forum.com/
Happy Hackin'
Suscribirse a:
Entradas (Atom)