elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Security Series.XSS. [Cross Site Scripting]


  Mostrar Mensajes
Páginas: 1 ... 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 [691] 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 ... 1236
6901  Informática / Software / Re: NO PUEDO DESACARGAR FILEZILLA en: 5 Agosto 2014, 15:00 pm
Buenas

1) ¿Lo estás intentando descargar desde la página oficial?: https://filezilla-project.org/download.php?type=client

He comprobado que los servidores de SourceForge funcionan correctamente, la descarga se finaliza tanto la del cliente de Filezilla como la del Server, es posible que exista algún tipo de problema ajeno relacionado con tu conexión (con tu router), o quizás simplemente tengas descargando demasiadas cosas ocupando el espacio de banda ancha necesario para descargar otras cosas...

Prueba desde otro navegador, o con algún administrador de descargas como JDownloader.

Saludos
6902  Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Compartan aquí sus snippets) en: 4 Agosto 2014, 20:13 pm
Ejemplos de uso de la librería nDDE para controlar un navegador compatible (aunque la verdad, DDE es muy limitado ...por no decir obsoleto, es preferible echar mano de UI Automation).

Nota: Aquí teneis algunos ServiceNames y Topics de DDE para IExplore por si alguien está interesado en esta librería: support.microsoft.com/kb/160957
        He probado el tópico "WWW_Exit" por curiosidad y funciona, pero ninguno de ellos funciona en Firefox (solo los que añadi a la Class de abajo).

Código
  1.    ' nDDE Helper
  2.    ' By Elektro
  3.    '
  4.    ' Instructions:
  5.    ' 1. Add a reference to 'NDDE.dll' library.
  6.    '
  7.    ' Usage Examples:
  8.    ' MessageBox.Show(GetFirefoxUrl())
  9.    ' NavigateFirefox(New Uri("http://www.mozilla.org"), OpenInNewwindow:=False)
  10.  
  11.    ''' <summary>
  12.    ''' Gets the url of the active Tab-page from a running Firefox process.
  13.    ''' </summary>
  14.    ''' <returns>The url of the active Tab-page.</returns>
  15.    Public Function GetFirefoxUrl() As String
  16.  
  17.        Using dde As New DdeClient("Firefox", "WWW_GetWindowInfo")
  18.  
  19.            dde.Connect()
  20.  
  21.            Dim Url As String =
  22.                dde.Request("URL", Integer.MaxValue).
  23.                    Trim({ControlChars.NullChar, ControlChars.Quote, ","c})
  24.  
  25.  
  26.            dde.Disconnect()
  27.  
  28.            Return Url
  29.  
  30.        End Using
  31.  
  32.    End Function
  33.  
  34.    ''' <summary>
  35.    ''' Navigates to an URL in the running Firefox process.
  36.    ''' </summary>
  37.    ''' <param name="url">Indicates the URL to navigate.</param>
  38.    ''' <param name="OpenInNewwindow">
  39.    ''' If set to <c>true</c> the url opens in a new Firefox window, otherwise, the url opens in a new Tab.
  40.    ''' </param>
  41.    Public Sub NavigateFirefox(ByVal url As Uri,
  42.                               ByVal OpenInNewwindow As Boolean)
  43.  
  44.        Dim Address As String = url.AbsoluteUri
  45.  
  46.        If OpenInNewwindow Then
  47.            Address &= ",,0"
  48.        End If
  49.  
  50.        Using dde As New DdeClient("Firefox", "WWW_OpenURL")
  51.  
  52.            dde.Connect()
  53.            dde.Request(Address, Integer.MaxValue)
  54.            dde.Disconnect()
  55.  
  56.        End Using
  57.  
  58.    End Sub
6903  Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Compartan aquí sus snippets) en: 4 Agosto 2014, 18:44 pm
Una Class para ayudar a implementar una lista MRU (MostRecentUsed)

( La parte gráfica sobre como implementar los items en un menú no la voy a explicar, al menos en esta publicación )





Código
  1. ' ***********************************************************************
  2. ' Author           : Elektro
  3. ' Last Modified On : 08-04-2014
  4. ' ***********************************************************************
  5. ' <copyright file="MRU.vb" company="Elektro Studios">
  6. '     Copyright (c) Elektro Studios. All rights reserved.
  7. ' </copyright>
  8. ' ***********************************************************************
  9.  
  10. #Region " Usage Examples "
  11.  
  12. 'Public Class Form1
  13. '
  14. '    ' Initialize a new List of MostRecentUsed-Item
  15. '    Dim MRUList As New List(Of MRU.Item)
  16. '
  17. '    Private Sub Test() Handles MyBase.Shown
  18. '
  19. '        ' Add some items into the collection.
  20. '        With MRUList
  21. '            .Add(New MRU.Item("C:\File1.ext"))
  22. '            .Add(New MRU.Item("C:\File2.ext") With {.Date = Date.Today,
  23. '                                                    .Icon = Bitmap.FromFile("C:\Image.ico"),
  24. '                                                    .Tag = Nothing})
  25. '        End With
  26. '
  27. '        ' Save the MRUItem collection to local file.
  28. '        MRU.IO.Save(MRUList, ".\MRU.tmp")
  29. '
  30. '        ' Load the saved collection from local file.
  31. '        For Each MRUItem As MRU.Item In MRU.IO.Load(Of List(Of MRU.Item))(".\MRU.tmp")
  32. '            MessageBox.Show(MRUItem.FilePath)
  33. '        Next MRUItem
  34. '
  35. '        ' Just another way to load the collection:
  36. '        MRU.IO.Load(MRUList, ".\MRU.tmp")
  37. '
  38. '    End Sub
  39. '
  40. 'End Class
  41.  
  42. #End Region
  43.  
  44. #Region " MostRecentUsed "
  45.  
  46. ''' <summary>
  47. ''' Class MRU (MostRecentUsed).
  48. ''' Administrates the usage of a MRU item collection.
  49. ''' </summary>
  50. Public Class MRU
  51.  
  52. #Region " Constructors "
  53.  
  54.    ''' <summary>
  55.    ''' Prevents a default instance of the <see cref="MRU"/> class from being created.
  56.    ''' </summary>
  57.    Private Sub New()
  58.    End Sub
  59.  
  60. #End Region
  61.  
  62. #Region " Types "
  63.  
  64. #Region "IO"
  65.  
  66.    ''' <summary>
  67.    ''' Performs IO operations with a <see cref="MRU.Item"/> Collection.
  68.    ''' </summary>
  69.    Public Class [IO]
  70.  
  71. #Region " Constructors "
  72.  
  73.        ''' <summary>
  74.        ''' Prevents a default instance of the <see cref="MRU.IO"/> class from being created.
  75.        ''' </summary>
  76.        Private Sub New()
  77.        End Sub
  78.  
  79. #End Region
  80.  
  81. #Region " Public Methods "
  82.  
  83.        ''' <summary>
  84.        ''' Saves the specified MRU List to local file, using binary serialization.
  85.        ''' </summary>
  86.        ''' <typeparam name="T"></typeparam>
  87.        ''' <param name="MRUItemCollection">The <see cref="MRU.Item"/> Collection.</param>
  88.        ''' <param name="filepath">The filepath to save the <see cref="MRU.Item"/> Collection.</param>
  89.        Public Shared Sub Save(Of T)(ByVal MRUItemCollection As T,
  90.                                     ByVal filepath As String)
  91.  
  92.            Dim Serializer = New System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
  93.  
  94.            ' Serialization.
  95.            Using Writer As New System.IO.FileStream(filepath, System.IO.FileMode.Create)
  96.                Serializer.Serialize(Writer, MRUItemCollection)
  97.            End Using ' Writer
  98.  
  99.        End Sub
  100.  
  101.        ''' <summary>
  102.        ''' Loads the specified <see cref="MRU.Item"/> Collection from a local file, using binary deserialization.
  103.        ''' </summary>
  104.        ''' <typeparam name="T"></typeparam>
  105.        ''' <param name="MRUItemCollection">The ByRefered <see cref="MRU.Item"/> collection.</param>
  106.        ''' <param name="filepath">The filepath to load its <see cref="MRU.Item"/> Collection.</param>
  107.        Public Shared Sub Load(Of T)(ByRef MRUItemCollection As T,
  108.                                     ByVal filepath As String)
  109.  
  110.            Dim Serializer = New System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
  111.  
  112.            ' Deserialization.
  113.            Using Reader As New System.IO.FileStream(filepath, System.IO.FileMode.Open)
  114.  
  115.                MRUItemCollection = Serializer.Deserialize(Reader)
  116.  
  117.            End Using ' Reader
  118.  
  119.        End Sub
  120.  
  121.        ''' <summary>
  122.        ''' Loads the specified <see cref="MRU.Item"/> Collection from a local file, using the specified deserialization.
  123.        ''' </summary>
  124.        ''' <typeparam name="T"></typeparam>
  125.        ''' <param name="filepath">The filepath to load its <see cref="MRU.Item"/> Collection.</param>
  126.        Public Shared Function Load(Of T)(ByVal filepath As String) As T
  127.  
  128.            Dim Serializer = New System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
  129.  
  130.            ' Deserialization.
  131.            Using Reader As New System.IO.FileStream(filepath, System.IO.FileMode.Open)
  132.  
  133.                Return Serializer.Deserialize(Reader)
  134.  
  135.            End Using ' Reader
  136.  
  137.        End Function
  138.  
  139. #End Region
  140.  
  141.    End Class
  142.  
  143. #End Region
  144.  
  145. #Region " Item "
  146.  
  147.    ''' <summary>
  148.    ''' An Item for a MostRecentUsed-Item collection that stores the item filepath and optionally additional info.
  149.    ''' This Class can be serialized.
  150.    ''' </summary>
  151.    <Serializable()>
  152.    Public Class Item
  153.  
  154. #Region " Constructors "
  155.  
  156.        ''' <summary>
  157.        ''' Prevents a default instance of the <see cref="MRU.Item"/> class from being created.
  158.        ''' </summary>
  159.        Private Sub New()
  160.        End Sub
  161.  
  162.        ''' <summary>
  163.        ''' Initializes a new instance of the <see cref="MRU.Item"/> class.
  164.        ''' </summary>
  165.        ''' <param name="FilePath">The item filepath.</param>
  166.        ''' <exception cref="System.ArgumentNullException">FilePath</exception>
  167.        Public Sub New(ByVal FilePath As String)
  168.  
  169.            If FilePath Is Nothing Then
  170.                Throw New ArgumentNullException("FilePath")
  171.            End If
  172.  
  173.            Me._FilePath = FilePath
  174.  
  175.        End Sub
  176.  
  177.        ''' <summary>
  178.        ''' Initializes a new instance of the <see cref="MRU.Item"/> class.
  179.        ''' </summary>
  180.        ''' <param name="File">The fileinfo object.</param>
  181.        Public Sub New(ByVal File As System.IO.FileInfo)
  182.  
  183.            Me.New(File.FullName)
  184.  
  185.        End Sub
  186.  
  187. #End Region
  188.  
  189. #Region " Properties "
  190.  
  191.        ''' <summary>
  192.        ''' Gets the item filepath.
  193.        ''' </summary>
  194.        ''' <value>The file path.</value>
  195.        Public ReadOnly Property FilePath As String
  196.            Get
  197.                Return Me._FilePath
  198.            End Get
  199.        End Property
  200.        Private _FilePath As String = String.Empty
  201.  
  202.        ''' <summary>
  203.        ''' Gets the FileInfo object of the item.
  204.        ''' </summary>
  205.        ''' <value>The FileInfo object.</value>
  206.        Public ReadOnly Property FileInfo As System.IO.FileInfo
  207.            Get
  208.                Return New System.IO.FileInfo(FilePath)
  209.            End Get
  210.        End Property
  211.  
  212.        ''' <summary>
  213.        ''' (Optionally) Gets or sets the item last-time open date.
  214.        ''' </summary>
  215.        ''' <value>The index.</value>
  216.        Public Property [Date] As Date
  217.  
  218.        ''' <summary>
  219.        ''' (Optionally) Gets or sets the item icon.
  220.        ''' </summary>
  221.        ''' <value>The icon.</value>
  222.        Public Property Icon As Bitmap
  223.  
  224.        ''' <summary>
  225.        ''' (Optionally) Gets or sets the item tag.
  226.        ''' </summary>
  227.        ''' <value>The tag object.</value>
  228.        Public Property Tag As Object
  229.  
  230. #End Region
  231.  
  232.    End Class
  233.  
  234. #End Region
  235.  
  236. #End Region
  237.  
  238. End Class
  239.  
  240. #End Region
6904  Foros Generales / Foro Libre / Re: Raro a la hora de mover algo liquido en: 4 Agosto 2014, 18:41 pm
Elektro ¿que pasa si cuando hago el 6 el pie se mueve hacia el lado contrario? xD :huh: :huh:

Que eres normal :laugh:

PD: Supongo que cuando dices que se mueve hacia el lado contrario significa hacia el sentido contrario de las agujas del reloj, de lo contrario ...una de dos, o en vez de intentar hacer un 6 has echo trampas y dibujaste un 3, o tienes genes de Alien.

Saludos!
6905  Foros Generales / Foro Libre / Re: Raro a la hora de mover algo liquido en: 4 Agosto 2014, 16:11 pm
muevo de izquierda a derecha y bueno veo a mis familiares y veo que todos lo mueven de otra forma diferente a la mia  :xD

Puedes sentirte especial y único por no hacer las cosas como lo hacen todos los demás ;) (aunque sea en la forma en mover un puñetero Té xD)

Yo creo que a menos que seas capaz de solucionar el problema que sugiere la siguiente imagen entonces no tienes nada de lo que preocuparte respecto al movimiento que hacen tus extremidades :rolleyes:

6906  Foros Generales / Dudas Generales / Re: Desactivar Zonas Del Teclado en: 4 Agosto 2014, 14:07 pm
No me queda muy clara la pregunta ya que ahí solo hay dígitos por lo tanto siempre es numérico (un punto no es alfabético por lo tanto no hay combinación alfanumérica).

De todas formas puedes modificar y/o eliminar la funcionalidad de un set de teclas específicos con aplicaciones como SharpKeys y KeyTweak, eso solucionará el problema que tengas con esas teclas.

Si prefieres hacerlo mediante un script este no es el subforo indicado, pásate por la sección de Scripting, explica el problema detalladamente y especifica el lenguaje en el que lo vas a intentar hacer ...no sin antes haber demostrado que has investigado un poco sobre el tema y mostrar tu código.
Hay varias maneras de llevarlo a cabo, una manera simple sería registrando un acceso directo global (un Hotkey) de la tecla especifica y no hacer nada cuando se presione dicha tecla, puedes hacerlo con AutoHotkey, la otra seria manipulando la clave de registro del mapeo de teclas como hace la aplicación SharpKeys.

Saludos.
6907  Programación / .NET (C#, VB.NET, ASP) / Re: Programa en C# en: 4 Agosto 2014, 10:19 am
En el código de .::IT::. se está asumiendo que los valores sean enteros y que el resultado también lo sea, pero obviamente el resultado de la suma de dos Int32 podría dar un valor más alto (ej: Int64)

Aquí tienes mi versión, por si te sirve de algo:

Código
  1. Module Module1
  2.  
  3. #Region " Enumerations "
  4.  
  5.    ''' <summary>
  6.    ''' Indicates an arithmetic operation.
  7.    ''' </summary>
  8.    Public Enum ArithmeticOperation As Integer
  9.  
  10.        ''' <summary>
  11.        ''' Any arithmetic operation.
  12.        ''' </summary>
  13.        None = 0
  14.  
  15.        ''' <summary>
  16.        ''' Sums the values.
  17.        ''' </summary>
  18.        Sum = 1I
  19.  
  20.        ''' <summary>
  21.        ''' Subtracts the values.
  22.        ''' </summary>
  23.        Subtract = 2I
  24.  
  25.        ''' <summary>
  26.        ''' Multiplies the values.
  27.        ''' </summary>
  28.        Multiply = 3I
  29.  
  30.        ''' <summary>
  31.        ''' Divides the values.
  32.        ''' </summary>
  33.        Divide = 4I
  34.  
  35.    End Enum
  36.  
  37. #End Region
  38.  
  39. #Region " Entry Point (Main)"
  40.  
  41.    ''' <summary>
  42.    ''' Defines the entry point of the application.
  43.    ''' </summary>
  44.    Public Sub Main()
  45.  
  46.        DoArithmetics()
  47.  
  48.    End Sub
  49.  
  50. #End Region
  51.  
  52. #Region " Public Methods "
  53.  
  54.    Public Sub DoArithmetics()
  55.  
  56.        Dim ExitString As String = String.Empty
  57.        Dim ExitDemand As Boolean = False
  58.        Dim Operation As ArithmeticOperation = ArithmeticOperation.None
  59.        Dim Value1 As Decimal = 0D
  60.        Dim Value2 As Decimal = 0D
  61.        Dim Result As Decimal = 0D
  62.  
  63.        Do Until ExitDemand
  64.  
  65.            SetValue(Value1, "Ingresar el  primer numero: ")
  66.            SetValue(Value2, "Ingresar el segundo numero: ")
  67.            Console.WriteLine()
  68.  
  69.            SetOperation(Operation, "Elegir una operacion aritmética: ")
  70.            SetResult(Operation, Value1, Value2, Result)
  71.            Console.WriteLine()
  72.  
  73.            Console.WriteLine(String.Format("El resultado es: {0}", CStr(Result)))
  74.            Console.WriteLine()
  75.  
  76.            SetExit(ExitDemand, "S"c, "N"c, "¿Quiere salir? [S/N]: ")
  77.            Console.Clear()
  78.  
  79.        Loop ' ExitDemand
  80.  
  81.    End Sub
  82.  
  83.    ''' <summary>
  84.    ''' Asks for a value and waits for the user-input to set the value.
  85.    ''' </summary>
  86.    ''' <param name="Value">The ByRefered variable to set the input result.</param>
  87.    ''' <param name="message">The output message.</param>
  88.    Public Sub SetValue(ByRef Value As Decimal,
  89.                        Optional ByVal message As String = "Enter a value: ")
  90.  
  91.        Dim Success As Boolean = False
  92.  
  93.        Do Until Success
  94.  
  95.            Console.Write(message)
  96.  
  97.            Try
  98.                Value = Decimal.Parse(Console.ReadLine().Replace("."c, ","c))
  99.                Success = True
  100.  
  101.            Catch ex As Exception
  102.                Console.WriteLine(ex.Message)
  103.                Console.WriteLine()
  104.  
  105.            End Try
  106.  
  107.        Loop ' Success
  108.  
  109.    End Sub
  110.  
  111.    ''' <summary>
  112.    ''' Asks for an arithmetic operation and waits for the user-input to set the value.
  113.    ''' </summary>
  114.    ''' <param name="Operation">The ByRefered variable to set the input result.</param>
  115.    ''' <param name="message">The output message.</param>
  116.    Public Sub SetOperation(ByRef Operation As ArithmeticOperation,
  117.                            Optional ByVal message As String = "Choose an operation: ")
  118.  
  119.        Dim Success As Boolean = False
  120.  
  121.        For Each Value As ArithmeticOperation In [Enum].GetValues(GetType(ArithmeticOperation))
  122.            Console.Write(String.Format("{0}={1} | ", CStr(Value), Value.ToString))
  123.        Next Value
  124.  
  125.        Console.WriteLine()
  126.  
  127.        Do Until Success
  128.  
  129.            Console.Write(message)
  130.  
  131.            Try
  132.                Operation = [Enum].Parse(GetType(ArithmeticOperation), Console.ReadLine, True)
  133.                Success = True
  134.  
  135.            Catch ex As Exception
  136.                Console.WriteLine(ex.Message)
  137.                Console.WriteLine()
  138.  
  139.            End Try
  140.  
  141.        Loop ' Success
  142.  
  143.    End Sub
  144.  
  145.    ''' <summary>
  146.    ''' Performs an arithmetic operation on the given values.
  147.    ''' </summary>
  148.    ''' <param name="Operation">The arithmetic operation to perform.</param>
  149.    ''' <param name="Value1">The first value.</param>
  150.    ''' <param name="Value2">The second value.</param>
  151.    ''' <param name="Result">The ByRefered variable to set the operation result value.</param>
  152.    Public Sub SetResult(ByVal Operation As ArithmeticOperation,
  153.                         ByVal Value1 As Decimal,
  154.                         ByVal Value2 As Decimal,
  155.                         ByRef Result As Decimal)
  156.  
  157.        Select Case Operation
  158.  
  159.            Case ArithmeticOperation.Sum
  160.                Result = Sum(Value1, Value2)
  161.  
  162.            Case ArithmeticOperation.Subtract
  163.                Result = Subtract(Value1, Value2)
  164.  
  165.            Case ArithmeticOperation.Multiply
  166.                Result = Multiply(Value1, Value2)
  167.  
  168.            Case ArithmeticOperation.Divide
  169.                Result = Divide(Value1, Value2)
  170.  
  171.            Case ArithmeticOperation.None
  172.                ' Do Nothing
  173.  
  174.        End Select
  175.  
  176.    End Sub
  177.  
  178.    ''' <summary>
  179.    ''' Asks for a Boolean value and waits for the user-input to set the value.
  180.    ''' </summary>
  181.    ''' <param name="ExitBool">The ByRefered variable to set the input result.</param>
  182.    ''' <param name="TrueChar">Indicates the character threated as 'True'.</param>
  183.    ''' <param name="FalseChar">Indicates the character threated as 'False'.</param>
  184.    ''' <param name="message">The output message.</param>
  185.    Public Sub SetExit(ByRef ExitBool As Boolean,
  186.                       Optional ByVal TrueChar As Char = "Y"c,
  187.                       Optional ByVal FalseChar As Char = "N"c,
  188.                       Optional ByVal message As String = "¿Want to exit? [Y/N]: ")
  189.  
  190.        Dim Success As Boolean = False
  191.        Dim Result As Char = Nothing
  192.  
  193.        Console.Write(message)
  194.  
  195.        Do Until Success
  196.  
  197.            Result = Console.ReadKey().KeyChar
  198.  
  199.            Select Case Char.ToLower(Result)
  200.  
  201.                Case Char.ToLower(TrueChar)
  202.                    ExitBool = True
  203.                    Success = True
  204.  
  205.                Case Char.ToLower(FalseChar)
  206.                    ExitBool = False
  207.                    Success = True
  208.  
  209.                Case Else
  210.                    Console.Beep()
  211.  
  212.                    If Not Char.IsLetterOrDigit(Result) Then
  213.                        Console.CursorLeft = 0
  214.                        SetExit(ExitBool, TrueChar, FalseChar, message)
  215.                    Else
  216.                        Console.CursorLeft = Console.CursorLeft - 1
  217.                        Console.Write(" ")
  218.                        Console.CursorLeft = Console.CursorLeft - 1
  219.                    End If
  220.  
  221.            End Select ' Char.ToLower(Result)
  222.  
  223.        Loop ' Success
  224.  
  225.    End Sub
  226.  
  227. #End Region
  228.  
  229. #Region " Private Functions "
  230.  
  231.    ''' <summary>
  232.    ''' Performs a Sum operation on the specified values.
  233.    ''' </summary>
  234.    Private Function Sum(ByVal Value1 As Decimal,
  235.                         ByVal Value2 As Decimal) As Decimal
  236.  
  237.        Return (Value1 + Value2)
  238.  
  239.    End Function
  240.  
  241.    ''' <summary>
  242.    ''' Performs a subtraction operation on the specified values.
  243.    ''' </summary>
  244.    Private Function Subtract(ByVal Value1 As Decimal,
  245.                              ByVal Value2 As Decimal) As Decimal
  246.  
  247.        Return (Value1 - Value2)
  248.  
  249.    End Function
  250.  
  251.    ''' <summary>
  252.    ''' Performs a multiplier operation on the specified values.
  253.    ''' </summary>
  254.    Private Function Multiply(ByVal Value1 As Decimal,
  255.                              ByVal Value2 As Decimal) As Decimal
  256.  
  257.        Return (Value1 * Value2)
  258.  
  259.    End Function
  260.  
  261.    ''' <summary>
  262.    ''' Performs a divider operation on the specified values.
  263.    ''' </summary>
  264.    Private Function Divide(ByVal Value1 As Decimal,
  265.                            ByVal Value2 As Decimal) As Decimal
  266.  
  267.        Return (Value1 / Value2)
  268.  
  269.    End Function
  270.  
  271. #End Region
  272.  
  273. End Module
  274.  


Traducción instantanea a C#:

Código
  1. using Microsoft.VisualBasic;
  2. using System;
  3. using System.Collections;
  4. using System.Collections.Generic;
  5. using System.Data;
  6. using System.Diagnostics;
  7. static class Module1
  8. {
  9.  
  10. #region " Enumerations "
  11.  
  12. /// <summary>
  13. /// Indicates an arithmetic operation.
  14. /// </summary>
  15. public enum ArithmeticOperation : int
  16. {
  17.  
  18. /// <summary>
  19. /// Any arithmetic operation.
  20. /// </summary>
  21. None = 0,
  22.  
  23. /// <summary>
  24. /// Sums the values.
  25. /// </summary>
  26. Sum = 1,
  27.  
  28. /// <summary>
  29. /// Subtracts the values.
  30. /// </summary>
  31. Subtract = 2,
  32.  
  33. /// <summary>
  34. /// Multiplies the values.
  35. /// </summary>
  36. Multiply = 3,
  37.  
  38. /// <summary>
  39. /// Divides the values.
  40. /// </summary>
  41. Divide = 4
  42.  
  43. }
  44.  
  45. #endregion
  46.  
  47. #region " Entry Point (Main)"
  48.  
  49. /// <summary>
  50. /// Defines the entry point of the application.
  51. /// </summary>
  52.  
  53. public static void Main()
  54. {
  55. DoArithmetics();
  56.  
  57. }
  58.  
  59. #endregion
  60.  
  61. #region " Public Methods "
  62.  
  63.  
  64. public static void DoArithmetics()
  65. {
  66. string ExitString = string.Empty;
  67. bool ExitDemand = false;
  68. ArithmeticOperation Operation = ArithmeticOperation.None;
  69. decimal Value1 = 0m;
  70. decimal Value2 = 0m;
  71. decimal Result = 0m;
  72.  
  73.  
  74. while (!(ExitDemand)) {
  75. SetValue(ref Value1, "Ingresar el  primer numero: ");
  76. SetValue(ref Value2, "Ingresar el segundo numero: ");
  77. Console.WriteLine();
  78.  
  79. SetOperation(ref Operation, "Elegir una operacion aritmética: ");
  80. SetResult(Operation, Value1, Value2, ref Result);
  81. Console.WriteLine();
  82.  
  83. Console.WriteLine(string.Format("El resultado es: {0}", Convert.ToString(Result)));
  84. Console.WriteLine();
  85.  
  86. SetExit(ref ExitDemand, 'S', 'N', "¿Quiere salir? [S/N]: ");
  87. Console.Clear();
  88.  
  89. }
  90. // ExitDemand
  91.  
  92. }
  93.  
  94. /// <summary>
  95. /// Asks for a value and waits for the user-input to set the value.
  96. /// </summary>
  97. /// <param name="Value">The ByRefered variable to set the input result.</param>
  98. /// <param name="message">The output message.</param>
  99.  
  100. public static void SetValue(ref decimal Value, string message = "Enter a value: ")
  101. {
  102. bool Success = false;
  103.  
  104.  
  105. while (!(Success)) {
  106. Console.Write(message);
  107.  
  108. try {
  109. Value = decimal.Parse(Console.ReadLine().Replace('.', ','));
  110. Success = true;
  111.  
  112. } catch (Exception ex) {
  113. Console.WriteLine(ex.Message);
  114. Console.WriteLine();
  115.  
  116. }
  117.  
  118. }
  119. // Success
  120.  
  121. }
  122.  
  123. /// <summary>
  124. /// Asks for an arithmetic operation and waits for the user-input to set the value.
  125. /// </summary>
  126. /// <param name="Operation">The ByRefered variable to set the input result.</param>
  127. /// <param name="message">The output message.</param>
  128.  
  129. public static void SetOperation(ref ArithmeticOperation Operation, string message = "Choose an operation: ")
  130. {
  131. bool Success = false;
  132.  
  133. foreach (ArithmeticOperation Value in Enum.GetValues(typeof(ArithmeticOperation))) {
  134. Console.Write(string.Format("{0}={1} | ", Convert.ToString(Value), Value.ToString));
  135. }
  136.  
  137. Console.WriteLine();
  138.  
  139.  
  140. while (!(Success)) {
  141. Console.Write(message);
  142.  
  143. try {
  144. Operation = Enum.Parse(typeof(ArithmeticOperation), Console.ReadLine, true);
  145. Success = true;
  146.  
  147. } catch (Exception ex) {
  148. Console.WriteLine(ex.Message);
  149. Console.WriteLine();
  150.  
  151. }
  152.  
  153. }
  154. // Success
  155.  
  156. }
  157.  
  158. /// <summary>
  159. /// Performs an arithmetic operation on the given values.
  160. /// </summary>
  161. /// <param name="Operation">The arithmetic operation to perform.</param>
  162. /// <param name="Value1">The first value.</param>
  163. /// <param name="Value2">The second value.</param>
  164. /// <param name="Result">The ByRefered variable to set the operation result value.</param>
  165.  
  166. public static void SetResult(ArithmeticOperation Operation, decimal Value1, decimal Value2, ref decimal Result)
  167. {
  168. switch (Operation) {
  169.  
  170. case ArithmeticOperation.Sum:
  171. Result = Sum(Value1, Value2);
  172.  
  173. break;
  174. case ArithmeticOperation.Subtract:
  175. Result = Subtract(Value1, Value2);
  176.  
  177. break;
  178. case ArithmeticOperation.Multiply:
  179. Result = Multiply(Value1, Value2);
  180.  
  181. break;
  182. case ArithmeticOperation.Divide:
  183. Result = Divide(Value1, Value2);
  184.  
  185. break;
  186. case ArithmeticOperation.None:
  187. break;
  188. // Do Nothing
  189.  
  190. }
  191.  
  192. }
  193.  
  194. /// <summary>
  195. /// Asks for a Boolean value and waits for the user-input to set the value.
  196. /// </summary>
  197. /// <param name="ExitBool">The ByRefered variable to set the input result.</param>
  198. /// <param name="TrueChar">Indicates the character threated as 'True'.</param>
  199. /// <param name="FalseChar">Indicates the character threated as 'False'.</param>
  200. /// <param name="message">The output message.</param>
  201.  
  202. public static void SetExit(ref bool ExitBool, char TrueChar = 'Y', char FalseChar = 'N', string message = "¿Want to exit? [Y/N]: ")
  203. {
  204. bool Success = false;
  205. char Result = null;
  206.  
  207. Console.Write(message);
  208.  
  209.  
  210. while (!(Success)) {
  211. Result = Console.ReadKey().KeyChar;
  212.  
  213. switch (char.ToLower(Result)) {
  214.  
  215. case char.ToLower(TrueChar):
  216. ExitBool = true;
  217. Success = true;
  218.  
  219. break;
  220. case char.ToLower(FalseChar):
  221. ExitBool = false;
  222. Success = true;
  223.  
  224. break;
  225. default:
  226. Console.Beep();
  227.  
  228. if (!char.IsLetterOrDigit(Result)) {
  229. Console.CursorLeft = 0;
  230. SetExit(ref ExitBool, TrueChar, FalseChar, message);
  231. } else {
  232. Console.CursorLeft = Console.CursorLeft - 1;
  233. Console.Write(" ");
  234. Console.CursorLeft = Console.CursorLeft - 1;
  235. }
  236.  
  237. break;
  238. }
  239. // Char.ToLower(Result)
  240.  
  241. }
  242. // Success
  243.  
  244. }
  245.  
  246. #endregion
  247.  
  248. #region " Private Functions "
  249.  
  250. /// <summary>
  251. /// Performs a Sum operation on the specified values.
  252. /// </summary>
  253. private static decimal Sum(decimal Value1, decimal Value2)
  254. {
  255.  
  256. return (Value1 + Value2);
  257.  
  258. }
  259.  
  260. /// <summary>
  261. /// Performs a subtraction operation on the specified values.
  262. /// </summary>
  263. private static decimal Subtract(decimal Value1, decimal Value2)
  264. {
  265.  
  266. return (Value1 - Value2);
  267.  
  268. }
  269.  
  270. /// <summary>
  271. /// Performs a multiplier operation on the specified values.
  272. /// </summary>
  273. private static decimal Multiply(decimal Value1, decimal Value2)
  274. {
  275.  
  276. return (Value1 * Value2);
  277.  
  278. }
  279.  
  280. /// <summary>
  281. /// Performs a divider operation on the specified values.
  282. /// </summary>
  283. private static decimal Divide(decimal Value1, decimal Value2)
  284. {
  285.  
  286. return (Value1 / Value2);
  287.  
  288. }
  289.  
  290. #endregion
  291.  
  292. }
  293.  
  294. //=======================================================
  295. //Service provided by Telerik (www.telerik.com)
  296. //Conversion powered by NRefactory.
  297. //Twitter: @telerik
  298. //Facebook: facebook.com/telerik
  299. //=======================================================
  300.  
6908  Programación / Programación General / Re: error al compilar en autoit en: 4 Agosto 2014, 07:59 am
tengo un problema al compilar el siguiente codigo en C++ a autoit

¿Y esperas que te adivinemos el problema y el mensaje de error de compilación, o piensas tener el detalle de explicarlo?.

De todas formas no es necesario, con tu pregunta te estás respondiendo a ti mismo, C++ y AutoIt son dos lenguajes distintos.

PD: Esto me recuerda a otro mensaje que publicaste, sin detalles necesarios y sin respuesta por tu parte: http://foro.elhacker.net/net/help_gui-t416628.0.html;msg1949188#msg1949188

Saludos.
6909  Programación / .NET (C#, VB.NET, ASP) / Re: Ayuda con un pequeño ejercicio que estoy haciendo en C# con windows form? en: 3 Agosto 2014, 19:24 pm
"talonary"?  :xD, menuda invención :P, supongo que intentaste traducir "talonario" al inglés, en ese caso el termino correcto es counterfoil.

Respecto a la Class, ¿podrias especificar en que necesitas ayuda?, eso no me ha quedado claro,
de todas formas si lo que buscas son que te demos consejos, entonces yo te sugiero que guardes la información a modo de base de datos (XML es un formato que me gusta, porque es legible por el humano) y la guardes en un archivo local para guardar los datos de todos los clientes, serializándolo, y acceder cuando precises (deserializando).

Te mostraría un ejemplo, pero sería en VB.NET, de todas formas en MSDN puedes encontrar ejemplos de serialización por XML como este.

Espero que te haya servido de algo,
Saludos.



EDITO:
No estoy acostumbrado a manejar C#, pero aqui tienes unas cuantas mejoras que le hice:

EDITO:
Se me olvidaba comentar que mientras la class siga igual de "simple" realmente no es necesario implementar ISerializable (ni IXmlSerializable), pero mejor tenerlo implementado de manera básica por si piensas hacerle cambios "importantes" en el futuro y lo puedas necesitar, le añadí la implementación de serialización binaria, pero como ya digo todo eso no es necesario ahora mismo, sin implementarlo puedes serializar.

Código
  1. #region Usings
  2.  
  3. using System;
  4. using System.Runtime.Serialization;
  5. using System.Security.Permissions;
  6. using System.Xml.Serialization;
  7. using System.Xml;
  8.  
  9. #endregion
  10.  
  11. /// <summary>
  12. /// Class talonary (or Counterfoil? xD).
  13. /// This class can be serialized.
  14. /// </summary>
  15. [Serializable]
  16. public class talonary : ISerializable, IXmlSerializable
  17. {
  18.  
  19.    #region Properties
  20.  
  21.    /// <summary>
  22.    /// Gets or sets the client name.
  23.    /// </summary>
  24.    /// <value>The name.</value>
  25.    public string name
  26.    {
  27.        get { return this._name; }
  28.        set { this._name = value; }
  29.    }
  30.    private string _name;
  31.  
  32.    /// <summary>
  33.    /// Gets or sets the client surname.
  34.    /// </summary>
  35.    /// <value>The surname.</value>
  36.    public string surname
  37.    {
  38.        get { return this._surname; }
  39.        set { this._surname = value; }
  40.    }
  41.    private string _surname;
  42.  
  43.    /// <summary>
  44.    /// Gets or sets the client salary.
  45.    /// </summary>
  46.    /// <value>The salary.</value>
  47.    public double salary
  48.    {
  49.        get { return this._salary; }
  50.        set { this._salary = value; }
  51.    }
  52.    private double _salary;
  53.  
  54.    /// <summary>
  55.    /// Gets the client salary.
  56.    /// </summary>
  57.    /// <value>The salary.</value>
  58.    public double discountedSalary
  59.    {
  60.        get
  61.        {
  62.            return (this._salary * 0.05D) - this._salary;
  63.        }
  64.    }
  65.  
  66.    #endregion
  67.  
  68.    #region Constructors
  69.  
  70.    /// <summary>
  71.    /// Prevents a default instance of the <see cref="talonary"/> class from being created.
  72.    /// </summary>
  73.    private talonary() { }
  74.  
  75.    /// <summary>
  76.    /// Initializes a new instance of the <see cref="talonary"/> class.
  77.    /// </summary>
  78.    /// <param name="name">Indicates the client name.</param>
  79.    /// <param name="surname">Indicates the client surname.</param>
  80.    /// <param name="salary">Indicates the client salary.</param>
  81.    public talonary(string name,
  82.                    string surname,
  83.                    double salary)
  84.    {
  85.  
  86.        if (name == null)
  87.        {
  88.            throw new ArgumentNullException("name");
  89.        }
  90.  
  91.        this._name = name;
  92.        this._surname = surname;
  93.        this._salary = salary;
  94.    }
  95.  
  96.    #endregion
  97.  
  98.    #region ISerializable implementation | For Binary serialization.
  99.  
  100.    /// <summary>
  101.    /// Populates a <see cref="T:System.Runtime.Serialization.SerializationInfo" /> with the data needed to serialize the target object.
  102.    /// </summary>
  103.    /// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> to populate with data.</param>
  104.    /// <param name="context">The destination (see <see cref="T:System.Runtime.Serialization.StreamingContext" />) for this serialization.</param>
  105.    [SecurityPermissionAttribute(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)]
  106.     void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
  107.    {
  108.        if (info == null)
  109.        {
  110.            throw new ArgumentNullException("info");
  111.        }
  112.  
  113.        info.AddValue("name", this._name, typeof(string));
  114.        info.AddValue("surname", this._surname, typeof(string));
  115.        info.AddValue("salary", this._salary, typeof(double));
  116.    }
  117.  
  118.    /// <summary>
  119.    /// Initializes a new instance of the <see cref="talonary"/> class.
  120.    /// This constructor is used to deserialize values.
  121.    /// </summary>
  122.    /// <param name="info">The information.</param>
  123.    /// <param name="context">The context.</param>
  124.    protected talonary(SerializationInfo info, StreamingContext context)
  125.    {
  126.        if (info == null)
  127.        {
  128.            throw new ArgumentNullException("info");
  129.        }
  130.  
  131.        this._name = (string)info.GetValue("name", typeof(string));
  132.        this._surname = (string)info.GetValue("surname", typeof(string));
  133.        this._salary = (double)info.GetValue("salary", typeof(double));
  134.    }
  135.  
  136.    #endregion
  137.  
  138.    #region "IXMLSerializable implementation" | For XML serialization.
  139.  
  140.    /// <summary>
  141.    /// This method is reserved and should not be used.
  142.    /// When implementing the IXmlSerializable interface, you should return null (Nothing in Visual Basic) from this method,
  143.    /// and instead, if specifying a custom schema is required, apply the <see cref="T:XmlSchemaProviderAttribute"/> to the class.
  144.    /// </summary>
  145.    /// <returns>
  146.    /// An <see cref="T:Xml.Schema.XmlSchema"/> that describes the XML representation of the object
  147.    /// that is produced by the <see cref="M:IXmlSerializable.WriteXml(Xml.XmlWriter)"/> method
  148.    /// and consumed by the <see cref="M:IXmlSerializable.ReadXml(Xml.XmlReader)"/> method.
  149.    /// </returns>
  150.    public System.Xml.Schema.XmlSchema GetSchema()
  151.    {
  152.        return null;
  153.    }
  154.  
  155.    /// <summary>
  156.    /// Converts an object into its XML representation.
  157.    /// </summary>
  158.    /// <param name="writer">The <see cref="T:Xml.XmlWriter"/> stream to which the object is serialized.</param>
  159.    public void WriteXml(XmlWriter writer)
  160.    {
  161.        writer.WriteElementString("name", this._name);
  162.        writer.WriteElementString("surname", this._surname);
  163.        writer.WriteElementString("salary", Convert.ToString(this._salary));
  164.    }
  165.  
  166.    /// <summary>
  167.    /// Generates an object from its XML representation.
  168.    /// </summary>
  169.    /// <param name="reader">The <see cref="T:Xml.XmlReader"/> stream from which the object is deserialized.</param>
  170.    public void ReadXml(XmlReader reader)
  171.    {
  172.        reader.ReadStartElement(base.GetType().Name);
  173.        this._name = reader.ReadElementContentAsString();
  174.        this._surname = reader.ReadElementContentAsString();
  175.        this._salary = reader.ReadElementContentAsDouble();
  176.    }
  177.  
  178.    #endregion
  179.  
  180. }

EDITO:
No te vendría mal leer esto, sobre la serialización XML: http://support.microsoft.com/kb/316730

Ejemplo:

Código
  1.    Imports System.IO
  2.    Imports System.Xml.Serialization
  3.  
  4.    Public Class TestClass : Inherits form
  5.  
  6.       Private Sub Test_Handler() Handles MyBase.Shown
  7.  
  8.           Dim Clients As New List(Of talonary)
  9.           With Clients
  10.               .Add(New talonary("pedro", "castaño", 10.0R))
  11.               .Add(New talonary("manolo", "ToLoko", 150.0R))
  12.               .Add(New talonary("Elektro", "Zero", Double.MaxValue))
  13.           End With
  14.  
  15.           ' Serialización XML.
  16.           Using Writer As New StreamWriter(".\Clients.xml")
  17.  
  18.               Dim Serializer As New XmlSerializer(Clients.GetType)
  19.               Serializer.Serialize(Writer, Clients)
  20.  
  21.           End Using
  22.  
  23.           ' Deserialización XML.
  24.           Using Reader As New StreamReader(".\Clients.xml")
  25.  
  26.               Dim Serializer As New XmlSerializer(Clients.GetType)
  27.               Dim tmpClients As List(Of talonary) = Serializer.Deserialize(Reader)
  28.  
  29.               For Each Client As talonary In tmpClients
  30.                   MessageBox.Show(Client.name)
  31.               Next
  32.  
  33.           End Using
  34.  
  35.       End Sub
  36.  
  37.    End Class

Traducción al vuelo a C# (no lo he testeado):
Código
  1.    using Microsoft.VisualBasic;
  2.    using System;
  3.    using System.Collections;
  4.    using System.Collections.Generic;
  5.    using System.Data;
  6.    using System.Diagnostics;
  7.    using System.IO;
  8.    using System.Xml.Serialization;
  9.  
  10.    public class TestClass : form
  11.    {
  12.  
  13.  
  14.    private void Test_Handler()
  15.    {
  16.    List<talonary> Clients = new List<talonary>();
  17.    var _with1 = Clients;
  18.    _with1.Add(new talonary("pedro", "castaño", 10.0));
  19.    _with1.Add(new talonary("manolo", "ToLoko", 150.0));
  20.    _with1.Add(new talonary("Elektro", "Zero", double.MaxValue));
  21.  
  22.    // Serialización XML.
  23.    using (StreamWriter Writer = new StreamWriter(".\\Clients.xml")) {
  24.  
  25.    XmlSerializer Serializer = new XmlSerializer(Clients.GetType);
  26.    Serializer.Serialize(Writer, Clients);
  27.  
  28.    }
  29.  
  30.    // Deserialización XML.
  31.    using (StreamReader Reader = new StreamReader(".\\Clients.xml")) {
  32.  
  33.    XmlSerializer Serializer = new XmlSerializer(Clients.GetType);
  34.    List<talonary> tmpClients = Serializer.Deserialize(Reader);
  35.  
  36.    foreach (talonary Client in tmpClients) {
  37.    MessageBox.Show(Client.name);
  38.    }
  39.  
  40.    }
  41.  
  42.    }
  43.    public TestClass()
  44.    {
  45.    Shown += Test_Handler;
  46.    }
  47.  
  48.    }
  49.  
  50.    //=======================================================
  51.    //Service provided by Telerik (www.telerik.com)
  52.    //Conversion powered by NRefactory.
  53.    //Twitter: @telerik
  54.    //Facebook: facebook.com/telerik
  55.    //=======================================================
   
Saludos.
6910  Foros Generales / Foro Libre / Re: desproteger un archivo comprimido con contraseña sin saberla en: 3 Agosto 2014, 19:11 pm
Buenas

Este es un tema que se ha comentado, explicado, y solucionado CIENTOS de veces en el foro, pues no eres el único que se ha preguntado "como crackear un archivo comprimido", eso ya lo sabías, así que porfavor utiliza el buscador del foro antes de preguntar, que para algo está, jeje.

· http://foro.elhacker.net/hacking_avanzado/como_sacar_la_contrasena_de_un_archivo_winrar-t399233.0.html;msg1886728#msg1886728
· http://foro.elhacker.net/hacking_basico/como_hackear_archivos_con_metodo_fuerza_bruta-t410646.0.html;msg1927549#msg1927549
· http://foro.elhacker.net/software/iquestcomo_abrir_archivos_rar_que_tengan_contrasenas-t311203.0.html;msg1899910#msg1899910
· http://foro.elhacker.net/search.html

Lo más práctico, lógico, y sencillo es que antes de descargarte un archivo pesado compruebes si especifica alguna contraseña en la fuente (página) desde donde iniciaste la descarga.

Saludos.
Páginas: 1 ... 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 [691] 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 ... 1236
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines