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

 

 


Tema destacado: ¿Eres nuevo? ¿Tienes dudas acerca del funcionamiento de la comunidad? Lee las Reglas Generales


  Mostrar Mensajes
Páginas: 1 ... 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 [29] 30 31 32 33 34 35 36 37 38 39 40 41
281  Programación / .NET (C#, VB.NET, ASP) / Re: Enviar correo a Gmail! en: 26 Febrero 2010, 03:50 am
El code funciona, prueba con otra cuenta de gmail o como piensas es problema de tu ordenador, el mensaje de error deberia ubicarte para solucionar el problema, si no hay dicho mensaje puede ser problema en tu cuenta gmail o tu IP.
282  Programación / Scripting / Re: [Duda Python+TK] Sobre variables y funciones en: 25 Febrero 2010, 20:06 pm
Este ejemplo lo vi hace tiempo:

Código
  1. from Tkinter import *
  2. import os
  3. import urllib
  4. import threading
  5. import time
  6.  
  7. def logs(b):
  8.    f = open('./downloads/log.txt','aw')
  9.    f.write ("Archivo %s" % b + "descargado %s \n" % time.strftime("a Horas: %H:%M:%S en Fecha: %D"))
  10.    f.close()
  11.  
  12.  
  13. def reporthook(blocks_read, block_size, total_size):
  14.    if not blocks_read:
  15.        myapp.lab1["text"] = "conexión Establecida"
  16.        return
  17.    if total_size < 0:
  18.        myapp.lab1["text"] = "Bloques Leidos " % blocks_read
  19.    else:
  20.        amount_read = blocks_read * block_size
  21.        myapp.lab1["text"] = "Faltan: %d Kb para terminar la Descarga" %((total_size/1024) -  (amount_read/1024))
  22.        return
  23.  
  24. class Hilo(threading.Thread ):
  25.    def run ( self ):
  26.        try:
  27.            i = 0
  28.            while i==0:
  29.                c = myapp.text3.get(1.0, 2.0)
  30.                b = c[c.rfind('/',0,len(c))+1:len(c)]
  31.                urllib.urlretrieve("%s" % myapp.text3.get(1.0, 2.0), 'downloads/%s' % b, reporthook=reporthook)
  32.                myapp.lab1["text"] = "ARCHIVO %s DESCARGADO" % b
  33.                logs(b)
  34.  
  35.                myapp.text3.delete(1.0, 2.0)
  36.  
  37.                if myapp.text3.search("http://", 1.0, 1.7):
  38.                    myapp.lab1["text"] = "CONTINUANDO DESCARGA"
  39.                    continue;
  40.                else:
  41.                    myapp.lab1["text"] = "NO HAY URLS PARA DESCARGAR"
  42.                    break;
  43.  
  44.        except:
  45.           myapp.lab1["text"] = "ERROR VERIFIQUE conexión Y DIRECCION URL"
  46.  
  47. class Application(Frame):
  48.  
  49.  
  50.    def limpiar(self):
  51.        myapp.text3.delete(1.0, END)
  52.  
  53.  
  54.    def download(self):
  55.        if os.path.exists("downloads")==0:
  56.            os.makedirs("downloads")
  57.  
  58.        Hilo().start()
  59.  
  60.    def salir(self):
  61.  
  62.        myapp.master.destroy()
  63.        exit()
  64.  
  65.  
  66.    def agregar(self):
  67.  
  68.        myapp.text3.insert(END, myapp.text3.clipboard_get()+"\n")
  69.  
  70.    def createWidgets(self):
  71.  
  72.        self.lab0 = Label(self)
  73.        self.lab0["text"] = "INTRODUCE DIRECCION A DESCARGAR"
  74.        self.lab0["fg"]   = "white"
  75.        self.lab0["bg"]   = "black"
  76.        self.lab0["width"]   = 50
  77.        self.lab0["height"]   = 3
  78.        self.lab0.pack({"side": "top"})
  79.  
  80.  
  81.        self.lab1 = Label(self)
  82.        self.lab1["text"] = "CONTADOR DESCARGA PREPARADO"
  83.        self.lab1["fg"]   = "white"
  84.        self.lab1["bg"]   = "black"
  85.        self.lab1["width"]   = 80
  86.        self.lab1["height"]   = 3
  87.        self.lab1.pack({"side": "top"})
  88.  
  89.  
  90.        self.but1 = Button(self)
  91.        self.but1["text"] = "AGREGAR URL DEL PORTAPAPELES"
  92.        self.but1["fg"]   = "white"
  93.        self.but1["bg"]   = "blue"
  94.        self.but1["width"]   = 30
  95.        self.but1["height"]   = 2
  96.        self.but1["border"]   = 4
  97.        self.but1.grid(row = 10, sticky = E, column = 2, pady = 3)
  98.        self.but1["command"] = self.agregar
  99.        self.but1.pack({"side": "top"})        
  100.  
  101.  
  102.  
  103.        self.text3 = Text(self)
  104.        self.text3["fg"]   = "white"
  105.        self.text3["bg"]   = "black"
  106.        self.text3["width"]   = 80
  107.        self.text3.pack({"side": "top"})
  108.  
  109.  
  110.        self.but2 = Button(self)
  111.        self.but2["text"] = "SALIR"
  112.        self.but2["fg"]   = "white"
  113.        self.but2["bg"]   = "blue"
  114.        self.but2["width"]   = 10
  115.        self.but2["height"]   = 3
  116.        self.but2["border"]   = 4
  117.        self.but2.grid(row = 10, sticky = E, column = 2, pady = 3)
  118.        self.but2["command"] = self.salir
  119.        self.but2.pack({"side": "left"})
  120.  
  121.        self.but3 = Button(self)
  122.        self.but3["text"] = "LIMPIAR LISTA URL'S"
  123.        self.but3["fg"]   = "white"
  124.        self.but3["bg"]   = "blue"
  125.        self.but3["width"]   = 30
  126.        self.but3["height"]   = 3
  127.        self.but3["border"]   = 4
  128.        self.but3.grid(row = 10, sticky = E, column = 2, pady = 3)
  129.        self.but3["command"] = self.limpiar
  130.        self.but3.pack({"side": "left"})
  131.  
  132.  
  133.        self.but4 = Button(self)
  134.        self.but4["text"] = "INICIAR LAS DESCARGAS"
  135.        self.but4["fg"]   = "white"
  136.        self.but4["bg"]   = "blue"
  137.        self.but4["width"]   = 30
  138.        self.but4["height"]   = 3
  139.        self.but4["border"]   = 4
  140.        self.but4.grid(row = 10, sticky = E, column = 2, pady = 3)
  141.        self.but4["command"] =  self.download
  142.        self.but4.pack({"side": "right"})
  143.  
  144.  
  145.    def __init__(self, master=None):
  146.        Frame.__init__(self, master)
  147.        self.pack()
  148.        self.createWidgets()
  149.  
  150.  
  151. myapp = Application()
  152. myapp.master.title("DOWNLOADER EN LINUX - GET LINUX")
  153. myapp.master.geometry("+600+600")
  154. myapp.master.tk_setPalette("black")
  155. myapp.master.resizable(0,0)
  156.  
  157. myapp.mainloop()

Espero te sirva, necesitas trabajar con hilos...
283  Programación / .NET (C#, VB.NET, ASP) / Re: Problemas con Variable por Referencia a un HILO en: 19 Febrero 2010, 04:47 am
Para hacerlo sencillo puedes declarar 2 variables globales
Código
  1. LINK ="URL"
  2. CODIGO = "CODE"
  3.  

las cuales actualizas antes antes de

Código
  1. dim p as new thread(address of Descarga)
  2. p.start()
y las utilizas dentro de
Código
  1. sub Descarga()
  2. LINK
  3. CODIGO
  4. end sub

284  Programación / .NET (C#, VB.NET, ASP) / Re: Emular desplazamiento en: 19 Febrero 2010, 04:38 am
Se puede hacer de este modo, actualizando la posición del pictureBox con una variable que sume o reste 1 a su valor, esta en C# solo para ubicarse.

Código
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9.  
  10. namespace WindowsFormsApplication1
  11. {
  12.    public partial class Form1 : Form
  13.    {
  14.        int i = 10;
  15.        int x = 0;
  16.        public Form1()
  17.        {
  18.            InitializeComponent();
  19.        }
  20.  
  21.        private void button1_Click(object sender, EventArgs e)
  22.        {
  23.            i = int.Parse(textBox1.Text);
  24.        }
  25.  
  26.        private void timer1_Tick(object sender, EventArgs e)
  27.        {
  28.            if (pictureBox1.Location.X < i)
  29.            {
  30.                x++;
  31.                Point nPos = new Point(x, 158);
  32.                pictureBox1.Location = nPos;
  33.                this.Text = pictureBox1.Location.X.ToString();
  34.  
  35.            }
  36.            else if (pictureBox1.Location.X > i)
  37.            {
  38.                x--;
  39.                Point nPos = new Point(x, 158);
  40.                pictureBox1.Location = nPos;
  41.                this.Text = pictureBox1.Location.X.ToString();
  42.            }
  43.  
  44.        }
  45.  
  46.    }
  47. }
  48.  
285  Programación / Java / Re: try catch, bucle en: 13 Febrero 2010, 06:45 am
Algo asi podria ser:

Código
  1. import java.io.*;
  2. public class Main {
  3.  
  4.    public static void main(String[] args) {
  5.         //System.out.println(Integer.MAX_VALUE);
  6.        InputStreamReader isr = new InputStreamReader(System.in);
  7.        BufferedReader br = new BufferedReader(isr);
  8.        try
  9.                {
  10.                    String linea = "";
  11.                    int n_elementos;
  12.                    do
  13.                    {
  14.                        linea = br.readLine();
  15.                        n_elementos = Integer.parseInt(linea);
  16.                         System.out.println("Numero: " + n_elementos + "\n");
  17.                    }while(IsNum(linea));
  18.  
  19.                }
  20.                catch(Exception e)
  21.                {
  22.                    System.out.println("error: " + e.getMessage());
  23.                    System.out.println("No es numero o esta fuera del limite");
  24.                }
  25.    }
  26.    private static boolean IsNum(String cadena)
  27.    {
  28.        for(int i=0;i<cadena.length();i++)
  29.            {
  30.               int ascii =(int)cadena.charAt(i);
  31.               if(ascii <48 ||ascii > 57 ) return false;
  32.            }
  33.        return true;
  34.    }
  35. }
286  Programación / Scripting / Re: ¿Como añadir un scrollbar a una ventana muy grande?(Python) en: 13 Febrero 2010, 05:09 am
Este ejemplo de python 2.6 podria servirte "Demo/tkinter/matt/canvas-with-scrollbars.py"

Código
  1. from Tkinter import *
  2. class Test(Frame):
  3.    def printit(self):
  4.        print "hi button"
  5.    def createWidgets(self):
  6.        self.question = Label(self, text="Can Find The BLUE Square??????")
  7.        self.question.pack()
  8.        self.QUIT = Button(self, text='Press', background='red',
  9.                           height=3, command=self.printit)
  10.        self.QUIT.pack(side=BOTTOM, fill=BOTH)
  11.        spacer = Frame(self, height="0.25i")
  12.        spacer.pack(side=BOTTOM)
  13.        # notice that the scroll region (20" x 20") is larger than
  14.        # displayed size of the widget (5" x 5")
  15.        self.draw = Canvas(0, width="5i", height="5i",
  16.                           background="white",
  17.                           scrollregion=(0, 0, "20i", "20i"))
  18.        self.draw.scrollX = Scrollbar(0, orient=HORIZONTAL)
  19.        self.draw.scrollY = Scrollbar(0, orient=VERTICAL)
  20.        # now tie the three together. This is standard boilerplate text
  21.        self.draw['xscrollcommand'] = self.draw.scrollX.set
  22.        self.draw['yscrollcommand'] = self.draw.scrollY.set
  23.        self.draw.scrollX['command'] = self.draw.xview
  24.        self.draw.scrollY['command'] = self.draw.yview
  25.        # draw something. Note that the first square
  26.        # is visible, but you need to scroll to see the second one.
  27.        self.draw.create_rectangle(0, 0, "3.5i", "3.5i", fill="black")
  28.        self.draw.create_rectangle("10i", "10i", "13.5i", "13.5i", fill="blue")
  29.        # pack 'em up
  30.        self.draw.scrollX.pack(side=BOTTOM, fill=X)
  31.        self.draw.scrollY.pack(side=RIGHT, fill=Y)
  32.        self.draw.pack(side=LEFT)
  33.    def scrollCanvasX(self, *args):
  34.            print "scrolling", args
  35.            print self.draw.scrollX.get()
  36.    def __init__(self, master=None):
  37.            Frame.__init__(self, master)
  38.            Pack.config(self)
  39.            self.createWidgets()
  40. test = Test()
  41. test.mainloop()
  42.  
287  Seguridad Informática / Hacking / Re: Ocultar virus sin cambiar tamano en: 28 Noviembre 2009, 04:19 am
la esteganografia (que por cierto de hacking barato no tiene nada ;D) es un mundo inmenso.

Muy cierto, utilizando la misma el archivo contenedor no tendra variaciones en absoluto respecto a su tamaño o caracteristicas, sea visual o auditiva y obviamente existen limitaciones en cuanto al tipo de archivo apropiado para el objetivo.

En otras palabras el archivo que contiene a otro no aumenta de tamaño ni muestra un cambio perceptible... a simple vista.

Se que no es nada util, de hecho no lo veo nada util. Pero era una peticion, por eso le dije hacking barato porque es algo tonto  :D

Osea que es inútil saber y aplicar el Sistema Binario, Sistema Decimal, tabla ASCII, Algebra Booleana, etc????

Y muchas Universidades tienen un curso de Algebra Universal para perder el tiempo con:

nada util.
hacking barato porque es algo tonto  :D

 :rolleyes:    :rolleyes:    :rolleyes:

Gracias por el comentario, mañana nos reunimos como cada fin de semana con los amigos y me diste buen material para reirnos bastante tiempo  :laugh:
288  Programación / .NET (C#, VB.NET, ASP) / Re: ayuda con mi proyecto en asp.net y conexion a mysql en: 28 Noviembre 2009, 03:57 am
Deberias mostrar el código que hiciste para ubicar el error...
289  Programación / .NET (C#, VB.NET, ASP) / Re: Ayuda en VB.net.. en: 28 Noviembre 2009, 03:54 am
Viendo el code de pasada, los datos solo se guardan en un arraylist?
Si es asi, en la clase deportista podrias agregar el almacenado fisico, ya sea en un archivo o una base de datos.
290  Programación / Desarrollo Web / Re: Les presento mi web en Silverlight en: 25 Noviembre 2009, 04:33 am
No lei todos los mensajes, pero por si todavia te sirve, puedes detectar silverlight y redireccionar deacuerdo al resultado de esta manera:

Código
  1. <body onLoad="detectasilverligth()">
  2. REDIRECCIONAR
  3. <script language="javascript">
  4. function detectasilverligth(){
  5. var browser = navigator.appName;
  6. var silverlightInstalled = false;
  7.  
  8. if (browser == 'Microsoft Internet Explorer') {
  9. try {
  10. var slControl = new ActiveXObject('AgControl.AgControl');
  11. silverlightInstalled = true;
  12. }
  13. catch (e) {
  14. // Error. Silverlight not installed.
  15. }
  16. }
  17. else {
  18. // Handle Netscape, FireFox, Google chrome etc
  19. try {
  20. if (navigator.plugins['Silverlight Plug-In']) {
  21. silverlightInstalled = true;
  22. }
  23. }
  24. catch (e) {
  25. // Error. Silverlight not installed.
  26. }
  27. }
  28. if (silverlightInstalled == false) {
  29.  alert("Usted no tiene el Plugin de Microsoft Silverligth, redireccionando a Standard");
  30.  location.href="http://www.brodasoft.com.ar/Standart/index.html";
  31. }
  32. else
  33. {
  34. alert("Redireccionando a Pagina con Microsoft Silverligth");
  35.  location.href="http://www.brodasoft.com.ar";
  36. }
  37. }
  38. </script>
  39. </body>

El ejemplo lo tenia guardado de alguna pagina que no recuerdo.
Páginas: 1 ... 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 [29] 30 31 32 33 34 35 36 37 38 39 40 41
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines