Cita de: engel lex en 5 Agosto 2014, 19:46 PMque pasaría si en matrix alguien crea un inteligencia artificial tal que se vuelva imponente y empiece a destruir a los humanos e intente crear una matrix? XD
Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.
Mostrar Mensajes MenúCita de: engel lex en 5 Agosto 2014, 19:46 PMque pasaría si en matrix alguien crea un inteligencia artificial tal que se vuelva imponente y empiece a destruir a los humanos e intente crear una matrix? XD
Cita de: Senior++ en 5 Agosto 2014, 19:06 PMabro el navegador chrome y ahora le doy doble clic
Cita de: Senior++ en 5 Agosto 2014, 19:06 PMestaba jugando a las magics
Cita de: valencia456 en 3 Agosto 2014, 00:05 AMcuando te pones encima de algun enlace, se cambia a la forma de una manita y además en las palabras del enlace aparece una linea debajo.
Cita de: valencia456 en 3 Agosto 2014, 00:05 AM¿a qué se debe ese típico retraso?
' nDDE Helper
' By Elektro
'
' Instructions:
' 1. Add a reference to 'NDDE.dll' library.
'
' Usage Examples:
' MessageBox.Show(GetFirefoxUrl())
' NavigateFirefox(New Uri("http://www.mozilla.org"), OpenInNewwindow:=False)
''' <summary>
''' Gets the url of the active Tab-page from a running Firefox process.
''' </summary>
''' <returns>The url of the active Tab-page.</returns>
Public Function GetFirefoxUrl() As String
Using dde As New DdeClient("Firefox", "WWW_GetWindowInfo")
dde.Connect()
Dim Url As String =
dde.Request("URL", Integer.MaxValue).
Trim({ControlChars.NullChar, ControlChars.Quote, ","c})
dde.Disconnect()
Return Url
End Using
End Function
''' <summary>
''' Navigates to an URL in the running Firefox process.
''' </summary>
''' <param name="url">Indicates the URL to navigate.</param>
''' <param name="OpenInNewwindow">
''' If set to <c>true</c> the url opens in a new Firefox window, otherwise, the url opens in a new Tab.
''' </param>
Public Sub NavigateFirefox(ByVal url As Uri,
ByVal OpenInNewwindow As Boolean)
Dim Address As String = url.AbsoluteUri
If OpenInNewwindow Then
Address &= ",,0"
End If
Using dde As New DdeClient("Firefox", "WWW_OpenURL")
dde.Connect()
dde.Request(Address, Integer.MaxValue)
dde.Disconnect()
End Using
End Sub
' ***********************************************************************
' Author : Elektro
' Last Modified On : 08-04-2014
' ***********************************************************************
' <copyright file="MRU.vb" company="Elektro Studios">
' Copyright (c) Elektro Studios. All rights reserved.
' </copyright>
' ***********************************************************************
#Region " Usage Examples "
'Public Class Form1
'
' ' Initialize a new List of MostRecentUsed-Item
' Dim MRUList As New List(Of MRU.Item)
'
' Private Sub Test() Handles MyBase.Shown
'
' ' Add some items into the collection.
' With MRUList
' .Add(New MRU.Item("C:\File1.ext"))
' .Add(New MRU.Item("C:\File2.ext") With {.Date = Date.Today,
' .Icon = Bitmap.FromFile("C:\Image.ico"),
' .Tag = Nothing})
' End With
'
' ' Save the MRUItem collection to local file.
' MRU.IO.Save(MRUList, ".\MRU.tmp")
'
' ' Load the saved collection from local file.
' For Each MRUItem As MRU.Item In MRU.IO.Load(Of List(Of MRU.Item))(".\MRU.tmp")
' MessageBox.Show(MRUItem.FilePath)
' Next MRUItem
'
' ' Just another way to load the collection:
' MRU.IO.Load(MRUList, ".\MRU.tmp")
'
' End Sub
'
'End Class
#End Region
#Region " MostRecentUsed "
''' <summary>
''' Class MRU (MostRecentUsed).
''' Administrates the usage of a MRU item collection.
''' </summary>
Public Class MRU
#Region " Constructors "
''' <summary>
''' Prevents a default instance of the <see cref="MRU"/> class from being created.
''' </summary>
Private Sub New()
End Sub
#End Region
#Region " Types "
#Region "IO"
''' <summary>
''' Performs IO operations with a <see cref="MRU.Item"/> Collection.
''' </summary>
Public Class [IO]
#Region " Constructors "
''' <summary>
''' Prevents a default instance of the <see cref="MRU.IO"/> class from being created.
''' </summary>
Private Sub New()
End Sub
#End Region
#Region " Public Methods "
''' <summary>
''' Saves the specified MRU List to local file, using binary serialization.
''' </summary>
''' <typeparam name="T"></typeparam>
''' <param name="MRUItemCollection">The <see cref="MRU.Item"/> Collection.</param>
''' <param name="filepath">The filepath to save the <see cref="MRU.Item"/> Collection.</param>
Public Shared Sub Save(Of T)(ByVal MRUItemCollection As T,
ByVal filepath As String)
Dim Serializer = New System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
' Serialization.
Using Writer As New System.IO.FileStream(filepath, System.IO.FileMode.Create)
Serializer.Serialize(Writer, MRUItemCollection)
End Using ' Writer
End Sub
''' <summary>
''' Loads the specified <see cref="MRU.Item"/> Collection from a local file, using binary deserialization.
''' </summary>
''' <typeparam name="T"></typeparam>
''' <param name="MRUItemCollection">The ByRefered <see cref="MRU.Item"/> collection.</param>
''' <param name="filepath">The filepath to load its <see cref="MRU.Item"/> Collection.</param>
Public Shared Sub Load(Of T)(ByRef MRUItemCollection As T,
ByVal filepath As String)
Dim Serializer = New System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
' Deserialization.
Using Reader As New System.IO.FileStream(filepath, System.IO.FileMode.Open)
MRUItemCollection = Serializer.Deserialize(Reader)
End Using ' Reader
End Sub
''' <summary>
''' Loads the specified <see cref="MRU.Item"/> Collection from a local file, using the specified deserialization.
''' </summary>
''' <typeparam name="T"></typeparam>
''' <param name="filepath">The filepath to load its <see cref="MRU.Item"/> Collection.</param>
Public Shared Function Load(Of T)(ByVal filepath As String) As T
Dim Serializer = New System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
' Deserialization.
Using Reader As New System.IO.FileStream(filepath, System.IO.FileMode.Open)
Return Serializer.Deserialize(Reader)
End Using ' Reader
End Function
#End Region
End Class
#End Region
#Region " Item "
''' <summary>
''' An Item for a MostRecentUsed-Item collection that stores the item filepath and optionally additional info.
''' This Class can be serialized.
''' </summary>
<Serializable()>
Public Class Item
#Region " Constructors "
''' <summary>
''' Prevents a default instance of the <see cref="MRU.Item"/> class from being created.
''' </summary>
Private Sub New()
End Sub
''' <summary>
''' Initializes a new instance of the <see cref="MRU.Item"/> class.
''' </summary>
''' <param name="FilePath">The item filepath.</param>
''' <exception cref="System.ArgumentNullException">FilePath</exception>
Public Sub New(ByVal FilePath As String)
If FilePath Is Nothing Then
Throw New ArgumentNullException("FilePath")
End If
Me._FilePath = FilePath
End Sub
''' <summary>
''' Initializes a new instance of the <see cref="MRU.Item"/> class.
''' </summary>
''' <param name="File">The fileinfo object.</param>
Public Sub New(ByVal File As System.IO.FileInfo)
Me.New(File.FullName)
End Sub
#End Region
#Region " Properties "
''' <summary>
''' Gets the item filepath.
''' </summary>
''' <value>The file path.</value>
Public ReadOnly Property FilePath As String
Get
Return Me._FilePath
End Get
End Property
Private _FilePath As String = String.Empty
''' <summary>
''' Gets the FileInfo object of the item.
''' </summary>
''' <value>The FileInfo object.</value>
Public ReadOnly Property FileInfo As System.IO.FileInfo
Get
Return New System.IO.FileInfo(FilePath)
End Get
End Property
''' <summary>
''' (Optionally) Gets or sets the item last-time open date.
''' </summary>
''' <value>The index.</value>
Public Property [Date] As Date
''' <summary>
''' (Optionally) Gets or sets the item icon.
''' </summary>
''' <value>The icon.</value>
Public Property Icon As Bitmap
''' <summary>
''' (Optionally) Gets or sets the item tag.
''' </summary>
''' <value>The tag object.</value>
Public Property Tag As Object
#End Region
End Class
#End Region
#End Region
End Class
#End Region
Cita de: Senior++ en 4 Agosto 2014, 18:14 PMElektro ¿que pasa si cuando hago el 6 el pie se mueve hacia el lado contrario? xD
Cita de: Senior++ en 4 Agosto 2014, 11:46 AMmuevo de izquierda a derecha y bueno veo a mis familiares y veo que todos lo mueven de otra forma diferente a la mia
Module Module1
#Region " Enumerations "
''' <summary>
''' Indicates an arithmetic operation.
''' </summary>
Public Enum ArithmeticOperation As Integer
''' <summary>
''' Any arithmetic operation.
''' </summary>
None = 0
''' <summary>
''' Sums the values.
''' </summary>
Sum = 1I
''' <summary>
''' Subtracts the values.
''' </summary>
Subtract = 2I
''' <summary>
''' Multiplies the values.
''' </summary>
Multiply = 3I
''' <summary>
''' Divides the values.
''' </summary>
Divide = 4I
End Enum
#End Region
#Region " Entry Point (Main)"
''' <summary>
''' Defines the entry point of the application.
''' </summary>
Public Sub Main()
DoArithmetics()
End Sub
#End Region
#Region " Public Methods "
Public Sub DoArithmetics()
Dim ExitString As String = String.Empty
Dim ExitDemand As Boolean = False
Dim Operation As ArithmeticOperation = ArithmeticOperation.None
Dim Value1 As Decimal = 0D
Dim Value2 As Decimal = 0D
Dim Result As Decimal = 0D
Do Until ExitDemand
SetValue(Value1, "Ingresar el primer numero: ")
SetValue(Value2, "Ingresar el segundo numero: ")
Console.WriteLine()
SetOperation(Operation, "Elegir una operacion aritmética: ")
SetResult(Operation, Value1, Value2, Result)
Console.WriteLine()
Console.WriteLine(String.Format("El resultado es: {0}", CStr(Result)))
Console.WriteLine()
SetExit(ExitDemand, "S"c, "N"c, "¿Quiere salir? [S/N]: ")
Console.Clear()
Loop ' ExitDemand
End Sub
''' <summary>
''' Asks for a value and waits for the user-input to set the value.
''' </summary>
''' <param name="Value">The ByRefered variable to set the input result.</param>
''' <param name="message">The output message.</param>
Public Sub SetValue(ByRef Value As Decimal,
Optional ByVal message As String = "Enter a value: ")
Dim Success As Boolean = False
Do Until Success
Console.Write(message)
Try
Value = Decimal.Parse(Console.ReadLine().Replace("."c, ","c))
Success = True
Catch ex As Exception
Console.WriteLine(ex.Message)
Console.WriteLine()
End Try
Loop ' Success
End Sub
''' <summary>
''' Asks for an arithmetic operation and waits for the user-input to set the value.
''' </summary>
''' <param name="Operation">The ByRefered variable to set the input result.</param>
''' <param name="message">The output message.</param>
Public Sub SetOperation(ByRef Operation As ArithmeticOperation,
Optional ByVal message As String = "Choose an operation: ")
Dim Success As Boolean = False
For Each Value As ArithmeticOperation In [Enum].GetValues(GetType(ArithmeticOperation))
Console.Write(String.Format("{0}={1} | ", CStr(Value), Value.ToString))
Next Value
Console.WriteLine()
Do Until Success
Console.Write(message)
Try
Operation = [Enum].Parse(GetType(ArithmeticOperation), Console.ReadLine, True)
Success = True
Catch ex As Exception
Console.WriteLine(ex.Message)
Console.WriteLine()
End Try
Loop ' Success
End Sub
''' <summary>
''' Performs an arithmetic operation on the given values.
''' </summary>
''' <param name="Operation">The arithmetic operation to perform.</param>
''' <param name="Value1">The first value.</param>
''' <param name="Value2">The second value.</param>
''' <param name="Result">The ByRefered variable to set the operation result value.</param>
Public Sub SetResult(ByVal Operation As ArithmeticOperation,
ByVal Value1 As Decimal,
ByVal Value2 As Decimal,
ByRef Result As Decimal)
Select Case Operation
Case ArithmeticOperation.Sum
Result = Sum(Value1, Value2)
Case ArithmeticOperation.Subtract
Result = Subtract(Value1, Value2)
Case ArithmeticOperation.Multiply
Result = Multiply(Value1, Value2)
Case ArithmeticOperation.Divide
Result = Divide(Value1, Value2)
Case ArithmeticOperation.None
' Do Nothing
End Select
End Sub
''' <summary>
''' Asks for a Boolean value and waits for the user-input to set the value.
''' </summary>
''' <param name="ExitBool">The ByRefered variable to set the input result.</param>
''' <param name="TrueChar">Indicates the character threated as 'True'.</param>
''' <param name="FalseChar">Indicates the character threated as 'False'.</param>
''' <param name="message">The output message.</param>
Public Sub SetExit(ByRef ExitBool As Boolean,
Optional ByVal TrueChar As Char = "Y"c,
Optional ByVal FalseChar As Char = "N"c,
Optional ByVal message As String = "¿Want to exit? [Y/N]: ")
Dim Success As Boolean = False
Dim Result As Char = Nothing
Console.Write(message)
Do Until Success
Result = Console.ReadKey().KeyChar
Select Case Char.ToLower(Result)
Case Char.ToLower(TrueChar)
ExitBool = True
Success = True
Case Char.ToLower(FalseChar)
ExitBool = False
Success = True
Case Else
Console.Beep()
If Not Char.IsLetterOrDigit(Result) Then
Console.CursorLeft = 0
SetExit(ExitBool, TrueChar, FalseChar, message)
Else
Console.CursorLeft = Console.CursorLeft - 1
Console.Write(" ")
Console.CursorLeft = Console.CursorLeft - 1
End If
End Select ' Char.ToLower(Result)
Loop ' Success
End Sub
#End Region
#Region " Private Functions "
''' <summary>
''' Performs a Sum operation on the specified values.
''' </summary>
Private Function Sum(ByVal Value1 As Decimal,
ByVal Value2 As Decimal) As Decimal
Return (Value1 + Value2)
End Function
''' <summary>
''' Performs a subtraction operation on the specified values.
''' </summary>
Private Function Subtract(ByVal Value1 As Decimal,
ByVal Value2 As Decimal) As Decimal
Return (Value1 - Value2)
End Function
''' <summary>
''' Performs a multiplier operation on the specified values.
''' </summary>
Private Function Multiply(ByVal Value1 As Decimal,
ByVal Value2 As Decimal) As Decimal
Return (Value1 * Value2)
End Function
''' <summary>
''' Performs a divider operation on the specified values.
''' </summary>
Private Function Divide(ByVal Value1 As Decimal,
ByVal Value2 As Decimal) As Decimal
Return (Value1 / Value2)
End Function
#End Region
End Module
using Microsoft.VisualBasic;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
static class Module1
{
#region " Enumerations "
/// <summary>
/// Indicates an arithmetic operation.
/// </summary>
public enum ArithmeticOperation : int
{
/// <summary>
/// Any arithmetic operation.
/// </summary>
None = 0,
/// <summary>
/// Sums the values.
/// </summary>
Sum = 1,
/// <summary>
/// Subtracts the values.
/// </summary>
Subtract = 2,
/// <summary>
/// Multiplies the values.
/// </summary>
Multiply = 3,
/// <summary>
/// Divides the values.
/// </summary>
Divide = 4
}
#endregion
#region " Entry Point (Main)"
/// <summary>
/// Defines the entry point of the application.
/// </summary>
public static void Main()
{
DoArithmetics();
}
#endregion
#region " Public Methods "
public static void DoArithmetics()
{
string ExitString = string.Empty;
bool ExitDemand = false;
ArithmeticOperation Operation = ArithmeticOperation.None;
decimal Value1 = 0m;
decimal Value2 = 0m;
decimal Result = 0m;
while (!(ExitDemand)) {
SetValue(ref Value1, "Ingresar el primer numero: ");
SetValue(ref Value2, "Ingresar el segundo numero: ");
Console.WriteLine();
SetOperation(ref Operation, "Elegir una operacion aritmética: ");
SetResult(Operation, Value1, Value2, ref Result);
Console.WriteLine();
Console.WriteLine(string.Format("El resultado es: {0}", Convert.ToString(Result)));
Console.WriteLine();
SetExit(ref ExitDemand, 'S', 'N', "¿Quiere salir? [S/N]: ");
Console.Clear();
}
// ExitDemand
}
/// <summary>
/// Asks for a value and waits for the user-input to set the value.
/// </summary>
/// <param name="Value">The ByRefered variable to set the input result.</param>
/// <param name="message">The output message.</param>
public static void SetValue(ref decimal Value, string message = "Enter a value: ")
{
bool Success = false;
while (!(Success)) {
Console.Write(message);
try {
Value = decimal.Parse(Console.ReadLine().Replace('.', ','));
Success = true;
} catch (Exception ex) {
Console.WriteLine(ex.Message);
Console.WriteLine();
}
}
// Success
}
/// <summary>
/// Asks for an arithmetic operation and waits for the user-input to set the value.
/// </summary>
/// <param name="Operation">The ByRefered variable to set the input result.</param>
/// <param name="message">The output message.</param>
public static void SetOperation(ref ArithmeticOperation Operation, string message = "Choose an operation: ")
{
bool Success = false;
foreach (ArithmeticOperation Value in Enum.GetValues(typeof(ArithmeticOperation))) {
Console.Write(string.Format("{0}={1} | ", Convert.ToString(Value), Value.ToString));
}
Console.WriteLine();
while (!(Success)) {
Console.Write(message);
try {
Operation = Enum.Parse(typeof(ArithmeticOperation), Console.ReadLine, true);
Success = true;
} catch (Exception ex) {
Console.WriteLine(ex.Message);
Console.WriteLine();
}
}
// Success
}
/// <summary>
/// Performs an arithmetic operation on the given values.
/// </summary>
/// <param name="Operation">The arithmetic operation to perform.</param>
/// <param name="Value1">The first value.</param>
/// <param name="Value2">The second value.</param>
/// <param name="Result">The ByRefered variable to set the operation result value.</param>
public static void SetResult(ArithmeticOperation Operation, decimal Value1, decimal Value2, ref decimal Result)
{
switch (Operation) {
case ArithmeticOperation.Sum:
Result = Sum(Value1, Value2);
break;
case ArithmeticOperation.Subtract:
Result = Subtract(Value1, Value2);
break;
case ArithmeticOperation.Multiply:
Result = Multiply(Value1, Value2);
break;
case ArithmeticOperation.Divide:
Result = Divide(Value1, Value2);
break;
case ArithmeticOperation.None:
break;
// Do Nothing
}
}
/// <summary>
/// Asks for a Boolean value and waits for the user-input to set the value.
/// </summary>
/// <param name="ExitBool">The ByRefered variable to set the input result.</param>
/// <param name="TrueChar">Indicates the character threated as 'True'.</param>
/// <param name="FalseChar">Indicates the character threated as 'False'.</param>
/// <param name="message">The output message.</param>
public static void SetExit(ref bool ExitBool, char TrueChar = 'Y', char FalseChar = 'N', string message = "¿Want to exit? [Y/N]: ")
{
bool Success = false;
char Result = null;
Console.Write(message);
while (!(Success)) {
Result = Console.ReadKey().KeyChar;
switch (char.ToLower(Result)) {
case char.ToLower(TrueChar):
ExitBool = true;
Success = true;
break;
case char.ToLower(FalseChar):
ExitBool = false;
Success = true;
break;
default:
Console.Beep();
if (!char.IsLetterOrDigit(Result)) {
Console.CursorLeft = 0;
SetExit(ref ExitBool, TrueChar, FalseChar, message);
} else {
Console.CursorLeft = Console.CursorLeft - 1;
Console.Write(" ");
Console.CursorLeft = Console.CursorLeft - 1;
}
break;
}
// Char.ToLower(Result)
}
// Success
}
#endregion
#region " Private Functions "
/// <summary>
/// Performs a Sum operation on the specified values.
/// </summary>
private static decimal Sum(decimal Value1, decimal Value2)
{
return (Value1 + Value2);
}
/// <summary>
/// Performs a subtraction operation on the specified values.
/// </summary>
private static decimal Subtract(decimal Value1, decimal Value2)
{
return (Value1 - Value2);
}
/// <summary>
/// Performs a multiplier operation on the specified values.
/// </summary>
private static decimal Multiply(decimal Value1, decimal Value2)
{
return (Value1 * Value2);
}
/// <summary>
/// Performs a divider operation on the specified values.
/// </summary>
private static decimal Divide(decimal Value1, decimal Value2)
{
return (Value1 / Value2);
}
#endregion
}
//=======================================================
//Service provided by Telerik (www.telerik.com)
//Conversion powered by NRefactory.
//Twitter: @telerik
//Facebook: facebook.com/telerik
//=======================================================