Convert Excel's log files to ADIF

The process of conversion from MS Excel's log© to ADIF is relatively simple and can be done using a bit of programming VBA. Through this link can refer to the specifications of the ADIF 1.0 which is used by most log, is important that you read this document.

To start a conversion process based on this tutorial start by creating a file in MS Excel©. In the first linen Write the name of the fields you will want to import (Please check the ADIF 1.0 of the name of the fields). Even in the first line, type “ADIF RAW” na last cell, this is where the text will be written in ADIF.

The worksheet is to look like this (but still no data on the line 2). Although the ADIF format does not specify a minimum number of fields, at least your QSO log must have values ​​to Call, QSO_Date, Time_On, Band e Mode.

Then select the entire worksheet and format the cells as text.

Save the file as xls2adi.xls (worksheet in MS Excel©)

Let us now write and insert the code in VBA. Go to Tools / Macro and click Visual Basic Editor (Alt F11).

In the VBA editor double-click 'ThisWorkbook’ that is in the 'Project – VBAProject '. This is where you get the main block of code that will run when you open this file again.

The block of code that follows sets some variables and calls the function fCampoAdifValido (line 05) that will check if the field name that is on the first line corresponds to the specification of the ADIF. If all the field names are correct function calls the procedure pEscreveAdif (line 09) will write the log in ADIF, If a field has an invalid name the function shows an error message (line 07) and ends.

Copy / paste or type the following code:

 

Private Sub Workbook_Open()
  As Boolean Dim bNomeDoCampoValido(conLinhaInicial)
  sUltimaColuna = fQualEAUltimaColuna(conColunaInicial)
  bNomeDoCampoValido = fCampoAdifValido(conColunaInicial, sUltimaColuna)
    If bNomeDoCampoValido = False Then
      MsgBox ("Found invalid field names" & vbCrLf & "Remove the columns filled in red!")
    Else
      pEscreveAdif
    End If
End Sub

In the VBA editor, click Insert / Module. In this module will be the remaining code that is called by the main block.

The constants conLinhaInicial (line 02 the next block) and conColunaInicial (line 03 the next block) define the line 2 (Spreadsheet) have the first registration and that the column A (Spreadsheet) the first field.

The functions fQualEAUltimaLinha (line 08 the next block) and fQualEAUltimaColuna (line 17 the next block) will determine the last row and column data. This requires an empty cell means the end of the log records.

The function fCampoAdifValido (line 05 do previous bloco) tests the validity of the field name. The cycle 'Select Case sNomeDoCampo’ (line 31 the next block) more fields can be added according to the specification of the ADIF.

The procedure pEscreveAdif (line 09 do previous bloco) will write the text in the column that has ADIF “ADIF RAW” the first line. This procedure is taken from the field Ifen QSO_DATE, the two points of the field and added a TIME_ON M at the end of the field BAND. To make this more macro can be imposed more stringent conditions for checking data in this procedure.

Copy / paste or type the following code within the module:

 

Option Explicit
Public Const conLinhaInicial As Integer = 2
Public Const conColunaInicial As String = "A"
IUltimaLinha As Integer Public(iPrimeiraLinha As Integer) The Integer(Folha1.Cells(iValRecebido, "A")) > 0
      iValRecebido = iValRecebido + 1
    Loop - 1
End Function

Public Function fQualEAUltimaColuna(sPrimeiraColuna As String) The String(sPrimeiraColuna)
    Do While Len(Folha1.Cells(1, Chr(iValRecebido))) > 0
      iValRecebido = iValRecebido + 1
    Loop(iValRecebido - 1)
End Function

Public Function fCampoAdifValido(sPrimeiraColuna As String, sUltimaColuna As String) The Boolean(sPrimeiraColuna) To Asc(sUltimaColuna)
      sNomeDoCampo = LCase(Folha1.Cells(1, iColunaCorrente - 64))
      Select Case sNomeDoCampo
        Case Is = "band": fCampoAdifValido = True
        Case Is = "call": fCampoAdifValido = True
        Case Is = "CQZ": fCampoAdifValido = True
        Case Is = "mode": fCampoAdifValido = True
        Case Is = "qso_date": fCampoAdifValido = True
        Case Is = "rst_rcvd": fCampoAdifValido = True
        Case Is = "rst_sent": fCampoAdifValido = True
        Case Is = "srx": fCampoAdifValido = True
        Case Is = "stx": fCampoAdifValido = True
        Case Is = "time_on": fCampoAdifValido = True
        Case Is = "adif raw"
          fCampoAdifValido = True = iAdifRaw iColunaCorrente - 64
        Case Else
          Folha1.Cells(1, iColunaCorrente - 64).Interior.Color = RGB(255, 0, 0)
          fCampoAdifValido = False
        End Select
      Next
End Function

Public Sub pEscreveAdif()
  ILinhaCorrente As Integer Dim ""
    For iColunaCorrente = Asc(conColunaInicial) To Asc(sUltimaColuna) - 1
      If LCase(Folha1.Cells(1, Chr(iColunaCorrente))) = "band" Then
        sTextoNaCelula = Folha1.Cells(iLinhaCorrente, Chr(iColunaCorrente)) & "M"
      Else
        If LCase(Folha1.Cells(1, Chr(iColunaCorrente))) = "qso_date" Then
          sTextoNaCelula = Replace(Folha1.Cells(iLinhaCorrente, Chr(iColunaCorrente)), "-", "")
        Else
          If LCase(Folha1.Cells(1, Chr(iColunaCorrente))) = "time_on" Then
       iLinhaCorrenteelula = Replace(Folha1.Cells(iLinhaCorrente, Chr(iColunaCorrente)), ":", "")
          Else
            sTextoNaCelula = Folha1.Cells(iLinhaCorrente, Chr(iColunaCorrente))
          End If
        End If
      End If
      sLinhaEmAdif = sLinhaEmAdif & "<" & LCase(Folha1.Cells(1, Chr(iColunaCorrente))) & ":" & Only(sTextoNaCelula) & ">" & sTextoNaCelula
    Next
    Folha1.Cells(iLinhaCorrente, iAdifRaw) = SLinhaEmAdif & "<" & "EOR" & ">"
  Next
End Sub

 

Click File / Save xls2adi.xls and close the VBA editor.

Now copy the data in your MS Excel files© you want to convert to the appropriate columns, serious quit at the end and MS Excel©.

You may need to change the settings for MS Excel sugurança© to run macros, if necessary go to Tools / Macro and click Security, choose a lower level. This was written for MS Excel© em MS Windows XP© (both in the Portuguese version). Use this code is noutra vai língua, eg in English, replace the term 'Sheet1’ por ‘Sheet1’

When you double-click the file xls2adi.xls, the code you just entered will be executed and the column “ADIF RAW” is our Log in ADIF format.

Now to finish, select the column contents “ADIF RAW” and copies (Ctrl C), start or Notepad (Notepad) and colas (Ctrl V). Save the file with the additional extension.

This code sample is free to use, you can freely use. It is a very simple example of what can only be done using VBA (Visual Basic for Applications). Complement this code validations with more accurate, especially in the fields' qso_date’ e ‘time_on’, where the formats must match the specification ADIF. If you notice an error or have any questions, do not hesitate to comment. I hope the article will be useful.

Tags: ,

Installing Debian NVIDIA graphics cards

It is, another 'How to …’ and again on the nVidia graphics, the difference is that this works perfectly for me (not both Debian and Ubuntu do not).

The first recommendation is to visit the site download the drivers NVIDIA, choose the model of the card, OS (in my case 32-bit Linux) e a linguagem. A option 2 não works for Linux. Click DOWNLOAD, copy the link address that is on the button AGREE & DOWNLOAD (something like http://us.download.nvidia.com/XFree86/Linux-x86/190.53/NVIDIA-Linux-x86-190.53-pkg1.run).

Open a terminal and type su to pass the root.

Type apt-get install build-essential linux-headers-$(uname -r).

Type cd /usr/src to prompt the birds to this directory.

Type ln -s linux-headers-$(uname -r) linux to create the symbolic link.

Type wget and click the right mouse button to paste the link you copied the page from NVIDIA (will stand as wget http://us.download.nvidia.com/XFree86/Linux-x86/190.53/NVIDIA-Linux-x86-190.53-pkg1.run).

Type /etc/init.d/gdm stop this will stop gdm and passes to the terminal. From this point it is appropriate to have this article printed, it will be without a graphical environment.

Now that is in a terminal prompt enter cd /usr/src.

Then launch the installation script by typing NVIDIA sh NVIDIA-Linux-x86-190.53-pkg1.run.

The installer asks you to start to accept the license agreement.

Answer NO the question about downloading the kernel from the NVIDIA.

Click OK to compile a new kernel.

Click NO at the message '… abort now&#8217;.

Let the installer and select continue Yes to allow automatic update of your xorg.conf by nvidia-xconfig.

Click OK and when the installer finishes, will stay again in the terminal prompt, then enter startx to start your X server again.

Now you can modify the resolution and other advanced settings for the graphics card by NVIDIA X Server Settings utility that is in the System Tools menu (System Tools).

Tags: , , ,

ASCII to UTF-8 Converter

ASC2UTF8 is a small utility to convert some special characters from ASCII to UTF-8.

ASC 2 UTF-8 Converter

In preparing, with some frequency, texts to include in php scripts, came the need to write this utility in Gambas2.

When working with two or more languages ​​to echo in HTML environments, write special characters can be an interesting challenge. Using a META tag <meta http-equiv=Content-Type content="text/html; charset=UTF-8"> and a conversion table for UTF-8 can be a good solution (resulted at least with me). The utility ASC2UTF8 only converts some special characters, those who actually need to convert me faziam. The code-fonte can be easily changed to other special characters.

Tags: , ,

Como instalar o OpenOffice 3.1 Debian does not 5.0 Lenny

For the Debian Lenny defeito outlined in OpenOffice 2.6.4, But OpenOffice 3.1 was released, to install, just simply follow these steps:

  • Add the repository backports, as root edit / etc / apt / sources.list and add the line deb http://www.backports.org/debian lenny-backports main contrib non-free
  • Open a console (como root)
  • Instale o ‘Debian backports keyring’ typing apt-get install debian-backports-keyring
  • Update the package list by typing apt-get update
  • Por fim instale o OpenOffice.org apt-get -t lenny-backports install openoffice.org

And ready, is made. O OpenOffice.org 3.1 is installed and ready to use, digite ‘openoffice.org’ console or use the menu 'Applications'.

Tags: