|
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: from Tkinter import * import os import urllib import threading import time def logs(b): f = open('./downloads/log.txt','aw') f.write ("Archivo %s" % b + "descargado %s \n" % time.strftime("a Horas: %H:%M:%S en Fecha: %D")) f.close() def reporthook(blocks_read, block_size, total_size): if not blocks_read: myapp.lab1["text"] = "conexión Establecida" return if total_size < 0: myapp.lab1["text"] = "Bloques Leidos " % blocks_read else: amount_read = blocks_read * block_size myapp.lab1["text"] = "Faltan: %d Kb para terminar la Descarga" %((total_size/1024) - (amount_read/1024)) return class Hilo(threading.Thread ): def run ( self ): try: i = 0 while i==0: c = myapp.text3.get(1.0, 2.0) b = c[c.rfind('/',0,len(c))+1:len(c)] urllib.urlretrieve("%s" % myapp.text3.get(1.0, 2.0), 'downloads/%s' % b, reporthook=reporthook) myapp.lab1["text"] = "ARCHIVO %s DESCARGADO" % b logs(b) myapp.text3.delete(1.0, 2.0) if myapp.text3.search("http://", 1.0, 1.7): myapp.lab1["text"] = "CONTINUANDO DESCARGA" continue; else: myapp.lab1["text"] = "NO HAY URLS PARA DESCARGAR" break; except: myapp.lab1["text"] = "ERROR VERIFIQUE conexión Y DIRECCION URL" class Application(Frame): def limpiar(self): myapp.text3.delete(1.0, END) def download(self): if os.path.exists("downloads")==0: os.makedirs("downloads") Hilo().start() def salir(self): myapp.master.destroy() exit() def agregar(self): myapp.text3.insert(END, myapp.text3.clipboard_get()+"\n") def createWidgets(self): self.lab0 = Label(self) self.lab0["text"] = "INTRODUCE DIRECCION A DESCARGAR" self.lab0["fg"] = "white" self.lab0["bg"] = "black" self.lab0["width"] = 50 self.lab0["height"] = 3 self.lab0.pack({"side": "top"}) self.lab1 = Label(self) self.lab1["text"] = "CONTADOR DESCARGA PREPARADO" self.lab1["fg"] = "white" self.lab1["bg"] = "black" self.lab1["width"] = 80 self.lab1["height"] = 3 self.lab1.pack({"side": "top"}) self.but1 = Button(self) self.but1["text"] = "AGREGAR URL DEL PORTAPAPELES" self.but1["fg"] = "white" self.but1["bg"] = "blue" self.but1["width"] = 30 self.but1["height"] = 2 self.but1["border"] = 4 self.but1.grid(row = 10, sticky = E, column = 2, pady = 3) self.but1["command"] = self.agregar self.but1.pack({"side": "top"}) self.text3 = Text(self) self.text3["fg"] = "white" self.text3["bg"] = "black" self.text3["width"] = 80 self.text3.pack({"side": "top"}) self.but2 = Button(self) self.but2["text"] = "SALIR" self.but2["fg"] = "white" self.but2["bg"] = "blue" self.but2["width"] = 10 self.but2["height"] = 3 self.but2["border"] = 4 self.but2.grid(row = 10, sticky = E, column = 2, pady = 3) self.but2["command"] = self.salir self.but2.pack({"side": "left"}) self.but3 = Button(self) self.but3["text"] = "LIMPIAR LISTA URL'S" self.but3["fg"] = "white" self.but3["bg"] = "blue" self.but3["width"] = 30 self.but3["height"] = 3 self.but3["border"] = 4 self.but3.grid(row = 10, sticky = E, column = 2, pady = 3) self.but3["command"] = self.limpiar self.but3.pack({"side": "left"}) self.but4 = Button(self) self.but4["text"] = "INICIAR LAS DESCARGAS" self.but4["fg"] = "white" self.but4["bg"] = "blue" self.but4["width"] = 30 self.but4["height"] = 3 self.but4["border"] = 4 self.but4.grid(row = 10, sticky = E, column = 2, pady = 3) self.but4["command"] = self.download self.but4.pack({"side": "right"}) def __init__(self, master=None): Frame.__init__(self, master) self.pack() self.createWidgets() myapp = Application() myapp.master.title("DOWNLOADER EN LINUX - GET LINUX") myapp.master.geometry("+600+600") myapp.master.tk_setPalette("black") myapp.master.resizable(0,0) myapp.mainloop()
Espero te sirva, necesitas trabajar con hilos...
|
|
|
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. using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace WindowsFormsApplication1 { public partial class Form1 : Form { int i = 10; int x = 0; public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { i = int.Parse(textBox1.Text); } private void timer1_Tick(object sender, EventArgs e) { if (pictureBox1.Location.X < i) { x++; Point nPos = new Point (x, 158); pictureBox1.Location = nPos; this.Text = pictureBox1.Location.X.ToString(); } else if (pictureBox1.Location.X > i) { x--; Point nPos = new Point (x, 158); pictureBox1.Location = nPos; this.Text = pictureBox1.Location.X.ToString(); } } } }
|
|
|
285
|
Programación / Java / Re: try catch, bucle
|
en: 13 Febrero 2010, 06:45 am
|
Algo asi podria ser: import java.io.*; public class Main { public static void main (String[] args ) { //System.out.println(Integer.MAX_VALUE); try { int n_elementos; do { linea = br.readLine(); n_elementos = Integer. parseInt(linea ); System. out. println("Numero: " + n_elementos + "\n"); }while(IsNum(linea)); } { System. out. println("error: " + e. getMessage()); System. out. println("No es numero o esta fuera del limite"); } } private static boolean IsNum (String cadena ) { for(int i=0;i<cadena.length();i++) { int ascii =(int)cadena.charAt(i); if(ascii <48 ||ascii > 57 ) return false; } return true; } }
|
|
|
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" from Tkinter import * class Test(Frame): def printit(self): print "hi button" def createWidgets(self): self.question = Label(self, text="Can Find The BLUE Square??????") self.question.pack() self.QUIT = Button(self, text='Press', background='red', height=3, command=self.printit) self.QUIT.pack(side=BOTTOM, fill=BOTH) spacer = Frame(self, height="0.25i") spacer.pack(side=BOTTOM) # notice that the scroll region (20" x 20") is larger than # displayed size of the widget (5" x 5") self.draw = Canvas(0, width="5i", height="5i", background="white", scrollregion=(0, 0, "20i", "20i")) self.draw.scrollX = Scrollbar(0, orient=HORIZONTAL) self.draw.scrollY = Scrollbar(0, orient=VERTICAL) # now tie the three together. This is standard boilerplate text self.draw['xscrollcommand'] = self.draw.scrollX.set self.draw['yscrollcommand'] = self.draw.scrollY.set self.draw.scrollX['command'] = self.draw.xview self.draw.scrollY['command'] = self.draw.yview # draw something. Note that the first square # is visible, but you need to scroll to see the second one. self.draw.create_rectangle(0, 0, "3.5i", "3.5i", fill="black") self.draw.create_rectangle("10i", "10i", "13.5i", "13.5i", fill="blue") # pack 'em up self.draw.scrollX.pack(side=BOTTOM, fill=X) self.draw.scrollY.pack(side=RIGHT, fill=Y) self.draw.pack(side=LEFT) def scrollCanvasX(self, *args): print "scrolling", args print self.draw.scrollX.get() def __init__(self, master=None): Frame.__init__(self, master) Pack.config(self) self.createWidgets() test = Test() test.mainloop()
|
|
|
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 ) 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 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 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
|
|
|
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: <body onLoad="detectasilverligth()"> REDIRECCIONAR <script language="javascript"> function detectasilverligth(){ var browser = navigator.appName; var silverlightInstalled = false; if (browser == 'Microsoft Internet Explorer') { try { var slControl = new ActiveXObject('AgControl.AgControl'); silverlightInstalled = true; } catch (e) { // Error. Silverlight not installed. } } else { // Handle Netscape, FireFox, Google chrome etc try { if (navigator.plugins['Silverlight Plug-In']) { silverlightInstalled = true; } } catch (e) { // Error. Silverlight not installed. } } if (silverlightInstalled == false) { alert("Usted no tiene el Plugin de Microsoft Silverligth, redireccionando a Standard"); location.href="http://www.brodasoft.com.ar/Standart/index.html"; } else { alert("Redireccionando a Pagina con Microsoft Silverligth"); location.href="http://www.brodasoft.com.ar"; } } </script> </body>
El ejemplo lo tenia guardado de alguna pagina que no recuerdo.
|
|
|
|
|
|
|