|
9352
|
Programación / Scripting / Re: Base de datos desde archivo de texto.
|
en: 19 Marzo 2013, 18:06 pm
|
No hay problema... Este script sólamente comprueba el valor de la última línea. PD: Las explicaciones están en el código. @Echo OFF SETLOCAL ENABLEDELAYEDEXPANSION
Set /A "Max=100" Set /A "Interval=10" Set /A "LastFileSize=0" Set /A "CurrentFileSize=0"
Set "File=C:\Users\Administrador\Desktop\1.txt"
:Loop
REM Comprueba el tamaño actual del archivo LOG For %%F in ("%File%") Do (Set /A "CurrentFileSize=%%~zF")
REM Si el tamaño actual no es igual al ultimo tamaño registrado [Es decir, si el LOG se ha actualizado...] If %CurrentFileSize% NEQ %LastFileSize% ( Set /A "LastFileSize=%CurrentFileSize%"
Echo [%TIME:~0,-3%] Comprobando actualización del LOG... For /F "Usebackq Tokens=1-3* Delims= " %%A in ("%File%") Do (Set /A "Value=%%C")
REM Si el valor es mayor que X... If !Value! GTR %MAX% ( Echo [%TIME:~0,-3%] Valor: "!Value!" es mayor que "%MAX%". Echo [%TIME:~0,-3%] Enviando e-mail... rem Zulc.exe -receivers="tuemail@hot.com" -remarks="Test remark" -subject="Test subject") ) ELSE ( Echo [%TIME:~0,-3%] Valor: "!Value!" Todo Correcto. ) ) ELSE ( REM De lo contrario... Echo [%TIME:~0,-3%] Nada que comprobar. ) (Ping -n %INTERVAL% Localhost >NUL) & (GOTO :LOOP)
|
|
|
9353
|
Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Posteen aquí sus snippets)
|
en: 19 Marzo 2013, 17:34 pm
|
Minimizar la IDE del VisualStudio cuando la APP está en debug:
[code=vbnet]#Region " Minimize VS IDE when APP is in execution "
Declare Function ShowWindow Lib "User32.dll" (ByVal hwnd As IntPtr, ByVal nCmdShow As UInteger) As Boolean
' Minimize VS IDE when APP is in execution Private Sub Minimize_VS_IDE_when_APP_is_in_execution(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load #If DEBUG Then Dim Pr() As Process = Process.GetProcesses For Each P As Process In Pr If P.MainWindowTitle.Contains(My.Application.Info.AssemblyName) Then Dim hwnd As IntPtr = P.MainWindowHandle ShowWindow(hwnd, 6) Exit For End If Next #End If End Sub
#End Region
Redondear los bordes de cualquier control: #Region " Round Borders " ' [ Round Borders ] ' ' Examples : ' Round_Border(TextBox1) ' Round_Border(PictureBox1, 100) Private Sub Round_Borders(ByVal vbObject As Object, Optional ByVal RoundSize As Integer = 20) Try Dim p As New Drawing2D.GraphicsPath() p.StartFigure() p.AddArc(New Rectangle(0, 0, RoundSize, RoundSize), 180, 90) p.AddLine(RoundSize, 0, vbObject.Width - RoundSize, 0) p.AddArc(New Rectangle(vbObject.Width - RoundSize, 0, RoundSize, RoundSize), -90, 90) p.AddLine(vbObject.Width, RoundSize, vbObject.Width, vbObject.Height - RoundSize) p.AddArc(New Rectangle(vbObject.Width - RoundSize, vbObject.Height - RoundSize, RoundSize, RoundSize), 0, 90) p.AddLine(vbObject.Width - RoundSize, vbObject.Height, RoundSize, vbObject.Height) p.AddArc(New Rectangle(0, vbObject.Height - RoundSize, RoundSize, RoundSize), 90, 90) p.CloseFigure() vbObject.Region = New Region(p) Catch ex As Exception : Throw New Exception(ex.Message) End Try End Sub #End Region
Decodificar URL: #Region " URL Decode Function " ' [ URL Decode Function ] ' ' Examples : ' Dim URL As String = URL_Decode("http%3A%2F%2Fwww%2Esomesite%2Ecom%2Fpage%2Easp%3Fid%3D5%26test%3DHello+World") Public Function URL_Decode(ByVal Source As String) As String Dim x As Integer = 0 Dim CharVal As Byte = 0 Dim sb As New System.Text.StringBuilder() For x = 0 To (Source.Length - 1) Dim c As Char = Source(x) If (c = "+") Then sb.Append(" ") ElseIf c <> "%" Then sb.Append(c) Else CharVal = Int("&H" & Source(x + 1) & Source(x + 2)) sb.Append(Chr(CharVal)) x += 2 End If Next Return sb.ToString() End Function #End Region
Codificar URL: #Region " URL Encode Function " ' [ URL Encode Function ] ' ' Examples : ' Dim URL As String = URL_Encode("http://www.somesite.com/page.asp?id=5&test=Hello World") Public Function URL_Encode(ByVal Source As String) As String Dim chars() As Char = Source.ToCharArray() Dim sb As New System.Text.StringBuilder() For Each c As Char In chars If c Like "[A-Z-a-z-0-9]" Then sb.Append(c) ElseIf c = " " Then sb.Append("+") Else Dim sHex As String = Hex(Asc(c)) sHex = "%" & sHex.PadLeft(2, "0") sb.Append(sHex) End If Next Erase chars ' Clean Up Return sb.ToString() End Function #End Region
[/code]
|
|
|
9354
|
Programación / Desarrollo Web / Re: ¿ Como cambiar el fondo de color ?
|
en: 19 Marzo 2013, 16:02 pm
|
El color naranja de tu htm es eso, un color sólido.
El gradiante no es un color, es un efecto de varios tonos de colores conjuntos, y los estilos (efectos, gradiantes) se hacen manejando CSS, si usas DreamWeaver los estilos de CSS te los hace en 1 segundo casi sin esfuerzo vaya!
Un saludo!
|
|
|
9355
|
Programación / Scripting / Re: Base de datos desde archivo de texto.
|
en: 19 Marzo 2013, 15:57 pm
|
¿Entonces lo de añadir datos a la base desde la consola ya no quieres? A ver si no he entendido mal: Ahora sólo sería obtener el valor numérico de la tercera palabra de la primera línea, o sería de cada tercera palabra de cada línea? y en fín si el número es mayor de "X", que te mande un email. La manera más sencilla desde Windows es Batch, para lo del email puedes usar esta utilidad Commandline (no requiere autentificación de ningún tipo): https://www.zeta-uploader.com/esEsto comprueba el tercer token de cada línea, si es mayor que "X" envía un email. He usado como delimitador el caracter del espacio, quizás debas modificarlo a tus necesidades... :Loop Echo [ %TIME:~0,-3%] Checkando... For /F "Usebackq Tokens=1-3* Delims= " %%A in ("Archivo.txt" ) Do ( Echo [ %TIME:~0,-3%] Variable: %%C es mayor que %MAX%, enviando email... Zulc.exe -receivers="tuemail@hot.com" -remarks="Test remark" -subject="Test subject") ) ) (Ping -n %INTERVAL% Localhost >NUL) & (GOTO : LOOP)
|
|
|
9356
|
Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Posteen aquí sus snippets)
|
en: 19 Marzo 2013, 15:32 pm
|
@arts la verdad es que según tengo entendido entre las comprbocaciones de IF y Select Case no hay diferencia así que creo que deben ser igual.
Generador de captchas. #Region " Captcha Generator Function " ' [ Captcha Generator Function ] ' ' Instructions: ' Copy the Captcha Class into a new Class "Captcha.vb" ' ' Examples : ' Dim myCaptcha As New Captcha ' PictureBox1.Image = myCaptcha.GenerateCaptcha(5) ' Generate a captcha of 5 letters ' MsgBox(myCaptcha.Check(TextBox1.Text, True)) ' Check if the given text is correct ' Captcha.vb #Region " Captcha Class " Imports System.Drawing Imports System.Drawing.Drawing2D Public Class Captcha Dim cap As String Public ReadOnly Property CaptchaString As String Get Return cap End Get End Property ' Generate Captcha Function GenerateCaptcha(ByVal NumberOfCharacters As Integer) As Bitmap Dim R As New Random Dim VerticalLineSpaceing As Integer = R.Next(5, 10) ' The space between each horizontal line Dim HorisontalLineSpaceing As Integer = R.Next(5, 10) ' The space between each Vertical line Dim CWidth As Integer = (NumberOfCharacters * 120) 'Generating the width Dim CHeight As Integer = 180 ' the height Dim CAPTCHA As New Bitmap(CWidth, CHeight) Dim allowedCharacters() As Char = "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM123456789".ToCharArray 'Guess Dim str(NumberOfCharacters - 1) As Char ' The String to turn into a captcha For i = 0 To NumberOfCharacters - 1 str(i) = allowedCharacters(R.Next(0, 61)) ' Generating random characters Next Using g As Graphics = Graphics.FromImage(CAPTCHA) ' the gradient brush for the background Dim gradient As New Drawing2D.LinearGradientBrush(New Point(0, CInt(CHeight / 2)), New Point(CWidth, CInt(CHeight / 2)), Drawing.Color.FromArgb(R.Next(&HFF7D7D7D, &HFFFFFFFF)), Drawing.Color.FromArgb(R.Next(&HFF7D7D7D, &HFFFFFFFF))) g.FillRectangle(gradient, New Rectangle(0, 0, CWidth, CHeight)) Dim plist As New List(Of Point) ' the list of points the curve goes through For i = 0 To str.Length - 1 Dim FHeight As Integer = R.Next(60, 100) 'Font height in EM Dim Font As New Font("Arial", FHeight) Dim Y As Integer = R.Next(0, (CHeight - FHeight) - 40) 'Generating the Y value of a char: will be between the top and (bottom - 40) to prevent half characters Dim X As Integer = CInt((((i * CWidth) - 10) / NumberOfCharacters)) 'Some formula that made sense At the time that I typed it to generate the X value Dim p As New Point(X, Y) g.DrawString(str(i).ToString, Font, Brushes.Black, p) plist.Add(New Point(X, R.Next(CInt((CHeight / 2) - 40), CInt((CHeight / 2) + 40)))) ' add the points to the array Next plist.Add(New Point(CWidth, CInt(CHeight / 2))) 'for some reason it doesn't go to the end so we manually add the last point Dim ppen As New Pen(Brushes.Black, R.Next(5, 10)) ' the pen used to draw the curve g.DrawCurve(ppen, plist.ToArray) Dim pen As New Pen(Brushes.SteelBlue, CSng(R.Next(1, 2))) 'the pen that will draw the horisontal and vertical lines. ' Drawing the vertical lines For i = 1 To CWidth Dim ptop As New Point(i * VerticalLineSpaceing, 0) Dim pBottom As New Point(i * VerticalLineSpaceing, CHeight) g.DrawLine(pen, ptop, pBottom) Next ' Drawing the horizontal lines For i = 1 To CHeight Dim ptop As New Point(0, i * HorisontalLineSpaceing) Dim pBottom As New Point(CWidth, i * HorisontalLineSpaceing) g.DrawLine(pen, ptop, pBottom) Next ' Drawing the Black noise particles Dim numnoise As Integer = CInt(CWidth * CHeight / 25) 'calculating the number of noise for the block. This will generate 1 Noise per 25X25 block of pixels if im correct For i = 1 To numnoise / 2 Dim X As Integer = R.Next(0, CWidth) Dim Y As Integer = R.Next(0, CHeight) Dim int As Integer = R.Next(1, 2) g.FillEllipse(Brushes.Black, New Rectangle(X, Y, R.Next(2, 5), R.Next(2, 5))) 'Size of the white noise Next ' Drawing the white noise particles For i = 1 To numnoise / 2 Dim X As Integer = R.Next(0, CWidth) Dim Y As Integer = R.Next(0, CHeight) Dim int As Integer = R.Next(1, 2) g.FillEllipse(Brushes.White, New Rectangle(X, Y, R.Next(2, 5), R.Next(2, 5))) 'Size of the white noise Next End Using cap = str Return CAPTCHA End Function ' Check captcha Function Check(ByVal captcha As String, Optional ByVal IgnoreCase As Boolean = False) As Boolean If IgnoreCase Then If captcha.ToLower = CaptchaString.ToLower Then Return True Else Return False End If Else If captcha = CaptchaString Then Return True Else Return False End If End If End Function End Class #End Region #End Region
|
|
|
9357
|
Sistemas Operativos / Windows / Re: Buscador imvu
|
en: 19 Marzo 2013, 14:37 pm
|
Esto es lo que te respondí en otro foro (por si no lo llegases a ver):
ya he comprobado que no me aparezca en los programas La solución no es ocultarlo, sinó desinstalarlo. ¿Te refieres a la barra de programas de Firefox, o en la lista de programas instalados de Windows? De todas formas sigue los pasos oficiales de desinstalación de IMVU: http://imvuinc.ourtoolbar.com/help/How do I uninstall the IMVU Inc toolbar? Firefox users
In the Firefox browser menu, select Add-ons > Extensions. Select the IMVU Inc Community Toolbar. Click Remove.
How do I enable or disable the search page that appears when I open a new tab? Firefox users
Open the toolbar's main menu (by clicking on the arrow immediately to the right of the toolbar's logo). Select Toolbar Options and then click the Additional Settings tab. Select or clear the check box next to: "Show a search box on new browser tabs."
How do I remove the IMVU Inc toolbar's customized Web Search? Firefox users
Open your browser's Search Engine menu (upper-right corner of your browser) by clicking the arrow. Choose Manage Search Engines… Select IMVU Inc Customized Web Search. Click the Remove button, and then click OK.
|
|
|
9359
|
Programación / .NET (C#, VB.NET, ASP) / [SOLUCIONADO] ¿Como se puede cancelar una operación de FileCopy?
|
en: 19 Marzo 2013, 14:28 pm
|
Si creo una aplicación y uso los metodos de "IO" o por ejemplo "My.Computer.FileSystem.CopyFile" para copiar un archivo de 50 GB, y cierro la aplicación, la operación de copiado reside en segundo plano y no se detiene hasta que el archivo haya sido copiado, así que parece ser que Windows es quien decide esto...
Mi pregunta es: ¿Se puede cancelar una operación de copiado? y: ¿Se puede hacer de alguna manera segura? (no me gustaría que se corrompieran los datos del disco duro, o algo parecido)
No encuentro info en ningún lado
un saludo!
|
|
|
9360
|
Programación / Scripting / Re: Acciones sobre archivos de texto. [Batch]
|
en: 19 Marzo 2013, 13:26 pm
|
@XWatmin Acciones sobre archivos de texto. [Batch]¿Que tiene que ver tu pregunta con la temática de este hilo? La máquina Arcade es la que se llama " Sega model 2", el emulador todavía no sabemos cual es su nombre, hay muchos emuladores que corren roms de la SM2. Infórmate sobre el nombre real del emulador que estás usando, después ve a la página oficial del emulador y descárgatelo, debe incluir un archivo de documentación y allí te debe indicar las opciones CommandLine del emulador para ejecutar una ROM, si la documentación no está en el emulador entonces debe estar en la página web oficial, así encontrarás lo que necesitas. De todas formas has puesto mal el slash (la barra vertical), prueba así: Emulator.exe ".\roms\daytona.zip" Si te quedan dudas no sigas este tema aquí o me veré obligado a eliminarlo, haz el favor de crear un nuevo post para formular preguntas que no estén relacionadas con archivos de texto. Saludos.
|
|
|
|
|
|
|