$text = String.new “World”

print “Hello #{$text}”

Archive for the ‘Howto’ Category

Howto do something.

Installing Eclipse on Ubuntu 7.10

Posted by siegem on March 21, 2008

This holiday I wanted to use eclipse on my new install of Linux (Ubuntu 7.10 “Gutsy Gibbon”), but found it somewhat strange to do with the Add/Remove tool and searched a way to consistently install it and integrate on the Desktop environment.

The first thing I have done was to go on “Synaptic Package Manager” in “Administration” and search for the last JDK to install, you can do it by searching for jdk using the search button. In the time I’m writing, the latest JDK avaliable package avaliable was sun-java6-jdk. It needed some other packages to be installed (jre, gcc-3.3, and other java packages) for me.

Synaptic Package Manager - JDK Latest package (2008.03.21)

When the installation was complete, I went to the Eclipse site and downloaded the latest Eclipse version for Linux, in the time was Eclipse 3.3.2, from here.

After the download was completed, I changed to a terminal and entered in my root account. With root privileges, I sent the eclipse package to the /root directory and unpacked it with the command “tar -zxvf ./eclipse-java-europa-winter-linux-gtk.tar.gz”. With the new directory /root/eclipse, I sent it to the /usr/lib with the command “mv /root/eclipse /usr/lib” and created a symbolic link to the eclipse application on the /usr/lib/eclipse directory with the command “ln –symbolic /usr/lib/eclipse/eclipse /usr/bin/eclipse”. With this last command, we add a link to call eclipse inside a PATH that is already in our system variable allowing us to call it as a simple command in the console (try it by exiting the root account and using yours type the command “eclipse”, in an gui console).

It’s done, but, if you want to create a menu entry you can access the “Main Menu” software on “Preferences” and add an entry where you would like using the option “New Item”, for me I created on the Programming sub menu, below my entry for eclipse:

Eclipse Entry in Ubuntu Menu “Programming”

I hope this tutorial helps you out installing the Eclipse manually on Ubuntu. I like this way, because I can choose what version, when and where I would like to install it, and manually take care of it.

Best Regards!

Posted in Howto, Java, Linux, Technology, Ubuntu | Tagged: , , , | 7 Comments »

Popup on Flex

Posted by siegem on February 18, 2008

These days I was playing with PopUpManager component on Flex. I was searching for some way to create Popup windows, in the moment for a Login screen, and came across this component.

It’s simple to use, you need only to import it on the script and use it directly. There are four things that you can set on a popup from the component, you can add a popup to the Manager, put a window on the top of others, center it and remove it from the Manager.

I will put some examples here. Let’s first consider creating a popup, we need to extend some component to create a container for the popup.

In this sample, we will use the TitleWindow component as the extended component. Before it’s creation, we need to set up some properties, we will leave it with the default.

Next, we need to set up some basic behaviourof the window, like it’s title, show it’s close button and the code that will take place when someone closes the window. To set all these things up we will need to do the following:

  1. On the TitleWindow component set the parameter “showCloseButton” to true and set the function that will be called when the event “close” is captured (it can be anything, be creative);
  2. In the script component, you need to add the definition of the function you set to the close event and code the “PopUpManager.removePopUp(this)” to close the window, you can add some other code too;
  3. You can add, if you want, a title for the window using the”title” attribute.

With the new component implemented, we can now go to the main program and instantiate it to create the popup window, but, to achieve this, we can use two ways. In the first, we create an instance of the component you created and then add it to the PopUpManager, in the second, we use the PopUpManager to create the instance to us, then we cast it to the type of our component and send it to an empty variable.

The first way is done with this code:

var bar:foo;
bar = foo(PopUpManager.createPopUp(this,foo,true));

Being foo my customized component based on TitleWindow and bar the variable that will contain the instance of the popup. The first parameter is the parent component, the second the component type of the window to be created and the third is the modal definition (if other popups will be avaliable while this one is opened).

The second way:

var bar:foo = new foo();
PopUpManager.addPopUp(bar,this,true);

Being foo the same as above and bar the instance of the component, but this time we do instantiate it and only send it to the PopUpManager. The way you choose is almost identical, it’s up to you if you need to instantiate it manually or let the manager create it to you. In this case, the parameters changed a bit, the first is the component instance, the second the parent and the third is the modal definition, again.

I saw some usefulness in the second if your component have some parameters to be sent on the constructor, but I’m still meditating about it. Some day it can become one post or half…

Best Regards!

Posted in Flex, Howto, Technology | Tagged: , , , | 2 Comments »