|
7301
|
Programación / Scripting / Re: Ayuda con Ruby
|
en: 12 Marzo 2014, 14:08 pm
|
Advertencia - mientras estabas escribiendo, una nueva respuesta fue publicada. Probablemente desees revisar tu mensaje.
pero hago eso y me da error ¿Nos piensas mostrar el código que estás usando, con las modificaciones, o debemos inventarlo?, ¿y nos vas a mostrar el detalle del error que te indica, o debemos adivinarlo?, no se, ¿ tienes alguna pregunta sobre programación?. Porfavor, lee las reglas de este subforo (lo tienes en un post con chincheta), sobre todo deberías leer el tema de sugerencias para formular una pregunta inteligente. De todas formas... : # -*- coding: UTF-8 -*- num = 25 bool = true str = "Ruby" puts ( "Numero : #{num} Boolean: #{bool} String : #{str} " ) sleep 10 and Process.exit __END__
Saludos.
|
|
|
7302
|
Foros Generales / Foro Libre / Re: noticia de concurso + juego para aprender a programar
|
en: 12 Marzo 2014, 02:16 am
|
Programa un algoritmo para cazar asteroides y gana 35.000 dólares Juas! Pues como no te lleven a la misma NASA para que te dejen programar allí... No se yo quien podría ser el Genius capaz de planificar y desarrollar un algoritmo semejante ...sentado enfrente de su PC, sin disponer del instrumental astronómico necesario (telescopios, satelites, o que se yo) para realizar las distintas pruebas y comparaciones, y un software de predicción astronómica que solo la NASA y 4 gatos más tendrán para poder calcular todas las posibles variantes aritméticas (no muy documentadas hasta la fecha si lo comparamos con cualquier otro objeto cercano) que conlleva el estudio de un objeto a miles y millnes de kilómetros y/o incluso años luz como es un Asteroide. No es por ser pesimista, pero el concurso me parece más que ridículo, destinado a gente con muchos, pero muchos recursos científicos tecnológicos, en fin considero una pérdida de tiempo inconmesurable el simple hecho de leer más que el enunciado del artículo xD (he leido eso y pocos párrafos más). Saludos!
|
|
|
7303
|
Programación / Scripting / Re: No puedo iniciar un bat desde otro batch windows 7 que ascooo
|
en: 12 Marzo 2014, 01:56 am
|
si lo ejecuto en la misma carpeta si funciona pero la idea es ejecutarlo desde otra No se si entiendo muy bien lo que quieres decir... Si ejecutas el Script desde otro directorio, óbviamente el directorio de trabajo actual cambia, y entonces, aquí: xcopy /y "*.bat" "Bank_022\*.bat" start "" "D:\GTAndroidRipeado\com.rockstargames.gtasa\main.2.com.rockstargames.gtasa\audio\n\Bank_022\sss.bat"
Debes indicar la ruta absoluta del cirectorio " Bank_022". Saludos
|
|
|
7304
|
Programación / Scripting / Re: [Python] Traductor Ingles-Español
|
en: 12 Marzo 2014, 01:32 am
|
me parecio interesante que lo tengas en .net , no lo podrias subir en algun lado? , para ver si lo puedo traducir a C#. No se, teniendo en cuenta las cosas tan feas que me dijiste... No te costará convertirlo, el código es simple, el código original que escribí lo puedes ver aquí ~> Usar Google Translate sin comprar la API de pago xDÓbviamente el método de parsing que empleo es muy básico y tiene sus fallas (caracteres escapados como la comilla doble los dejo como están), quien quiera puede perfeccionarlo, a mi me vale tal como está para seguir sacando las castañas del fuego. De todas formas he tomado el código y lo acabo de documentar un poco y cambiar su modo de empleo, aquí tienes: ' *********************************************************************** ' Author : Elektro ' Modified : 03-12-2014 ' *********************************************************************** ' <copyright file="GoogleTranslator.vb" company="Elektro Studios"> ' Copyright (c) Elektro Studios. All rights reserved. ' </copyright> ' *********************************************************************** #Region " Usage Examples " ' MsgBox(GoogleTranslator.Translate("Hello Google!", GoogleTranslator.Language.en, GoogleTranslator.Language.es)) ' Result: Hola Google! ' MsgBox(GoogleTranslator.Translate("Hello Google!", GoogleTranslator.Language.auto, GoogleTranslator.Language.fr)) ' Result: Bonjour Google! #End Region #Region " Google Translator " ''' <summary> ''' Uses GoogleTranslate page to translate text from one Language to another. ''' </summary> Public Class GoogleTranslator #Region " Enumerations " ''' <summary> ''' Indicates a GoogleTranslate Language abbreviation. ''' </summary> Public Enum Language As Integer ''' <summary> ''' Let Google Detect The Language ''' </summary> auto ''' <summary> ''' afrikáans ''' </summary> af ''' <summary> ''' árabe ''' </summary> ar ''' <summary> ''' azerí ''' </summary> az ''' <summary> ''' bielorruso ''' </summary> be ''' <summary> ''' búlgaro ''' </summary> bg ''' <summary> ''' bengalí; bangla ''' </summary> bn ''' <summary> ''' bosnio ''' </summary> bs ''' <summary> ''' catalán ''' </summary> ca ''' <summary> ''' cebuano ''' </summary> ceb ''' <summary> ''' checo ''' </summary> cs ''' <summary> ''' galés ''' </summary> cy ''' <summary> ''' danés ''' </summary> da ''' <summary> ''' alemán ''' </summary> de ''' <summary> ''' griego ''' </summary> el ''' <summary> ''' inglés ''' </summary> en ''' <summary> ''' esperanto ''' </summary> eo ''' <summary> ''' español ''' </summary> es ''' <summary> ''' estonio ''' </summary> et ''' <summary> ''' euskera ''' </summary> eu ''' <summary> ''' persa ''' </summary> fa ''' <summary> ''' finlandés ''' </summary> fi ''' <summary> ''' francés ''' </summary> fr ''' <summary> ''' irlandés ''' </summary> ga ''' <summary> ''' gallego ''' </summary> gl ''' <summary> ''' gujarati ''' </summary> gu ''' <summary> ''' hindi ''' </summary> hi ''' <summary> ''' Hmong ''' </summary> hmn ''' <summary> ''' croata ''' </summary> hr ''' <summary> ''' criollo haitiano ''' </summary> ht ''' <summary> ''' húngaro ''' </summary> hu ''' <summary> ''' armenio ''' </summary> hy ''' <summary> ''' indonesio ''' </summary> id ''' <summary> ''' italiano ''' </summary> it ''' <summary> ''' hebreo ''' </summary> iw ''' <summary> ''' japonés ''' </summary> ja ''' <summary> ''' javanés ''' </summary> jw ''' <summary> ''' georgiano ''' </summary> ka ''' <summary> ''' Jemer ''' </summary> km ''' <summary> ''' canarés ''' </summary> kn ''' <summary> ''' coreano ''' </summary> ko ''' <summary> ''' latín ''' </summary> la ''' <summary> ''' lao ''' </summary> lo ''' <summary> ''' lituano ''' </summary> lt ''' <summary> ''' letón ''' </summary> lv ''' <summary> ''' macedonio ''' </summary> mk ''' <summary> ''' maratí ''' </summary> mr ''' <summary> ''' malayo ''' </summary> ms ''' <summary> ''' maltés ''' </summary> mt ''' <summary> ''' holandés ''' </summary> nl ''' <summary> ''' noruego ''' </summary> no ''' <summary> ''' polaco ''' </summary> pl ''' <summary> ''' portugués ''' </summary> pt ''' <summary> ''' rumano ''' </summary> ro ''' <summary> ''' ruso ''' </summary> ru ''' <summary> ''' eslovaco ''' </summary> sk ''' <summary> ''' esloveno ''' </summary> sl ''' <summary> ''' albanés ''' </summary> sq ''' <summary> ''' serbio ''' </summary> sr ''' <summary> ''' sueco ''' </summary> sv ''' <summary> ''' suajili ''' </summary> sw ''' <summary> ''' tamil ''' </summary> ta ''' <summary> ''' telugu ''' </summary> te ''' <summary> ''' tailandés ''' </summary> th ''' <summary> ''' tagalo ''' </summary> tl ''' <summary> ''' turco ''' </summary> tr ''' <summary> ''' ucraniano ''' </summary> uk ''' <summary> ''' urdu ''' </summary> ur ''' <summary> ''' vietnamita ''' </summary> vi ''' <summary> ''' yidis ''' </summary> yi ''' <summary> ''' chino ''' </summary> zh_CN End Enum #End Region #Region " Public Methods " ''' <summary> ''' Translates the specified text. ''' </summary> ''' <param name="String">Indicates the string to translate.</param> ''' <param name="From">Indicates the text lanuage.</param> ''' <param name="To">Indicates the resulting language.</param> ''' <returns>System.String.</returns> Public Shared Function Translate(ByVal [String] As String, ByVal From As Language, ByVal [To] As Language) As String Dim Query As String = String.Format("http://translate.google.com/translate_a/t?client=t&text={0}&sl={1}&tl={2}", [String], From.ToString.Replace("_", "-"), [To].ToString.Replace("_", "-")) Using WebClient As New Net.WebClient [String] = WebClient.DownloadString(Query) WebClient.Dispose() End Using Return [String].Substring([String].IndexOf(ControlChars.Quote) + 1, [String].LastIndexOf(ControlChars.Quote)). Split({ControlChars.Quote & "," & ControlChars.Quote}, StringSplitOptions.None). First End Function #End Region End Class #End Region
Saludos.
|
|
|
7305
|
Programación / Scripting / Re: No puedo iniciar un bat desde otro batch windows 7 que ascooo
|
en: 12 Marzo 2014, 00:17 am
|
ya se que no es aconsejable pero ni asi funciona.
Tampoco especificas cual es el comando que no te funciona, ni los detalles del error que te indica la CMD, así no vas a poder conseguir mucha ayuda posible. Lee la actualización que le hice a mi comentario de arriba, abajo del todo te puse el comando, pruébalo. saludos!
|
|
|
7306
|
Programación / Scripting / Re: No puedo iniciar un bat desde otro batch windows 7 que ascooo
|
en: 12 Marzo 2014, 00:10 am
|
Hola No es aconsejable utilizar el comando start de esa manera. La mejor manera de aprender es dándote tu mismo cuenta del porqué. Escribe en consola: ¿Que ves? START ["título"] [/D ruta] Entonces, ¿que le falta a tu comando?, el parámetro donde debes especificar el "título". start "GTA RIP" "D:\GTAndroidRipeado\com.rockstargames.gtasa\main.2.com.rockstargames.gtasa\audio\n\Bank_022\sss.bat" Saludos
|
|
|
7307
|
Programación / Scripting / Re: [Python] Traductor Ingles-Español
|
en: 12 Marzo 2014, 00:07 am
|
A mi la ausencia de una API gratis no me impide seguir utilizando GoogleTranslate enviando peticiones por web, ¿te lo has planteado?, es reálmente sencillo, aunque, claro, más incómodo, y el grado de eficiencia resultante sería la eficacia que tu tengas al momento de parsear la respuesta. Ahora, en Python no tengo ni conozco ningún código para esto, pero si te sirviera en VB.NET, solo dímelo. PD: Aquí puedes encontrar muchos ejemplos en Python. Saludos!
|
|
|
7308
|
Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Compartan aquí sus snippets)
|
en: 11 Marzo 2014, 21:08 pm
|
Determina si un caracter es diacrítico o si contiene una marca diacrítica (no es 100% efectivo con caracteres demasiado raros de otras culturas) ' Character Is Diacritic? ' ( By Elektro ) ' ' Usage Examples: ' MsgBox(CharacterIsDiacritic("á")) ' Result: True ' ''' <summary> ''' Determines whether a character is diacritic or else contains a diacritical mark. ''' </summary> ''' <param name="Character">Indicates the character.</param> ''' <returns><c>true</c> if character is diacritic or contains a diacritical mark, <c>false</c> otherwise.</returns> Public Function CharacterIsDiacritic(ByVal Character As Char) As Boolean If String.IsNullOrEmpty(CharacterIsDiacritic) Then Return False Else Dim Descomposed As Char() = Character.ToString.Normalize(System.Text.NormalizationForm.FormKD).ToCharArray Return (Descomposed.Count <> 1 OrElse String.IsNullOrWhiteSpace(Descomposed)) End If End Function
Convierte un caracter diacritico ' Convert Diacritic Character ' ( By Elektro ) ' ' Usage Examples: ' MsgBox(ConvertDiacritic("á", UnicodeNormalization:=System.Text.NormalizationForm.FormKD)) ' Result: 'a' ' ''' <summary> ''' Converts the diacritic characters in a String to an equivalent normalized English characters. ''' </summary> ''' <param name="Character"> ''' Indicates the diacritic character. ''' </param> ''' <param name="UnicodeNormalization"> ''' Defines the type of Unicode character normalization to perform. ''' (Default is 'NormalizationForm.FormKD') ''' </param> ''' <returns>The converted character.</returns> Public Function ConvertDiacritic(ByVal Character As Char, Optional ByVal UnicodeNormalization As System.Text.NormalizationForm = System.Text.NormalizationForm.FormKD) As String Dim Chars As Char() = CStr(Character).Normalize(System.Text.NormalizationForm.FormKD).ToCharArray For Each c As Char In Chars Select Case Globalization.CharUnicodeInfo.GetUnicodeCategory(c) Case Globalization.UnicodeCategory.NonSpacingMark, Globalization.UnicodeCategory.SpacingCombiningMark, Globalization.UnicodeCategory.EnclosingMark ' Do nothing. Exit Select Case Else Return c End Select Next c Return Character End Function
Obtiene el keyboardlayout ' Get Keyboard Layout ' ( By Elektro ) ' ' Usage Examples: ' MsgBox(GetKeyboardLayout(IntPtr.Zero)) ' Result: 10 ' MsgBox(GetKeyboardLayout(Process.GetCurrentProcess.MainWindowHandle)) ' Result: 10 ' ''' <summary> ''' Retrieves the active input locale identifier (formerly called the keyboard layout). ''' </summary> ''' <param name="idThread"> ''' A window handle identifier of the thread to query, or 'IntPtr.Zero' to query the current thread. ''' </param> ''' <returns> ''' The return value is the input locale identifier for the thread. ''' </returns> Public Shared Function GetKeyboardLayout(Optional ByVal idThread As IntPtr = Nothing) As Short Return BitConverter.GetBytes(APIGetKeyboardLayout(idThread)).First End Function ''' <summary> ''' Retrieves the active input locale identifier (formerly called the keyboard layout). ''' </summary> ''' <param name="idThread"> ''' A window handle identifier of the thread to query, or 'IntPtr.Zero' to query the current thread. ''' </param> ''' <returns> ''' The return value is the input locale identifier for the thread. ''' ''' The low-order byte contains a Language Identifier for the input language, ''' and the high-order byte contains a device handle to the physical layout of the keyboard. ''' </returns> <System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint:="GetKeyboardLayout", CharSet:=System.Runtime.InteropServices.CharSet.Unicode)> Private Shared Function APIGetKeyboardLayout( Optional ByVal idThread As IntPtr = Nothing ) As UInteger End Function
Obtiene el keycode de un caracter (ojo, no el keycode virtual). ' Get KeyCode ' ( By Elektro ) ' ' Usage Examples: ' MsgBox(GetKeyCode("a")) ' Result: 65 ' MsgBox(GetKeyCode("á")) ' Result: 65 ' MsgBox(GetKeyCode("á", IntPtr.Zero)) ' Result: 65 ' MsgBox(GetKeyCode("a", Process.GetCurrentProcess.MainWindowHandle)) ' Result: 65 ' 'Private Sub Test() Handles MyBase.Shown ' Dim sb As New System.Text.StringBuilder ' Dim Characters As Char() = "ABCDEFGHIJKLMNOPQRSTUVWXYZ ñÑçÇ áéíóú ÁÉÍÓÚ àèìòù ÀÈÌÒÙ äëïÖÜ ÄËÏÖÜ º\'¡`+´-.,ª!·$%&/()=?¿".ToCharArray ' For Each c As Char In Characters ' sb.AppendFormat("Character: {0}", CStr(c)) ' sb.AppendLine() ' sb.AppendFormat("KeyCode : {0}", CStr(GetKeyCode(c, IntPtr.Zero))) ' MessageBox.Show(sb.ToString) ' sb.Clear() ' Next c 'End Sub ''' <summary> ''' Translates a character to the corresponding keycode. ''' </summary> ''' <param name="Character">Indicates the character.</param> ''' <param name="KeyboardLayout">Indicates the keyboard layout.</param> ''' <returns> ''' If the function succeeds, the return value contains the keycode. ''' ''' If the function finds no key that translates to the passed character code, ''' the return value contains "-1". ''' </returns> Public Shared Function GetKeyCode(ByVal Character As Char, Optional ByVal KeyboardLayout As IntPtr = Nothing) As Short ' Get the Keycode of the character. Dim Keycode As Short = BitConverter.GetBytes(VkKeyScanEx(Character)).First Select Case Keycode Case Is <> 255S ' Character is found on the current KeyboardLayout. Return Keycode Case Else ' Character is not found on the current KeyboardLayout. ' Descompose the character. Dim Descomposed As Char() = Character.ToString.Normalize(System.Text.NormalizationForm.FormKD).ToCharArray ' If character is diacritic then... If Descomposed.Count <> 1 OrElse String.IsNullOrWhiteSpace(Descomposed) Then For Each c As Char In Descomposed Select Case Globalization.CharUnicodeInfo.GetUnicodeCategory(c) Case Globalization.UnicodeCategory.NonSpacingMark, Globalization.UnicodeCategory.SpacingCombiningMark, Globalization.UnicodeCategory.EnclosingMark ' Do nothing. Exit Select Case Else ' Character is diacritic so we convert the diacritic and try to find the Keycode. Return GetKeyCode(c, KeyboardLayout) End Select Next c End If ' Chars.Count <> 1 End Select ' Keycode Return -1S ' Character is not diacritic and the keycode is not found. End Function ''' <summary> ''' Translates a character to the corresponding virtual-key code and shift state. ''' The function translates the character using the input language and ''' physical keyboard layout identified by the input locale identifier. ''' For more info see here: ''' http://msdn.microsoft.com/en-us/library/ms646332%28v=VS.85%29.aspx ''' </summary> ''' <param name="c">Indicates the character.</param> ''' <param name="KeyboardLayout">Indicates the keyboard layout.</param> ''' <returns> ''' If the function succeeds, ''' the low-order byte of the return value contains the virtual-key code, ''' and the high-order byte contains the shift state. ''' ''' If the function finds no key that translates to the passed character code, ''' both the low-order and high-order bytes contain '255'. ''' </returns> <System.Runtime.InteropServices.DllImport("user32.dll", CharSet:=System.Runtime.InteropServices.CharSet.Unicode)> Private Shared Function VkKeyScanEx( ByVal c As Char, Optional ByVal KeyboardLayout As IntPtr = Nothing ) As Short End Function
Envio de peticion por el método POST ' Send POST ' ( By Elektro ) ' ' Usage Examples: ' 'Dim Response As String = ' SendPOST("http://es.wikipedia.org/wiki/Special:Search?", ' New Dictionary(Of String, String) From { ' {"search", "Petición+POST"}, ' {"sourceid", "Mozilla-search"} ' }) ' Formated POST Data: "search=Petición+POST&sourceid=Mozilla-search" 'Clipboard.SetText(Response) ' Copy the response to Clipboard. ' ''' <summary> ''' Sends a POST method petition and returns the server response. ''' </summary> ''' <param name="URL">Indicates the URL.</param> ''' <param name="PostData">Indicates the post data.</param> ''' <returns>The response.</returns> Public Function SendPOST(ByVal URL As String, ByVal PostData As Dictionary(Of String, String)) As String Dim Data As New System.Text.StringBuilder ' PostData to send, formated. Dim Request As Net.HttpWebRequest = HttpWebRequest.Create(URL) ' HTTP Request. Dim Response As HttpWebResponse ' Server response. Dim ResponseContent As String ' Server response result. ' Set and format the post data of the query. For Each Item As KeyValuePair(Of String, String) In PostData Data.AppendFormat("{0}={1}&", Item.Key, Item.Value) Next Item ' Set the Request properties. With Request .Method = "POST" .ContentType = "application/x-www-form-urlencoded" .ContentLength = Data.ToString.Length .Proxy = Nothing ' .UserAgent = "Mozilla/5.0 (Windows NT 6.2; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0" End With ' Write the POST data bytes into the Stream. Using RequestStream As IO.Stream = Request.GetRequestStream() RequestStream.Write(System.Text.Encoding.UTF8.GetBytes(Data.ToString), 0, Data.ToString.Length) RequestStream.Close() End Using ' Get the response. Response = Request.GetResponse() ' Get the response content. Using Reader As New IO.StreamReader(Response.GetResponseStream) ResponseContent = Reader.ReadToEnd Response.Close() End Using ' Return the response content. Return ResponseContent End Function
|
|
|
7310
|
Sistemas Operativos / Windows / Re: problemas con ms dos ayuda
|
en: 11 Marzo 2014, 16:47 pm
|
me di cuenta que no tengo la carpeta (system32) dice (system) calculo que es lo mismo tampoco tengo en mi computadora la carpeta que me señalas "WinSXS" o sea directamente no existe en mi computadora Es técnicamente imposible que no existan dichas carpetas en tu SO. La carpeta System32 (no System, esa no es importante) es el corazón de Windows, almacena los drivers de tus dispositivos así como la configuración del Bootloader y todas las herramientas que necesita usar tu SO (comandos externos de Batch, PowerShell, MMC, etc) junto a sus configuraciones de idioma, y casi todos los archivos esenciales que Windows necesita para cargar el sistema, sin esta carpeta, no podrías iniciar Windows. La carpeta WinSXS se puede reducir de tamaño consideráblemente eliminando gran parte de las copias de seguridad de archivos que contiene la carpeta, pero la carpeta en si misma no se puede eliminar complétamente, ya que almacena otros archivos importantes de los que depende Windows para cargarse. ¿Has comprobado que las carpetas no están símplemente ocultas?, deben existir. No suelo decir esto, pero dado el extraño caso donde cosas que deberían estar (WBEM), no estan, y otras cosas que deberían ser visibles por defecto pero están invisibles o...no se sabe donde están ubicadas (System32), te recomiendo que hagas una reinstalación limpia del SO. Saludos!
|
|
|
|
|
|
|