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

 

 


Tema destacado: Rompecabezas de Bitcoin, Medio millón USD en premios


  Mostrar Mensajes
Páginas: 1 ... 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 [518] 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 ... 1236
5171  Programación / Scripting / Re: Ayuda con Select Case VBS en: 9 Junio 2015, 10:40 am
Ni siquiera utilizas la indentación para que el código sea minimamente legible para ti y para los demás, MUY MAL, te lo digo seriamente, la indentación es una cosa muy importante, aprende a usarla, por que la mayoría de personas que vean ese código ni siquiera se van a molestar en leerlo/analizarlo.

Esto es simplemente horrible de ver:
Citar
Código
  1. if result<=59 then
  2. msgbox("El Alumno esta: "  & re )
  3. else
  4. if result>=60 and result<=69 then
  5. msgbox("El alumno esta: " & de )
  6. else
  7. if result>=70 and result<=79 then
  8. msgbox("El Alumno esta: " & bu )
  9. else
  10. if result>=80 and result<=89 then
  11. msgbox("El Alumno esta: " & mbu )
  12. else
  13. if result>=90 and result <= 100 then
  14. msgbox("El Alumno esta: " & exc )
  15. end if
  16. end if
  17. end if
  18. end if
  19. end if

Aparte, una cosa importante que también deberías tener en cuenta es que no es necesario anidar las condicionales (en este caso), ya que puedes usar la sentencia ElseIf.

También deberías hacer uso de las características que el lenguaje te proporciona, cómo Arrays, ElseIf, y funciones built-in, aparte, deberías estructurar el código para trasladar la lógica que has escrito en el bloque del select case, a métodos/funciones adicionales.

Aquí te dejo un código funcional:

Código
  1. Option Explicit : Dim appTitle, boxMsg, result
  2.  
  3. ' ***************************************************************
  4. '                           Main
  5. ' ***************************************************************
  6.  
  7. appTitle = "Título del programa."
  8.  
  9. boxMsg   = "Introduzca el numero de la operacion a realizar:" & _
  10.           vbNewLine & _
  11.           vbNewLine & _
  12.           "1. Encontrar el valor de Y" & _
  13.           vbNewLine & _
  14.           "2. Promedio de un Estudiante" & _
  15.           vbNewLine & _
  16.           "3. Salir"
  17.  
  18. Do While ( result <> 3 )
  19.  
  20.    result = Cint( InputBox(boxMsg, appTitle) )
  21.  
  22.    Select Case result
  23.  
  24.        Case 1 ' Encontrar el valor de Y
  25.            EncontrarElValorDeY()
  26.  
  27.        Case 2 ' Promedio de un Estudiante
  28.            PromedioDeUnEstudiante()
  29.  
  30.        Case 3 ' Salir
  31.            Salir()
  32.  
  33.    End Select
  34.  
  35. Loop
  36.  
  37. ' ***************************************************************
  38. '                           Methods
  39. ' ***************************************************************
  40.  
  41. ' Encontrar el valor de Y
  42. Sub EncontrarElValorDeY()
  43.    Dim x, y
  44.    x = CDbl( InputBox("Introduzca el valor de 'X'.", appTitle) )
  45.    y = GetValue(x)
  46.    Call MsgBox("El Valor de 'Y' es: " & CStr(y), vbInformation, appTitle)
  47. End Sub
  48.  
  49. ' Promedio de un Estudiante
  50. Sub PromedioDeUnEstudiante()
  51.    Dim matters, notes, average, _
  52.        sentences, curSentence,  _
  53.        index, alumnInfo
  54.  
  55.    matters = Array(Null, Null, Null, Null, Null)
  56.    notes   = Array(Null, Null, Null, Null, Null)
  57.    average = Null
  58.  
  59.    sentences   = Array("Reprobado", "Deficiente", "Bueno", "Muy Bueno", "Excelente")
  60.    curSentence = Null
  61.    alumnInfo   = Null
  62.  
  63.    For index = 0 To UBound(matters)
  64.        matters(index) = InputBox("Nombre de la" & CStr(index + 1) & "° materia", appTitle)
  65.  
  66.        Do Until ( notes(index) <= 100 )
  67.            notes(index) = CInt( InputBox("Nota de '" & matters(index) & "' (entre 0 y 100)", appTitle) )
  68.        Loop
  69.    Next
  70.  
  71.    average = GetAverage(notes)
  72.  
  73.    If (average <= 59) Then
  74.        curSentence = sentences(0)
  75.  
  76.    ElseIf (average >= 60) And (average <= 69) Then
  77.        curSentence = sentences(1)
  78.  
  79.    ElseIf (average >= 70) And (average <= 79) Then
  80.        curSentence = sentences(2)
  81.  
  82.    ElseIf (average >= 80) And (average <= 89) Then
  83.        curSentence = sentences(3)
  84.  
  85.    Else ' average >= 90
  86.        curSentence = sentences(4)
  87.  
  88.    End If
  89.  
  90.    alumnInfo = alumnInfo & "El promedio es: "  & CStr(average) & vbNewLine
  91.    alumnInfo = alumnInfo & "El alumno esta: "  & curSentence & vbNewLine
  92.  
  93.    For index = 0 To UBound(notes)
  94.  
  95.        If notes(index) <= 59 Then
  96.            alumnInfo = alumnInfo & "El alumno reprobo " & matters(index) & vbNewLine
  97.  
  98.        Else
  99.            alumnInfo = alumnInfo & "El alumno aprobo " & matters(index) & vbNewLine
  100.  
  101.        End If
  102.  
  103.    Next
  104.  
  105.    Call MsgBox(alumnInfo, vbInformation, appTitle)
  106. End Sub
  107.  
  108. ' Salir
  109. Sub Salir()
  110.    Call MsgBox("Usted esta saliendo del programa...", vbExclamation, appTitle)
  111.    WScript.Quit(0)
  112. End Sub
  113.  
  114. ' ***************************************************************
  115. '                           Functions
  116. ' ***************************************************************
  117.  
  118. ' valor de X
  119. Function GetValue(value)
  120.    GetValue = CDbl( Log(value + 30) / 20 )
  121. End Function
  122.  
  123. ' Promedio de X
  124. Function GetAverage(values)
  125.    Dim value
  126.  
  127.    For Each value In values
  128.        GetAverage = GetAverage + value
  129.    Next
  130.  
  131.    GetAverage = CDbl( GetAverage / 5 )
  132. End Function

Saludos!
5172  Programación / Programación General / Re: .Exe evita ejecución de una dll? en: 8 Junio 2015, 18:43 pm
¿Y cómo has llegado a la conclusión de que la función "exportar" se encuentra en una de esas dll, y no es algún procedimiento del código compilado en el exe?, ¿lo has analizado bien, o solo es una suposición?.

¿En que lenguaje está programada la aplicación?, ¿en C#?;
en C# (y otros lenguajes) puedes cargar dinamicamente una dll, es decir, no necesariamente se debe cargar una dll en el startup de la aplicación si el programador no quiere, siempre y cuando dicha dll no sea una dependencia "crítica" para el inicio de la app, claro está.

Ten en cuenta también, que las dll se podrían adjuntar/embedir en el exe, es decir, unir las dependencias .dll en un archivo .exe unificado, lo comento por eso de que tienes una versión sin dlls y otra con dlls, ese podría ser un motivo, o tal vez simplemente en una versión el autor no usó ninguna dll y en una actualización posterior añadió el uso de esas dll, quien sabe realmente cómo es sin poder analizar la app que comentas...

De todas formas por lo que has comentado me parece que esto no tiene que ver con la programación, sino más bien con la ingeniería inversa, ya que si no entiendo mal lo que realmente pretendes es bypassear la prohibición de la característica de exportar sin tener que registrarte,
en ese caso debes saber que en el foro no se da soporte para craquear aplicaciones comerciales, pero de todas formas puedes probar suerte a ver que opinan los moderadores del foro de Ingeniería Inversa.

Saludos!
5173  Foros Generales / Foro Libre / Re: Sonidos fondo marino en: 8 Junio 2015, 16:13 pm
Un día escucharéis roncar a Cthulhu, y os echaréis a llorar.

Bah, hay otras cosas que asustarían más.



5174  Foros Generales / Foro Libre / Re: Sonidos fondo marino en: 8 Junio 2015, 15:58 pm
Recuerdo haber visto un documental sobre las zonas "paranormales" de los mares La Tierra, una era el triángulo de Las Bermudas, claro está, pero no recuerdo muy bien si uno de los otros... me parece que otra "zona paranormal" es el triángulo que ha indicado Simorg, que nadie se atreve a cruzar barcos por el centro de esa zona ya que suelen desaparecer todos, o bien se quedan incomunicados completamente, pero cómo ya digo, no recuerdo muy bien si se trata de esa zona en particular.

¿Alguien me lo puede aclarar?, ya que si esa zona está considerada "paranormal" por tema de desapariciones continuas entonces si sería muy interesante ponerse a escuchar un rato los sonidos que suceden xD.

Saludos!
5175  Programación / Programación General / Re: ¿que lenguaje elegir? en: 8 Junio 2015, 13:14 pm
Y donde has visto que Java esté muriendo? Muriendo? Java?

Existe un mito innegable que afirma el hecho de que "Java está muriendo", pero probablemente solo sea eso ...un mito, ya que aparte de que por el momento son afirmaciones que no se cumplen, realmente los lenguajes no mueren, se van quedando en cierto deshuso ante la competencia, pero se siguen usando durante muchos años e ncluso décadas más.

la inmensa mayoría de las ofertas de empleo es raro no ver alguna que pida java

Si, y lo mismo se puede decir de C#.



1-Debe tener mucha documentación de ayuda con ejemplos, una comunidad

He usado muy poco Java cómo para elaborar un análisis o comparativa profunda, así que me basaré en mi poca experiencia con Java, pero mi bastante experiencia con .Net, mi opinión, y fuentes externas de información.

Java y C# disponen de una referencia online del lenguaje, pero, la MSDN en mi opinión es muy superior, obviamente encontrarás toda la información necesaria, con ejemplos de ayuda, y con la comunidad/foros de MSDN, pero también una infinidad de artículos sobre como iniciarse, tutoriales, video tutoriales, consejos; en fin, infinidad de documentación sobre el lenguaje, VisualStudio, y todo lo que lo que compne .Net; es algo normal, ya que la calidad que puede ofrecer un tiburón cómo Microsoft no puede tener competencia en ese sentido.



2- programar apliaciones visuales de escritorio cliente servidor

Sobre esto no puedo decir nada sobre Java, ya que no tendría suficiente criterio para hacerlo.

Lo que está claro es que C# es auto-suficiente en aplicaciones de escritorio, ya sea teniendo en cuenta sus capacidades remotas/cliente-servidor o no. y Java del mismo modo parece serlo también.



Android

Java, entre otros lenguajes, ha sido utilizado para el desarrollo de android, particularmente para el desarrollo de la interfáz de usuario de Android, y las Apps de Android están desarrolladas en Java, así que quizás sería sensato pensar que Java es el lenguaje más adecuado en este sentido.

De todas formas, en C# también se pueden desarrollar aplicaciones para Android, existe una muy buena herramienta para esto (un framework completo) llamado Xamarin, en su versión standalone llamada "Xamarin Studio", y en su versión extensión para integrarse en Visual Studio, llamada "Xamarin for Visual Studio", sin duda sería mejor elegir C# en caso y solo en caso de que éste fuese tu lenguaje principal, ya que gracias a esto no tendrías que hacer una transición a Java solo para programar apps para Android, pudiendo hacer lo mismo en C#, no faltaría de nada ni desarrollando una app en Java ni en C#.



si se puede algo para web mejor...

Sobre el desarrollo de aplicaciones Web, al parecer, un gran inconveniente de Java es que las librerías no están incluidas, necesitas incluir una tonelada de librerías de terceros (y aprender su documentación, suponiendo que la tengan) de lugares como Apache commons, esto, aparte de que puede causar un incremento insano del tamaño del proyecto donde la aplicación web más simple puede llegar a pesar 100 MB, también puede resultar en un infierno de dependencias Jar, y si encima cargas los archivos Jar incorrectamente entonces la has pifiado, necesitas utilizar otras herramientas para esto cómo Maven.

Al parecer, utilizar Java para aplicaciones web disminuye considerablemente el rendimiento del programador en comparación con una webapp desarrollada en C#.

En conclusión, parece estar claro que C#, es decir, la tecnología ASP.Net, te lo pone todo más facil, y esto aumentaría considerablemente la productividad del programador.

Fuente:
Batteries not included:

I programmed java web apps for 10 years before I switched to python, 4+ years ago. I feel that I'm much more productive using python and can get much more done in a shorter period of time, and to be honest, I'm much happier when I develop in python. Here are some of the reasons why I think python is better then Java based on my personal experience, your milage may very.
Web Frameworks:

When I first start programming web apps in Java, Struts just came out, and it wasn't great, but it was the best thing available. I created a bunch of struts apps, and a few in other frameworks along the way. Whenever a new framework came out (Tapestry, Wicket, GWT, stripe, grails, AppFuse, Play, RichFaces, Spring, etc), I would try it out and see if it was any better, and most times it was only a little better, and sometimes not better at all. I do have to say the play framework is a step in the right direction.
Batteries not included:

One of the most annoying parts of Java was the fact that most of the libraries that you use were not included in java itself, you had to include a ton of 3rd party libs from places like apache commons. If you use something like hibernate with any other large library, you end up in Jar dependency hell, where hibernate needs one version of a jar, and something else needs another version. If you load the jar files in the wrong order, you are out of luck. You need to depend on tools like maven, and ivy to manage your dependencies, and this just brings in more dependencies into your project which results in projects being huge. I had some war files 100MB+ war files for the simplest web apps.
Too many options:

For some reason there seems to be way too many different ways to do the same thing in Java. There are over 38 different web frameworks for java according to wikipedia ( http://en.wikipedia.org/wiki/Comparison_of_web_application_frameworks#Java ) and 23 different ORM's ( http://en.wikipedia.org/wiki/List_of_object-relational_mapping_software#Java ) just to name a couple of examples. If you look at other languages they have a more reasonable number. Some people think that having lots of options is a good thing, but it isn't it leads to a lot of wasted effort in the developer community, everyone is reinventing the same wheel, and if you are a new person to the language you have too many option to pick from.
App servers:

Java web applications are really heavy, and require a lot of resources to run. They are especially memory hungry. Like any piece of software they can be tuned to reduce their resource footprint, but compared to other languages their out of the box setup is horrible. In my past I have used weblogic, websphere, Jboss, tomcat, and jetty. I only used the first three when I was forced to use EJB's, but even if you aren't using EJB's they were large app servers and sometimes hard to configure and get running correctly. Tomcat and Jetty are much better and easier to setup, but are still resource hogs.
App Hosting:

If you aren't running your own server it is real hard to find shared hosting for your java apps at a reasonable price. The main reason is because java apps require much more memory compared to other languages, so it doesn't make sense for a shared hosting provider to spend their valuable RAM running a java site, when they could run 5 php sites in the same place. That means there are less providers offering java hosting, which in turn means higher costs to run your website.
Development Time:

When I developing in java, I found myself much slower then what I can do in python. I would need to make a change, compile, redeploy and then test, and this slows down the iterative process. I know there are ways to make this faster, but even at it's best, I felt much slower then what I can do in python.

There is also a lot less boilerplate code to do the same thing in python, so I spend less time developing the code as well.

Java just feels over engineered in a lot of parts, A lot of the API's and interfaces are just way to complicated for what you want to do. And everyone and their brother thinks they are a java architect and this results in big complicated systems that are hard to use and develop with.
IDE:

When I was developing in Java, I felt stuck to the IDE, I was lost without it. IntelliJ is the best IDE's on the market, and it was hard switching to python because there wasn't anything like it for python. So instead of an IDE, I just used textmate, which is just a normal text editor. It was hard at first, but because it was just a text editor, it was a really fast and responsive application. I could open my whole project in a few seconds, whereas when I want to open a project in an IDE it could take a minute or more, with a machine with a ton of RAM. The makers of IntelliJ came out with a python editor called pycharm, I bought it when it first came out, and it is great. But what I realized is that I don't need an IDE for python, I'm fine with a text editor. When I go back to working on Java web apps which I have to do from time to time, I try to use the text editor, but I haven't quite mastered that yet. I personally need the IDE for Java more because If I mess up something it takes longer to recompile and redeploy, which slows me down.
ORM:

When I first started using Hibernate as an ORM, I thought it was great, it had it's problems, and it wasn't perfect, but it was better then what I was doing before. I was happy with it, until I did an application with Django's ORM on a python project, and that opened up my eyes, that is how an ORM is suppose to work. After that project I went back to hibernate, and I just felt disappointed, and longed for going back to Django's ORM. Another great python ORM is sqlalchemy, which is similar to Django's ORM, but a little different. I have limited experience with ROR's ORM, but from what I remember, it was pretty good as well.
Templates:

The web templating systems in Java aren't that good, and I think I have tried them all (tiles, freemarker, velocity, etc). Most of them offer only basic functionality and are a pain to work with. On the Python side, my two favorites are Django templates and Jinja2, they have everything that I could need in a templating engine, and are really easy to use.

En esa misma página encontrarás opiniones muy diversas sobre el uso de Java en la web.



Hasta ahora creo q tanto c# y java son idóneos, pero cual y por qué?

Java es soportado en más sistemas operativos que C#, pero eso no quiere decir que en el futuro, podamos ver un MSIL corriendo en otros sistemas operativos que no sean Windowsm nada lo impidem y C# es un lenguaje por el que cualquiera podría apostar a favor.

Si quieres desarrollar una aplicación que hoy en día corra en casi cualquier sistema, entonces ese lenguaje es Java, si por lo contrario quieres desarrollar una aplicación para Windows o Web y con soporte adicional para Android, entonces ese lenguaje es C# (o VB.Net, ya que ambos son pracicamente lo mismo), ya que las características internas, es decir, la librería de classes de .Net Framework, la cantidad de funciones built-in, es en gran medida superior que la de Jajva (aunque la de Java también es muy inmensa).

Ante dos lenguajes semejantes, lo mejor sería elegir el lenguaje con el que mejor te sientas programando, comparar sus capacidades/limitaciones, pero sobre todo su sintaxis, y su IDE, ¿por qué?, por que siendo dos lenguajes que ofrecen practicamente las mismas características, ese sería el punto a favor que marcará la diferencia en tu rendimiento, cómo ya he dicho, la sintaxis, el modo de operar con el lenguaje, y la IDE, tu entorno de trabajo.

Ten en cuenta una cosa muy importante también, C#, es decir, la IDE de Microsoft, Visual Studio, es el entorno de programación más completo y más elaborado en comparación con cualquier otra IDE freeware o comercial, esto en mi opinión es lo que marca la diferencia entre elegir C# o Java (cómo ya dije he usado poco Java, pero si he manejado varias IDES de Java).


Hasta ahora creo q tanto c# y java son idóneos, pero cual y por qué?

Por último, te sugiero que leas este artículo de MSDN donde realizan un análisis comparativo sobre C# y Java, cuyas consluciones son que practicamente los dos son muy buenos lenguajes en comparación:

C# and Java: Comparing Programming Languages

PD: Para que veas también hasta donde llega el alcance de la comunidad MSDN, infinidad de documentación sobre todas las cosas de .Net cómo dije antes ...incluso sobre Java xD.

Saludos!
5176  Foros Generales / Dudas Generales / Re: Cómo se llama este sistema? en: 8 Junio 2015, 11:51 am
¿Qué tiene que ver supuestamente esto con Windows?.

¿Un sistema de que exactamente?.

Saludos!
5177  Foros Generales / Foro Libre / Re: ¿Por qué la Nasa quiere ir a Europa? en: 8 Junio 2015, 05:24 am
La luna Europe siempre me ha fascinado, aunque no tengo fe en que la NASA vaya, encuentre vida marina, y despues de haberla encontrado revele sus hallazgos al público, esto último no creo que pase, pero bueno, el simple hecho de saber que el ser humano o un instrumento fabricado por el ser humano (taladro) llegará hasta allí para hacer experimentos... me emociona imaginar las expectativas.

   
5178  Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets para VB.Net !! (Compartan aquí sus snippets) en: 7 Junio 2015, 10:41 am
Un aspecto para utilizar con la librería Postsharp, para difundir un poquito la programación orientada a aspectos (AOP).

Este aspecto en particular sirve para definir un valor mínimo y máximo para un miembro público de una class (Ej: Una propiedad Byte, Short, Integer, Long, etc...),
con esto nos aseguramos de que el valor asignado nunca supere el máximo ...ni el mínimo.

Hay bastante repetición de código ya que al parecer la Class no se puede hacer genérica.

Ejemplo de uso:
Código
  1. Imports PostSharp.Aspects
  2.  
  3. Public Class MyClass
  4.  
  5.    <RangeAttribute(0S, SByte.MaxValue)>
  6.    Dim sByteValue As SByte
  7.  
  8.    <RangeAttribute(0S, Byte.MaxValue)>
  9.    Dim ByteValue As Byte
  10.  
  11.    <RangeAttribute(0S, Short.MaxValue)>
  12.    Dim Int16Value As Short
  13.  
  14.    <RangeAttribute(0US, UShort.MaxValue)>
  15.    Dim UInt16Value As UShort
  16.  
  17.    <RangeAttribute(0I, Integer.MaxValue)>
  18.    Dim Int32Value As Integer
  19.  
  20.    <RangeAttribute(0UI, UInteger.MaxValue)>
  21.    Dim UInt32Value As UInteger
  22.  
  23.    <RangeAttribute(0L, Long.MaxValue)>
  24.    Dim Int64Value As Long
  25.  
  26.    <RangeAttribute(0UL, ULong.MaxValue)>
  27.    Dim UInt64Value As ULong
  28.  
  29.    <RangeAttribute(0.0F, Single.MaxValue)>
  30.    Dim SglValue As Single
  31.  
  32.    <RangeAttribute(0.0R, Double.MaxValue)>
  33.    Dim DblValue As Double
  34.  
  35. End Class

Código fuente:
Código
  1. ' ***********************************************************************
  2. ' Author   : Elektro
  3. ' Modified : 07-June-2015
  4. ' ***********************************************************************
  5. ' <copyright file="RangeAttribute.vb" company="Elektro Studios">
  6. '     Copyright (c) Elektro Studios. All rights reserved.
  7. ' </copyright>
  8. ' ***********************************************************************
  9.  
  10. #Region " Usage Examples "
  11.  
  12. 'Imports PostSharp.Aspects
  13. '
  14. 'Public Class Myclass
  15. '
  16. '    <RangeAttribute(0S, SByte.MaxValue)>
  17. '    Dim sByteValue As SByte
  18. '
  19. '    <RangeAttribute(0S, Byte.MaxValue)>
  20. '    Dim ByteValue As Byte
  21. '
  22. '    <RangeAttribute(0S, Short.MaxValue)>
  23. '    Dim Int16Value As Short
  24. '
  25. '    <RangeAttribute(0US, UShort.MaxValue)>
  26. '    Dim UInt16Value As UShort
  27. '
  28. '    <RangeAttribute(0I, Integer.MaxValue)>
  29. '    Dim Int32Value As Integer
  30. '
  31. '    <RangeAttribute(0UI, UInteger.MaxValue)>
  32. '    Dim UInt32Value As UInteger
  33. '
  34. '    <RangeAttribute(0L, Long.MaxValue)>
  35. '    Dim Int64Value As Long
  36. '
  37. '    <RangeAttribute(0UL, ULong.MaxValue)>
  38. '    Dim UInt64Value As ULong
  39. '
  40. '    <RangeAttribute(0.0F, Single.MaxValue)>
  41. '    Dim SglValue As Single
  42. '
  43. '    <RangeAttribute(0.0R, Double.MaxValue)>
  44. '    Dim DblValue As Double
  45. '
  46. 'End Class
  47.  
  48. #End Region
  49.  
  50. #Region " Imports "
  51.  
  52. Imports PostSharp.Aspects
  53.  
  54. #End Region
  55.  
  56. #Region " Range Attribute "
  57.  
  58. ''' <summary>
  59. ''' Aspect that when applied to a property, defines its minimum and maximum value.
  60. ''' </summary>
  61. <Serializable>
  62. Public Class RangeAttribute : Inherits LocationInterceptionAspect
  63.  
  64. #Region " Properties "
  65.  
  66.    ''' <summary>
  67.    ''' Gets or sets the minimum value.
  68.    ''' </summary>
  69.    Private Property Min As Object
  70.  
  71.    ''' <summary>
  72.    ''' Gets or sets the maximum value.
  73.    ''' </summary>
  74.    Private Property Max As Object
  75.  
  76. #End Region
  77.  
  78. #Region " Constructors "
  79.  
  80.    ''' <summary>
  81.    ''' Initializes a new instance of the <see cref="RangeAttribute"/> class for <see cref="SByte"/> datatype.
  82.    ''' </summary>
  83.    ''' <param name="minInt8">The minimum <see cref="SByte"/> value.</param>
  84.    ''' <param name="maxInt8">The maximum <see cref="SByte"/> value.</param>
  85.    Public Sub New(ByVal minInt8 As SByte, ByVal maxInt8 As SByte)
  86.  
  87.        Me.Min = minInt8
  88.        Me.Max = maxInt8
  89.  
  90.    End Sub
  91.  
  92.    ''' <summary>
  93.    ''' Initializes a new instance of the <see cref="RangeAttribute"/> class for <see cref="Byte"/> datatype.
  94.    ''' </summary>
  95.    ''' <param name="minUInt8">The minimum <see cref="Byte"/> value.</param>
  96.    ''' <param name="maxUInt8">The maximum <see cref="Byte"/> value.</param>
  97.    Public Sub New(ByVal minUInt8 As Byte, ByVal maxUInt8 As Byte)
  98.  
  99.        Me.Min = minUInt8
  100.        Me.Max = maxUInt8
  101.  
  102.    End Sub
  103.  
  104.    ''' <summary>
  105.    ''' Initializes a new instance of the <see cref="RangeAttribute"/> class for <see cref="Short"/> datatype.
  106.    ''' </summary>
  107.    ''' <param name="minInt16">The minimum <see cref="Short"/> value.</param>
  108.    ''' <param name="maxInt16">The maximum <see cref="Short"/> value.</param>
  109.    Public Sub New(ByVal minInt16 As Short, ByVal maxInt16 As Short)
  110.  
  111.        Me.Min = minInt16
  112.        Me.Max = maxInt16
  113.  
  114.    End Sub
  115.  
  116.    ''' <summary>
  117.    ''' Initializes a new instance of the <see cref="RangeAttribute"/> class for <see cref="UShort"/> datatype.
  118.    ''' </summary>
  119.    ''' <param name="minUInt16">The minimum <see cref="UShort"/> value.</param>
  120.    ''' <param name="maxUInt16">The maximum <see cref="UShort"/> value.</param>
  121.    Public Sub New(ByVal minUInt16 As UShort, ByVal maxUInt16 As UShort)
  122.  
  123.        Me.Min = minUInt16
  124.        Me.Max = maxUInt16
  125.  
  126.    End Sub
  127.  
  128.    ''' <summary>
  129.    ''' Initializes a new instance of the <see cref="RangeAttribute"/> class for <see cref="Integer"/> datatype.
  130.    ''' </summary>
  131.    ''' <param name="minInt32">The minimum <see cref="Integer"/> value.</param>
  132.    ''' <param name="maxInt32">The maximum <see cref="Integer"/> value.</param>
  133.    Public Sub New(ByVal minInt32 As Integer, ByVal maxInt32 As Integer)
  134.  
  135.        Me.Min = minInt32
  136.        Me.Max = maxInt32
  137.  
  138.    End Sub
  139.  
  140.    ''' <summary>
  141.    ''' Initializes a new instance of the <see cref="RangeAttribute"/> class for <see cref="UInteger"/> datatype.
  142.    ''' </summary>
  143.    ''' <param name="minUInt32">The minimum <see cref="UInteger"/> value.</param>
  144.    ''' <param name="maxUInt32">The maximum <see cref="UInteger"/> value.</param>
  145.    Public Sub New(ByVal minUInt32 As UInteger, ByVal maxUInt32 As UInteger)
  146.  
  147.        Me.Min = minUInt32
  148.        Me.Max = maxUInt32
  149.  
  150.    End Sub
  151.  
  152.    ''' <summary>
  153.    ''' Initializes a new instance of the <see cref="RangeAttribute"/> class for <see cref="Long"/> datatype.
  154.    ''' </summary>
  155.    ''' <param name="minInt64">The minimum <see cref="Long"/> value.</param>
  156.    ''' <param name="maxInt64">The maximum <see cref="Long"/> value.</param>
  157.    Public Sub New(ByVal minInt64 As Long, ByVal maxInt64 As Long)
  158.  
  159.        Me.Min = minInt64
  160.        Me.Max = maxInt64
  161.  
  162.    End Sub
  163.  
  164.    ''' <summary>
  165.    ''' Initializes a new instance of the <see cref="RangeAttribute"/> class for <see cref="ULong"/> datatype.
  166.    ''' </summary>
  167.    ''' <param name="minUInt64">The minimum <see cref="ULong"/> value.</param>
  168.    ''' <param name="maxUInt64">The maximum <see cref="ULong"/> value.</param>
  169.    Public Sub New(ByVal minUInt64 As ULong, ByVal maxUInt64 As ULong)
  170.  
  171.        Me.Min = minUInt64
  172.        Me.Max = maxUInt64
  173.  
  174.    End Sub
  175.  
  176.    ''' <summary>
  177.    ''' Initializes a new instance of the <see cref="RangeAttribute"/> class for <see cref="Single"/> datatype.
  178.    ''' </summary>
  179.    ''' <param name="minSingle">The minimum <see cref="Single"/> value.</param>
  180.    ''' <param name="maxSingle">The maximum <see cref="Single"/> value.</param>
  181.    Public Sub New(ByVal minSingle As Single, ByVal maxSingle As Single)
  182.  
  183.        Me.Min = minSingle
  184.        Me.Max = maxSingle
  185.  
  186.    End Sub
  187.  
  188.    ''' <summary>
  189.    ''' Initializes a new instance of the <see cref="RangeAttribute"/> class for <see cref="Double"/> datatype.
  190.    ''' </summary>
  191.    ''' <param name="minDouble">The minimum <see cref="Double"/> value.</param>
  192.    ''' <param name="maxDouble">The maximum <see cref="Double"/> value.</param>
  193.    Public Sub New(ByVal minDouble As Double, ByVal maxDouble As Double)
  194.  
  195.        Me.Min = minDouble
  196.        Me.Max = maxDouble
  197.  
  198.    End Sub
  199.  
  200.    ''' <summary>
  201.    ''' Prevents a default instance of the <see cref="RangeAttribute"/> class from being created.
  202.    ''' </summary>
  203.    Private Sub New()
  204.    End Sub
  205.  
  206. #End Region
  207.  
  208. #Region " Methods "
  209.  
  210.    ''' <summary>
  211.    ''' Method invoked <i>instead</i> of the <c>Set</c> semantic of the field or property to which the current aspect is applied,
  212.    ''' i.e. when the value of this field or property is changed.
  213.    ''' </summary>
  214.    ''' <param name="args">Advice arguments.</param>
  215.    Public Overrides Sub OnSetValue(ByVal args As LocationInterceptionArgs)
  216.  
  217.        Dim value As Object = args.Value
  218.  
  219.        Select Case True
  220.  
  221.            Case TypeOf value Is SByte
  222.                If DirectCast(value, SByte) < CSByte(Me.Min) Then
  223.                    value = Me.Min
  224.                ElseIf DirectCast(value, SByte) > CSByte(Me.Max) Then
  225.                    value = Me.Max
  226.                End If
  227.                args.SetNewValue(CSByte(value))
  228.  
  229.            Case TypeOf value Is Byte
  230.                If DirectCast(value, Byte) < CByte(Me.Min) Then
  231.                    value = Me.Min
  232.                ElseIf DirectCast(value, Byte) > CByte(Me.Max) Then
  233.                    value = Me.Max
  234.                End If
  235.                args.SetNewValue(CByte(value))
  236.  
  237.            Case TypeOf value Is Short
  238.                If DirectCast(value, Short) < CShort(Me.Min) Then
  239.                    value = Me.Min
  240.                ElseIf DirectCast(value, Short) > CShort(Me.Max) Then
  241.                    value = Me.Max
  242.                End If
  243.                args.SetNewValue(CShort(value))
  244.  
  245.            Case TypeOf value Is UShort
  246.                If DirectCast(value, UShort) < CUShort(Me.Min) Then
  247.                    value = Me.Min
  248.                ElseIf DirectCast(value, UShort) > CUShort(Me.Max) Then
  249.                    value = Me.Max
  250.                End If
  251.                args.SetNewValue(CUShort(value))
  252.  
  253.            Case TypeOf value Is Integer
  254.                If DirectCast(value, Integer) < CInt(Me.Min) Then
  255.                    value = Me.Min
  256.                ElseIf DirectCast(value, Integer) > CInt(Me.Max) Then
  257.                    value = Me.Max
  258.                End If
  259.                args.SetNewValue(CInt(value))
  260.  
  261.            Case TypeOf value Is UInteger
  262.                If DirectCast(value, UInteger) < CUInt(Me.Min) Then
  263.                    value = Me.Min
  264.                ElseIf DirectCast(value, UInteger) > CUInt(Me.Max) Then
  265.                    value = Me.Max
  266.                End If
  267.                args.SetNewValue(CUInt(value))
  268.  
  269.            Case TypeOf value Is Long
  270.                If DirectCast(value, Long) < CLng(Me.Min) Then
  271.                    value = Me.Min
  272.                ElseIf DirectCast(value, Long) > CLng(Me.Max) Then
  273.                    value = Me.Max
  274.                End If
  275.                args.SetNewValue(CLng(value))
  276.  
  277.            Case TypeOf value Is ULong
  278.                If DirectCast(value, ULong) < CULng(Me.Min) Then
  279.                    value = Me.Min
  280.                ElseIf DirectCast(value, ULong) > CULng(Me.Max) Then
  281.                    value = Me.Max
  282.                End If
  283.                args.SetNewValue(CULng(value))
  284.  
  285.            Case TypeOf value Is Single
  286.                If DirectCast(value, Single) < CSng(Me.Min) Then
  287.                    value = Me.Min
  288.                ElseIf DirectCast(value, Single) > CSng(Me.Max) Then
  289.                    value = Me.Max
  290.                End If
  291.                args.SetNewValue(CSng(value))
  292.  
  293.            Case TypeOf value Is Double
  294.                If DirectCast(value, Double) < CDbl(Me.Min) Then
  295.                    value = Me.Min
  296.                ElseIf DirectCast(value, Double) > CDbl(Me.Max) Then
  297.                    value = Me.Max
  298.                End If
  299.                args.SetNewValue(CDbl(value))
  300.  
  301.        End Select
  302.  
  303.    End Sub
  304.  
  305. #End Region
  306.  
  307. End Class
  308.  
  309. #End Region
5179  Programación / .NET (C#, VB.NET, ASP) / Re: Listar procesos y rutas en ListBox en: 7 Junio 2015, 09:43 am
Este trozo de codigo  son los procesos que no deberian ejecutarse y en caso que desee mostrar todos los procesos deberia de agregarlos al array?
Código
  1. Dim blacklisted As IEnumerable(Of String) =
  2.    {
  3.        "audiodg",
  4.        "csrss",
  5.        "Idle",
  6.        "services",
  7.        "smss",
  8.        "System"
  9.    }
  10.  

Son los procesos de la lista negra, procesos excluidos de la query de LINQ.

Idle y System son pseudo-procesos (y por lo tanto, daría error la query al intentar obtener una ruta que no existe), y los otros son procesos protegidos.

De todas formas ten en cuenta que lo que escribí es un ejemplo básico que se puede extender para adaptarlo a "X" necesidades, si quieres hacer una buena réplica entonces deberías mostrar lo mismo que muestra el administrador de tareas de Windows.



y esta parte por que solo muestra la ruta del  proceso pero no el nombre o la ruta ya contiene el nombre del proceso? por que declara pNames.

Obviamente la ruta del archivo contiene el nombre del archivo.

¿Por qué declaré pNames y pPaths por separado?, para mostrar dos ejemplos distintos, uno para obtener solo el nombre, y el otro para obtener la ruta completa.



Código
  1. ListBox1.Items.AddRange(pPaths.ToArray)

me dice lo siquiente


Fíjate bien, estás utilizando un ListView, no un ListBox.

Debes pasarle cómo argumento un array de ListViewItem, o un ListViewItemcollection:

Código
  1. With ListView1
  2.  
  3.    .View = View.Details
  4.    .Columns.Add("ExecutablePath")
  5.    .Items.AddRange((From path As String In pPaths Select New ListViewItem({path})).ToArray)
  6.  
  7. End With

Saludos!
5180  Foros Generales / Foro Libre / Re: Una peli para ver esta noche? en: 7 Junio 2015, 09:13 am
Electro, ve "starving games" y después podrás opinar que es una película basura (y te darás cuenta que tu escala puede iniciar en 0 y no 1)

Lo peor de todo es que ya la vi entera (para poder criticar con mayor objetividad xD), "Los muertos del hambre" se títula en España, pf!, claramente se lleva un:



Lo mismo ocurre con todo el resto de películas que han hecho los mismos productores de esa peli, año tras año, no se si realmente alguien puede considerar ese tipo de películas cómo "comedia"... es humor raro ...¿para niños de 4 años?.


Una película 7 de 10 para ver que recomiendo y quedarse "wtf!" es "predestination", es interesante, y agradablemente decepcionante

Hace mucho, pero mucho, muchísimo ...¡la tira de años!... que no me sorprende ninguna película, será que he visto demasiadas, pero recientemente hay una que "me ha devuelto a la vida", de verdad que hacía mucho que no sentía tantanta emoción con una película ...más bien tensión, se trata del reciente remake de "Mad Max", si tengo que recomendar alguna peli del momento entonces sin duda es esa, una pelicula que consigue que no te despegues de la pantalla ni para parpadear, ¡pura tensión!.

TL/DR:
Y ya que hablamos de películas, la película del momento que menos me gusta es "Extraterrestrial", podría puntarla con un 2 y estaría siendo generoso; es la típica película de terror con monstruos, solo que los monstruos son Aliens, pero mezclar el género de terror con alienígenas de esa manera... ponen al típico alien gris cómo si fueran monstruos/bichos malvados que se suben por las paredes y te acosan en la puerta de tu casa hasta que salgas... comerte o violarte o secuestrarte, es muy poco creible esto de los Aaliens haciendo "bullying", en algunas partes de la película me daba la sensación que el director de la peli pretendía transmitir al espectador que los Aliens son una especie de hienas depredadoras y aterradoras al hacecho de humanos, en fin, me parece muy absurdo el estilo que le han dado en ese aspecto, directamente son más monstruos que alienígenas.

Tengo muchas películas favoritas de antaño y de ahora, pero creo que ninguna dejaría con cara de "wtf".

Saludos!
Saludos!
Páginas: 1 ... 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 [518] 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 ... 1236
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines