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

 

 


Tema destacado: Usando Git para manipular el directorio de trabajo, el índice y commits (segunda parte)


  Mostrar Mensajes
Páginas: 1 ... 675 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 ... 1236
6891  Programación / Scripting / Re: [python] ayuda caracteres especiales tildes y ñ python en: 6 Agosto 2014, 22:39 pm
Código:
text_file.write(str(lol))

Estás tratando la lista como si fuese un string por ende se muestra el contenido RAW, no estás convirtiendo la lista a String, debes unir los elementos de la lista:

Código
  1. text_file.write(''.join(lol))

Documentación:
· str()
· str.join()

Saludos.
6892  Programación / .NET (C#, VB.NET, ASP) / Re: Problema con formatos VB.NET 2010, Access 2007 en: 6 Agosto 2014, 21:29 pm
1) El mensaje de la excepción es bien claro, no se puede tratar la cadena de texto "La operación necesita una consu" como si fuese un valor de tipo Integer, en alguna parte del código, la cual no tiene porque ser necesariamente la que has mostrado, estás intentando hacer ese tipo de conversión, y es donde está el error.
Aunque te parezca un error absurdo, es muy común en los inicios de cualquier programador equivocarse de esa manera.

2) En el código que has mostrado parece como si, mientras un usuario escribe en un textbox, tu quisieras comprobar si lo que escribe es un número, y luego reemplazar/formatear el texto de ese textbox mientras el usuario pueda seguir escribiendo?... en ese caso debes darle otro enfoque a lo que intentes conseguir.

3) En lugar de usar métodos del siglo pasado de VisualBasic6 (IsNumeric) deberías reemplazarlo por métodos de la programación actual (Double.TryParse), ejemplo:

Código
  1.        Dim comprobar As String = TxtMonto.Text
  2.        Dim monto As Double = 0.0R
  3.        Dim Success As Boolean = Double.TryParse(comprobar, monto)
  4.  
  5.        Select Case Success
  6.            Case True
  7.                lblmonto.Text = ""
  8.                TxtMonto.Text = monto.ToString("###,###,###.##")
  9.  
  10.            Case Else
  11.                lblmonto.ForeColor = Color.Red
  12.                lblmonto.Text = "Dato Incorrecto"
  13.  
  14.        End Select
  15.  
  16.        btnGuardarDatos.Enabled = Success

4) Si lo que pretendes es que en el TextBox solo se puedan escribir dígitos y puntos, como ya digo tienes que darle otro enfoque al código, esa no es la manera apropiada, esta sería una manera:

Código
  1.    ''' <summary>
  2.    ''' The keys that are allowed to press in the TextBox.
  3.    ''' </summary>
  4.    Private ReadOnly AllowedKeys As Char() = "0123456789."
  5.  
  6.    ''' <summary>
  7.    ''' Handles the Enter event of the TextBox control.
  8.    ''' </summary>
  9.    ''' <param name="sender">The source of the event.</param>
  10.    ''' <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
  11.    Private Sub TxtMonto_Enter(ByVal sender As Object, ByVal e As EventArgs) Handles TxtMonto.MouseEnter
  12.  
  13.        ' Disable Copy/Paste contextmenu by creating a new empty one.
  14.        If sender.ContextMenuStrip Is Nothing Then
  15.            sender.ContextMenuStrip = New ContextMenuStrip
  16.        End If
  17.  
  18.    End Sub
  19.  
  20.    ''' <summary>
  21.    ''' Handles the KeyPress event of the TextBox control.
  22.    ''' </summary>
  23.    ''' <param name="sender">The source of the event.</param>
  24.    ''' <param name="e">The <see cref="KeyPressEventArgs"/> instance containing the event data.</param>
  25.    Private Sub TxtMonto_KeyPress(ByVal sender As Object, ByVal e As KeyPressEventArgs) Handles TxtMonto.KeyPress
  26.  
  27.        Select Case e.KeyChar
  28.  
  29.            Case Convert.ToChar(Keys.Enter) ' 'Enter' key is pressed.
  30.                ' Do something here...
  31.  
  32.            Case Convert.ToChar(Keys.Back) ' 'Backspace' key is pressed.
  33.                e.Handled = False ' Delete the character
  34.  
  35.            Case Convert.ToChar(Keys.Capital Or Keys.RButton) ' 'CTRL+V' combination is pressed.
  36.                ' Paste clipboard content only if contains allowed keys.
  37.                e.Handled = Not Clipboard.GetText().All(Function(c) AllowedKeys.Contains(c))
  38.  
  39.            Case Else ' Other key is pressed.
  40.                e.Handled = Not AllowedKeys.Contains(e.KeyChar)
  41.  
  42.        End Select
  43.  
  44.    End Sub

Otra manera sería que en lugar de usar un TextBox normal utilizases un MaskedTextbox y aplicarle una máscara numérica, usando la propiedad "Mask".

De todas formas no me ha quedado muy claro lo que pretendes conseguir, la función de ese textbox y porque intentas aplicarle un formato específico mientras el usuario typea.

5) Si tienes dudas acerca dle formato que le estás intentando dar al número, tienes información y ejemplos en MSDN:
· Double.ToString(IFormatProvider)
· Double.ToString(String)

Saludos
6893  Programación / .NET (C#, VB.NET, ASP) / Re: Mandar Correo con c# y smtp de gmail en: 6 Agosto 2014, 19:33 pm
Buenas

1) Está prohibido revivir temas antiguos para preguntar, debes formular tu duda en un nuevo post.

2) Debes mostrar tu código si esperas poder recibir mejor ayuda.

3) La razón del error:

Código:
System.Net.Mail.SmtpException: The SMTP server requires a secure connection or the client was not authenticated
Citar
That error message is typically caused by one of the following:

    Incorrect connection settings, such as the wrong port specified for the secured or non-secured connection
    Incorrect credentials. I would verify the username and password combination, to make sure the credentials are correct.

4) Un ejemplo que a mi me funciona:

Código
  1.    ' GMail Sender
  2.    ' By Elektro
  3.    '
  4.    ' Usage Examples :
  5.    ' GMailSender("Username@Gmail.com", "Password", "Email Subject", "Message Body", "Receiver@Address.com")
  6.    '
  7.    ''' <summary>
  8.    ''' Sends an e-mail through GMail service.
  9.    ''' </summary>
  10.    ''' <param name="Username">Indicates the GMail account username.</param>
  11.    ''' <param name="Password">Indicates the GMail account password.</param>
  12.    ''' <param name="Subject">Indicates e-mail subject.</param>
  13.    ''' <param name="Body">Indicates e-mail body.</param>
  14.    ''' <param name="Addresses">Indicates the address(es) to send.</param>
  15.    Private Sub GMailSender(ByVal Username As String,
  16.                            ByVal Password As String,
  17.                            ByVal Subject As String,
  18.                            ByVal Body As String,
  19.                            ByVal Addresses As String)
  20.  
  21.            Using MailSetup As New System.Net.Mail.MailMessage
  22.  
  23.                MailSetup.Subject = Subject
  24.                MailSetup.To.Add(Addresses)
  25.                MailSetup.From = New System.Net.Mail.MailAddress(Username)
  26.                MailSetup.Body = Body
  27.  
  28.                Using SMTP As New System.Net.Mail.SmtpClient("smtp.gmail.com")
  29.                    SMTP.Port = 587
  30.                    SMTP.EnableSsl = True
  31.                    SMTP.Credentials = New Net.NetworkCredential(Username, Password)
  32.                    SMTP.Send(MailSetup)
  33.                End Using ' SMTP
  34.  
  35.            End Using ' MailSetup
  36.  
  37.    End Sub

Tema cerrado.
6894  Foros Generales / Foro Libre / Re: que pasaría si en matrix se crea una inteligencia artificial? en: 5 Agosto 2014, 19:51 pm
que pasaría si en matrix alguien crea un inteligencia artificial tal que se vuelva imponente y empiece a destruir a los humanos e intente crear una matrix? XD

6895  Foros Generales / Dudas Generales / Re: No veo las aplicaciones en: 5 Agosto 2014, 19:43 pm
Creo que no he entendido practicamente nada ... :-/

abro el navegador chrome y ahora le doy doble clic

¿A donde le diste doble-click, al navegador, al botón del juego en la barra de tareas para maximizarlo tal vez?

¿Que entiendes por "zona no visible"?, ¿el Chrome desaparece de la pantalla al minimizarlo quieres decir?, ¿no aparecen los botones de los procesos en la barra de tareas?.

Me gusta intentar encontrar la causa a cualquier problema, pero creo que en este caso lo mejor que puedes hacer es reiniciar el explorer desde el administrador de tareas (primero lo matas, y luego ejecutas el proceso "explorer.exe", ambas cosas las puedes hacer desde el TaskManager), eso debería solucionar los problemas que comentas... si es que los he entendido bien.

PD:
estaba jugando a las magics

por "las magics" quieres decir las cartas de Magic?, ¿al Magic 2015?
6896  Foros Generales / Dudas Generales / Re: retrasos. en: 5 Agosto 2014, 17:14 pm
cuando te pones encima de algun enlace, se cambia a la forma de una manita y además en las palabras del enlace aparece una linea debajo.

Se denomina HyperLink



¿a qué se debe ese típico retraso?

A nada en especial, el SO y/o navegador recibe un flujo de datos que tiene que procesar/interpretar a cada momento, si tu PC tiene unos componentes de Hardware "lentos" entonces el proceso será lento paara indicarle las instrucciones de que debe cambiar el icono del cursor, etc..., a eso súmale la cantidad de instancias y/o de pestañas que tengas abiertas en el navegador, y los servicios y procesos que tengas en ejecución en el SO, tanto activos como en segundo plano, los cuales merman el rendimiento en general del SO.

Saludos.
6897  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
6898  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
6899  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
6900  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!
Páginas: 1 ... 675 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 ... 1236
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines