Category: Aprendendo

Apr 28 2009

Stack, using pointer, Data Structure.

This is a implementation of a Stack using pointers. The basic thing is the structure of tPilha is

constant MAXPILHA = 100;
tipo tPilha {
inteiro dados[MAXPILHA];
inteiro *topo;
};

Where *topo is a pointer to the first element in the stack. When you`re going to add a new one you verify if the stack is full, if it ins`t you put the data in a position in the stack and change the *topo. When removing, you decrement one in pointer *topo. Then it will reference the element that was there before.

(I had an enunciation but it was too big to translate)

stack with pointers implementation!

Regards,
Matheus

PS: You can see the enunciation in portuguese and then use google translate to translate it

Apr 27 2009

Netbeans 6.5.1, Line-spacing

Hello,

I was using NetBeans in Ubuntu 9.04 when i started a new project and I realized that the line-spacing is so fucking bigger. To fix this you have to do this:

Edit the file "org-netbeans-modules-editor-settings-CustomPreferences.xml"

$ pico org-netbeans-modules-editor-settings-CustomPreferences.xml

This file will be in:

/home/user/.netbeans/6.5/config/Editors/Preferences

If the file and the directory exists just add the following lines:

<entry javaType="java.lang.Float" name="line-height-correction"
xml:space="preserve">
<value><![CDATA[0.75]]></value>
</entry>

If don't you have to create the directory "Preferences":
$ mkdir Preferences
(In /home/user/.netbeans/6.5/config/Editors)

$ cd Preferences

And create the file:

$ pico org-netbeans-modules-editor-settings-CustomPreferences.xml

Add the following lines:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE editor-preferences PUBLIC "-//NetBeans//DTD Editor Preferences 1.0//EN" "http://www.netbeans.org/dtds/EditorPreferences-1_0.dtd">
<editor-preferences>
<entry javaType="java.lang.String" name="code-template-expand-key" xml:space="preserve">
<value><![CDATA[TAB]]></value>
</entry>
<entry javaType="java.lang.Float" name="line-height-correction" xml:space="preserve">
<value><![CDATA[0.75]]></value>
</entry>
</editor-preferences>

Save, restart netbeans and enjoy it. ;)

Good Night,
Matheus

Portuguese Version

References:
http://my.opera.com/Nobita2708/blog/show.dml/2914020
http://www.linux4all.net/how_to_change_line_height_in_netbeans_editor
http://www.cs.wcupa.edu/rkline/netbeans-lin.html
http://www.google.com.br/search?hl=pt-BR&q=line+spacing+ubuntu+netbeans&btnG=Pesquisar&meta=

Apr 26 2009

Ubuntu 9.04, 64 Bits with Java.

Hi,

I was trying to access my back account but I could not due to problems with the java. Talking with a friend, he told me what i have to install to get it working. If you want to use Java in Ubuntu 64bits you have to use "sun-java-plugin". To install it use this command:

sudo apt-get install sun-java6-plugin

See you,
Matheus

PS: Forgive me for publishing just a little. I was traveling and now I have some tests in university.

Apr 25 2009

Ubuntu, VirtualBox 2.2 and USB

Hello,

Now, with this new version of ubuntu, i will post alot about it while I'm trying configurations. I don't want to teach how to install VirtualBox 2.2, because it's a package .deb and is so easy to install it (Download Sun VirtualBox). In this post I want to remember that we should select the option "Enable IO APIC" in "Settings - General - Advanced". (My version of WinXp doesn't work without it). So if you system is not booting, verify this option. Now let's go to enable USB in your Virtual machine.

You have to install "Guest Additions", use the menu "Devices - Install Guest Additions". (Don't forget to mount it on your cd in virtualbox)

After you install it go to console:

$ grep vbox /etc/group
The result is something similar to this: vboxusers:x:gid:user

(If your user is not there, add it "System - Administration - Users and groups")

Edit the file "mountkernfs.sh":
$ sudo pico /etc/init.d/mountkernfs.sh

Go to the end of do_start(), and before the } add this line:
domount usbfs "" /proc/bus/usb usbdevfs -onoexec,nosuid,nodev,devgid=GID,devmode=644

(Replace the GID with your GID)

Save the file, reboot the computer and use your usb in your virtualmachine.

The site that make me try this way is http://www.davidgrant.ca/virtualbox_usb_windows_xp_guest_ubuntu_hardy. This website don't says it works on Ubuntu 9.04 (Jaunty), so i tried and it worked.

I hope this is useful,
Matheus

PS: You have to select the device you want to use in virtual machine in "Device - USB DEVICES"

Mar 21 2009

Data Structure, C

Hello,

This semester I have data structure class, my professor Aldo Von Wangenheim, decided to use C in the first part of the class, and in the end C++. If you don't know it, he recommended this C course. He asked us to solve some exercices. Me and my colleague solved it and I'm uploading it here.

5 exercices for begginers (Portuguese)
Implementation of exercices

Regards,
Matheus

PS: I start translating "all" old posts. Maybe this old ones, don't have all stuffs translated (like attachments in this one)

Mar 08 2009

Telis, learning how to program

Today I will introduce you a programming language that the professor Fernando (Melga) uses in his class.

Telis is a programming language like many others, but it has its advantages for beginners, most of your commands are write in Portuguese (don't know if it have an english version), and the word means what happens (like draw means draw). It includes a simple graphic support , easy to use, letting the learning process more interesting. With it, it is possible public in internet your programs, the Edugraf, that develop this language provides a space in their server, in the programming environment you can upload it, just with some clicks. They provide a mail list where you can ask for help;

Some usefull links:
An example that I devolop
Language web page
Published programms
Mail list

And remember, Telis is free software. Use it, modify it, share it.

See you,
Matheus