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

 

 


Tema destacado: (TUTORIAL) Aprende a emular Sentinel Dongle By Yapis


  Mostrar Mensajes
Páginas: 1 ... 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 [589] 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 ... 1236
5881  Programación / .NET (C#, VB.NET, ASP) / Re: Obtener texto de un elemento de una web en: 2 Febrero 2015, 02:12 am
Buenas

Pasos a seguir:

1) Obtener el código fuente para parsearlo.

2) Encontrar el elemento que contiene el valor, mediante técnica XPATH o REGEX, y obtener el valor en cuestión, del Ibex en este caso.

Solo debes examinar el source minuciosamente para rastrear el xpath correcto. Te muestro un ejemplo real en VB.Net utilizando la librería HtmlAgilityPack, y también traducido a C# (quizás se traduzca incorrectamente):

vb.net
Código
  1. Public Class Form1
  2.  
  3.    Private ReadOnly html As String =
  4.        <a><![CDATA[
  5. <!DOCTYPE html>
  6. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  7. <body>
  8.  
  9. <div class="infolinks"><input type="hidden" name="IL_IN_TAG" value="1"/></div><div id="main">
  10.  
  11. <div class="music">
  12.  
  13. <h2 class="boxtitle">New releases \ <small>
  14. <a href="/newalbums" title="New releases mp3 downloads" rel="bookmark">see all</a></small>
  15. </h2>
  16.  
  17. <div class="item">
  18.  
  19.     <div class="thumb">
  20. <a href="http://www.mp3crank.com/curt-smith/deceptively-heavy-121861" rel="bookmark" lang="en" title="Curt Smith - Deceptively Heavy album downloads"><img width="100" height="100" alt="Mp3 downloads Curt Smith - Deceptively Heavy" title="Free mp3 downloads Curt Smith - Deceptively Heavy" src="http://www.mp3crank.com/cover-album/Curt-Smith-Deceptively-Heavy-400x400.jpg"/></a>
  21.     </div>
  22.  
  23. <div class="release">
  24. <h3>Curt Smith</h3>
  25. <h4>
  26. <a href="http://www.mp3crank.com/curt-smith/deceptively-heavy-121861" title="Mp3 downloads Curt Smith - Deceptively Heavy">Deceptively Heavy</a>
  27. </h4>
  28. <script src="/ads/button.js"></script>
  29. </div>
  30.  
  31. <div class="release-year">
  32. <p>Year</p>
  33. <span>2013</span>
  34. </div>
  35.  
  36. <div class="genre">
  37. <p>Genre</p>
  38. <a href="http://www.mp3crank.com/genre/indie" rel="tag">Indie</a><a href="http://www.mp3crank.com/genre/pop" rel="tag">Pop</a>
  39. </div>
  40.  
  41. </div>
  42.  
  43. <div class="item">
  44.  
  45.     <div class="thumb">
  46. <a href="http://www.mp3crank.com/wolf-eyes/lower-demos-121866" rel="bookmark" lang="en" title="Wolf Eyes - Lower Demos album downloads"><img width="100" height="100" alt="Mp3 downloads Wolf Eyes - Lower Demos" title="Free mp3 downloads Wolf Eyes - Lower Demos" src="http://www.mp3crank.com/cover-album/Wolf-Eyes-–-Lower-Demos.jpg" /></a>
  47.     </div>
  48.  
  49. <div class="release">
  50. <h3>Wolf Eyes</h3>
  51. <h4>
  52. <a href="http://www.mp3crank.com/wolf-eyes/lower-demos-121866" title="Mp3 downloads Wolf Eyes - Lower Demos">Lower Demos</a>
  53. </h4>
  54. <script src="/ads/button.js"></script>
  55. </div>
  56.  
  57. <div class="release-year">
  58. <p>Year</p>
  59. <span>2013</span>
  60. </div>
  61.  
  62. <div class="genre">
  63. <p>Genre</p>
  64. <a href="http://www.mp3crank.com/genre/rock" rel="tag">Rock</a>
  65. </div>
  66.  
  67. </div>
  68.  
  69. </div>
  70.  
  71. </div>
  72.  
  73. </body>
  74. </html>
  75. ]]>$</a>.Value
  76.  
  77.    Private sb As New System.Text.StringBuilder
  78.  
  79.    Private htmldoc As HtmlAgilityPack.HtmlDocument = New HtmlAgilityPack.HtmlDocument
  80.    Private htmlnodes As HtmlAgilityPack.HtmlNodeCollection = Nothing
  81.  
  82.    Private Title As String = String.Empty
  83.    Private Cover As String = String.Empty
  84.    Private Year As String = String.Empty
  85.    Private Genres As String() = {String.Empty}
  86.    Private URL As String = String.Empty
  87.  
  88.    Private Sub Test() Handles MyBase.Shown
  89.  
  90.        ' Load the html document.
  91.        htmldoc.LoadHtml(html)
  92.  
  93.        ' Select the (10 items) nodes.
  94.        ' All "SelectSingleNode" below will use this DIV element as a starting point.
  95.        htmlnodes = htmldoc.DocumentNode.SelectNodes("//div[@class='item']")
  96.  
  97.        ' Loop trough the nodes.
  98.        For Each node As HtmlAgilityPack.HtmlNode In htmlnodes
  99.  
  100.             ' Set the values:
  101.            Title = node.SelectSingleNode(".//div[@class='release']/h4/a[@title]").GetAttributeValue("title", "Unknown Title")
  102.            Cover = node.SelectSingleNode(".//div[@class='thumb']/a/img[@src]").GetAttributeValue("src", String.Empty)
  103.            Year = node.SelectSingleNode(".//div[@class='release-year']/span").InnerText
  104.            Genres = (From genre In node.SelectNodes(".//div[@class='genre']/a") Select genre.InnerText).ToArray
  105.            URL = node.SelectSingleNode(".//div[@class='release']/h4/a[@href]").GetAttributeValue("href", "Unknown URL")
  106.  
  107.            ' Display the values:
  108.            sb.Clear()
  109.            sb.AppendLine(String.Format("Title : {0}", Title))
  110.            sb.AppendLine(String.Format("Cover : {0}", Cover))
  111.            sb.AppendLine(String.Format("Year  : {0}", Year))
  112.            sb.AppendLine(String.Format("Genres: {0}", String.Join(", ", Genres)))
  113.            sb.AppendLine(String.Format("URL   : {0}", URL))
  114.            MsgBox(sb.ToString)
  115.  
  116.        Next node
  117.  
  118.    End Sub
  119.  
  120. End Class

c#:
Código
  1. using Microsoft.VisualBasic;
  2. using System;
  3. using System.Collections;
  4. using System.Collections.Generic;
  5. using System.Data;
  6. using System.Diagnostics;
  7. public class Form1
  8. {
  9.  
  10.  
  11. private readonly string html = new XElement("a", new XCData("\n<!DOCTYPE html>\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n<body>\n\n\t<div class=\"infolinks\"><input type=\"hidden\" name=\"IL_IN_TAG\" value=\"1\"/></div><div id=\"main\">\n\n\t\t<div class=\"music\">\n\n\t\t\t<h2 class=\"boxtitle\">New releases \\ <small>\n\t\t\t\t<a href=\"/newalbums\" title=\"New releases mp3 downloads\" rel=\"bookmark\">see all</a></small>\n\t\t\t</h2>\n\n\t\t\t<div class=\"item\">\n\n\t    \t\t<div class=\"thumb\">\n\t\t\t\t\t<a href=\"http://www.mp3crank.com/curt-smith/deceptively-heavy-121861\" rel=\"bookmark\" lang=\"en\" title=\"Curt Smith - Deceptively Heavy album downloads\"><img width=\"100\" height=\"100\" alt=\"Mp3 downloads Curt Smith - Deceptively Heavy\" title=\"Free mp3 downloads Curt Smith - Deceptively Heavy\" src=\"http://www.mp3crank.com/cover-album/Curt-Smith-Deceptively-Heavy-400x400.jpg\"/></a>\n\t    \t\t</div>\n\n\t\t\t\t<div class=\"release\">\n\t\t\t\t\t<h3>Curt Smith</h3>\n\t\t\t\t\t<h4>\n\t\t\t\t\t\t<a href=\"http://www.mp3crank.com/curt-smith/deceptively-heavy-121861\" title=\"Mp3 downloads Curt Smith - Deceptively Heavy\">Deceptively Heavy</a>\n\t\t\t\t\t</h4>\n\t\t\t\t\t<script src=\"/ads/button.js\"></script>\n\t\t\t\t</div>\n\n\t\t\t\t<div class=\"release-year\">\n\t\t\t\t\t<p>Year</p>\n\t\t\t\t\t<span>2013</span>\n\t\t\t\t</div>\n\n\t\t\t\t<div class=\"genre\">\n\t\t\t\t\t<p>Genre</p>\n\t\t\t\t\t<a href=\"http://www.mp3crank.com/genre/indie\" rel=\"tag\">Indie</a><a href=\"http://www.mp3crank.com/genre/pop\" rel=\"tag\">Pop</a>\n\t\t\t\t</div>\n\n\t\t\t</div>\n\n\t\t\t<div class=\"item\">\n\n\t    \t\t<div class=\"thumb\">\n\t\t\t\t\t<a href=\"http://www.mp3crank.com/wolf-eyes/lower-demos-121866\" rel=\"bookmark\" lang=\"en\" title=\"Wolf Eyes - Lower Demos album downloads\"><img width=\"100\" height=\"100\" alt=\"Mp3 downloads Wolf Eyes - Lower Demos\" title=\"Free mp3 downloads Wolf Eyes - Lower Demos\" src=\"http://www.mp3crank.com/cover-album/Wolf-Eyes-–-Lower-Demos.jpg\" /></a>\n\t    \t\t</div>\n\n\t\t\t\t<div class=\"release\">\n\t\t\t\t\t<h3>Wolf Eyes</h3>\n\t\t\t\t\t<h4>\n\t\t\t\t\t\t<a href=\"http://www.mp3crank.com/wolf-eyes/lower-demos-121866\" title=\"Mp3 downloads Wolf Eyes - Lower Demos\">Lower Demos</a>\n\t\t\t\t\t</h4>\n\t\t\t\t\t<script src=\"/ads/button.js\"></script>\n\t\t\t\t</div>\n\n\t\t\t\t<div class=\"release-year\">\n\t\t\t\t\t<p>Year</p>\n\t\t\t\t\t<span>2013</span>\n\t\t\t\t</div>\n\n\t\t\t\t<div class=\"genre\">\n\t\t\t\t\t<p>Genre</p>\n\t\t\t\t\t<a href=\"http://www.mp3crank.com/genre/rock\" rel=\"tag\">Rock</a>\n\t\t\t\t</div>\n\n\t\t\t</div>\n\n\t\t</div>\n\n\t</div>\n\n</body>\n</html>\n")).Value;
  12.  
  13. private System.Text.StringBuilder sb = new System.Text.StringBuilder();
  14. private HtmlAgilityPack.HtmlDocument htmldoc = new HtmlAgilityPack.HtmlDocument();
  15.  
  16. private HtmlAgilityPack.HtmlNodeCollection htmlnodes = null;
  17. private string Title = string.Empty;
  18. private string Cover = string.Empty;
  19. private string Year = string.Empty;
  20. private string[] Genres = { string.Empty };
  21.  
  22. private string URL = string.Empty;
  23.  
  24. private void Test()
  25. {
  26. // Load the html document.
  27. htmldoc.LoadHtml(html);
  28.  
  29. // Select the (10 items) nodes.
  30. // All "SelectSingleNode" below will use this DIV element as a starting point.
  31. htmlnodes = htmldoc.DocumentNode.SelectNodes("//div[@class='item']");
  32.  
  33. // Loop trough the nodes.
  34.  
  35. foreach (HtmlAgilityPack.HtmlNode node in htmlnodes) {
  36. // Set the values:
  37. Title = node.SelectSingleNode(".//div[@class='release']/h4/a[@title]").GetAttributeValue("title", "Unknown Title");
  38. Cover = node.SelectSingleNode(".//div[@class='thumb']/a/img[@src]").GetAttributeValue("src", string.Empty);
  39. Year = node.SelectSingleNode(".//div[@class='release-year']/span").InnerText;
  40. Genres = (from genre in node.SelectNodes(".//div[@class='genre']/a")genre.InnerText).ToArray;
  41. URL = node.SelectSingleNode(".//div[@class='release']/h4/a[@href]").GetAttributeValue("href", "Unknown URL");
  42.  
  43. // Display the values:
  44. sb.Clear();
  45. sb.AppendLine(string.Format("Title : {0}", Title));
  46. sb.AppendLine(string.Format("Cover : {0}", Cover));
  47. sb.AppendLine(string.Format("Year  : {0}", Year));
  48. sb.AppendLine(string.Format("Genres: {0}", string.Join(", ", Genres)));
  49. sb.AppendLine(string.Format("URL   : {0}", URL));
  50. Interaction.MsgBox(sb.ToString);
  51.  
  52. }
  53.  
  54. }
  55. public Form1()
  56. {
  57. Shown += Test;
  58. }
  59.  
  60. }
  61.  
  62. //=======================================================
  63. //Service provided by Telerik (www.telerik.com)
  64. //=======================================================

Plus este util snippet para buscar y obtener todos los xpath de un archivo html, para que sea más facil de llevarlo a cabo:

vb.net:
Código
  1.    ' Get Html XPaths
  2.    ' By Elektro
  3.    '
  4.    ' Example Usage:
  5.    '
  6.    ' Dim Document As New HtmlAgilityPack.HtmlDocument
  7.    ' Document.LoadHtml(IO.File.ReadAllText("C:\File.html"))
  8.    ' Dim XpathList As List(Of String) = GetHtmlXPaths(Document)
  9.    ' ListBox1.Items.AddRange((From XPath As String In XpathList Select XPath).ToArray)
  10.  
  11.    ''' <summary>
  12.    ''' Gets all the XPath expressions of an <see cref="HtmlAgilityPack.HtmlDocument"/> document.
  13.    ''' </summary>
  14.    ''' <param name="Document">Indicates the <see cref="HtmlAgilityPack.HtmlDocument"/> document.</param>
  15.    ''' <returns>List(Of System.String).</returns>
  16.    Public Function GetHtmlXPaths(ByVal Document As HtmlAgilityPack.HtmlDocument) As List(Of String)
  17.  
  18.        Dim XPathList As New List(Of String)
  19.        Dim XPath As String = String.Empty
  20.  
  21.        For Each Child As HtmlAgilityPack.HtmlNode In Document.DocumentNode.ChildNodes
  22.  
  23.            If Child.NodeType = HtmlAgilityPack.HtmlNodeType.Element Then
  24.                GetHtmlXPaths(Child, XPathList, XPath)
  25.            End If
  26.  
  27.        Next Child
  28.  
  29.        Return XPathList
  30.  
  31.    End Function
  32.  
  33.    ''' <summary>
  34.    ''' Gets all the XPath expressions of an <see cref="HtmlAgilityPack.HtmlNode"/>.
  35.    ''' </summary>
  36.    ''' <param name="Node">Indicates the <see cref="HtmlAgilityPack.HtmlNode"/>.</param>
  37.    ''' <param name="XPathList">Indicates a ByReffered XPath list as a <see cref="List(Of String)"/>.</param>
  38.    ''' <param name="XPath">Indicates the current XPath.</param>
  39.    Private Sub GetHtmlXPaths(ByVal Node As HtmlAgilityPack.HtmlNode,
  40.                              ByRef XPathList As List(Of String),
  41.                              Optional ByVal XPath As String = Nothing)
  42.  
  43.        XPath &= Node.XPath.Substring(Node.XPath.LastIndexOf("/"c))
  44.  
  45.        Const ClassNameFilter As String = "[@class='{0}']"
  46.        Dim ClassName As String = Node.GetAttributeValue("class", String.Empty)
  47.  
  48.        If Not String.IsNullOrEmpty(ClassName) Then
  49.            XPath &= String.Format(ClassNameFilter, ClassName)
  50.        End If
  51.  
  52.        If Not XPathList.Contains(XPath) Then
  53.            XPathList.Add(XPath)
  54.        End If
  55.  
  56.        For Each Child As HtmlAgilityPack.HtmlNode In Node.ChildNodes
  57.  
  58.            If Child.NodeType = HtmlAgilityPack.HtmlNodeType.Element Then
  59.                GetHtmlXPaths(Child, XPathList, XPath)
  60.            End If
  61.  
  62.        Next Child
  63.  
  64.    End Sub

c#:
Código
  1. // Get Html XPaths
  2. // By Elektro
  3.  
  4. /// <summary>
  5. /// Gets all the XPath expressions of an <see cref="HtmlAgilityPack.HtmlDocument"/> document.
  6. /// </summary>
  7. /// <param name="Document">Indicates the <see cref="HtmlAgilityPack.HtmlDocument"/> document.</param>
  8. /// <returns>List(Of System.String).</returns>
  9. public List<string> GetHtmlXPaths(HtmlAgilityPack.HtmlDocument Document)
  10. {
  11.  
  12. List<string> XPathList = new List<string>();
  13. string XPath = string.Empty;
  14.  
  15.  
  16. foreach (HtmlAgilityPack.HtmlNode Child in Document.DocumentNode.ChildNodes) {
  17. if (Child.NodeType == HtmlAgilityPack.HtmlNodeType.Element) {
  18. GetHtmlXPaths(Child, ref XPathList, XPath);
  19. }
  20.  
  21. }
  22.  
  23. return XPathList;
  24.  
  25. }
  26.  
  27. /// <summary>
  28. /// Gets all the XPath expressions of an <see cref="HtmlAgilityPack.HtmlNode"/>.
  29. /// </summary>
  30. /// <param name="Node">Indicates the <see cref="HtmlAgilityPack.HtmlNode"/>.</param>
  31. /// <param name="XPathList">Indicates a ByReffered XPath list as a <see cref="List(Of String)"/>.</param>
  32. /// <param name="XPath">Indicates the current XPath.</param>
  33.  
  34. private void GetHtmlXPaths(HtmlAgilityPack.HtmlNode Node, ref List<string> XPathList, string XPath = null)
  35. {
  36. XPath += Node.XPath.Substring(Node.XPath.LastIndexOf('/'));
  37.  
  38. const string ClassNameFilter = "[@class='{0}']";
  39. string ClassName = Node.GetAttributeValue("class", string.Empty);
  40.  
  41. if (!string.IsNullOrEmpty(ClassName)) {
  42. XPath += string.Format(ClassNameFilter, ClassName);
  43. }
  44.  
  45. if (!XPathList.Contains(XPath)) {
  46. XPathList.Add(XPath);
  47. }
  48.  
  49.  
  50. foreach (HtmlAgilityPack.HtmlNode Child in Node.ChildNodes) {
  51. if (Child.NodeType == HtmlAgilityPack.HtmlNodeType.Element) {
  52. GetHtmlXPaths(Child, ref XPathList, XPath);
  53. }
  54.  
  55. }
  56.  
  57. }
  58.  
  59. //=======================================================
  60. //Service provided by Telerik (www.telerik.com)
  61. //=======================================================
  62.  

saludos
5882  Programación / Programación General / Re: Como podría esconder una pagina web en: 1 Febrero 2015, 23:57 pm
Me alegro de que te haya servido, pero aclárame una duda, ¿el simple script de VBS entonces SÍ que funciona con la ventana de IE?, estaría bien saberlo porque yo lo probé en dos navegadores menos en el IE, ahora siento que escribí todo ese otro largo código en VB.Net para nada, jaja, pero no hay problema :P.

Ahora como podría ponerlo para que inicie al encender windows, por ejemplo me funciona al colocarlo en la carpeta inicio pero claro lo que quiero ademas es que no se vea al ir al inicio de todos los programas en esa carpeta. quiero que este invisible.

Para conseguir lo más parecido a una verdadera "invisibilidad" se requieren conocimientos de programación para el uso de técnicas Stealth, por ejemplo, si se quiere ocultar un proceso en el administrador de tareas de Widnows (TaskManager) de "X" versión de Windows eso puede resultar una tarea muy laboriosa a nivel avanzado, cómo también es para otros tipos de invisibilidad la creación de servicios de Windows, Hooking, etc.

Si lo único que quieres es que no aparezca en la carpeta "Inicio" y te conformas con sacarlo de dicha carpeta, entonces puede añadir una clave en la sección Run del registro de Windows:

Startup.reg
Código
  1. Windows Registry Editor Version 5.00
  2.  
  3. [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
  4. "*Título"="C:\\Carpeta\\MiPrograma.exe"

Nota 1: El asterísco (*) indica que el programa se debe iniciar también al reiniciar el PC en modo seguro, si quieres evitar que el programa se inicie en modo seguro entonces no escribas el asterisco al principio del título.
Nota 2: La clave será accesible/visible desde cualquier editor del registro de Windows como el propio Regedit (obviamente), así cómo también por programas que permitan administrar los programas que se inician junto a Windows (ej: CCleaner)

También puedes utilizar mi aplicación File2Startup para añadir un programa al inicio de Windows de forma sencilla:
[SOURCE] File 2 startup v1.1

Cita de: File2Startup by Elektro

Saludos
5883  Programación / Scripting / Re: Compilacion Archivo .bat en: 1 Febrero 2015, 23:22 pm
Buenas

1) Lo que denominas como "la ventana negra", es la consola de Windows, el proceso se llama CMD.exe, y es necesario para interpretar un Batch-Script, la instancia de la CMD, es decir, "la ventana negra", se cierra cuando ya se han procesado todas las instrucciones del Script (y en otros casos es debido a errores de sintaxis).

2) Para redirigir la salida de un proceso a un archivo de texto, puedes usar el operador de redireccionamiento en la salida correspondiente (normal o error).

Command Redirection, Pipes | Windows CMD | SS64.com

Ejemplo:
Código:
(Echo Hola Mundo!)1>".\Archivo.txt" 2>&1

3) El comando externo Clip.exe, como su nombre indica, sirve como portapapeles, lo que redirijas a la entrada del comando clip se copiará en el clipboard de Windows, no tiene sentido intentar usarlo para redirigir la salida hacia un archivo local.

4) El título de tu tema sugiere otra cosa distinta a las preguntas que formulas, pero la contestaré igualmente:
    Un Batch-Script no puede ser compilado, ya que es un lenguaje interpretado (procesamiento por lotes), pero puedes empaquetar el script en un archivo executable con infinidad de herramientas que puedes encontrar si buscases en Google.
    Si quieres mi recomendación, utiliza la aplicación ExeScript Editor para optimizar los resultados: http://www.scriptcode.com/vbscripteditor/


Saludos!
5884  Programación / .NET (C#, VB.NET, ASP) / Re: [C#] ¿Cómo podría hacer esto? en: 1 Febrero 2015, 20:06 pm
Buenas

1) El título de un tema debe describir el problema.
Porfavor, lee las normas del subforo de programación.



Una ayudita? xD

¿Donde está el código que demuestra tus progresos?, en este lugar no hacemos trabajos, ayudamos a resolver dudas específicas o aportamos orientación.

Hay varias librerías, algunas gratis y otras de pago, que ofrecen algoritmos profesionales de técnicas ImageSearch o PixelSearch, como por ejemplo AForge.Net
http://www.aforgenet.com/framework/downloads.html

Si quieres desarrollar tu propio algoritmo de forma tradicional no te lo recomiendo, por el simple hecho de que jamás podrás optimizarlo hasta tal punto, pero de todas formas puedes ver un ejemplo escrito en VB.Net en la class PixelUtil que desarrollé:
Librería de Snippets !! (Compartan aquí sus snippets)

Este ejemplo utilizando Aforge, es una función de uso genérico que busca una imagen en otra imagen, y devuelve un objeto con las coordenadas y otra información relevante:

VB.Net:
Código
  1.    ' Find Image
  2.    ' ( By Elektro )
  3.    '
  4.    ' Usage Examples:
  5.    '
  6.    'Private Sub Test() Handles MyBase.Shown
  7.    '
  8.    '    ' A Desktop Screenshot, in 1920x1080 px. resolution.
  9.    '    Dim desktopScreenshoot As New Bitmap("C:\Desktop.png")
  10.    '
  11.    '    ' A cutted piece of the screenshot, in 50x50 px. resolution.
  12.    '    Dim partOfDesktopToFind As New Bitmap("C:\PartOfDesktop.png")
  13.    '
  14.    '    ' Find the part of the image in the desktop, with the specified similarity.
  15.    '    For Each matching As AForge.Imaging.TemplateMatch In
  16.    '
  17.    '        FindImage(baseImage:=desktopScreenshoot, imageToFind:=partOfDesktopToFind, similarity:=80.5R) ' 80,5% similarity.
  18.    '
  19.    '        Dim sb As New System.Text.StringBuilder
  20.    '
  21.    '        sb.AppendFormat("Top-Left Corner Coordinates: {0}", matching.Rectangle.Location.ToString())
  22.    '        sb.AppendLine()
  23.    '        sb.AppendFormat("similarity Image Percentage: {0}%", (matching.similarity * 100.0F).ToString("00.00"))
  24.    '
  25.    '        MessageBox.Show(sb.ToString)
  26.    '
  27.    '    Next matching
  28.    '
  29.    'End Sub
  30.    '
  31.    ''' <summary>
  32.    ''' Finds a part of an image inside other image and returns the top-left corner coordinates and it's similarity percent.
  33.    ''' </summary>
  34.    ''' <param name="baseImage">
  35.    ''' Indicates the base image.
  36.    ''' </param>
  37.    ''' <param name="imageToFind">
  38.    ''' Indicates the image to find in the base image.
  39.    ''' </param>
  40.    ''' <param name="similarity">
  41.    ''' Indicates the similarity percentage to compare the images.
  42.    ''' A value of '100' means identical image.
  43.    ''' Note: High percentage values with big images could take several minutes to finish.
  44.    ''' </param>
  45.    ''' <returns>AForge.Imaging.TemplateMatch().</returns>
  46.    Private Function FindImage(ByVal baseImage As Bitmap,
  47.                               ByVal imageToFind As Bitmap,
  48.                               ByVal similarity As Double) As AForge.Imaging.TemplateMatch()
  49.  
  50.        Dim currentSimilarity As Single
  51.  
  52.        ' Translate the readable similarity percent value to Single value.
  53.        Select Case similarity
  54.  
  55.            Case Is < 0.1R, Is > 100.0R ' Value is out of range.
  56.                Throw New Exception(String.Format("similarity value of '{0}' is out of range, range is from '0.1' to '100.0'",
  57.                                                  CStr(similarity)))
  58.  
  59.            Case Is = 100.0R ' Identical image comparission.
  60.                currentSimilarity = 1.0F
  61.  
  62.            Case Else ' Image comparission with specific similarity.
  63.                currentSimilarity = Convert.ToSingle(similarity) / 100.0F
  64.  
  65.        End Select
  66.  
  67.        ' Set the similarity threshold to find all matching images with specified similarity.
  68.        Dim tm As New AForge.Imaging.ExhaustiveTemplateMatching(currentSimilarity)
  69.  
  70.        ' Return all the found matching images,
  71.        ' it contains the top-left corner coordinates of each one
  72.        ' and matchings are sortered by it's similarity percent.
  73.        Return tm.ProcessImage(baseImage, imageToFind)
  74.  
  75.    End Function
  76.  

C#:
EDITO: El Snippet está traducido incorrectamente.

Código
  1. // Find Image
  2. // ( By Elektro )
  3.  
  4. /// <summary>
  5. /// Finds a part of an image inside other image and returns the top-left corner coordinates and it's similarity percent.
  6. /// </summary>
  7. /// <param name="baseImage">
  8. /// Indicates the base image.
  9. /// </param>
  10. /// <param name="imageToFind">
  11. /// Indicates the image to find in the base image.
  12. /// </param>
  13. /// <param name="similarity">
  14. /// Indicates the similarity percentage to compare the images.
  15. /// A value of '100' means identical image.
  16. /// Note: High percentage values with big images could take several minutes to finish.
  17. /// </param>
  18. /// <returns>AForge.Imaging.TemplateMatch().</returns>
  19. private AForge.Imaging.TemplateMatch[] FindImage(Bitmap baseImage, Bitmap imageToFind, double similarity)
  20. {
  21.  
  22. float currentSimilarity = 0;
  23.  
  24. // Translate the readable similarity percent value to Single value.
  25. switch (similarity) {
  26.  
  27. case 100.0: // Identical image comparission.
  28. currentSimilarity = 1f;
  29. break;
  30.  
  31. default: // Image comparission with specific similarity.
  32. currentSimilarity = Convert.ToSingle(similarity) / 100f;
  33. break;
  34. }
  35.  
  36. // Set the similarity threshold to find all matching images with specified similarity.
  37. AForge.Imaging.ExhaustiveTemplateMatching tm = new AForge.Imaging.ExhaustiveTemplateMatching(currentSimilarity);
  38.  
  39. // Return all the found matching images,
  40. // it contains the top-left corner coordinates of each one
  41. // and matchings are sortered by it's similarity percent.
  42. return tm.ProcessImage(baseImage, imageToFind);
  43.  
  44. }
  45.  
  46. //=======================================================
  47. //Service provided by Telerik (www.telerik.com)
  48. //=======================================================

Saludos.
5885  Programación / Programación General / Re: Que lenguaje escojer primero? en: 1 Febrero 2015, 12:00 pm
¿Por qué no usan el buscador del foro?, es obvio que esta pregunta se ha formulado cientos de veces, y eso significa que podrás encontrar miles de opiniones distintas.

Saludos!
5886  Sistemas Operativos / Windows / Re: Registro de windows en: 1 Febrero 2015, 09:36 am
- Para agregar una opcion al menú conextual del Explorador de Windows:

Creas la clave de registro:
"HKEY_CLASSES_ROOT\*\shell\Abrir con mi programa"

Hay que mencionar un detalle muy importante, y es que el comodín "*" afectará a todos los tipos de archivos, así que si quieres que el menú contextual y/o asociación de archivo afecte solamente a un tipo de archivo específico, entonces cambia el comodín por la extensión deseada.

Nota: Si la extensión ya tiene una clave referenciada (en el valor por defecto), entonces deberás realizar más modificaciones.

Yo te sugiero realizar las modificaciones en esta clave para añadir el menú contextual (no en la clave mencionada arriba):
Código:
HKEY_CLASSES_ROOT\SystemFileAssociations\.ext\Shell

Ejemplo para una integración del menú contextual para archivos mp3, es un submenu con dos comandos, 'Run', y 'OpenFile':
Código
  1. Windows Registry Editor Version 5.00
  2.  
  3. [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\SystemFileAssociations\.mp3\Shell\MiPrograma]
  4. "MUIVerb"="MiPrograma"
  5. "SubCommands"="MiPrograma.Run;MiPrograma.OpenFile"
  6. "Icon"="C:\\Program Files\\MiPrograma\\MiPrograma.Title.ico"
  7. "Position"="Middle"
  8.  
  9. [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\MiPrograma.Run]
  10. @="Run MiPrograma"
  11. "icon"="C:\\Program Files\\MiPrograma\\MiPrograma.Run.ico"
  12. [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\MiPrograma.Run\command]
  13. @="C:\\Program Files\\MiPrograma\\MiPrograma.exe"
  14.  
  15. [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\MiPrograma.OpenFile]
  16. @="Open file in MiPrograma"
  17. "icon"="C:\\Program Files (x86)\\MiPrograma\\MiPrograma.OpenFile.ico"
  18. [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\MiPrograma.OpenFile\command]
  19. @="\"C:\\Program Files\\MiPrograma\\MiPrograma.exe\" \"%1\""

Me sirvo de estos 2 iconos, plus el icono principal de la aplicación en cuestión (MiPrograma.Title.ico):

MiPrograma.Run.ico
MiPrograma.OpenFile.ico

Resultado:


Saludos
5887  Foros Generales / Foro Libre / Re: Cual es tu lenguaje de programacion favorito? en: 31 Enero 2015, 18:44 pm
siendo asi ¿por que esta tan generalizado ese problema?
El motivo siempre viene siendo el mismo en todos los casos: La Ignorancia, ya que la gente suele llevarse por la opinión de terceras personas y le dan creedibilidad a sus palabras, y eso no siempre es lo correcto.

Performance
Java performance

Programs written in Java have a reputation for being slower and requiring more memory than those written in C++. However, Java programs' execution speed improved significantly with the introduction of Just-in-time compilation in 1997/1998 for Java 1.1,[32] the addition of language features supporting better code analysis (such as inner classes, the StringBuilder class, optional assertions, etc.), and optimizations in the Java virtual machine, such as HotSpot becoming the default for Sun's JVM in 2000.

Debo decir que yo no manejo Java, así que no puedo hablar en profundidad como el compañero @Nac-ho u otros que si sean expertos, pero a mi a pesar de todas las supuestas optimizaciones que han ido implementando con los años, java siempre me ha parecido y me sigue pareciendo un lenguaje que consume demasiados recursos de memoria de forma excesiva, cualquier software desarrollado en Java me lo va a demostrar si le hago un profilling de memoria (que por supuesto lo he hecho en varias ocasiones), el G.C. de Java no me parece estar tan bien optimizado en camparación con otros lenguajes, así que digan lo que digan, en mi opinión, parte de razón tienen al criticar a Java en ese sentido.

Pero de todas formas Java no es el único ni será el último lenguaje con mitos y leyendas, por ejemplo VB.Net es mi lenguaje favorito (contestando a la pregunta del post :P) y también sigue siendo bastante criticado de forma ridícula a día de hoy y con una no muy buena reputación por gente inexperta (por no decir ignorante, en el sentido de no haberlo experimentado/analizado nunca para poder criticarlo si quieren).

Saludos!
5888  Programación / Programación General / Re: Como podría esconder una pagina web en: 29 Enero 2015, 21:58 pm
Buenas, primero que nada:

1) Utiliza el foro adecuado para formular preguntas sobre CMD/Batch: http://foro.elhacker.net/scripting-b64.0/

2) Cuando formules una pregunta sobre programación, si dices tener un código, como mínimo publica el contenido de dicho código.

3) Especifica el navegador también, por Dios, que no somos adivinos.




Si no he entendido mal, ¿lo que quieres hacer es ejecutar un navegador (con una url específica) y ocultar la ventana de dicho navegador?,
en ese caso, en una herramienta tan simple como Batch no es posible realizar es tarea, no sin utilizar herramientas de terceros como CMDOW/NirCMD.

Normalmente podrías llevarlo a cabo de forma sencilla y natural usando VisualBasicScript:

Código
  1. Option Explicit : Dim procFilePath, procArguments, procWindowStyle, procWaitReturn
  2.  
  3. procFilePath    = """" & "C:\Program Files\Google Chrome\Google Chrome.exe" & """"
  4. procArguments   = """" & "http://foro.elhacker.net/"                        & """"
  5. procWindowStyle = 0 ' Hides the window and activates another window.
  6. procWaitReturn  = False
  7.  
  8. Call CreateObject("WScript.Shell"). _
  9. Run(procFilePath & " " & procArguments, procWindowStyle, procWaitReturn)
  10.  
  11. Wscript.Quit(0)

El problema es que aplicaciones como Chrome o Firefox no soportan la modificación del estilo de ventana, en este caso mediante el método Run/ShellExecute para volver invisible la ventana, así que al igual que con Batch, otro lenguaje simple como es VBS tampoco te sirve para la tarea.

Debes recurrir a otro lenguaje que esté capacitado para dicha tarea, o bien puedes mezclar Batch+VBS+CMDOW/NirCMD para llevarlo a cabo de una forma más simple en nivel de conocimientos, pero también mucho más tediosa.

Los procesos de esos navegadores en cuestión son bastante problemáticos al respecto de esto, por lo que he leido hay mucha gente más o menos en tu misma situación (que aparecen en los resultados de Google xD), así que he decidido proporcionarte ayuda en profundidad.

Lo primero de todo es obtener el navegador por defecto registrado en el SO, luego iniciar el navegador, esperar a que cargue el formulario, obtener el puntero de la ventana principal, y por último ocultar la ventana (usando la API de Windows).

Pero hay un inconveniente en todo esto, ya que es necesario esperar a que la ventana se haya creado para que se defina el Handle y poder obtenerlo para así ocultar la ventana, es decir, que la ventana de firefox/chrome se debe mostrar si o si durante el tiempo necesario, que pueden ser apenas unos ínfimos ms (ni se notaría), o segundos, dependiendo del tiempo de respuesta del sistema.

Aparte hay que tener en cuenta muchos otros factores, como por ejemplo el aviso de restaurar sesion de Firefox que literalmente jodería esta metodología al no estar visible la ventana principal, o que la clave de registro que almacena el directorio absoluto al navegador por defecto haya sido eliminada por el usuario, etc, etc, etc...

En fin, te muestro un ejemplo de como se podria llevar a cabo, he escogido como lenguaje VB.Net al ser muy práctico, eficiente, para poder hacerlo de forma simplificada.

Aquí tienes la aplicación ya compilada junto al proyecto de VisualStudio:
https://www.mediafire.com/?9e5ixgz5ne6n8n8

Modo de empleo:
Código:
RunWebBrowserEx.exe "http://url" hide
o
Código:
RunWebBrowserEx.exe "http://url" show

Es una aplicación que usa tecnología WinForms, es decir, con interfáz gráfica, pero he omitido la interfáz para aceptar parámetros commandline y evitar que se muestre cualquier ventana del programa ;).
De todas formas solo es un ejemplo de aplicación, sin controles de errores, ya que bastante he hecho.

Este es el Core de la aplicación:
Código
  1.        ' Get Default WebBrowser
  2.        ' By Elektro
  3.        '
  4.        ''' <summary>
  5.        ''' Gets the default web browser filepath.
  6.        ''' </summary>
  7.        ''' <returns>The default web browser filepath.</returns>
  8.        Friend Shared Function GetDefaultWebBrowser() As String
  9.  
  10.            Dim regKey As RegistryKey = Nothing
  11.            Dim regValue As String = String.Empty
  12.  
  13.            Try
  14.                regKey = Registry.ClassesRoot.OpenSubKey("HTTP\Shell\Open\Command", writable:=False)
  15.                Using regKey
  16.  
  17.                    regValue = regKey.GetValue(Nothing).ToString()
  18.                    regValue = regValue.Substring(0, regValue.IndexOf(".exe", StringComparison.OrdinalIgnoreCase) + ".exe".Length).
  19.                                        Trim({ControlChars.Quote})
  20.  
  21.                End Using
  22.  
  23.            Catch ex As Exception
  24.                Throw
  25.  
  26.            Finally
  27.                If regKey IsNot Nothing Then
  28.                    regKey.Dispose()
  29.                End If
  30.  
  31.            End Try
  32.  
  33.            Return regValue
  34.  
  35.        End Function
  36.  
  37.        ' Run Default WebBrowser
  38.        ' By Elektro
  39.        '
  40.        ''' <summary>
  41.        ''' Runs the specified url using the default registered web browser.
  42.        ''' </summary>
  43.        ''' <param name="url">The url to navigate.</param>
  44.        ''' <param name="windowState">The target web browser its window state.</param>
  45.        Friend Shared Sub RunDefaultWebBrowser(ByVal url As String,
  46.                                               ByVal windowState As SetWindowState.WindowState)
  47.  
  48.            Dim browserHwnd As IntPtr = IntPtr.Zero
  49.            Dim browserFileInfo As New FileInfo(WebBrowserTools.GetDefaultWebBrowser)
  50.            Dim browserProcess As New Process With
  51.                                {
  52.                                    .StartInfo = New ProcessStartInfo With
  53.                                                {
  54.                                                    .FileName = browserFileInfo.FullName,
  55.                                                    .Arguments = url,
  56.                                                    .WindowStyle = ProcessWindowStyle.Minimized,
  57.                                                    .CreateNoWindow = False
  58.                                                }
  59.                                }
  60.  
  61.            browserProcess.Start()
  62.            browserProcess.WaitForExit(0)
  63.  
  64.            Do Until browserHwnd <> IntPtr.Zero
  65.                browserHwnd = Process.GetProcessById(browserProcess.Id).MainWindowHandle
  66.            Loop
  67.  
  68.            SetWindowState.SetWindowState(browserHwnd, windowState)
  69.  
  70.        End Sub

Plus el P/Invoking:

Código
  1. ' ***********************************************************************
  2. ' Author           : Elektro
  3. ' Last Modified On : 10-02-2014
  4. ' ***********************************************************************
  5. ' <copyright file="SetWindowState.vb" company="Elektro Studios">
  6. '     Copyright (c) Elektro Studios. All rights reserved.
  7. ' </copyright>
  8. ' ***********************************************************************
  9.  
  10. #Region " Usage Examples "
  11.  
  12. 'Dim HWND As IntPtr = Process.GetProcessesByName("devenv").First.MainWindowHandle
  13. '
  14. 'SetWindowState.SetWindowState(HWND, SetWindowState.WindowState.Hide)
  15. 'SetWindowState.SetWindowState("devenv", SetWindowState.WindowState.Restore, Recursivity:=False)
  16.  
  17. #End Region
  18.  
  19. #Region " Imports "
  20.  
  21. Imports System.Runtime.InteropServices
  22.  
  23. #End Region
  24.  
  25. Namespace Tools
  26.  
  27.    ''' <summary>
  28.    ''' Sets the state of a window.
  29.    ''' </summary>
  30.    Public NotInheritable Class SetWindowState
  31.  
  32. #Region " P/Invoke "
  33.  
  34.        ''' <summary>
  35.        ''' Platform Invocation methods (P/Invoke), access unmanaged code.
  36.        ''' This class does not suppress stack walks for unmanaged code permission.
  37.        ''' <see cref="System.Security.SuppressUnmanagedCodeSecurityAttribute"/>  must not be applied to this class.
  38.        ''' This class is for methods that can be used anywhere because a stack walk will be performed.
  39.        ''' MSDN Documentation: http://msdn.microsoft.com/en-us/library/ms182161.aspx
  40.        ''' </summary>
  41.        Protected NotInheritable Class NativeMethods
  42.  
  43. #Region " Methods "
  44.  
  45.            ''' <summary>
  46.            ''' Retrieves a handle to the top-level window whose class name and window name match the specified strings.
  47.            ''' This function does not search child windows.
  48.            ''' This function does not perform a case-sensitive search.
  49.            ''' To search child windows, beginning with a specified child window, use the FindWindowEx function.
  50.            ''' MSDN Documentation: http://msdn.microsoft.com/en-us/library/windows/desktop/ms633499%28v=vs.85%29.aspx
  51.            ''' </summary>
  52.            ''' <param name="lpClassName">The class name.
  53.            ''' If this parameter is NULL, it finds any window whose title matches the lpWindowName parameter.</param>
  54.            ''' <param name="lpWindowName">The window name (the window's title).
  55.            ''' If this parameter is NULL, all window names match.</param>
  56.            ''' <returns>If the function succeeds, the return value is a handle to the window that has the specified class name and window name.
  57.            ''' If the function fails, the return value is NULL.</returns>
  58.            <DllImport("user32.dll", SetLastError:=False, CharSet:=CharSet.Auto, BestFitMapping:=False)>
  59.            Friend Shared Function FindWindow(
  60.                   ByVal lpClassName As String,
  61.                   ByVal lpWindowName As String
  62.            ) As IntPtr
  63.            End Function
  64.  
  65.            ''' <summary>
  66.            ''' Retrieves a handle to a window whose class name and window name match the specified strings.
  67.            ''' The function searches child windows, beginning with the one following the specified child window.
  68.            ''' This function does not perform a case-sensitive search.
  69.            ''' MSDN Documentation: http://msdn.microsoft.com/en-us/library/windows/desktop/ms633500%28v=vs.85%29.aspx
  70.            ''' </summary>
  71.            ''' <param name="hwndParent">
  72.            ''' A handle to the parent window whose child windows are to be searched.
  73.            ''' If hwndParent is NULL, the function uses the desktop window as the parent window.
  74.            ''' The function searches among windows that are child windows of the desktop.
  75.            ''' </param>
  76.            ''' <param name="hwndChildAfter">
  77.            ''' A handle to a child window.
  78.            ''' The search begins with the next child window in the Z order.
  79.            ''' The child window must be a direct child window of hwndParent, not just a descendant window.
  80.            ''' If hwndChildAfter is NULL, the search begins with the first child window of hwndParent.
  81.            ''' </param>
  82.            ''' <param name="strClassName">
  83.            ''' The window class name.
  84.            ''' </param>
  85.            ''' <param name="strWindowName">
  86.            ''' The window name (the window's title).
  87.            ''' If this parameter is NULL, all window names match.
  88.            ''' </param>
  89.            ''' <returns>
  90.            ''' If the function succeeds, the return value is a handle to the window that has the specified class and window names.
  91.            ''' If the function fails, the return value is NULL.
  92.            ''' </returns>
  93.            <DllImport("User32.dll", SetLastError:=False, CharSet:=CharSet.Auto, BestFitMapping:=False)>
  94.            Friend Shared Function FindWindowEx(
  95.                   ByVal hwndParent As IntPtr,
  96.                   ByVal hwndChildAfter As IntPtr,
  97.                   ByVal strClassName As String,
  98.                   ByVal strWindowName As String
  99.            ) As IntPtr
  100.            End Function
  101.  
  102.            ''' <summary>
  103.            ''' Retrieves the identifier of the thread that created the specified window
  104.            ''' and, optionally, the identifier of the process that created the window.
  105.            ''' MSDN Documentation: http://msdn.microsoft.com/en-us/library/windows/desktop/ms633522%28v=vs.85%29.aspx
  106.            ''' </summary>
  107.            ''' <param name="hWnd">A handle to the window.</param>
  108.            ''' <param name="ProcessId">
  109.            ''' A pointer to a variable that receives the process identifier.
  110.            ''' If this parameter is not NULL, GetWindowThreadProcessId copies the identifier of the process to the variable;
  111.            ''' otherwise, it does not.
  112.            ''' </param>
  113.            ''' <returns>The identifier of the thread that created the window.</returns>
  114.            <DllImport("user32.dll")>
  115.            Friend Shared Function GetWindowThreadProcessId(
  116.                   ByVal hWnd As IntPtr,
  117.                   ByRef processId As Integer
  118.            ) As Integer
  119.            End Function
  120.  
  121.            ''' <summary>
  122.            ''' Sets the specified window's show state.
  123.            ''' MSDN Documentation: http://msdn.microsoft.com/en-us/library/windows/desktop/ms633548%28v=vs.85%29.aspx
  124.            ''' </summary>
  125.            ''' <param name="hwnd">A handle to the window.</param>
  126.            ''' <param name="nCmdShow">Controls how the window is to be shown.</param>
  127.            ''' <returns><c>true</c> if the function succeeds, <c>false</c> otherwise.</returns>
  128.            <DllImport("User32", SetLastError:=False)>
  129.            Friend Shared Function ShowWindow(
  130.                   ByVal hwnd As IntPtr,
  131.                   ByVal nCmdShow As WindowState
  132.            ) As Boolean
  133.            End Function
  134.  
  135. #End Region
  136.  
  137.        End Class
  138.  
  139. #End Region
  140.  
  141. #Region " Enumerations "
  142.  
  143.        ''' <summary>
  144.        ''' Controls how the window is to be shown.
  145.        ''' MSDN Documentation: http://msdn.microsoft.com/en-us/library/windows/desktop/ms633548%28v=vs.85%29.aspx
  146.        ''' </summary>
  147.        Friend Enum WindowState As Integer
  148.  
  149.            ''' <summary>
  150.            ''' Hides the window and activates another window.
  151.            ''' </summary>
  152.            Hide = 0I
  153.  
  154.            ''' <summary>
  155.            ''' Activates the window and displays it in its current size and position.
  156.            ''' </summary>
  157.            Show = 5I
  158.  
  159.            ''' <summary>
  160.            ''' Activates and displays the window.
  161.            ''' If the window is minimized or maximized, the system restores it to its original size and position.
  162.            ''' An application should specify this flag when restoring a minimized window.
  163.            ''' </summary>
  164.            Restore = 9I
  165.  
  166.        End Enum
  167.  
  168. #End Region
  169.  
  170. #Region " Public Methods "
  171.  
  172.        ''' <summary>
  173.        ''' Set the state of a window by an HWND.
  174.        ''' </summary>
  175.        ''' <param name="WindowHandle">A handle to the window.</param>
  176.        ''' <param name="WindowState">The state of the window.</param>
  177.        ''' <returns><c>true</c> if the function succeeds, <c>false</c> otherwise.</returns>
  178.        Friend Shared Function SetWindowState(ByVal windowHandle As IntPtr,
  179.                                              ByVal windowState As WindowState) As Boolean
  180.  
  181.            Return NativeMethods.ShowWindow(windowHandle, windowState)
  182.  
  183.        End Function
  184.  
  185. #End Region
  186.  
  187.    End Class
  188.  
  189. End Namespace

Saludos
5889  Programación / Scripting / Re: FreeSSHd Error Windows en: 29 Enero 2015, 19:23 pm
Buenas

Si la instrucción que estás utilizando es algo parecido a esto:
Código:
ssh.exe me@myWindowsBox 'Dir'

Entonces el problema se debe a que la aplicación espera un proceso como argumento y la aplicación interpreta "dir" como si fuera un proceso, pero obviamente no lo es, así que debes especificar el proceso CMD.exe y pasarle los argumentos a dicho proceso, por ejemplo:
Código:
ssh.exe me@myWindowsBox 'cmd.exe /C Dir' 
En ciertas circunstancias (al usar caracteres reservados, por ejemplo al concatenar comandos) también deberás asegurarte de encerrar los argumentos pasados al proceso CMD.exe:
Código:
ssh.exe me@myWindowsBox 'cmd.exe /C "Dir & Echo Hello World"' 

Pero, según parece creo que primero debes activar la siguiente opción:
Citar
uncheck freeSSHD settings->SSH->Use new console engine

Fuente:
Execute remote command? - freeSSHd and freeFTPd

Otras posibles soluciones:
Google

Saludos
5890  Programación / Programación General / Re: Python o Visual Basic. Que me recomiendan aprender primero. en: 29 Enero 2015, 18:40 pm
Y otra cosita que olvide. Una vez utilizé Visual Basic y noté que era demasiado secillo crear la parte visual, es decir, la cajas de texto, los botones, las entanas emergentes y esas cosas (el código lo auto generaba el mismo Visual Basic en segundo plano). Para lo que nesecitaba código era para especificar las interacciones entre las ventanas, cajas y botones.

Acabas de descubrir la diferencia entre una IDE con soporte RAD (VisualStudio), y un lenguaje que ofrece una IDE sin practicamente ninguna utilidad valiosa para el programador más allá de sus funcionalidades más primarias (Python-IDLE).

Recuerda que Python es un lenguaje de Scripting cuyo paquete de instalación lleva una IDE gratuita y orientada a principiantes (nada que ver con las IDES profesionales de terceros para Python), ¡no lo confundas con un buen patrón de programación a seguir o algo parecido por ser la herramienta que va incluida en el paquete o por parecerse al notepa o por lo que sea!,
mientras que VB.Net es un lenguaje compilado y se puede adquirir una IDE de pago que proporciona las herramientas más profesionales para manejar dicho lenguaje (VS).



Encambio con Python, (la verdad no se) pero noté que nesecitabas conocer el código para cualquier cosa que quisiera hacer, como las cajas y botones, y sus funciones entre ellas. ¿Será a esto a lo que se refieren cuando dicen: Bueno, no se si es esto, pero creo que me gustaría mas así.

¿Eso lo consideras un beneficio al respecto?, no te das cuenta de lo improductivo que resulta escribirlo todo todito a mano, jeje, pero bueno, si tú crees que eso va a ser más cómodo para ti o crees que te vas a sentir más profesional por "escribir la UI a mano", o lo que sea... pues bueno, allá cada uno con sus gustos :P.

Pero déjame explicarte que VisualStudio solo "genera" un control dándole un estilo visual por defecto (algún estilo debe tener el control por defecto, no puede estar en blanco, vaya), quiero decir, que no te hace el trabajo, obviamente puedes modificar tanto los elementos visuales del control, como las propiedades de cada control de la misma manera que lo haces usando Python-GTK/etc en un editor, escribiendo el código a mano, al igual que puedes añadir los controles en la UI "escribiendo código" (y no usando el designer), e incluso puedes ir mucho más lejos y crear tus propios controles de forma bastante sencilla (o compleja variando las necesidades), y dinamicamente.



Ya que no me gusta mcho la idea de depender de un programa para hecer las cosas. (Es como DreamWaver y el Bloc de Notas de windown. El DreamWaver podria hacerlo todo y tu no aprenderás nada, mientras que el Bloc de Notas no hará nada pero tu podrías hacerte llamar Diseñador Web  ;) )

Por usar un GUI builder para añadir un control en la UI arrastrando el ratón no vas a estar aprendiendo más, ni menos, ni tampoco te va a hacer peor programador ni mucho menos mejor, ni te estará haciendo el trabajo sucio si es lo que piensas. Todo eso son conceptos erroneos, en mi opinión.

De hecho, es una característica que va ligada a los estándares de la programación de hoy en día, cualquier IDE que tenga integrado un GUI builder, no solo se ve en VB.Net, sino en IDES de Java, C++, C#, Delphi, etc, y Python, porsupuestisimamente:

Is there an GUI Designer for python?

¿Y por que se usan esas herramientas en lugar de un editor de texto?, La razón principal es obvia, fue un avance informático muy importante en lo relacionado con el desarrollo de aplicaciones, y deberías aprovecharlo.

Aquí puedes leer un poco sobre el tema del que estoy hablando, algunas características muy importantes que se suelen ver en una IDE:

Rapid application development
Graphical user interface builder
Intelligent code completion
Debugger



El DreamWaver podria hacerlo todo y tu no aprenderás nada, mientras que el Bloc de Notas no hará nada pero tu podrías hacerte llamar Diseñador Web  ;) ) Por eso yo eliminé de mi PC a DreamWaver y descargue el NotePad...  ;D

Seguimos con el ejemplo entre una IDE wysiwyg orientada a la programación Web y una IDE orientada al desarrollo de aplicaciones de escritorio, ¡Es algo totalmente distinto!.

Hay gente capaz de escribir una página html con el notepad, si, por supuesto, es algo relativamente fáicl, y bueno, el scripting se basa más o menos en eso, en escribir y escribir instrucciones en un editor, omitiendo otros detalles innecesarios como la elaboración de una GUI, no por eso está mal usar un GUI builder cuando necesitar desarrollar una GUI en un lenguaje de Scripting, para eso existen.

Dices que usas notepad en lugar de DreamWeaver porque así te puedes hacer llamar "diseñador de webs" al no usar una IDE, es decir, ¿que te sientes mejor programador al usar una herramienta primitiva, al imponerte límites inecesarios por negarte a usar los beneficios de las herramientas modernas?, ¿que sentido le ves a eso?.

EDITO: No se mucho sobre programación web, pero uno de mis hermanos lleva décadas diseñando Webs y he adquirido muchas experiencias de él, tienes razón en que quien suele aprender a usar Dreamweaver luego no sabe hacer nada por si solito a mano por ejemplo ni sabe cómo corregir bugs ni nah, pero es que esto es muy distinto, esto no es Html,
el buen programador (de webs, y de lo que sea) es aquél que mejor sabe aprovechar los recursos de su entorno (entre otras cosas, como conocer sus capacidades, intentar desarrollar un algoritmo de la forma más eficiente, ser humilde, blah blah blah... ese no es el tema ahora), una IDE aumenta tu rendimiento/productivas en un 200%, mientras que el notepad solo te ralentiza en cada tarea ...por no decir que ni siquiera puedes debuggear una app, ya me dirás que cualidades ganarás como desarrollador de software usando un editor de texto para programar, en lugar de una IDE capacitada, aunque sea un simple script de Python.

Estás muy equivocado con ese manera de pensar.



Citar
Pero yo me inclino a Python, porque se que cuando llegue a las cosas avanzadas Python será mejor opción (bueno, lo sé por lo que leo en internet  :P)...

Generalizando con las espectativas y las necesidades de un programador "estándar", no va a haber practicamente NADA que puedas desarrollar en Python pero no puedas hacerlo en VB.Net, y viceversa



Sobre la elección entre Python o VB.Net:

Al final todo depende de gustos y necesidades, quiero dejar claro que todo lo que he comentado hasta ahora y lo que voy a comentar solo es mi opinión personal, pero yo y mis gustos coincidimos en que Python es improductivo empezando por su estricta sintaxis, y dejándome por el camino cientos de razones más (que ya he comentado en muchas ocasiones en otros posts).

Entre dos lenguajes tan capacitados en funcionalidades como Python y VB.Net, la mejor opción es aquella con la que más a gusto estés y la que mejor se adapte a tu forma de trabajar en lo referente a la programación, no solo cuenta el lenguaje o sus capacidades/limitaciones, sino también la herramienta (IDE) que vayas a utilizar (si, hazte a la idea que no vas a usar por siempre el notepad si tienes pensado programar de forma seria en el lenguaje que sea, acabarás usando una IDE con características profesionales, de esas que tanto te has quejado en los comentarios), asi que simplemente evalua bien las distintas características que te ofrece cada lenguaje.

PD: Yo aprendí de forma básica Python (sin profundizar excesivamente en sus Internals), para evaluarlo como lenguaje, y luego pasé por la misma elección, ¿Python o VB.Net?, bueno, creo que te podrás dar cuenta de cual fue mi decisión si te fijas en la imagen de mi avatar xD.

Saludos!
Páginas: 1 ... 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 [589] 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 ... 1236
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines