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

 

 


Tema destacado: Como proteger una cartera - billetera de Bitcoin


  Mostrar Mensajes
Páginas: 1 ... 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 [18] 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 ... 128
171  Programación / PHP / Re: [PHP] Problema verificación Twitter en: 16 Septiembre 2011, 16:50 pm
Exacto, era eso, en el php.ini lo tenía comentado. :P
Gracias a ambos. :)

DoEvents! :P
172  Programación / PHP / [PHP] Problema verificación Twitter en: 16 Septiembre 2011, 13:46 pm
Perdón... ;D mover esto al foro de PHP... :rolleyes:

Hola, vi por ahí un articulo:
http://blog.timersys.com/tutoriales/actualizar-twitter-a-traves-de-php-y-oauth/
Sigo todos los pasos... pero me tira error...

¿Sabéis qué hago mal?
Puede ser que hallan actualizado la librería twitteroauth.php y ahora haya alguna incoherencia...
Consulté más ejemplos y me tira el mismo error. (Ambos usaban la librería antes citada)
Aún soy n00b en esto, así que gracias por la ayuda. :)

DoEvents! :P
173  Programación / Programación Visual Basic / Re: Programa Alarm by Hackmin en: 16 Septiembre 2011, 00:59 am
No pretendo ser aguafiestas... pero... ¿todo eso no se puede hacer con las tareas programadas de Windows?

DoEvents! :P
174  Programación / Programación Visual Basic / Re: [Reto] IsHour en: 16 Septiembre 2011, 00:43 am
@BlackZero
Ahh, ok, te lo había copiado de un código tuyo de no sé donde... :silbar:
Viniste a España y no me avisas. :-( :xD
Sí, sigo en el grupo, sé que no es muy metal para ti, pero bueno... :laugh: ;)

@raul
Gracias, corregida... :)
Que listo, justo pruebas con mis funciones lentas... :rolleyes:
Si probamos con mi función más rápida IsHour_Psyke12 las cosas cambian. :silbar:

Código:
Option Explicit
 
Private Declare Sub RtlMoveMemory Lib "kernel32" (ByVal pDst As Long, ByVal pSrc As Long, ByVal ByteLen As Long)
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Private Sub Form_Load()
Dim t As New CTiming, c As New Class1, i&, r&, a$(), b As Boolean

    Me.AutoRedraw = True
    a() = Split("34:23:45 5:59:59 10:45:67 raulfeo 00:00:00 14:57:79 111:23:4", " ")
    
    t.Reset
    For i = 0 To 200000
        For r = 0 To 6
            b = IsHour_r338(a(r))
        Next
    Next
    Me.Print t.sElapsed, "raul338"
    Sleep 1000
    
    t.Reset
    For i = 0 To 200000
        For r = 0 To 6
            b = isHour_BlackZX(a(r))
        Next
    Next
    Me.Print t.sElapsed, "Black"
    Sleep 1000
    
    t.Reset
    For i = 0 To 200000
        For r = 0 To 6
            b = c.IsHour_Psyke12(a(r))
        Next
    Next
    Me.Print t.sElapsed, , "Psyke13"

    Set c = Nothing
    Set t = Nothing
End Sub

Resultado:


DoEvents! :P

175  Programación / Programación Visual Basic / Re: [Reto] IsHour en: 15 Septiembre 2011, 22:37 pm
¿Ahora mejor? :xD :-*

DoEvents! :P
176  Programación / Programación Visual Basic / Re: [Reto] IsHour en: 15 Septiembre 2011, 12:49 pm
Mi segunda forma de hacerlo (sé que se puede simplificar código con bucles, pero yo lo elijo hacer así  :rolleyes:)


Código
  1. '//En un módulo de clase.
  2.  
  3. Option Explicit
  4. Private Declare Sub PutMem4 Lib "msvbvm60.dll" (ByVal Ptr&, ByVal Value&)
  5. Private Declare Function VarPtrArray Lib "msvbvm60.dll" Alias "VarPtr" (Ptr() As Any) As Long
  6.  
  7. Private lngAscHeader&(5), intAsc%()
  8.  
  9. Public Static Function IsHour_Psyke12(ByRef sHour$) As Boolean
  10.    If LenB(sHour) = 16 Then
  11.        lngAscHeader(3) = StrPtr(sHour)
  12.  
  13.        '//Check ":"
  14.        If intAsc(2) = 58 And intAsc(5) = 58 Then
  15.            '//Hours
  16.            If intAsc(0) < 48 Or intAsc(0) > 50 Then Exit Function
  17.  
  18.            If intAsc(1) < 48 Then Exit Function
  19.            If intAsc(0) = 50 Then
  20.                If intAsc(1) > 51 Then Exit Function
  21.            Else
  22.                If intAsc(1) > 57 Then Exit Function
  23.            End If
  24.  
  25.            '//Minutes
  26.            If intAsc(3) < 48 Or intAsc(3) > 53 Then Exit Function
  27.            If intAsc(4) < 48 Or intAsc(4) > 57 Then Exit Function
  28.  
  29.            '//Seconds
  30.            If intAsc(6) < 48 Or intAsc(6) > 53 Then Exit Function
  31.            If intAsc(7) < 48 Or intAsc(7) > 57 Then Exit Function
  32.  
  33.            IsHour_Psyke12 = True
  34.        End If
  35.    End If
  36. End Function
  37.  
  38. Private Sub Class_Initialize()
  39.    lngAscHeader(0) = 1
  40.    lngAscHeader(1) = 2
  41.    lngAscHeader(4) = &H7FFFFFFF
  42.    PutMem4 VarPtrArray(intAsc), VarPtr(lngAscHeader(0))
  43. End Sub
  44.  
  45. Private Sub Class_Terminate()
  46.    PutMem4 VarPtrArray(intAsc), 0
  47. End Sub

Test:
Código
  1. Option Explicit
  2.  
  3. Private Sub Form_Load()
  4. Dim c As New Class1
  5.  
  6.    Debug.Print String$(50, "=")
  7.    Debug.Print c.IsHour_Psyke12(Time$)      'True
  8.    Debug.Print c.IsHour_Psyke12("23:59:59") 'True
  9.    Debug.Print c.IsHour_Psyke12("00:00:00") 'True
  10.    Debug.Print c.IsHour_Psyke12("34:54:13") 'False
  11.    Debug.Print c.IsHour_Psyke12("14:64:24") 'False
  12.    Debug.Print c.IsHour_Psyke12("22:07:70") 'False
  13.  
  14. Set c = Nothing
  15. End Sub

Resultados:
Código:
==================================================
True
True
True
False
False
False


EDIT:

Mi tercera forma de hacerlo (no creo que sea muy rápida, tan solo doy más opciones...  ;) ):
Código
  1. '//En un módulo de clase.
  2.  
  3. Option Explicit
  4. Private oRegExp As Object
  5.  
  6. Public Static Function IsHour_Psyke13(ByRef sHour$) As Boolean
  7.    IsHour_Psyke13 = oRegExp.Test(sHour)
  8. End Function
  9.  
  10. Private Sub Class_Initialize()
  11.    Set oRegExp = CreateObject("VBScript.RegExp")
  12.    With oRegExp
  13.        .Pattern = "^([01]\d|2[0-3])\:[0-5]\d\:[0-5]\d$"
  14.        .Global = True
  15.    End With
  16. End Sub
  17.  
  18. Private Sub Class_Terminate()
  19.    Set oRegExp = Nothing
  20. End Sub

Código
  1. Option Explicit
  2.  
  3. Private Sub Form_Load()
  4. Dim c As New Class1
  5.  
  6.    Debug.Print String$(50, "=")
  7.    Debug.Print c.IsHour_Psyke13(Time$)      'True
  8.    Debug.Print c.IsHour_Psyke13("23:59:59") 'True
  9.    Debug.Print c.IsHour_Psyke13("00:00:00") 'True
  10.    Debug.Print c.IsHour_Psyke13("34:54:13") 'False
  11.    Debug.Print c.IsHour_Psyke13("14:64:24") 'False
  12.    Debug.Print c.IsHour_Psyke13("22:07:70") 'False
  13.  
  14. Set c = Nothing
  15. End Sub

Resultados:
Código:
==================================================
True
True
True
False
False
False


EDIT2:

Mi cuarta forma de hacerlo:
Código
  1. Option Explicit
  2.  
  3. Public Static Function IsHour_Psyke14(ByRef sHour$) As Boolean
  4. Dim h As Byte, m As Byte, s As Byte
  5. On Error GoTo NoHour:
  6.    If LenB(sHour) = 16 Then
  7.        If InStrB(1, ":", MidB$(sHour, 5, 2), vbBinaryCompare) = 0 Then Exit Function
  8.        If InStrB(1, ":", MidB$(sHour, 11, 2), vbBinaryCompare) = 0 Then Exit Function
  9.  
  10.        h = LeftB$(sHour, 4) + 0
  11.        If h > 23 Then Exit Function
  12.        m = MidB$(sHour, 7, 4) + 0
  13.        If m > 59 Then Exit Function
  14.        s = RightB$(sHour, 4) + 0
  15.        If s > 59 Then Exit Function
  16.  
  17.        IsHour_Psyke14 = True
  18.    End If
  19.    Exit Function
  20. NoHour:
  21. End Function

Test:
Código
  1. Option Explicit
  2.  
  3. Private Sub Form_Load()
  4.    Debug.Print String$(50, "=")
  5.    Debug.Print IsHour_Psyke14(Time$)      'True
  6.    Debug.Print IsHour_Psyke14("23:59:59") 'True
  7.    Debug.Print IsHour_Psyke14("00:00:00") 'True
  8.    Debug.Print IsHour_Psyke14("34:54:13") 'False
  9.    Debug.Print IsHour_Psyke14("14:64:24") 'False
  10.    Debug.Print IsHour_Psyke14("22:04:70") 'False
  11. End Sub

Resultados:
Código:
==================================================
True
True
True
False
False
False

PD: Lo próximo que tenga que decir haré un comentario nuevo que sino hago una pág kilométrica. :-X :laugh:

DoEvents! :P
177  Programación / Programación Visual Basic / Re: [Reto] IsHour en: 15 Septiembre 2011, 11:05 am
Ui que interesante, se me ocurren muchas formas de hacerlo, podré todas las que se me ocurran, con RegExp sería sencillísimo:
Código:
^([01]\d|2[0-3])\:[0-5]\d\:[0-5]\d$
(Después lo desarollo antes de que se me adelante raul338) :silbar: :xD

Mi primera forma de hacerlo (dudo que sea la más rápida, pero igual si la más corta):
Código
  1. Option Explicit
  2.  
  3. Public Static Function IsHour_Psyke1(ByRef sHour$) As Boolean
  4. On Error Resume Next
  5.    IsHour_Psyke1 = TimeValue(sHour) And (LenB(sHour) = 16)
  6. End Function

Test:
Código
  1. Private Sub Form_Load()
  2.    Debug.Print IsHour_Psyke1("12:13:12")
  3.    Debug.Print IsHour_Psyke1("24:13:12")
  4. End Sub

Resultado:
Código:
True
False

DoEvents! :P
178  Programación / Programación Visual Basic / Re: [RETO] IsDate en: 13 Septiembre 2011, 18:38 pm
Ook, ya están bien, recordemos que aún estoy engrasando motores, que llevo tiempo sin programar, ando oxidado.
Venga, ¿a qué esperáis? ¡otro reto ya!

DoEvents! :P
179  Programación / Programación Visual Basic / Re: [RETO] IsDate en: 13 Septiembre 2011, 12:55 pm
Mi nueva minifunción (no es para ir rápido, pero creo que es la manera más corta de hacerlo):
Código
  1. Option Explicit
  2.  
  3. '// Acepta formatos: DD/MM/YYYY, D/MM/YYYY y DD/M/YYYY.
  4. Public Static Function IsDate_Psyke12(ByRef sDate$) As Boolean
  5. On Error Resume Next
  6.    IsDate_Psyke12 = InStrB(1, CDate(sDate), sDate, vbBinaryCompare)
  7. End Function

La más rápida que se me ocurre:
Código
  1. Option Explicit
  2.  
  3. '// Acepta formatos: DD/MM/YYYY, D/MM/YYYY y DD/M/YYYY.
  4. Public Static Function IsDate_Psyke13(ByRef sDate$) As Boolean
  5. Dim lDay&, lMonth&, lYear&, lp1&
  6. On Error GoTo DateError
  7.  
  8.    lp1 = InStrB(1, sDate, "/", vbBinaryCompare)
  9.    If lp1 = 0 Then Exit Function
  10.  
  11.    lYear = RightB$(sDate, 8)
  12.  
  13.    lDay = LeftB$(sDate, lp1 - 1)
  14.    If lDay > 31 Then Exit Function
  15.    If lDay < 1 Then Exit Function
  16.  
  17.    lMonth = MidB$(sDate, lp1 + 2, InStrB(lp1 + 1, sDate, "/", vbBinaryCompare) - lp1 - 2)
  18.    Select Case lMonth
  19.        Case Is > 12, Is < 1
  20.            Exit Function
  21.        Case 2
  22.            If lDay = 29 Then
  23.                IsDate_Psyke13 = ((lYear Mod &H4 = 0) And (lYear Mod &H64) Or (lYear Mod &H190 = 0))
  24.                Exit Function
  25.            ElseIf lDay > 29 Then
  26.                Exit Function
  27.            End If
  28.        Case Else
  29.            If lDay = 31 Then
  30.                Select Case lMonth
  31.                    Case 1,3,5,7,8,10,12
  32.                        IsDate_Psyke13 = True
  33.                End Select
  34.                Exit Function
  35.            End If
  36.    End Select
  37.  
  38.    IsDate_Psyke13 = True
  39.    Exit Function
  40. DateError:
  41. End Function

@Tenient101
Quizás un poco larga, pero me gustó la idea, por cierto:
Código:
Testeo de calidad
==============================
30/07/2000 Tenient101 FAILS
30/12/2011 Tenient101 FAILS
31/12/9999 $Edu$ FAILS

Resultados:
Código:
Testeo de velocidades
==============================
43,271 msec Ignorante v1.1
43,986 msec 79137913
21,627 msec BlackZeroX
60,085 msec $Edu$
20,118 msec Tenient101
27,267 msec Raul338
18,805 msec Psyke1
29,638 msec Psyke12
12,705 msec Psyke13
23,933 msec IsDate (función original de vb)

IsDate() PWND! :xD


DoEvents! :P
180  Programación / Programación Visual Basic / Re: [RETO] IsDate en: 13 Septiembre 2011, 07:34 am
Ook, gracias, se me escapó una cosa, sólo fue cambiar el orden de un If... :silbar:

DoEvents! :P
Páginas: 1 ... 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 [18] 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 ... 128
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines