|
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: if result<=59 then msgbox("El Alumno esta: " & re ) else if result>=60 and result<=69 then msgbox("El alumno esta: " & de ) else if result>=70 and result<=79 then msgbox("El Alumno esta: " & bu ) else if result>=80 and result<=89 then msgbox("El Alumno esta: " & mbu ) else if result>=90 and result <= 100 then msgbox("El Alumno esta: " & exc ) end if end if end if end if 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: Option Explicit : Dim appTitle, boxMsg, result ' *************************************************************** ' Main ' *************************************************************** appTitle = "Título del programa." boxMsg = "Introduzca el numero de la operacion a realizar:" & _ vbNewLine & _ vbNewLine & _ "1. Encontrar el valor de Y" & _ vbNewLine & _ "2. Promedio de un Estudiante" & _ vbNewLine & _ "3. Salir" Do While ( result <> 3 ) result = Cint( InputBox(boxMsg, appTitle) ) Select Case result Case 1 ' Encontrar el valor de Y EncontrarElValorDeY() Case 2 ' Promedio de un Estudiante PromedioDeUnEstudiante() Case 3 ' Salir Salir() End Select Loop ' *************************************************************** ' Methods ' *************************************************************** ' Encontrar el valor de Y Sub EncontrarElValorDeY() Dim x, y x = CDbl( InputBox("Introduzca el valor de 'X'.", appTitle) ) y = GetValue(x) Call MsgBox("El Valor de 'Y' es: " & CStr(y), vbInformation, appTitle) End Sub ' Promedio de un Estudiante Sub PromedioDeUnEstudiante() Dim matters, notes, average, _ sentences, curSentence, _ index, alumnInfo matters = Array(Null, Null, Null, Null, Null) notes = Array(Null, Null, Null, Null, Null) average = Null sentences = Array("Reprobado", "Deficiente", "Bueno", "Muy Bueno", "Excelente") curSentence = Null alumnInfo = Null For index = 0 To UBound(matters) matters(index) = InputBox("Nombre de la" & CStr(index + 1) & "° materia", appTitle) Do Until ( notes(index) <= 100 ) notes(index) = CInt( InputBox("Nota de '" & matters(index) & "' (entre 0 y 100)", appTitle) ) Loop Next average = GetAverage(notes) If (average <= 59) Then curSentence = sentences(0) ElseIf (average >= 60) And (average <= 69) Then curSentence = sentences(1) ElseIf (average >= 70) And (average <= 79) Then curSentence = sentences(2) ElseIf (average >= 80) And (average <= 89) Then curSentence = sentences(3) Else ' average >= 90 curSentence = sentences(4) End If alumnInfo = alumnInfo & "El promedio es: " & CStr(average) & vbNewLine alumnInfo = alumnInfo & "El alumno esta: " & curSentence & vbNewLine For index = 0 To UBound(notes) If notes(index) <= 59 Then alumnInfo = alumnInfo & "El alumno reprobo " & matters(index) & vbNewLine Else alumnInfo = alumnInfo & "El alumno aprobo " & matters(index) & vbNewLine End If Next Call MsgBox(alumnInfo, vbInformation, appTitle) End Sub ' Salir Sub Salir() Call MsgBox("Usted esta saliendo del programa...", vbExclamation, appTitle) WScript.Quit(0) End Sub ' *************************************************************** ' Functions ' *************************************************************** ' valor de X Function GetValue(value) GetValue = CDbl( Log(value + 30) / 20 ) End Function ' Promedio de X Function GetAverage(values) Dim value For Each value In values GetAverage = GetAverage + value Next GetAverage = CDbl( GetAverage / 5 ) 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!
|
|
|
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 LanguagesPD: 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!
|
|
|
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: Imports PostSharp.Aspects Public Class MyClass <RangeAttribute(0S, SByte.MaxValue)> Dim sByteValue As SByte <RangeAttribute(0S, Byte.MaxValue)> Dim ByteValue As Byte <RangeAttribute(0S, Short.MaxValue)> Dim Int16Value As Short <RangeAttribute(0US, UShort.MaxValue)> Dim UInt16Value As UShort <RangeAttribute(0I, Integer.MaxValue)> Dim Int32Value As Integer <RangeAttribute(0UI, UInteger.MaxValue)> Dim UInt32Value As UInteger <RangeAttribute(0L, Long.MaxValue)> Dim Int64Value As Long <RangeAttribute(0UL, ULong.MaxValue)> Dim UInt64Value As ULong <RangeAttribute(0.0F, Single.MaxValue)> Dim SglValue As Single <RangeAttribute(0.0R, Double.MaxValue)> Dim DblValue As Double End Class
Código fuente: ' *********************************************************************** ' Author : Elektro ' Modified : 07-June-2015 ' *********************************************************************** ' <copyright file="RangeAttribute.vb" company="Elektro Studios"> ' Copyright (c) Elektro Studios. All rights reserved. ' </copyright> ' *********************************************************************** #Region " Usage Examples " 'Imports PostSharp.Aspects ' 'Public Class Myclass ' ' <RangeAttribute(0S, SByte.MaxValue)> ' Dim sByteValue As SByte ' ' <RangeAttribute(0S, Byte.MaxValue)> ' Dim ByteValue As Byte ' ' <RangeAttribute(0S, Short.MaxValue)> ' Dim Int16Value As Short ' ' <RangeAttribute(0US, UShort.MaxValue)> ' Dim UInt16Value As UShort ' ' <RangeAttribute(0I, Integer.MaxValue)> ' Dim Int32Value As Integer ' ' <RangeAttribute(0UI, UInteger.MaxValue)> ' Dim UInt32Value As UInteger ' ' <RangeAttribute(0L, Long.MaxValue)> ' Dim Int64Value As Long ' ' <RangeAttribute(0UL, ULong.MaxValue)> ' Dim UInt64Value As ULong ' ' <RangeAttribute(0.0F, Single.MaxValue)> ' Dim SglValue As Single ' ' <RangeAttribute(0.0R, Double.MaxValue)> ' Dim DblValue As Double ' 'End Class #End Region #Region " Imports " Imports PostSharp.Aspects #End Region #Region " Range Attribute " ''' <summary> ''' Aspect that when applied to a property, defines its minimum and maximum value. ''' </summary> <Serializable> Public Class RangeAttribute : Inherits LocationInterceptionAspect #Region " Properties " ''' <summary> ''' Gets or sets the minimum value. ''' </summary> Private Property Min As Object ''' <summary> ''' Gets or sets the maximum value. ''' </summary> Private Property Max As Object #End Region #Region " Constructors " ''' <summary> ''' Initializes a new instance of the <see cref="RangeAttribute"/> class for <see cref="SByte"/> datatype. ''' </summary> ''' <param name="minInt8">The minimum <see cref="SByte"/> value.</param> ''' <param name="maxInt8">The maximum <see cref="SByte"/> value.</param> Public Sub New(ByVal minInt8 As SByte, ByVal maxInt8 As SByte) Me.Min = minInt8 Me.Max = maxInt8 End Sub ''' <summary> ''' Initializes a new instance of the <see cref="RangeAttribute"/> class for <see cref="Byte"/> datatype. ''' </summary> ''' <param name="minUInt8">The minimum <see cref="Byte"/> value.</param> ''' <param name="maxUInt8">The maximum <see cref="Byte"/> value.</param> Public Sub New(ByVal minUInt8 As Byte, ByVal maxUInt8 As Byte) Me.Min = minUInt8 Me.Max = maxUInt8 End Sub ''' <summary> ''' Initializes a new instance of the <see cref="RangeAttribute"/> class for <see cref="Short"/> datatype. ''' </summary> ''' <param name="minInt16">The minimum <see cref="Short"/> value.</param> ''' <param name="maxInt16">The maximum <see cref="Short"/> value.</param> Public Sub New(ByVal minInt16 As Short, ByVal maxInt16 As Short) Me.Min = minInt16 Me.Max = maxInt16 End Sub ''' <summary> ''' Initializes a new instance of the <see cref="RangeAttribute"/> class for <see cref="UShort"/> datatype. ''' </summary> ''' <param name="minUInt16">The minimum <see cref="UShort"/> value.</param> ''' <param name="maxUInt16">The maximum <see cref="UShort"/> value.</param> Public Sub New(ByVal minUInt16 As UShort, ByVal maxUInt16 As UShort) Me.Min = minUInt16 Me.Max = maxUInt16 End Sub ''' <summary> ''' Initializes a new instance of the <see cref="RangeAttribute"/> class for <see cref="Integer"/> datatype. ''' </summary> ''' <param name="minInt32">The minimum <see cref="Integer"/> value.</param> ''' <param name="maxInt32">The maximum <see cref="Integer"/> value.</param> Public Sub New(ByVal minInt32 As Integer, ByVal maxInt32 As Integer) Me.Min = minInt32 Me.Max = maxInt32 End Sub ''' <summary> ''' Initializes a new instance of the <see cref="RangeAttribute"/> class for <see cref="UInteger"/> datatype. ''' </summary> ''' <param name="minUInt32">The minimum <see cref="UInteger"/> value.</param> ''' <param name="maxUInt32">The maximum <see cref="UInteger"/> value.</param> Public Sub New(ByVal minUInt32 As UInteger, ByVal maxUInt32 As UInteger) Me.Min = minUInt32 Me.Max = maxUInt32 End Sub ''' <summary> ''' Initializes a new instance of the <see cref="RangeAttribute"/> class for <see cref="Long"/> datatype. ''' </summary> ''' <param name="minInt64">The minimum <see cref="Long"/> value.</param> ''' <param name="maxInt64">The maximum <see cref="Long"/> value.</param> Public Sub New(ByVal minInt64 As Long, ByVal maxInt64 As Long) Me.Min = minInt64 Me.Max = maxInt64 End Sub ''' <summary> ''' Initializes a new instance of the <see cref="RangeAttribute"/> class for <see cref="ULong"/> datatype. ''' </summary> ''' <param name="minUInt64">The minimum <see cref="ULong"/> value.</param> ''' <param name="maxUInt64">The maximum <see cref="ULong"/> value.</param> Public Sub New(ByVal minUInt64 As ULong, ByVal maxUInt64 As ULong) Me.Min = minUInt64 Me.Max = maxUInt64 End Sub ''' <summary> ''' Initializes a new instance of the <see cref="RangeAttribute"/> class for <see cref="Single"/> datatype. ''' </summary> ''' <param name="minSingle">The minimum <see cref="Single"/> value.</param> ''' <param name="maxSingle">The maximum <see cref="Single"/> value.</param> Public Sub New(ByVal minSingle As Single, ByVal maxSingle As Single) Me.Min = minSingle Me.Max = maxSingle End Sub ''' <summary> ''' Initializes a new instance of the <see cref="RangeAttribute"/> class for <see cref="Double"/> datatype. ''' </summary> ''' <param name="minDouble">The minimum <see cref="Double"/> value.</param> ''' <param name="maxDouble">The maximum <see cref="Double"/> value.</param> Public Sub New(ByVal minDouble As Double, ByVal maxDouble As Double) Me.Min = minDouble Me.Max = maxDouble End Sub ''' <summary> ''' Prevents a default instance of the <see cref="RangeAttribute"/> class from being created. ''' </summary> Private Sub New() End Sub #End Region #Region " Methods " ''' <summary> ''' Method invoked <i>instead</i> of the <c>Set</c> semantic of the field or property to which the current aspect is applied, ''' i.e. when the value of this field or property is changed. ''' </summary> ''' <param name="args">Advice arguments.</param> Public Overrides Sub OnSetValue(ByVal args As LocationInterceptionArgs) Dim value As Object = args.Value Select Case True Case TypeOf value Is SByte If DirectCast(value, SByte) < CSByte(Me.Min) Then value = Me.Min ElseIf DirectCast(value, SByte) > CSByte(Me.Max) Then value = Me.Max End If args.SetNewValue(CSByte(value)) Case TypeOf value Is Byte If DirectCast(value, Byte) < CByte(Me.Min) Then value = Me.Min ElseIf DirectCast(value, Byte) > CByte(Me.Max) Then value = Me.Max End If args.SetNewValue(CByte(value)) Case TypeOf value Is Short If DirectCast(value, Short) < CShort(Me.Min) Then value = Me.Min ElseIf DirectCast(value, Short) > CShort(Me.Max) Then value = Me.Max End If args.SetNewValue(CShort(value)) Case TypeOf value Is UShort If DirectCast(value, UShort) < CUShort(Me.Min) Then value = Me.Min ElseIf DirectCast(value, UShort) > CUShort(Me.Max) Then value = Me.Max End If args.SetNewValue(CUShort(value)) Case TypeOf value Is Integer If DirectCast(value, Integer) < CInt(Me.Min) Then value = Me.Min ElseIf DirectCast(value, Integer) > CInt(Me.Max) Then value = Me.Max End If args.SetNewValue(CInt(value)) Case TypeOf value Is UInteger If DirectCast(value, UInteger) < CUInt(Me.Min) Then value = Me.Min ElseIf DirectCast(value, UInteger) > CUInt(Me.Max) Then value = Me.Max End If args.SetNewValue(CUInt(value)) Case TypeOf value Is Long If DirectCast(value, Long) < CLng(Me.Min) Then value = Me.Min ElseIf DirectCast(value, Long) > CLng(Me.Max) Then value = Me.Max End If args.SetNewValue(CLng(value)) Case TypeOf value Is ULong If DirectCast(value, ULong) < CULng(Me.Min) Then value = Me.Min ElseIf DirectCast(value, ULong) > CULng(Me.Max) Then value = Me.Max End If args.SetNewValue(CULng(value)) Case TypeOf value Is Single If DirectCast(value, Single) < CSng(Me.Min) Then value = Me.Min ElseIf DirectCast(value, Single) > CSng(Me.Max) Then value = Me.Max End If args.SetNewValue(CSng(value)) Case TypeOf value Is Double If DirectCast(value, Double) < CDbl(Me.Min) Then value = Me.Min ElseIf DirectCast(value, Double) > CDbl(Me.Max) Then value = Me.Max End If args.SetNewValue(CDbl(value)) End Select End Sub #End Region End Class #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? Dim blacklisted As IEnumerable(Of String) = { "audiodg", "csrss", "Idle", "services", "smss", "System" }
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.
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: With ListView1 .View = View.Details .Columns.Add("ExecutablePath") .Items.AddRange((From path As String In pPaths Select New ListViewItem({path})).ToArray) 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!
|
|
|
|
|
|
|