Tuesday, September 23, 2008

Tips On Brazilain Waxing

errors in a text file in encrypted form

always a good practice to keep a record of errors that occur in any application, I believe that the most common errors is to place a text file as a sort of log, or possibly within of a database to keep track. The more sophisticated there will make the information as an event of windows.

But if we want users of the application that are the curious, seeing and reading errors that occur in our application, a practical way is to encrypt the file. The problem with this is that if the text file becomes too large can slow the encryption application, and you have to open decrypt the file, post a message, and re-encrypt the file. Being

above a little impractical decided best to put the messages encrypted within the file. To modify the class which I am using to save your messages:

  1:     Public Shared Sub    WriteError (ByVal    errorMessage As String   ) 
  2: Try    
  3: Dim     path As String    =  "error.txt"  
     4:                  If   (  Not   File.Exists(System.Web.HttpContext.Current.Server.MapPath(path)))   Then   
      5:                    File.Create(System.Web.HttpContext.Current.Server.MapPath(path)).Close() 
      6:                  End     If   
      7:                Using w   As   StreamWriter = File.AppendText(System.Web.HttpContext.Current.Server.MapPath(path)) 
      8:                    w.WriteLine(Constants.vbCrLf &   "Error : "  ) 
      9:                  w.WriteLine ( "{0}" , DateTime.Now.ToString (CultureInfo.InvariantCulture)) 
  10:    Dim err As     String =  "In line:"  & System . Web.HttpContext.Current.Request.Url.ToString () & . "Message:" & errorMessage  
  11:  w.WriteLine (Encrypt (err,   True)) 
  12:  w.WriteLine ( "__________________________" ) 
  13:  w.Flush () 
  14:                   w.Close() 
     15:                  End   Using 
     16:              Catch   ex   As   Exception 
     17:                WriteError(ex.Message) 
     18:              End     Try   
     19:          End   Sub 


If you look at line 11 I put the word Encrypt, is there where I'm calling another function, the file imported into the library. NET Cryptography: Imports System.Security.Cryptography


 Public     Function Encrypt (ByVal   toEncrypt    As String , ByVal   useHashing    As Boolean )    As String Dim  
   keyArray  As    Byte () Dim 
   toEncryptArray  As    Byte () = UTF8Encoding. UTF8.GetBytes (toEncrypt) Dim 
     key   As     String   =   "MyKEY"   
           If   useHashing   Then   
               Dim   hashmd5   As     New   MD5CryptoServiceProvider() 
             keyArray = hashmd5.ComputeHash(UTF8Encoding.UTF8.GetBytes(key)) 
             hashmd5.Clear() 
           Else   
             keyArray = UTF8Encoding.UTF8.GetBytes(key) 
           End     If   
           Dim   tdes   As     New   TripleDESCryptoServiceProvider() 
        tdes.Key keyArray 
 tdes.Mode = = = CipherMode.ECB 
 tdes.Padding PaddingMode.PKCS7 
  Dim  ctransform  The  ICryptoTransform tdes.CreateEncryptor = () Dim 
   resultArray  The   GB  () = cTransform.TransformFinalBlock (toEncryptArray, 0, toEncryptArray.Length) 
 tdes.Clear () Return 
   Convert.ToBase64String (resultArray, 0, resultArray.Length) 
  End  function 


Now we have our encrypted messages. If we want to decrypt messages only have to use the following function somewhere and call it:



    Public Shared Function    Decrypt (ByVal   cipherString  As    String, ByVal   useHashing As     Boolean) As    String Dim  
   keyArray  As    Byte () Dim 
     toEncryptArray   As     Byte  () = Convert.FromBase64String(cipherString) 
           Dim   key   As     String   =   "MyKEY"   
           If   useHashing   Then   
               Dim   hashmd5   As     New   MD5CryptoServiceProvider() 
             keyArray = hashmd5.ComputeHash(UTF8Encoding.UTF8.GetBytes(key)) 
             hashmd5.Clear() 
           Else   
             keyArray = UTF8Encoding.UTF8.GetBytes(key) 
           End     If  
  Dim TDES   The New    TripleDESCryptoServiceProvider () 
 tdes.Key keyArray 
 tdes.Mode = = = CipherMode.ECB 
 tdes.Padding PaddingMode.PKCS7 
  Dim  ctransform  The  ICryptoTransform tdes.CreateDecryptor = () Dim 
   resultArray  The    Byte () = cTransform.TransformFinalBlock (toEncryptArray, 0, toEncryptArray.Length) 
 tdes.Clear () Return 
   UTF8Encoding.UTF8. GetString (resultArray) 
  End      Function   

} Maybe use an aspx form to receive the encrypted code:


  \u0026lt;% @ Page Language = "vb" AutoEventWireup = "false" CodeBehind = "WebForm1.aspx.vb" Inherits = "Bintech . WebForm1 "%>  
  \u0026lt;!   DOCTYPE html       PUBLIC "- / / W3C / / DTD XHTML 1.0 Transitional / / EN"   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "     >   
   <    html     xmlns    ="http://www.w3.org/1999/xhtml"     >   
   <    head     runat    ="server"    >   
       <    title    >  Untitled Page  </    title    >   
   </    head    >   
   <    body    >    
       <    form     id    ="form1"     runat    ="server"    >   
       <    div    >   
         Forma de desencriptacion:  <    br     />   
           <    asp:TextBox     ID    ="TextBoxEncriptado"     runat    ="server"     Height    ="173px"     TextMode    ="MultiLine"     Width = "308px"  > \u0026lt;/   asp: TextBox  >  
  \u0026lt;    br />  
  \u0026lt;  asp: Button     ID = "Button1"  
    runat = "server" Text     = "Button"  >  
  \u0026lt;    br />  
  \u0026lt;  asp: Label      ID    ="LabelResult"     runat    ="server"    ></    asp:Label    ></    div    >   
       </    form    >   
   </    body    >   
   </    html    >   
  

and add an event to the button:







    Protected Sub Button1_Click  (  ByVal sender As   System.   Object, ByVal    and  As System.EventArgs) Handles   Button1.Click 
 LabelResult.Text = Decrypt (TextBoxEncriptado.Text,   False) End 
   Sub 


Ready!

Savable Pokemon Online

Where do you want to publish your web site? Monitoring

left a strange bug here that I came across Visual Studio 2005 to the publishing of a website. First a little background, usually public web sites Niver root server, so, I always edit the preferences of publication of the project I'm working on and delete the virtual folder placed by default visual studio:

20080917z

In this way whenever I try a site I have only to put the url http://localhost, sometimes placed a certain port to the development server and the publication gets the standard 80.

This always has been. The detail was that this time the server publication should carry a virtual folder.

talacha To begin to point to a virtual folder in the code, particularly for the javascript files and styles. And unexpected changes. In order to return to the previous configuration:

20080917c

With the above problems could continue to work to debug the site. Once I had finished it occurred to me application to the server publishes the location:

20080917b

Where I want to publish? localhost of course. I say "publish" and:

20080917a

That, What?. As I can not publish my site locally.

If we analyze the message, telling me I should publish to a site different from the web application, but the fact is that at no time set to localhost is where my web application, it is but in reality, being strict is located in a folder called d: \\ dev.

Also, when you debug the application server and launch the visual test studio, at no time placed localhost only virtual folder is placed and at most one port, which in my case was different from 80.

But apparently some record is saved and stored somewhere localhost, which keeps track, not investigate, the truth is that I hurry, you can publish the site to prove it.

a quick search on Google, mentioned that this error was due place that I was putting the site on the same url, it changed to a remote site, very helpful. I turned to the matter, and I happened to catch the dove of IIS Server as of publication and place anything that is not localhost:

20080917d

Switch back the option to use Visual Studio Dev Server to continue working as they normally do,:

20080917e

As you can see the IIS server I'm not using, but nevertheless seems to have been changed if the parameter somewhere. Try

post:

20080917b

And this time without mistakes!

Ready!

Monday, September 22, 2008

Licens Number Ev Nova

IT Salaries in Mexico

Software Guru magazine is inviting every programmer, developer, manager or whatever the field, but involved in the area of \u200b\u200bthe software industry to participate in this 2008 survey, the results appear in the magazine's November issue.

Besides being a very good review software, I find very interesting about these types of indicators.

can fill out the survey at:

www.sg.com.mx / component / option, com_trivia / task, view / trivia_id, 3 .

Ready!

Tuesday, September 2, 2008

How To Continue Rome Total War After Victory

Google chrome: The solution for Ajax? Detecting if SQL Server

Google announced the launch of a new browser, which is intended to solve, and memory problems especially for Web applications that use Ajax extensively.

download-google-chrome

llanura.com

Here in, we believe that it comes to cool the market niche browsers very positive. Yes, as discussed in the presentation webcomic, this new browser will allow to have a Javascript virtual machine, the possibilities for better web applications are many.

At least for the average developer, have the advantage he be not worrying about memory pointers and the like.

I find it interesting they're using Webkit to the browser core development, and V8 for the virtual machine.

highly recommend the revision of the information that appears on page official google blog, and wait for the release of the download page, which appears to be www.gchrome.com www.google.com / chrome .

Ready!