|
5473
|
Foros Generales / Foro Libre / Re: ayuda para independizarme
|
en: 13 Abril 2015, 09:05 am
|
hola mi nombre es Enrique y vivo con mi madre tengo 30 años de eda bueno yo quiero independisame, estoy buscando prestamista por internet y todo son legares bueno pues entoce e desidido pedirle un credito a la mafia estoy pensando en ir a clubs de alterne a intenta da con la mafia pero no me atrevo balla que sea una mafia solo especialisada en mujeres y se cabreen aver si arguien de foro me puede aurienta, saludos. . .. ...
|
|
|
5474
|
Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Compartan aquí sus snippets)
|
en: 11 Abril 2015, 15:05 pm
|
Transformar una imagen a blanco y negro: ''' <summary> ''' Transforms an image to black and white. ''' </summary> ''' <param name="img">The image.</param> ''' <returns>The black and white image.</returns> Public Shared Function GetBlackAndWhiteImage(ByVal img As Image) As Image Dim bmp As Bitmap = New Bitmap(img.Width, img.Height) Dim grayMatrix As New System.Drawing.Imaging.ColorMatrix( { New Single() {0.299F, 0.299F, 0.299F, 0, 0}, New Single() {0.587F, 0.587F, 0.587F, 0, 0}, New Single() {0.114F, 0.114F, 0.114F, 0, 0}, New Single() {0, 0, 0, 1, 0}, New Single() {0, 0, 0, 0, 1} }) Using g As Graphics = Graphics.FromImage(bmp) Using ia As System.Drawing.Imaging.ImageAttributes = New System.Drawing.Imaging.ImageAttributes() ia.SetColorMatrix(grayMatrix) ia.SetThreshold(0.5) g.DrawImage(img, New Rectangle(0, 0, img.Width, img.Height), 0, 0, img.Width, img.Height, GraphicsUnit.Pixel, ia) End Using End Using Return bmp End Function
|
|
|
5475
|
Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Compartan aquí sus snippets)
|
en: 11 Abril 2015, 13:38 pm
|
Una simple función que publiqué en S.O para cifrar/descifrar un String mediante la técnica de Caesar. Ejemplo de uso: Dim value As String = "Hello World!" Dim encrypted As String = CaesarEncrypt(value, shift:=15) Dim decrypted As String = CaesarDecrypt(encrypted, shift:=15) Debug. WriteLine(String. Format("Unmodified string: {0}", value )) Debug. WriteLine(String. Format("Encrypted string: {0}", encrypted )) Debug. WriteLine(String. Format("Decrypted string: {0}", decrypted ))
Source: ''' <summary> ''' Encrypts a string using Caesar's substitution technique. ''' </summary> ''' <remarks> http://en.wikipedia.org/wiki/Caesar_cipher </remarks> ''' <param name="text">The text to encrypt.</param> ''' <param name="shift">The character shifting.</param> ''' <param name="charSet">A set of character to use in encoding.</param> ''' <returns>The encrypted string.</returns> Public Shared Function CaesarEncrypt(ByVal text As String, ByVal shift As Integer, Optional ByVal charSet As String = "abcdefghijklmnopqrstuvwxyz" & "ABCDEFGHIJKLMNOPQRSTUVWXYZ" & "0123456789" & "çñáéíóúàèìòùäëïöü" & "ÇÑÁÉÍÓÚÀÈÌÒÙÄËÏÖÜ" & " ,;.:-_´¨{`^[+*]ºª\!|""#$~%€&¬/()=?¿'¡}*") As String Dim sb As New System.Text.StringBuilder With {.Capacity = text.Length} For Each c As Char In text Dim charIndex As Integer = charSet.IndexOf(c) If charIndex = -1 Then Throw New ArgumentException(String.Format("Character '{0}' not found in character set '{1}'.", c, charSet), "charSet") Else Do Until (charIndex + shift) < (charSet.Length) charIndex -= charSet.Length Loop sb.Append(charSet(charIndex + shift)) End If Next c Return sb.ToString End Function ''' <summary> ''' Decrypts a string using Caesar's substitution technique. ''' </summary> ''' <remarks> http://en.wikipedia.org/wiki/Caesar_cipher </remarks> ''' <param name="text">The encrypted text to decrypt.</param> ''' <param name="shift">The character shifting to reverse the encryption.</param> ''' <param name="charSet">A set of character to use in decoding.</param> ''' <returns>The decrypted string.</returns> Public Shared Function CaesarDecrypt(ByVal text As String, ByVal shift As Integer, Optional ByVal charSet As String = "abcdefghijklmnopqrstuvwxyz" & "ABCDEFGHIJKLMNOPQRSTUVWXYZ" & "0123456789" & "çñáéíóúàèìòùäëïöü" & "ÇÑÁÉÍÓÚÀÈÌÒÙÄËÏÖÜ" & " ,;.:-_´¨{`^[+*]ºª\!|""#$~%€&¬/()=?¿'¡}*") As String Return CaesarEncrypt(text, shift, String.Join("", charSet.Reverse)) End Function
|
|
|
5476
|
Programación / Scripting / Re: [PYTHON][AYUDA] Problema con acentos y ñ
|
en: 11 Abril 2015, 10:49 am
|
# -*- coding: Windows-1252 -*- # -*- coding: cp1252 -*-
Si pongo sólo la segunda o la tercera línea funciona en el IDE de Python pero no en los otros dos. 1. Ambas "lineas" o codificaciones son la misma, el código de página o Codepage 1252 hace referencia al la misma codificación del alfabeto latino al que hace referencia Windows-1252, ya que son solo dos formas de referirse a lo mismo. 2. La codificación interna de la consola tiene un papel muy importante, para que puedas visualizar correctamente los caracteres latinos primero debes estar usando el código de página o codepage 850 (que es lo mismo que decir cp850 o IBM 850), guardar el archivo de tu script en codificación ANSI (windows-1252), declarar la codificación mostrar el string unicode y listo: # -*- coding: Windows-1252 -*- import sys print sys.stdout.encoding print u"áéíóú àèìòù Ñ"
PD: el codepage de la CMD lo puedes modificar con el comando CHCP. Saludos
|
|
|
5479
|
Informática / Software / Re: kgb archiver
|
en: 10 Abril 2015, 22:36 pm
|
Ni idea, pero el KGB Archiver solo es una GUI, poca importancia tendría que siguiese en desarrollo ya que realmente no aporta su propio algoritmo, el programa se basa en el algoritmo PAQ (la última versión de KGB se basa en PAQ7, algo bastante desactualizado), puedes encontrar "nuevas" versiones más estables con mejoras de compresión, descompresión y/o velocidad u otro tipo de mejoras por parte del autor del algoritmo, en su versión commandline, cómo PAQ8 (2006), PAQ9 (2007), y ZPAQ (2009). http://cs.fit.edu/~mmahoney/compression/Saludos
|
|
|
|
|
|
|