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


Tema destacado: Introducción a la Factorización De Semiprimos (RSA)


  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 ... 1253
6891  Foros Generales / Foro Libre / Re: Pelicula de los años 80's en: 4 Septiembre 2014, 19:48 pm
 ??

http://www.imdb.com/title/tt0092834/

No tengo ni idea de si será esa, solo busqué en Google por: "80s film angel fall in love"
6892  Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Compartan aquí sus snippets) en: 4 Septiembre 2014, 18:31 pm
BetfairUtil

Con esta class pueden analizar los próximos eventos de un mercado de futbol de la página Betfair, para meterlos por ejemplo como DataSource de un GridView:



Nota: es necesaria la librería HtmlAgilityPack.


Código
  1. ' ***********************************************************************
  2. ' Author           : Elektro
  3. ' Last Modified On : 09-01-2014
  4. ' ***********************************************************************
  5. ' <copyright file="BetfairUtil.vb" company="Elektro Studios">
  6. '     Copyright (c) Elektro Studios. All rights reserved.
  7. ' </copyright>
  8. ' ***********************************************************************
  9.  
  10. #Region " Imports "
  11.  
  12. Imports HtmlAgilityPack
  13. Imports System.Web
  14.  
  15. #End Region
  16.  
  17. ''' <summary>
  18. ''' Contains web related methods for Betfair.
  19. ''' </summary>
  20. Public Class BetfairUtil
  21.  
  22. #Region " XPath Expressions "
  23.  
  24.    ''' <summary>
  25.    ''' XPath to locate the coming-up events grid.
  26.    ''' </summary>
  27.    Private Shared ReadOnly XPathComingUpGrid As String = "//*/ul[1][@class='event-list']/li[@class='avb-row COMING_UP']/*"
  28.  
  29.    ''' <summary>
  30.    ''' XPath to locate the home team name.
  31.    ''' </summary>
  32.    Private Shared ReadOnly XPathHomeTeam As String = ".//span[@class='home-team-name']"
  33.  
  34.    ''' <summary>
  35.    ''' XPath to locate the away team name.
  36.    ''' </summary>
  37.    Private Shared ReadOnly XPathAwayTeam As String = ".//span[@class='away-team-name']"
  38.  
  39.    ''' <summary>
  40.    ''' XPath to locate the day which the teams will play.
  41.    ''' </summary>
  42.    Private Shared ReadOnly XPathPlayDay As String = ".//span[@class='date']"
  43.  
  44.    ''' <summary>
  45.    ''' XPath to locate the hour at which the teams will play.
  46.    ''' </summary>
  47.    Private Shared ReadOnly XPathPlayHour As String = XPathPlayDay
  48.  
  49.    ''' <summary>
  50.    ''' XPath to locate the odds value 1.
  51.    ''' </summary>
  52.    Private Shared ReadOnly XPathOddResult1 As String = ".//*/li[@class='selection sel-0']/*/span['ui-runner-price*']"
  53.  
  54.    ''' <summary>
  55.    ''' XPath to locate the odds value 2.
  56.    ''' </summary>
  57.    Private Shared ReadOnly XPathOddResult2 As String = ".//*/li[@class='selection sel-1']/*/span['ui-runner-price*']"
  58.  
  59.    ''' <summary>
  60.    ''' XPath to locate the odds value 3.
  61.    ''' </summary>
  62.    Private Shared ReadOnly XPathOddResult3 As String = ".//*/li[@class='selection sel-2']/*/span['ui-runner-price*']"
  63.  
  64. #End Region
  65.  
  66. #Region " Types "
  67.  
  68.    ''' <summary>
  69.    ''' Specifies an event info.
  70.    ''' </summary>
  71.    Public Class BetfairEventInfo
  72.  
  73.        ''' <summary>
  74.        ''' Gets or sets the home team name.
  75.        ''' </summary>
  76.        ''' <value>The home team name.</value>
  77.        Public Property HomeTeam As String
  78.  
  79.        ''' <summary>
  80.        ''' Gets or sets the away team name.
  81.        ''' </summary>
  82.        ''' <value>The away team name.</value>
  83.        Public Property AwayTeam As String
  84.  
  85.        ''' <summary>
  86.        ''' Gets or sets the day which the teams will play.
  87.        ''' </summary>
  88.        ''' <value>The day which the teams will play.</value>
  89.        Public Property PlayDay As String
  90.  
  91.        ''' <summary>
  92.        ''' Gets or sets the hour at which the teams will play.
  93.        ''' </summary>
  94.        ''' <value>The hour at which the teams will play.</value>
  95.        Public Property PlayHour As String
  96.  
  97.        ''' <summary>
  98.        ''' Gets or sets the odds value for result '1'.
  99.        ''' (which depending on the Betfair section could be the value for column-names: "1", "Yes" or "More than...")
  100.        ''' </summary>
  101.        ''' <value>The odds value for result '1'.</value>
  102.        Public Property Result1 As Double
  103.  
  104.        ''' <summary>
  105.        ''' Gets or sets the odds value for result '2'.
  106.        ''' (which depending on the Betfair section could be the value for column-names: "X", "No" or "Less than...")
  107.        ''' </summary>
  108.        ''' <value>The odds value for result '2'.</value>
  109.        Public Property Result2 As Double
  110.  
  111.        ''' <summary>
  112.        ''' (which depending on the Betfair section could be the value for column-names: "2")
  113.        ''' </summary>
  114.        ''' <value>The odds value for result 'X'.</value>
  115.        Public Property ResultX As Double
  116.  
  117.    End Class
  118.  
  119. #End Region
  120.  
  121. #Region " Public Methods "
  122.  
  123.    ''' <summary>
  124.    ''' Gets the coming-up events from a Betfair page.
  125.    ''' </summary>
  126.    ''' <param name="HtmlSource">The Betfair webpage raw Html source-code to parse the events.</param>
  127.    ''' <returns>List(Of EventInfo).</returns>
  128.    ''' <exception cref="System.Exception">Node not found in the html source-code, maybe there is any coming-up event?</exception>
  129.    Public Shared Function GetComingUpEvents(ByVal HtmlSource As String) As List(Of BetfairEventInfo)
  130.  
  131.        ' The event collection to add events.
  132.        Dim EventInfoList As New List(Of BetfairEventInfo)
  133.  
  134.        ' The current event info.
  135.        Dim EventInfo As BetfairEventInfo
  136.  
  137.        ' Initialize the HtmlDoc object.
  138.        Dim Doc As New HtmlDocument
  139.  
  140.        ' Load the Html document.
  141.        Doc.LoadHtml(HtmlSource)
  142.  
  143.        ' A temporal node to determine whether the node exist.
  144.        Dim tempNode As HtmlNode
  145.  
  146.        ' The HtmlDocument nodes to analyze.
  147.        Dim Nodes As HtmlNodeCollection
  148.  
  149.        ' Select the Teams nodes.
  150.        Nodes = Doc.DocumentNode.SelectNodes(XPathComingUpGrid)
  151.  
  152.        If Nodes Is Nothing Then ' Node not found in the html source-code.
  153.            Throw New Exception("Node not found in the html source-code, maybe there is any coming-up event?")
  154.            Return Nothing
  155.        End If
  156.  
  157.        ' Loop trough the nodes.
  158.        For Each Node As HtmlNode In Nodes
  159.  
  160.            EventInfo = New BetfairEventInfo
  161.  
  162.            ' Retrieve and set the home team name.
  163.            EventInfo.HomeTeam = HttpUtility.HtmlDecode(Node.SelectSingleNode(XPathHomeTeam).InnerText.
  164.                                                        Replace("(W)", String.Empty).
  165.                                                        Replace("(HT)", String.Empty).
  166.                                                        Replace("(QAT)", String.Empty).
  167.                                                        Replace("(Uru)", String.Empty).
  168.                                                        Replace("(Ecu)", String.Empty).
  169.                                                        Replace("(Bol)", String.Empty).
  170.                                                        Trim)
  171.  
  172.            ' Retrieve and set the away team name.
  173.            EventInfo.AwayTeam = HttpUtility.HtmlDecode(Node.SelectSingleNode(XPathAwayTeam).InnerText.
  174.                                                        Replace("(W)", String.Empty).
  175.                                                        Replace("(HT)", String.Empty).
  176.                                                        Replace("(QAT)", String.Empty).
  177.                                                        Replace("(Uru)", String.Empty).
  178.                                                        Replace("(Ecu)", String.Empty).
  179.                                                        Replace("(Bol)", String.Empty).
  180.                                                        Trim)
  181.  
  182.            ' Retrieve and set the day which the teams will play.
  183.            tempNode = Node.SelectSingleNode(XPathPlayDay)
  184.            If tempNode IsNot Nothing Then
  185.  
  186.                EventInfo.PlayDay = HttpUtility.HtmlDecode(Node.SelectSingleNode(XPathPlayDay).
  187.                                                           InnerText.
  188.                                                           Trim)
  189.  
  190.                ' This value can contains different words or one word;
  191.                ' Such as: "Mañana 14:00" or "14:00" or "03 Sep 14".
  192.                ' If the value is only the hour, the day is today.
  193.                If EventInfo.PlayDay Like "##:##" Then
  194.                    EventInfo.PlayDay = "Hoy"
  195.  
  196.                ElseIf EventInfo.PlayDay Like "Mañana*" Then
  197.                    EventInfo.PlayDay = EventInfo.PlayDay.Split(" "c).First
  198.  
  199.                End If
  200.  
  201.                If Not EventInfo.PlayDay Like "## *" Then
  202.  
  203.                    ' Retrieve and set the hour at which the teams will play.
  204.                    EventInfo.PlayHour = HttpUtility.HtmlDecode(Node.SelectSingleNode(XPathPlayHour).
  205.                                                                InnerText.
  206.                                                                Trim.
  207.                                                                Split(" "c).Last)
  208.                Else
  209.                    EventInfo.PlayHour = "N/A" ' Unknown, the hour is not displayed.
  210.                End If
  211.  
  212.            Else
  213.                EventInfo.PlayDay = "Error"
  214.                EventInfo.PlayHour = "Error"
  215.  
  216.            End If
  217.  
  218.            ' Retrieve and set the odds for result '1'.
  219.            tempNode = Node.SelectSingleNode(XPathOddResult1) ' Test whether the node exists.
  220.            If tempNode IsNot Nothing Then
  221.                If String.IsNullOrEmpty(HttpUtility.HtmlDecode(Node.SelectSingleNode(XPathOddResult1).InnerText).Trim) _
  222.                OrElse String.IsNullOrWhiteSpace(HttpUtility.HtmlDecode(Node.SelectSingleNode(XPathOddResult1).InnerText).Trim) _
  223.                OrElse HttpUtility.HtmlDecode(Node.SelectSingleNode(XPathOddResult1).InnerText).Trim.Equals("NC", StringComparison.OrdinalIgnoreCase) Then
  224.                    EventInfo.Result1 = 0
  225.  
  226.                Else
  227.                    EventInfo.Result1 = Node.SelectSingleNode(XPathOddResult1).InnerText.Trim().Replace(".", ",")
  228.                End If
  229.  
  230.            Else
  231.                EventInfo.Result1 = 0
  232.            End If
  233.  
  234.            ' Retrieve and set the odds for result '2'.
  235.            tempNode = Node.SelectSingleNode(XPathOddResult2) ' Test whether the node exists.
  236.            If tempNode IsNot Nothing Then
  237.                If String.IsNullOrEmpty(HttpUtility.HtmlDecode(Node.SelectSingleNode(XPathOddResult2).InnerText).Trim) _
  238.                OrElse String.IsNullOrWhiteSpace(HttpUtility.HtmlDecode(Node.SelectSingleNode(XPathOddResult2).InnerText).Trim) _
  239.                OrElse HttpUtility.HtmlDecode(Node.SelectSingleNode(XPathOddResult2).InnerText).Trim.Equals("NC", StringComparison.OrdinalIgnoreCase) Then
  240.                    EventInfo.Result2 = 0
  241.  
  242.                Else
  243.                    EventInfo.Result2 = Node.SelectSingleNode(XPathOddResult2).InnerText.Trim().Replace(".", ",")
  244.  
  245.                End If
  246.  
  247.            Else
  248.                EventInfo.Result2 = 0
  249.            End If
  250.  
  251.            ' Retrieve and set the odds for result 'X'.
  252.            tempNode = Node.SelectSingleNode(XPathOddResult3) ' Test whether the node exists.
  253.            If tempNode IsNot Nothing Then
  254.                If String.IsNullOrEmpty(HttpUtility.HtmlDecode(Node.SelectSingleNode(XPathOddResult3).InnerText).Trim) _
  255.                OrElse String.IsNullOrWhiteSpace(HttpUtility.HtmlDecode(Node.SelectSingleNode(XPathOddResult3).InnerText).Trim) _
  256.                OrElse HttpUtility.HtmlDecode(Node.SelectSingleNode(XPathOddResult3).InnerText).Trim.Equals("NC", StringComparison.OrdinalIgnoreCase) Then
  257.                    EventInfo.ResultX = 0
  258.  
  259.                Else
  260.                    EventInfo.ResultX = Node.SelectSingleNode(XPathOddResult3).InnerText.Trim().Replace(".", ",")
  261.  
  262.                End If
  263.            Else
  264.                EventInfo.ResultX = 0
  265.            End If
  266.  
  267.            ' Add the event-into into the event collection.
  268.            EventInfoList.Add(EventInfo)
  269.  
  270.        Next Node
  271.  
  272.        Return EventInfoList
  273.  
  274.    End Function
  275.  
  276. #End Region
  277.  
  278. End Class
  279.  

Ejemplo de uso:

Código
  1.    ''' <summary>
  2.    ''' Contains the Betfair coming-up events-info.
  3.    ''' </summary>
  4.    Private ComingUpEvents As List(Of BetfairEventInfo)
  5.  
  6.    ' Parse the Betfair page source-code to get the events.
  7.    Me.ComingUpEvents = BetfairUtil.GetComingUpEvents(Me.HtmlSource)
6893  Programación / Scripting / Re: Algún lenguaje "liviano" en: 4 Septiembre 2014, 18:01 pm
si no quieres usar ide puedes programar en notepad++  y compilarlo a mano
http://notepad-plus-plus.org/

O también con Sublime Text, entre otros por supuesto.

Lo que comenta el compañero @Daryo es algo a tener en cuenta, sí, pero para gente que sepa lo que se hace, ya que no me parece buena idea que alguien empiece a programar Scripts con un editor de texto en un lenguaje desconocido, una IDE facilita la tarea de aprendizaje y corrección.

De todas formas eso es algo que queda a la elección del OP.

Saludos!
6894  Programación / Scripting / Re: Algún lenguaje "liviano" en: 4 Septiembre 2014, 16:21 pm
Geormarsch, podrías usar el buscador del foro para encontrar cientos de recomendaciones a esta misma pregunta.

Si quieres seguir con el Scripting entonces te recomiendo Ruby o Python, en ambos puedes utilizar una gran variedad de IDE's, y en ambos puedes desarrollar una GUI.

Yo prefiero recomendarte las IDE's de Jetbrains porque son las que más herramientas incorporan, en mi opinión no existen IDEs más completas, pero lo cierto es que quizás podrían resultarte algo pesadas, lo mejor es que las pruebes a ver como te van.

⇲ Ruby:

⇲ Python:

Nota: Hay otros muy buenos lenguajes por supuesto (como Perl) pero no es cuestión de ponerse a recomendar todas las opciones que existen.
        Según la definición de "lenguaje liviano" por Wikipedia, el lenguaje liviano más destacado es LUA.

Saludos
6895  Programación / .NET (C#, VB.NET, ASP) / Re: Mis malas combinaciones :( en: 3 Septiembre 2014, 00:24 am
pues excluye el 0 al crear la combinación, tan facil como eso, tienes una mezcla de 20 códigos que se te han ido proporcionando para hacer todo lo que deseas, creo que ya es suficiente, preguntar "¿como hago para que no salga un 00?" a estas alturas... fíjate en el código que tienes y aprende a usarlo.

Saludos!
6896  Sistemas Operativos / Windows / Re: Menu contextual detectar unidad extraible en: 2 Septiembre 2014, 22:10 pm
no puedo cargar la ruta porq la variable contiene G:\ y lo que tiene que tener es solo G:

Código:
Set "Var=G:\"
Echo %Var:~0,-1%

saludos.
6897  Programación / Scripting / Re: [Batch]Ayuda con System32 desde la CMD en: 2 Septiembre 2014, 17:33 pm
Lo único que no se porque me pokne acceso denegado.

1) Precisamente para evitar catástrofes intencionadas como la de eliminar la carpeta System32.

2) Una cuenta de usuario "normal" tiene restricciones respecto a los archivos del sistema.

3) Muchos de esos archivos están en ejecución (ej: winlogon.exe, svchosts.exe), entonces aunque tuvieras permisos de eliminación sobre los archivos no podrás eliminarlos ya que forman la parte crítica del SO.


Puedes hacer dos cosas:

1) Acceder a la cuenta de usuario oculta sin restricciones llamada "Administrador", para eliminar los archivos de la carpeta System32.

2) Acceder a la cuenta corriente de Administrador y utilizar el comando ICacls y takeOwn para especificar los permisos de eliminación para esa carpeta y sus archivos, y posteriormente poder eliminarlos.

Ejemplo:

Citar
Código
  1. Echo OFF & Title Conceder acceso para: %UserName%
  2. :: By Elektro
  3.  
  4. "%systemRoot%\System32\Mode.com" Con Cols=100 Lines=20
  5. Color 0F
  6.  
  7. Echo: Procesando directorio y subdirectorios de:
  8. Echo: "%~1"
  9. "%systemRoot%\System32\Timeout.exe" /T 2 1>NUL
  10.  
  11. Dir /B /S /AD "%~1" 2>NUL
  12.  
  13. (
  14. (
  15. "%systemRoot%\System32\Takeown.exe" /F "%~1" /R /D S 1>NUL && "%systemRoot%\System32\Icacls.exe" "%~1" /Grant "%username%":"F" /T 1>NUL
  16. ) || (
  17. "%systemRoot%\System32\Icacls.exe" "%~1" /Grant "%username%":"F" /T >nul
  18. )
  19. ) && (
  20. Echo: "%~1"
  21. Echo. Permisos de "Acceso total" concedidos al usuario "%UserName%"
  22. ) || (
  23. Echo: "%~1"
  24. Echo: Error al intentar conceder permisos al usuario "%UserName%"
  25. )
  26.  
  27. "%systemRoot%\System32\Timeout.exe" /T 3

Uso:
Código:
Call Script.bat "%systemroot%\System32\"

Nota: en cualquiera de las 2 opciones, recordar el punto 3) que mencioné anteriormente.

Saludos!
6898  Programación / .NET (C#, VB.NET, ASP) / Re: Mis malas combinaciones :( en: 2 Septiembre 2014, 15:34 pm
¿y entonces que quieres mostrar en su lugar?, no soy adivino, luis.

pero de todas formas creo que eso ya puedes hacerlo tu solito

saludos!
6899  Programación / Scripting / Re: [Batch]Ayuda con System32 desde la CMD en: 2 Septiembre 2014, 15:31 pm
Código
  1. @echo off
  2. title Uninstall System32
  3. echo Bienvenido al asistente de desinstalacion de la carpeta System32

El código me parece bien... en caso de que la idea sea CARGARTE tu equipo.

Estás intentando eliminar la carpeta más importante del S.O., donde, solo por nombrar algo, se encuentran practicamente todos los archivos necesarios que hacen posible el funcionamiento del SO, desde los Drivers, hasta la CMD y todos sus comandos externos.

Te sugiero informarte de lo que haces antes de ""desinstalar"" otras carpetas como esa.

Saludos!
6900  Programación / .NET (C#, VB.NET, ASP) / Re: Como puedo sumar valores usando 1 solo txtbox en C# en: 2 Septiembre 2014, 04:32 am
ese "double" es un array con tipo de dato double solamente? o es una variable que se le asigna el tipo de dato?

Es una Lista, llamarlo Array sería poco preciso, pero si, y solo podrás añadir valores del tipo Double a la Lista.

> List<T> Class
> Type Parameters (<T>)


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 ... 1253
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines