English-Portuguese Freelancer Translator

I just created an account at ProZ. ProZ is the translation workplace providing translation service and translation jobs for freelance translators and translation agencies. It's is also home to the world's largest community of professional translators.

Translators and translation resources

Take a look at my Translator profile at ProZ.

If you ever need a translation work be it from English to Portuguese or from Portuguese to English, please, feel free to contact me at

I really like this kind of job, that is, to translate any type of material related to my area of expertise: software, technology and computer related stuff.

I translate ScottGu's blog from English to Portuguese - see Translating ScottGu's Blog to Portuguese post. ScottGu's blog is one of the most accessed Technology blogs in the world.

I'm looking forward to work with you.

Syntactic Analyzer built with Flex and YACC

Compilers construction paper
I and a dear brother in faith of mine called Wellington Magalhães Leite wrote a paper titled: A Syntactic Analyzer built with the CASE tools Flex and YACC

See the paper's abstract below:

The function of a syntactic analyzer in a compiler is to verify the syntactic structure of a program’s source code. It then detects, signalize and handle the syntactic errors found in the source code and at the same time servers as the framework for the front-end (user interface) of the program. So, its construction helps with the familiarization regarding the tasks included in the compiler project.

The language used in this paper does not have left recursion. The language neither presents subprograms, nor indexed variables and its only loop command is while for the sake of simplicity. The syntactic analyzer implemented uses the bottom-up parsing approach.

This paper presents the steps to the construction of a syntactic analyzer, which serves as a base element for a compiler implementation.

Keywords: syntactic analyzer, syntactical analysis, compiler construction, case tools, flex, yacc

CONTENTS
1 INTRODUCTION 7
  1.1 Objective 7
  1.2 Definition 7
      1.2.1 Grammar 7
            1.2.1.1 Grammar productions 8
            1.2.1.2 Lexical specifications 8
            1.2.1.3 Reserved words or keywords 10
            1.2.1.4 Operator types and attributes 11
            1.2.1.5 Separator types 11
2 DEVELOPMENT 13
  2.1 Lexical analysis 13
      2.1.1 Sample source code of a factorial program 13
      2.1.2 Flex 16
  2.2 Syntactical analysis 16
      2.2.1 Sample syntactic tree 16
      2.2.2 YACC 20
3 APPLICATION 21
  3.1 Constructing the file for the lexical analysis (lexan.lex) 21
  3.2 Constructing the file for the syntactic analysis (sinan.yacc) 21
  3.3 Guide to implementation 24
  3.4 Using a batch file to avoid boilerplate work 28
4 CONCLUSION 30
5 REFERENCES 31
6 ADDENDUM 32

See a screenshot of the syntactic analyzer in action:

SyntacticAnalyzerFlexYACCSyntaxError

You can get a PDF copy of the paper and the accompanying syntactical analyzer's files in a ZIP file at:

http://leniel.googlepages.com/SyntacticAnalyzerBuiltWithFlexYACC.pdf http://leniel.googlepages.com/SyntacticAnalyzerBuiltWithFlexYACC.zip

Tonal X Spatial Resolution X File Size

Computer graphics paper
I and a dear brother in faith of mine called Wellington Magalhães Leite wrote a paper titled: Influence of Tonal and Spatial Resolution on the Image File Size

See the original image we used to perform the tests regarding our paper:

The paper is accompanied by a spreadsheet and both are available in English and Portuguese.

See the paper's abstract below (English/Portuguese):

ABSTRACT

It is interesting to notice how the three variables (bits per pixel, number of colors and image file size) discussed in this paper are extremely related.

More and more we express ourselves through the use of images, which consequently need a place to be stored and this has to do with their usage in digital mediums as is the case of the Internet; take the Flickr service as an example. The storage is made in a digital form, that is, in bits.

It is known that: the better the image quality, the bigger will be the number of bits per pixel that are used to compose the image, what makes us capable of visualizing a great number of colors (tonal resolution), for the number of colors is coupled up to the quantity of bits per pixel. If we increase the number of pixels (spatial resolution) of the image, the generated file size will be bigger, in other words, more bits will be consumed to compose the image and depending on this value, the distribution or visualization of the image can be inadequate in certain conditions.

So, we can perceive the necessity of a case by case study, looking for a suitable value to the three variables, what will provide us with an ideal image file for each type of job.

Keywords: computer graphics, tonal resolution, spatial resolution, bits per pixel, number of colors, image file size

CONTENTS
1 INTRODUCTION 6
  1.1 Objective 6
  1.2 Definition 6
  1.3 Tonal resolution 7
  1.4 Spatial resolution 7
2 DEVELOPMENT 8
  2.1 Image edition 8
      2.1.1 Creating the work directory 8
      2.1.2 Obtaining the data “bits” for the experiment 8
      2.1.3 Selecting only the image of interest 8
      2.1.4 Opening the test file with Photoshop 9
      2.1.5 Visualizing the image size properties 10
      2.1.6 Redefining the image size 11
      2.1.7 Saving the modified image 12
      2.1.8 Producing images with different spatial resolution 13
      2.1.9 Altering the tonal resolution 13
      2.1.10 Returning to Windows Paint 14
      2.1.11 Producing images with different tonal resolutions 15
3 APPLICATION 16
  3.1 24, 16, 8, 4 and 1 bit tonal resolutions 16
  3.2 Tonal resolution vs. Spatial resolution vs. Image size 20
4 CONCLUSION 22
5 REFERENCES 23

RESUMO

É interessante notar como as três variáveis (bits por pixel, número de cores e tamanho do arquivo de imagem) discutidos neste trabalho estão intensamente relacionadas.

Cada vez mais nos expressamos através de imagens, as quais necessitam conseqüentemente de um local para serem armazenadas, haja vista a utilização em meio digital. Veja o site Flickr por exemplo. O armazenamento por sua vez é feito de forma digital, ou seja, através de bits.

É sabido que quanto maior for a qualidade da imagem, maior será o número de bits por pixel utilizados na composição da mesma, o que nos possibilita a visualização de um grande número de cores (resolução tonal), pois o número de cores está atrelado à quantidade de bits por pixel. Se aumentamos o número de pixels (resolução espacial) da imagem, maior será o tamanho do arquivo gerado, ou seja, mais bits serão consumidos para armazenar a imagem e dependendo deste valor, a distribuição ou visualização da imagem pode se tornar inadequada em certas condições.

Percebe-se então a necessidade de um estudo caso a caso, em busca de um valor adequado para essas três variáveis, de modo a obter um arquivo de imagem ideal para cada tipo de trabalho.

Palavras-chave: computação gráfica, resoulução tonal, resolução espacial, bits por pixel, número de cores, tamanho do arquivo de imagem

SUMÁRIO
1 INTRODUÇÃO 7
  1.1 Objetivo 7
  1.2 Definição 7
  1.3 Resolução tonal 8
  1.4 Resolução espacial 8
2 DESENVOLVIMENTO 9
  2.1 Edição de imagens 9
      2.1.1 Criando a pasta de trabalho 9
      2.1.2 Obtendo os dados “bits” para o experimento 9
      2.1.3 Selecionando somente a imagem de interesse 9
      2.1.4 Abrindo o arquivo de teste com o Photoshop 10
      2.1.5 Visualizando as propriedades do tamanho da imagem  11
      2.1.6 Redefinindo o tamanho da imagem 12
      2.1.7 Salvando a imagem modificada 13
      2.1.8 Produzindo imagens com diferentes resoluções espaciais 15
      2.1.9 Alterando a resolução tonal 15
      2.1.10 Retornando ao Paint do Windows 15
      2.1.11 Produzindo imagens com diferentes resoluções tonais 16
3 APLICAÇÃO 17
  3.1 Resoluções tonais de 24, 16, 8, 4 e 1 bit 17
  3.2 Resolução tonal vs. Resolução espacial vs. Tamanho do arquivo 21
4 CONCLUSÃO 23
5 BIBLIOGRAFIA 24

See the PivotChart created with the spreadsheet data:

Pivot Chart

You can get a PDF copy of the paper and the accompanying Excel spreadsheet at:

English version
http://leniel.googlepages.com/TonalSpatialResolutionImageFileSize.pdf
http://leniel.googlepages.com/TonalSpatialResolutionImageFileSize.xls

Portuguese version
http://leniel.googlepages.com/ResolucaoTonalEspacialTamanhoArquivo.pdf http://leniel.googlepages.com/ResolucaoTonalEspacialTamanhoArquivo.xls

Governmental and Private Scholarships in Brazil

This post aims to discuss a recent experience I had. It's is directly related to the problem of governmental and private scholarships in Brazil.

Flag of Brazil

I recently had to stop working in a highly exciting project called GradeBR - Rede Galileu. I just couldn't afford it. I can explain it better.

I wrote a post in which I discuss about the job I had gotten at the Computational Transport Phenomena Laboratory located at the Aeronautics Technological Institute (ITA). I was really motivated. What I had thought for my future was happening. I had gotten a great job opportunity at one of the most prestigious academic institutions here in Brazil. I’ve been planning to go to ITA since college. I had already talked about a master’s degree project and was even flying to meet with Rede Galileu’s work group. I had the first opportunity to travel in an aircraft. Believe it or not, it’s not so usual here in Brazil. Everything was perfect. I was just missing the company of my parents of course.

I started on the job on February 11th, and for almost two months (till April 4th) I didn't receive the scholarship that had been promised. As a matter of fact, I’ve been invited by the laboratory’s lead to go to ITA as I described in this post. There is an old saying that is as follow: if Leniel will not go to the mountain, the mountain must come to Leniel. I think it translates well what happened to me.

The reasons for the scholarship not being granted: pure bureaucracy, corruption and disregard to the development of the Brazilian nation.

I know there are lots of sheets of paper that must be read before the final signature granting the scholarship, but in this case, it wasn't the sheets of paper. The fact is that this scholarship was not from the government but from a private company called Petrobras that is one of the major global oil & gas market players. The scholarship agreement between a private company and a federal institution is established and managed through a Research Foundation that has as its motto: foster the development of projects related to research and development (R&D).

I won’t detail what specifically happened but the reasons I wrote above serve as a start point to think about why my scholarship didn’t take place.

My case is related to a private scholarship. I know people that don’t even have the possibility of getting a scholarship granted by the government. Why that? You may ask. My answer is: actually there is almost no condition of fostering research and development in this country. Because? You may ask. My answer: things were worse, today they are getting better but we still don’t have a serious investment plan to prepare human resources and to finance research and development projects. The rules are so complex that even a PhD professor doesn’t know how to ask a scholarship for his students. There are so many embarrassments. When there’s a scholarship the value paid is incompatible with real life. They only pay you for project related material and trips. They don’t think about the expenses related to relocation, about your daily necessities. They think you’re a research and development slave. In addition, you can’t work on other projects, that is, you must be a full-time researcher receiving a part-time scholarship. Do you get it? The work you do isn’t valued as it should be.

A nation can only grow and give fruits if and only if it has a really well prepared workforce. To have such really well prepared workforce it's necessary to invest in education. Education includes all sorts of knowledge fields, not only research and development, though in this specific post I treat about it.

I particularly like the Wikipedia's definition for Education: "Education means 'to draw out', facilitating realization of self-potential and latent talents of an individual", that is, without education, great part of people can't realize their potential, their talent and consequently the nation doesn't leverage as everyone expects.

It's not surprising that this country "Brazil" has a history marked by corruption and poor education or would it be a history marked by poor education and corruption? I think the former is worst given that is poor education that leads to corruption and all sorts of maliciousness. That's why Brazil is still a underdeveloped country. People grow governed by bad politicians that even don't know how to speak their mother tongue. Again this is a case of poor education. Education was so neglected that the ones that should represent the country don't know how to speak correctly. Can you understand that? It's all a matter of education. Your brain without proper instructions (education) can't do much. It's just like a computer hardware without software. I could develop more into this subject but I won't. I think this is sufficient to pass the message.

Getting back to the main topic: I had to relocate to a different city called São José dos Campos that is 140 miles far away from my parent's home in Volta Redonda. To stay there I had (my parents had) to pay for my lodging, lunch, etc. There's no free lunch at all! Without the scholarship that was previously promised I couldn't continue on the job. So what should I do? I just had to get back home and unfortunately abandon that great project. Was that easy? Surely no.

The people governing this country think that you are a robot researcher without emotions and aspirations.

What rest to comment about it? Oh, that there isn't incentive from the government to give scholarships to the ones that really want to continue their academic studies be it through a Master's degree or even a Doctor's degree. You see, I only could finish my graduation in Computer Engineering because my parents did work hard and set aside some money for my study. That's not easy here in Brazil. The major part of families can't afford a particular college. What is the result? More people without the proper education, more people with latent talents not realizing their potential. This causes sometimes more corruption, that is, without the proper means for achieving what people really want they take another easier paths to get there.

While this story doesn't change, we'll continue to have frustrated plans. Brazil won't change its status quo up to the time that every single person has conditions to study, to acquire the so called culture what will definitely permit that their aspirations be realized.

I'd like to write better words here, but if I did I would be more one liar. For some (the richest ones) everything in Brazil is going fine. The stock market is breaking records and that's just what matter. For others (as is my case) there's no free lunch!

Translating ScottGu's Blog to Portuguese

Joe Stagner from Microsoft wrote a post in which he calls people to volunteer for translating Scott Guthrie's Blog posts originally written in English to Portuguese. I immediately contacted Joe emphasizing that I would like to help. Since then I've translated three posts and I really expect to translate many more.

You can access the new blog created especially for the Portuguese community at http://weblogs.asp.net/scottguportuguese

Other great news for the Brazilian community is that the Developer Division, more precisely the Community Localization Team from Microsoft has released the Brazilian Localization of Visual Studio 2008 and .NET FX 3.5. More details can be found on this post at Somasegar's WebLog.

Again, I volunteered to participate in these community localization projects assisting with translating into my native language: Portuguese.

I think it's a good idea to participate in such projects. You can learn a lot more. As Joe stated in the title of his post "Do you translate ScottGu's blog in your head?"; my answer is YES, I do. I always do that. Besides, it's worth it to help others that still don't know the English language.

Java Video Rental Store App - Part 1

One of the last computer engineering course works I had to do was to code a simple Java application. This application should use a database to store and retrieve its data. The discipline was Advanced Computing Topics. The teacher Luís Henrique Campos Braune sent the class an e-mail explaining what he wanted us to do. The following lines are a transcript of what he wanted us to do initially.

The basic idea was that we would study a sample java application1, a very simple one, and starting with it we would program another one. The work would be done in teams and the teacher orientation was that we should only use the allotted class time because we were also preparing our computer engineering final project and he didn't want us to spend time at home with course work related to his discipline. He thought that the time allotted to the classes would be sufficient for this task.

1 The sample Java application can be downloaded at the end of this post. The initial code and instructions were written in Portuguese. I translated all the code and instructions to the English language, so that it can reach a broader audience.

The Java Sample Application
The Java sample application is a functional and really rudimentary one and uses the Swing User Interface Toolkit.

We didn't use an Integrated Development Environment (IDE) to work with it. All the preliminary changes to the code was done using a simple text editor as the Windows Notepad. The purpose of this application was to introduce the students to the object oriented programming world based on windows and user events. We should compile and run it according to the following steps:

1st step - Download and decompress the .zip file provided by the teacher.

The sample application should be uncompressed in the root dir C:\ on the classroom computer to facilitate the work.

The following table shows the content of the .zip file:

.ZIP file content
File Description
MainMenu.java Class pertaining to the main menu
ClientRecord.java Class pertaining to Retrieve/Change/Save/Delete client
VideoRecord.java Class pertaining to Retrieve/Change/Save/Delete video
VideoRental.java Class pertaining to video rental
VideoDevolution.java Class pertaining to video devolution
DatabaseAccess.java Class pertaining to the database connection and functions
VideoRentalStore.mdb Microsoft Access database file
README.txt A read me file with instructions

2nd step - Compile the sample app To do this we should open a command prompt, navigate to the sample app directory and type: javac MainMenu.java

In case the above command didn't work for you, refer to the The Java Platform section bellow.

3rd step - Run the sample app After compiling the the Sample app it's necessary to run the same. To do this, again in the command prompt, type: java MainMenu

In both cases it's important to type observing UPPER and lower case letters. It's case sensitive.

The Java Platform
Evidently, to do the the last two steps we should have the Java Platform installed. The Java platform consists of several programs, each of which provides a distinct portion of its overall capabilities. The principal portions are: the Java compiler, the Java Virtual Machine (JVM), the Java Development Kit (JDK), the Java Runtime Environment (JRE), and the just-in-time (JIT) compiler.

If the 2nd step above didn't work, we have two possibilities:

- The JDK is installed but not configured

A simple tip to see if the JDK is already installed is to look for some version of the JDK in "C:\Program files\Java"; if there is a version but on trying to compile you get an error, then you need to configure it first. That's what we'll do in the Installing the Java Development Kit section bellow.

- The JDK isn't installed

There are different "editions" of the Java Platform, including:

  • Java ME (Micro Edition): Specifies several different sets of libraries (known as profiles) for devices which are sufficiently limited that supplying the full set of Java libraries would take up unacceptably large amounts of storage.
  • Java SE (Standard Edition): For general purpose use on desktop PCs, servers and similar devices.
  • Java EE (Enterprise Edition): Java SE plus various APIs useful for multi-tier client-server enterprise applications.

The one that would fit our necessity was the J2SE edition without the NetBeans IDE, that is usually offered with the Java Platform when you download it.

To download the J2SE go at http://java.sun.com/javase/downloads/index.jsp (select JDK 6 Update 5).

There are several flavors, each one suitable for a specific type of operating system. For this post I used the Windows offline installation file called jdk-6u2-windows-i586-p.exe (65.5 MB).

Installing the Java Development Kit
The following are the steps we used to install the JDK. It's really easy! You practically have to click on next, next and next.

Just pay attention to the fact that, after the installation of the JDK, the JRE will also be installed in case you don't have it.

The trick is to configure the Java Platform after the JDK has been installed. To do that, check where the installation was done. Usually it is in C:\Proram files\Java\jdk...

Now, right click on My computer, Properties, Advanced tab, Environment variables. Click on New variable. Can be in User variables or System variables. Create the two variables according to the following table:

Environment variables
Variable Name Value
1 CLASSPATH ;.;C:\Program files\Java\jdk1.6.0_02
2 PATH ;C:\Program files\Java\jdk1.6.0_02\bin

Notes: - A dot (.) is part of the CLASSPATH variable value. - The path here presented are for mere illustration. What really matter is the current path you have on your computer. - Each value has a semicolon in its beginning. - I used the value jdk1.6.0_02 because this is the JDK version I have on my machine. This explains why I used ... to point the JDK installation path. If you have a different version, make the appropriate change.

Save everything clicking OK.

To test if the Java Platform was installed/configured correctly, try to compile and run the sample application executing the 1st and 2nd steps of The Java Sample Application section above.

Configuring the database connection
It wasn't enough for our Java sample application. We then should configure the database, more precisely, the alias used to reference the Microsoft Access VideoRentalStore.mdb database file.

What we needed to do was to create an ODBC connection so that the database file would be referenced through the alias used within the DatabaseAccess.java source code file. To do this we should do the following:

Go to Control Panel, Administrative Tools, ODBC Data Sources, click on the Add connection and choose Microsoft Access driver; in data source name value we should type the alias "VideoRentalStore" used in the DatabaseAccess.java source code file and in Database we should select/point to the VideoRentalStore.mdb database file that is inside the uncompressed directory.

Doing so we should be able to Retrieve/Change/Save/Delete data using the sample application.

Any doubts should be reported to the teacher. That's what he's there for, right?!

OK that was the first class we had and so is the first post in this series.

Next post in this series
Come back to see a next post in which I'll start to drill down what I particularly did, that is, what path I followed to take advantage of and master my skills while developing the other version of such application.

Get the Java Video Rental Store sample application at:

http://leniel.googlepages.com/VideoRentalStoreSampleApp.zip

Computer Virus: Types, Sources and Harms

Computer virus
A computer virus is a computer program that can copy itself and infect a computer without permission or knowledge of the user. The term virus is commonly used to refer to many different types of malware programs.

Types
The following table shows the most common types of computer viruses and their characteristics.

Common types of computer virus
Type Characteristic
File Attaches or associates its code to a file. Usually, this type of plague adds the code to a file of a normal program or overwrites the file. The virus infects Windows executable files, especially the ones with .com and .exe extension types and doesn't act directly over data files. In order for its destructive power to take effect, it's necessary that the contaminated files be executed.
False Alarm Does not cause damage to the computer, but consumes connection time and bandwidth of the internet connection to make the user send the alarm to a larger number of people. Can be classified as Hoax or Chain Letter.
Backdoor As its name states, it's a virus that open the computer's "back door" enabling hackers to take the computer control. Normally, the backdoor virus comes embedded in files received through e-mail or downloaded from the internet. When the file is executed, the user free the virus, that opens a computer port for the virus creator so that he can gain the complete or restrict control of the computer.
Boot Infects the initialization area of floppy discs and hard disks. Vital system files are found on these areas. This virus has a high destruction power, even blocking the user from starting the computer operating system.
Trojan Horse Apparently inoffensive virus that brings embedded another program that is the malign virus.
Encrypted Codified virus that complicates antivirus actions.
Hoax Messages that usually arrive in e-mails alerting the users about a showy, highly destructive virus.
Macro Infects macros (executable code used in text processors and spreadsheets to automate tasks). Disables essential functions as Save, Close and Exit.
Multipartite Infects the master boot record (MBR), boot tracks and files.
Mutant Programmed to complicate its detection by antivirus software. Is capable of altering itself after each execution of the infected file.
Polymorphic More intelligent variation of the mutant virus. Tries to impede the antivirus action modifying its internal structure or its codification techniques.
Program Infects only executable files, blocking the user from initializing the operating system.
Script Programmed to execute commands without user interaction. There are two categories of the script virus: VB based on the programming language and the JS based on JavaScript. This kind of virus can come embedded in images and in files with uncommon extensions as .vbs.doc, vbs.xls or js.jpg.
Stealth Invisible virus that uses one or more techniques to avoid its detection. Can redirect system indicators and infect a file without altering the same.

Sources
Relationship sites, torrent download sites, virtual communities as Orkut just to name a few are sources of virus. Messages or posts apparently inoffensive can have an embedded/attached virus. The virus can even be hidden in images as the one shown bellow. Take it easy. The image below doesn't have a built-in virus!

Generally, the computer virus is scattered in places of great access as is the case of pornographic sites and download networks that distribute pirate software copies (the so famous P2P networks), although nothing impedes that a virus be received in a simple e-mail message.

Harms
Most of the time the virus remains in an inactive state waiting for the user to take action. The virus can copy all the data typed by the computer user, getting a list of the visited sites, the user's preferences and even a list of all the contacts (e-mail addresses) of the user that has a virus in their computer. This forms a really dangerous virus chain in which the virus can propagate itself to other users given the e-mail addresses of the other users.

The inexperienced users don't realize the maliciousness in such appeals and end falling into the trap. They pass credit card numbers, details from where they live, where they study, what they do to have fun, etc, that is, hand over private details to a person (can be the virus creator or no) completely anonymous.

A common situation is that of an infected user that has a computer virus and not even knows about its existence till the moment that s/he receives the bank statement in which is listed the draws of tens, hundreds or thousands of dollars.

Summary
Nowadays we're witnessing an awfully race for the acquisition of new computers. Lots of inexperienced users are getting into the computer and internet world. Such users don't posses most of the time the correct information about the threats inherent to the inadequate use of computers.

Computers are excellent tools when used to legal work related tasks and healthy leisure practices,
however the inexperienced user can fall into traps when s/he decides to have fun using the computer to search for illegal tasks or practices.

With the increasingly proliferation of computer viruses it's recommended that unknown files be discarded and that visits to inappropriate sites be avoided. It's also recommend the use of an antivirus software.

In the last analysis, for those that are already familiarized with the virtual world there isn't too much danger, though the above advice must be observed. The inexperienced users must ask the experienced users for advices to gain the necessary information regarding the inherent threats present in the virtual world.