|
7491
|
Programación / Programación General / Re: Problemas para comparar versiones
|
en: 9 Marzo 2014, 20:36 pm
|
Sugerencia:
En una sección que está dedicada a todos los lenguajes en general, al menos podrías especificar que el lenguaje del que trata el post es Pascal, en un comentario o en un Tag, ya que no todos saben distinguir la sintaxis, y abrir un post sin saber de que lenguaje se habla es hacer perder el tiempo a todos los demás.
Sobre lo de 'el Setup', te digo lo mismo, ¿que Setup, que archivo de instalación, eso que es?, ¿acaso te refieres a un InstallBuilder ...InnoSetup por ejemplo?, ¡pues dilo!.
Saludos!
|
|
|
7492
|
Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Compartan aquí sus snippets)
|
en: 9 Marzo 2014, 17:31 pm
|
Algunos métodos más sobre bytes. ' Set LoByte ' ( By Elektro ) ' ' Usage Examples: ' MsgBox(SetHiByte(321, 0S)) ' Result: 65S ' ''' <summary> ''' Sets the low-order byte of an 'Int16' value. ''' </summary> ''' <param name="Value">Indicates the 'Int16' value that contains both the LoByte and the HiByte.</param> ''' <param name="NewLoByte">Indicates the new LoByte, a 'Byte' value.</param> ''' <returns>The 'Int16' value containing both the HiByte and the new LoByte.</returns> Private Function SetLoByte(ByVal Value As Short, ByVal NewLoByte As Byte) As Short Dim ValueBytes As Byte() = BitConverter.GetBytes(Value) ValueBytes(0) = NewLoByte Return BitConverter.ToInt16(ValueBytes, 0) End Function
' Set HiByte ' ( By Elektro ) ' ' Usage Examples: ' MsgBox(SetHiByte(65S, 1S)) ' Result: 321S ' ''' <summary> ''' Sets the high-order byte of an 'Int16' value. ''' </summary> ''' <param name="Value">Indicates the 'Int16' value that contains both the LoByte and the HiByte.</param> ''' <param name="NewHiByte">Indicates the new HiByte, a 'Byte' value.</param> ''' <returns>The 'Int16' value containing both the LoByte and the new HiByte.</returns> Private Function SetHiByte(ByVal Value As Short, ByVal NewHiByte As Byte) As Short Dim ValueBytes As Byte() = BitConverter.GetBytes(Value) ValueBytes(1) = NewHiByte Return BitConverter.ToInt16(ValueBytes, 0) End Function
' Set LoWord ' ( By Elektro ) ' ' Usage Examples: ' MsgBox(SetLoWord(13959358I, 6S)) ' Result: 13959174I ' ''' <summary> ''' Sets the low-order word of an 'Int32' value. ''' </summary> ''' <param name="Value">Indicates the 'Int32' value that contains both the LoWord and the HiWord.</param> ''' <param name="NewLoWord">Indicates the new LoWord, an 'Int16' value.</param> ''' <returns>The 'Int32' value containing both the HiWord and the new LoWord.</returns> Private Function SetLoWord(ByVal Value As Integer, ByVal NewLoWord As Short) As Integer Dim ValueBytes As Byte() = BitConverter.GetBytes(Value) Dim LoWordBytes As Byte() = BitConverter.GetBytes(NewLoWord) ValueBytes(0) = LoWordBytes(0) ValueBytes(1) = LoWordBytes(1) Return BitConverter.ToInt32(ValueBytes, 0) End Function
' Set HiWord ' ( By Elektro ) ' ' Usage Examples: ' MsgBox(SetHiWord(13959358I, 25S)) ' Result: 1638590I ' ''' <summary> ''' Sets the high-order word of an 'Int32' value. ''' </summary> ''' <param name="Value">Indicates the 'Int32' value that contains both the LoWord and the HiWord.</param> ''' <param name="NewHiWord">Indicates the new HiWord, an 'Int16' value.</param> ''' <returns>The 'Int32' value containing both the LoWord and the new HiWord.</returns> Private Function SetHiWord(ByVal Value As Integer, ByVal NewHiWord As Short) As Integer Dim ValueBytes As Byte() = BitConverter.GetBytes(Value) Dim HiWordBytes As Byte() = BitConverter.GetBytes(NewHiWord) ValueBytes(2) = HiWordBytes(0) ValueBytes(3) = HiWordBytes(1) Return BitConverter.ToInt32(ValueBytes, 0) End Function
' Set LoDword (From a Signed Integer) ' ( By Elektro ) ' ' Usage Examples: ' MsgBox(SetLoDword(328576329396160L, -1553649828I)) ' Result: 328576329396060L ' ''' <summary> ''' Sets the low-order double word of an 'Int64' value. ''' </summary> ''' <param name="Value">Indicates the 'Int64' value that contains both the LoDword and the HiDword.</param> ''' <param name="NewLoDword">Indicates the new LoDword, an 'Int32' value.</param> ''' <returns>The 'Int64' value containing both the HiDword and the new LoDword.</returns> Private Function SetLoDword(ByVal Value As Long, ByVal NewLoDword As Integer) As Long Dim ValueBytes As Byte() = BitConverter.GetBytes(Value) Dim LoDwordBytes As Byte() = BitConverter.GetBytes(NewLoDword) ValueBytes(0) = LoDwordBytes(0) ValueBytes(1) = LoDwordBytes(1) ValueBytes(2) = LoDwordBytes(2) ValueBytes(3) = LoDwordBytes(3) Return BitConverter.ToInt64(ValueBytes, 0) End Function
' Set HiDword (From a Signed Integer) ' ( By Elektro ) ' ' Usage Examples: ' MsgBox(SetHiDword(328576329396160L, 987654321I)) ' Result: 4241943011189403584L ' ''' <summary> ''' Sets the high-order double word of an 'Int64' value. ''' </summary> ''' <param name="Value">Indicates the 'Int64' value that contains both the LoDword and the HiDword.</param> ''' <param name="NewHiDword">Indicates the new HiDword, an 'Int32' value.</param> ''' <returns>The 'Int64' value containing both the LoDword and the new HiDword.</returns> Private Function SetHiDword(ByVal Value As Long, ByVal NewHiDword As Integer) As Long Dim ValueBytes As Byte() = BitConverter.GetBytes(Value) Dim HiDwordBytes As Byte() = BitConverter.GetBytes(NewHiDword) ValueBytes(4) = HiDwordBytes(0) ValueBytes(5) = HiDwordBytes(1) ValueBytes(6) = HiDwordBytes(2) ValueBytes(7) = HiDwordBytes(3) Return BitConverter.ToInt64(ValueBytes, 0) End Function
' Set LoDword (From an Unsigned Integer) ' ( By Elektro ) ' ' Usage Examples: ' MsgBox(SetLoDword(328576329396160L, 123456789UI)) ' Result: 328573711535381L ' ''' <summary> ''' Sets the low-order double word of an 'Int64' value. ''' </summary> ''' <param name="Value">Indicates the 'Int64' value that contains both the LoDword and the HiDword.</param> ''' <param name="NewLoDword">Indicates the new LoDword, an 'UInt32' value.</param> ''' <returns>The 'Int64' value containing both the HiDword and the new LoDword.</returns> Private Function SetLoDword(ByVal Value As Long, ByVal NewLoDword As UInteger) As Long Dim ValueBytes As Byte() = BitConverter.GetBytes(Value) Dim LoDwordBytes As Byte() = BitConverter.GetBytes(NewLoDword) ValueBytes(0) = LoDwordBytes(0) ValueBytes(1) = LoDwordBytes(1) ValueBytes(2) = LoDwordBytes(2) ValueBytes(3) = LoDwordBytes(3) Return BitConverter.ToInt64(ValueBytes, 0) End Function
' Set HiDword (From an Unsigned Integer) ' ( By Elektro ) ' ' Usage Examples: ' MsgBox(SetHiDword(328576329396160L, 987654321UI)) ' Result: 4241943011189403584L ' ''' <summary> ''' Sets the high-order double word of an 'Int64' value. ''' </summary> ''' <param name="Value">Indicates the 'Int64' value that contains both the LoDword and the HiDword.</param> ''' <param name="NewHiDword">Indicates the new HiDword, an 'UInt32' value.</param> ''' <returns>The 'Int64' value containing both the LoDword and the new HiDword.</returns> Private Function SetHiDword(ByVal Value As Long, ByVal NewHiDword As UInteger) As Long Dim ValueBytes As Byte() = BitConverter.GetBytes(Value) Dim HiDwordBytes As Byte() = BitConverter.GetBytes(NewHiDword) ValueBytes(4) = HiDwordBytes(0) ValueBytes(5) = HiDwordBytes(1) ValueBytes(6) = HiDwordBytes(2) ValueBytes(7) = HiDwordBytes(3) Return BitConverter.ToInt64(ValueBytes, 0) End Function
|
|
|
7494
|
Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Compartan aquí sus snippets)
|
en: 9 Marzo 2014, 16:27 pm
|
Unos snippets para imitar las macros "LoByte", "LoWord", "LoDword", etc, usando la Class BitConverter, la cual, aunque necesita hacer más trabajo, me parece una solución mucho mas elegante que las que se pueden encontrar por ahí, e igual de efectiva. ' Get LoByte ' ( By Elektro ) ' ' Usage Examples: ' MsgBox(GetLoByte(1587S)) ' Result: 51 ' ''' <summary> ''' Gets the low-order byte of an 'Int16' value. ''' </summary> ''' <param name="Value">Indicates the 'Int16' value that contains both the LoByte and the HiByte.</param> ''' <returns>The return value is the low-order byte.</returns> Public Shared Function GetLoByte(ByVal value As Short) As Byte Return BitConverter.GetBytes(value).First End Function
' Get HiByte ' ( By Elektro ) ' ' Usage Examples: ' MsgBox(GetHiByte(1587S)) ' Result: 6 ' ''' <summary> ''' Gets the high-order byte of an 'Int16' value. ''' </summary> ''' <param name="Value">Indicates the 'Int16' value that contains both the LoByte and the HiByte.</param> ''' <returns>The return value is the high-order byte.</returns> Public Shared Function GetHiByte(ByVal value As Short) As Byte Return BitConverter.GetBytes(value).Last End Function
' Get LoWord ' ( By Elektro ) ' ' Usage Examples: ' MsgBox(GetLoWord(13959358I)) ' Result: 190S ' ''' <summary> ''' Gets the low-order word of an 'Int32' value. ''' </summary> ''' <param name="Value">Indicates the 'Int32' value that contains both the LoWord and the HiWord.</param> ''' <returns>The return value is the low-order word.</returns> Public Shared Function GetLoWord(ByVal value As Integer) As Short Return BitConverter.ToInt16(BitConverter.GetBytes(value), 0) End Function
' Get HiWord ' ( By Elektro ) ' ' Usage Examples: ' MsgBox(GetHiWord(13959358I)) ' Result: 213S ' ''' <summary> ''' Gets the high-order word of an 'Int32' value. ''' </summary> ''' <param name="Value">Indicates the 'Int32' value that contains both the LoWord and the HiWord.</param> ''' <returns>The return value is the high-order word.</returns> Public Shared Function GetHiWord(ByVal value As Integer) As Short Return BitConverter.ToInt16(BitConverter.GetBytes(value), 2) End Function
' Get LoDword (As Unsigned Integer) ' ( By Elektro ) ' ' Usage Examples: ' MsgBox(GetLoDword(328576329396160UL)) ' Result: 2741317568UI ' ''' <summary> ''' Gets the low-order double word of an 'UInt64' value. ''' </summary> ''' <param name="Value">Indicates the 'UInt64' value that contains both the LoDword and the HiDword.</param> ''' <returns>The return value is the low-order double word.</returns> Public Shared Function GetLoDword(ByVal value As ULong) As UInteger Return BitConverter.ToUInt32(BitConverter.GetBytes(value), 0) End Function
' Get HiDword (As Unsigned Integer) ' ( By Elektro ) ' ' Usage Examples: ' MsgBox(GetHiDword(328576329396160UL)) ' Result: 76502UI ' ''' <summary> ''' Gets the high-order double word of an 'UInt64' value. ''' </summary> ''' <param name="Value">Indicates the 'UInt64' value that contains both the LoDword and the HiDword.</param> ''' <returns>The return value is the high-order double word.</returns> Public Shared Function GetHiDword(ByVal value As ULong) As UInteger Return BitConverter.ToUInt32(BitConverter.GetBytes(value), 4) End Function
' Get LoDword (As Signed Integer) ' ( By Elektro ) ' ' Usage Examples: ' MsgBox(GetLoDword(328576329396160L)) ' Result: -1553649728I ' ''' <summary> ''' Gets the low-order double word of an 'Int64' value. ''' </summary> ''' <param name="Value">Indicates the 'Int64' value that contains both the LoDword and the HiDword.</param> ''' <returns>The return value is the low-order double word.</returns> Public Shared Function GetLoDword(ByVal value As Long) As Integer Return BitConverter.ToInt32(BitConverter.GetBytes(value), 0) End Function
' Get HiDword (As Signed Integer) ' ( By Elektro ) ' ' Usage Examples: ' MsgBox(GetHiDword(328576329396160L)) ' Result: 76502I ' ''' <summary> ''' Gets the high-order double word of an 'Int64' value. ''' </summary> ''' <param name="Value">Indicates the 'Int64' value that contains both the LoDword and the HiDword.</param> ''' <returns>The return value is the high-order double word.</returns> Public Shared Function GetHiDword(ByVal value As Long) As Integer Return BitConverter.ToInt32(BitConverter.GetBytes(value), 4) End Function
' Make Word ' ( By Elektro ) ' ' Usage Examples: ' MsgBox(MakeWord(51S, 6S)) ' Result: 1587S ' ''' <summary> ''' Makes an 'Int16' value from two bytes. ''' </summary> ''' <param name="LoByte">Indicates the low-order byte.</param> ''' <param name="HiByte">Indicates the high-order byte.</param> ''' <returns>The 'Int16' value.</returns> Public Shared Function MakeWord(ByVal LoByte As Byte, ByVal HiByte As Byte) As Short Return BitConverter.ToInt16(New Byte() {LoByte, HiByte}, 0) End Function
' Make Dword ' ( By Elektro ) ' ' Usage Examples: ' MsgBox(MakedWord(190S, 213S)) ' Result: 13959358I ' ''' <summary> ''' Makes an 'Int32' value from two 'Int16' values. ''' </summary> ''' <param name="LoWord">Indicates the low-order word.</param> ''' <param name="HiWord">Indicates the high-order word.</param> ''' <returns>The 'Int32' value.</returns> Public Shared Function MakeDword(ByVal LoWord As Short, ByVal HiWord As Short) As Integer Dim LoBytes As Byte() = BitConverter.GetBytes(LoWord) Dim HiBytes As Byte() = BitConverter.GetBytes(HiWord) Dim Combined As Byte() = LoBytes.Concat(HiBytes).ToArray Return BitConverter.ToInt32(Combined, 0) End Function
' Make Long (From An Unsigned Integer) ' ( By Elektro ) ' ' Usage Examples: ' MsgBox(MakeLong(2741317568UI, 76502UI)) ' Result: 328576329396160UL ' ''' <summary> ''' Makes an 'UInt64' value from two 'UInt32' values. ''' </summary> ''' <param name="LoDword">Indicates the low-order Dword.</param> ''' <param name="HiDword">Indicates the high-order Dword.</param> ''' <returns>The 'UInt64' value.</returns> Public Shared Function MakeLong(ByVal LoDword As UInteger, ByVal HiDword As UInteger) As ULong Dim LoBytes As Byte() = BitConverter.GetBytes(LoDword) Dim HiBytes As Byte() = BitConverter.GetBytes(HiDword) Dim Combined As Byte() = LoBytes.Concat(HiBytes).ToArray Return BitConverter.ToUInt64(Combined, 0) End Function
' Make Long (From a Signed Integer) ' ( By Elektro ) ' ' Usage Examples: ' MsgBox(MakeLong(-1553649728I, 76502I)) ' Result: 328576329396160L ' ''' <summary> ''' Makes an 'Int64' value from two 'Int32' values. ''' </summary> ''' <param name="LoDword">Indicates the low-order Dword.</param> ''' <param name="HiDword">Indicates the high-order Dword.</param> ''' <returns>The 'Int64' value.</returns> Public Shared Function MakeLong(ByVal LoDword As Integer, ByVal HiDword As Integer) As Long Dim LoBytes As Byte() = BitConverter.GetBytes(LoDword) Dim HiBytes As Byte() = BitConverter.GetBytes(HiDword) Dim Combined As Byte() = LoBytes.Concat(HiBytes).ToArray Return BitConverter.ToInt64(Combined, 0) End Function
|
|
|
7495
|
Programación / Scripting / Re: Suma de variables dentro de bucle for en .bat
|
en: 9 Marzo 2014, 04:09 am
|
Hombre, los metadatos no cambian por si solos, y algo leí hace mucho tiempo sobre que Windows Media Player modifica los metadatos de los audios sin previo aviso ...cuando este considera necesario actualizarlos (otra de las grandes ideas desagradables por parte de Microsoft). ¿ Probaste con otro reproductor, por ejemplo ...Winamp ? Las dos lineas de código que muestras hacen exáctamente lo mismo, y me apostaría todo lo que tengo a que el problema es este (solo es una suposición): En la primera linea, osea en el For, le das como título a las canciones un número seguido de un punto y más números "5.XX", los (pesados) algoritmos de Windows Media Player segúramente escanearán el título de la canción y determinarán que ese tipo de título (número seguido de un punto) se trata de un título sin formatear, a continuación, se enciende una bombillita que dice: " he, vamos a cambiarle el título a esto sin avisarle al usuario, seguro que nos lo agradecerá !" En cambio, esto no te sucede en la segunda linea que muestras porque el título de la canción que le estás asignando al archivo ("hola") es normal, WMP lo considera un título formateado corréctamente, y entonces no hay motivo para que WMP quiera actualizar los tags. Como no estoy muy seguro de si ese será el problema, puedes hacer la prueba asignando manualmente ese tipo de título a una canción, y abrirla en el WMP para salir de dudas: id3 -1 -2 -t "5.1" "36_PISTA.mp3" En resumen, y suponiendo que ese sea el problema: O le asignas títulos normales a las canciones (que no empiecen por un número seguido de un punto), o desactivas la maravillosa opción de actualizar los metadatos en el WMP. Saludos
|
|
|
7498
|
Programación / Scripting / Re: Suma de variables dentro de bucle for en .bat
|
en: 9 Marzo 2014, 00:53 am
|
esa variable %%x del bucle me confunde '%%x' es la variable que toma el 'For' para asignar el valor del Rango numérico en el ciclo. La variable empezará siendo un '1', luego se le asignará un '2', y así sucesívamente hasta llegar a '13' y salir del Loop. El siguiente código que te muestro, produce el resultado que mencionaste:  Call Start /W "ID3 Maass Tagger" "id3.exe" -1 -2 -t "5. %%X" " %%Numero%%_PISTA.mp3" )
Saludos
|
|
|
7499
|
Media / Multimedia / Re: adn de archivos de video para buscar duplicados
|
en: 8 Marzo 2014, 20:07 pm
|
No, un Hash es (más o menos) un algoritmo criptográfico para calcular un valor que sirve como identificador único de un archivo, basándose en los bytes de dicho archivo, el Hash no se crea, no es un valor estático (como ya dije, 2 archivos distintos pueden dar como resultado el mismo hash), el Hash es algo que se calcula. Si intentas grabar metódicamente dos videos iguales con el movil, los fotogramas de uno y del otro nunca van a ser 100% idénticos (movimiento de cámara, particulas de polvo por el aire, la luz del Sol o del entorno, etc)... pero de todas formas, los frames podrían llegar a ser muy parecidos como para poder comparar diferencias y buscar similitudes con un algoritmo en cada fotograma y generar así un porcentaje para determinar si el video se debe considerar como un duplicado o no, y además, el software de grabación del movil graba en una resolución específica, en un formato determinado, y generarando unos metadatos específicos para ese formato/video, cosas que se pueden comparar con otros videos para identificar videos parecidos o casi iguales. Como ya dije, no existe un 'ADN' mágico, se utilizan algoritmos de comparación, básicos o avanzados. Para calcular y comparar Hashes y Checksums te recomiendo la aplicación: · Object Monitor http://sourceforge.net/projects/objectmonitor/Saludos
|
|
|
7500
|
Programación / Scripting / Re: [DUDA] Batch o FTP
|
en: 8 Marzo 2014, 19:52 pm
|
Puedes probar a usar la carpeta temporal del SO, en la cual deberías tener suficientes permisos para escribir: outFile = CreateObject("WScript.Shell").ExpandEnvironmentStrings( "%TEMP%" & "\" & "IP.txt" )
Saludos
|
|
|
|
|
|
|