LSI-TEC open vacancies for programmers

February 25, 2008 · Posted in Bla Bla Bla , C / C + + , Linux · View Comments

The LSI-TEC , part of the company internationally renowned Laboratory of Integrated sitemas USP, is looking for talent to work in development projects related to Digital TV.

Requirements:

  • C, C + + or Java;
  • Linux for embedded sitemas;
  • Subversion;
  • Autotools;

Location:
University of Sao Paulo - Campus University City

Interested parties may send their resumes to:
Hillel Becher <hilel@lsi.usp.br>

Laboratory of Integrated Technology Systems
Integrated Systems Laboratory

Migrating the blog server

February 23, 2008 · Posted in Blog , MySQL · View Comments

Enjoying the blog has gone through technical difficulties, I decided to change it from server and update the broken version of WordPress.

The details for the upgrade of WordPress may vary from version to version and can be found on- site .

I could use the options import / export of WordPress itself, but one of the problems with the old provider, was that I was not able to access the administrative area of ​​the blog. Without even making a single upload of anything I could no longer log into the blog and the response I got was the provider:

"... Contact the developers of the WordPress ..."

I then decided to contact a competitor and migrate to the nail ...

The passsos I used were very simple and are as follows:

Hiring the new provider

I did some internet searches, consulted friends, and at the end was just filling out a form, number of credit card and wait for the confirmation of payment.

Backup

While I was waiting for confirmation of the new provider, I was backing up the blog. As I had plenty of "junk" installed, I decided to just back up the database with the posts, and use a version of WordPress limpinha.

To back up the MySQL I used one of its command line tools mysqldump. One of the coolest features (in my opinion) mysql and its tools is the possibility of using them remotely. This has saved my skin a few times in times of SysAdmin.

The command was simple:

  =my.old.mysqlserver user @ host: ~ $ mysqldump - host = my.old.mysqlserver 
              - User = myuser - password 
              mybkp.sql - Databases myblogdatabase> mybkp.sql 

-Host = my.old.mysqlserver: Connect to the host where is my MySQL database
-User = myuser: Use this user for the connection.
-Password: Ask a password prompt. If I wanted to enter the password directly, could have done-password = mypass.
Myblogdatabase-databases: Make a dump of all tables in the database 'myblogdatabase', used by my blog.
> Mybkp.sql: Redirect the output to a file.

Mysqldump generates all the SQL needed to recreate the database in the same state it was.

Restoring data

At the start of the dump file is referenced based on the old data. If the new database has a different name you need to edit the dump file. This can be done with sed:

  s /` olddatabase `/` newdatabase `/ mybkp.sql > mynewbkp.sql user @ host: ~ $ sed s / olddatabase `` / `` newdatabase / mybkp.sql> mynewbkp.sql 

The restoration is very simple, using the mysql prompt:

  =my.new.mysqlserver --user =myuser --password user @ host: ~ $ mysql - host = my.new.mysqlserver - user = myuser - password
 mysql> use newdatabase;
 mysql>.  mynewbkp.sql 

This logamos we enter the new base, still empty, and executaamos the file with the dump full of SQL statements to recreate the tables and the data from the old into the new.

Upgrading WordPress

Upgrade WordPress follows the basic steps of installation : download, unpack, move the content to the desired location and edit the file wp-config.php.

Finally, with the browser, execute the file

http://my.blog.root.path/bla/bla/bla/wp-admin/upgrade.php

And voila! You will receive a random password for admin user login and just.

Setting up WordPress

When the provider provides the service, it usually provides two ways for you to access the site's features. One is the standard way to use your domain as address, since the other provides the same capability as a strange url. Today I discovered why this is: while the DNS provider was appointed to the former, I accessed the url in strange new provider without interfering with (mal) functioning of the old site.

After Wordpres installed, any attempt to access the content, redirected to the old blog. Then I remembered that there are two options for configuring the url in the blog. It was enough to know where it was in the database. Following the logic of table names, arrived at the table wp_options.

Using the GUI tool MySQL Query Browser, I changed fields 'option_value' that correspond to the fields 'option_name' option 'siteurl' and 'home' to that url strange, and I have utlizá it during migration, while installing plugins and themes . After all is done, I changed the DNS and finally restored the original values ​​in the options. This command line would look like this:

  ; mysql> select * from wp_options limit 1;
 + ----------- + --------- + ------------- + ------------- ------------ + ---------- +
 blog_id | option_name | option_value | autoload | | Option_id | blog_id | option_name | option_value | autoload |
 + ----------- + --------- + ------------- + ------------- ------------ + ---------- +
 | 0 | siteurl | http: // mydomain.com / etc | yes | | 1 | 0 | siteurl | http:// mydomain.com / etc | yes |
 + ----------- + --------- + ------------- + ------------- ------------ + ---------- +
 ( 0.00 sec ) 1 row in set (0.00 sec)

 ; mysql> select * from wp_options where option_value = 'http://mydomain.com/etc';
 + ----------- + --------- + ------------- + ------------- ------------ + ---------- +
 blog_id | option_name | option_value | autoload | | Option_id | blog_id | option_name | option_value | autoload |
 + ----------- + --------- + ------------- + ------------- ------------ + ---------- +
 | 0 | siteurl | http: // mydomain.com / etc | yes | | 1 | 0 | siteurl | http:// mydomain.com / etc | yes |
 | 0 | home | http: // mydomain.com / etc | yes | | 40 | 0 | home | http:// mydomain.com / etc | yes |
 + ----------- + --------- + ------------- + ------------- ------------ + ---------- +
 ( 0.00 sec ) 2 rows in set (0.00 sec)

 option_value = 'http://url.estranha.com/etc' mysql> update wp_options September option_value = 'http://url.estranha.com/etc' 
        where option_value = 'http://mydomain.com/etc';
 0.02 sec ) Query OK, 2 rows affected (0.02 sec)
 Warnings: 0 Rows matched: 2 Changed: 2 Warnings: 0

 mysql> 

The first SQL statement was to know which fields of the table, the second to check what the options that had the same url and the third, finally updating. After that, the blog is already pointing to the correct work address, and the return can be made through the site normally.

Conclusion

Migrate a blog on the nail is not the best option, since you risk losing all data. I could only perform this feat, because I know a little of the operation of WordPress and the tools around. Still, I had my moments of suspense. While maintaining home a separate backup of posts, I could not save your comments and options in general. In some ways it was good for me to get smart and go doing my weekly backups of the site.

Patxi!!!!

February 18, 2008 · Posted in Events · View Comments

How many blogs have been reported as the daily life of the Campus Party Brazil, would be redundant if I do the same. Actually, I did because I could not, and is the reason I could not, I'll tell you here.

Given the appeal of the now great friend Gustavo Gonzales, published in com-linux , I took what was a "vacation" and decided to apply for a vacancy for a volunteer to work at the Campus Party. I already participate voluntarily in free software projects, but physically attending would be the first time.

I got in touch, sent resume (was volunteer technical level), and carnival on Monday, I received an email asking to attend the Biennial building at Ibirapuera on Tuesday afternoon.

Arriving there, I was introduced to Polkan (Colombia) and Pablo and Samira (Spain), that would be our engineers. We know where the event and would be arranged to be there the next day. They waited about 30 volunteers, and there were numerous 2. And I also now great friend, Franci.

We went home with a mission to find more volunteers until the next day. Despite all the circumstances point to the contrary, I could support my buddy Gerard. Very happy with it, I called a childhood friend, Fernando, in Rio de Janeiro, and convinced him to come to Sao Paulo to be voluntary. He who is always willing to help pay the prórpio pocket and came just to be voluntary. This dixou so glad that I called my girlfriend, Luciana, the Holy Spirit, and persuaded him to take a plane to come here.

Ash Wednesday - 06/02/2008

I seek and Geraldo Fernando Road in the morning, keep your bags, we had coffee in padoca near here and went to Ibirapuera. Once there, find the Franci along with James and Patricia (brave new) and went to work. Mission: desembolar tables and hold more than 50 km of network cables (yes, 50,000 meters of network cable!). In entando, the biggest challenge was to understand what the engineers wanted. The riddle of Babel, was solved with a three-way handshake: They spoke slowly in Spanish, in Portuguese us We respond slowly, and did the strip insists on English. Piece of cake!

At the end of the day we seek Luciana at the airport and we were all exhausted from sleep arresting cable.

Thursday - 07/02/2008

Antes da Tempestade There appeared no more voluntary. We were six to do the work of thirty. We made a silent pact to give their utmost to ensure that the network infrastructure would be ready in time. We use the tricks learned in the previous day a team and coordinate the bank's support to finish attaching the cables. We test more than 5 000 RJ-45 connectors. On this day, we began to lose track of time. Any report from here may have corrupted the timeline. At our disposal were three verbs: eat, sleep, work. The note of the day was the idea of ​​buy those gloves mason. They saved our hands of developers :)

Friday - 08/02/2008

From the first day we saw that the language would be a difficulty, but not an impediment. We learned that more important than giving and / or receive orders, was to understand and be understood.

We continue to test connectors, and late in the day, more than two thousand meters of fiber should be initiated and carefully protected channels under heavy and moldy wood. Half of the fiber was released. The deadline was approaching. Voltage on all sides. We could not fail. We commit ourselves to it.

After much persuasion, Fernando Pablo persuaded to leave with us for an informal chat in potuñolish, of course!

Saturday - 09/02/2008

Ninho de Mafagafos Four hours of sleep after Friday, we spent the morning placing the channels to protect the first half of fiber launched on Friday, and this gave a damn job. The big problem for the rest of the launch fiber, was that it had to be launched at a time when there was movement of people, as a bruised could damage it. She had to be gently released and protected, or any work could be compromised. That moment came only late in the afternoon, and with fewer people giving Pitaco, we launch the rest of the fiber very quickly. Yet varamos night launching fiber. Point to Luciana, who after an anonymous transform the initial fiber bundle in a nest of mafagafos, desembolou and organized all one by one, greatly speeding the removal of same after the event.

Sunday - 10/02/2008

Jantar Tests, fixes, adjustments and related equipment. Everything should be working no matter the effort. The event start the next day. We work to a time like this where the sun slept in a while. We reported our work shift during the event. The six would work from 23:00 pm until 7:00 pm the following day. The other shifts would be guaranteed by the Foundation Vanzolini affectionately renamed during the event, by campuseiros, Foundation [no, I will not write it here!].

We went home with one goal in mind: sleep. And the only thing we did during the whole next day.

Monday - 11/02/2008, The Big Day

Antes de ser atropelado pela manada de Reporterontes We arrived at the event just before the official opening. I had the honor of being run over and almost trampled by a herd of Reporterontes frenzy that accompanied our Minister of Culture. I think rhinos have been more polished. Unlike them, the minister was friendly and polite. An example to be followed.

Abertura do Campus PArty Brasil 2008

From there, we worked night and tried to seize the day event. Sleep? "Sleep is for wimps!" And that stunned Colombians to our friends: "The Brazilians are not human!", Their words ...

Traditional Coverage:

Monday , Tuesday , Wednesday , Thursday , Friday

The Downers

Although promised during signup, no feeding alternative for those who had dietary restrictions. For me the food was nice, but many vegetarians rightly complained because almost everything had meat, and received a smile of mockery in response. I've seen. Regrettable. The worst is that the only place that sold food in there charging a fortune. Forcing participants to leave the park to eat a sandwich, and be barred for security later. What a shame!

Sobras de brindes sendo recolhidas, com conteúdo descartado à esquerda The Trophy "Mico of the Week" goes to a telecommunications company, the main sponsor of the event, which unlike all other companies in the event, refused to present volunteers with a backpack full of propaganda. The most ridiculous was the excuse:

"Volunteers are not entitled to make backpacks. The backpacks are for paying subscribers. "

Ok, ok, they should be counted, right? Wrong. The many who remained were gathered on Sunday afternoon. Stops all. I applied as a volunteer, brought friends from afar, taking our own money to help build a network infrastructure that was advertising for that company. Then I hear that I have no "right" to make a toast. Firstly we were volunteers. We went there willingly. No charge. Without expecting anything in return. Then an hour off, I stand as a potential customer of that company and the fact that the badge says "Technical Assistance", meaning that I spent the morning helping to ensure that other potential customers use the network of the same company, I have "right" to access the marketing materials of the same company? There is a little paradoxical?

The point here is not the issue I want a toast. The issue is that I as a potential customer was completely ignored just because working at the event. In the constitution it is called discrimination. In a sense I will not go hungry because they do not receive a gift that does not cost more than $ 10.00, so little interest me carry a green bag making propaganda for free, since I use a Targus serves me very well. The point is that since this company was the main beneficiary of the event, I felt mainly used for working for free for her own good. For these and other, I was not his client last year, and I do not regret.

This is good: Friday, returned home to pick up the bags of Luciana, who would return to the Holy Spirit in the early hours of Saturday. We ended up arriving at the Ibirapuera after midnight. When trying to enter the gate 3 as usual, were barred by park security, who claimed to have received orders not to let anyone enter. They refused to call the organization, which is very ironic and disrespectful. Details: all barred and were properly credentialed badge event, and more, people who were out there to work, all others (fifteen people) came from distant cities and paid to sleep in the tents of the event. Would be prevented from entering sleep. There were denied entry to foreigners to sleep. We had trouble talking to the organization by phone because the phones did not work well inside the building. Result: two hours we were barred at the gate until a campuseiro accompany a lady came to the exit and interou the subject. He quickly ran to the assistance and advised our comrades. Fifteen minutes later came a "magic" order to let everyone come. The foot. The car was stopped outside the park to talk with the organization (who said he knew of any order), and send back free entry, the car now.

Another good: Volunteer fined for five minutes are late to change the blue parking ticket. You see, the guy leaves home, goes to work for free at Ibirapuera willingly purchase an entire bead pink slip and be fined for working for free and are late five minutes to renew the ticket was already paid. No right to complain. Volunteer parking is not entitled to ... is soft?

Party Alternative: Class Axe. Seriously, no one deserves! In the middle of the night! Worse, it was public! And both public had TWO editions ...

Do not get a picture with the Mad Dog. By Luciana did it! : (

Positive Points

Radar Saber M60 The biggest technological innovation since Microsoft presented at an event: With a bandwidth of 5.5Gbps available, it leads to the incredible and unprecedented event installation cd MSN. How could I live without it until now?

The level of the talks I attended (without sleep :) ) I believe, was in line with the focus of the event.

The animation of the crowd. Patxi!!!!

The Presence of the Mad Dog.

View our old buddy Saber M60 Radar of the Brazilian Army.

A Lecture by Mark Bridges. Honestly, one of the most amazing I've ever seen. He makes us feel proud of ourselves, of our efforts. Only by hearing and seeing his eyes shining when speaking of the meaning of representing the country into something unique. I can not describe with words. It was the only speaker to a standing ovation for several minutes. That was an experience of those who paid any money.

I think the biggest plus point was to have the opportunity to exchange experiences with people from other countries. We made great friends that will stay forever. We learned among other things, that the language will never be a barrier as long as there respect and goodwill. The responsibility, friendship and commitment, can make us do things we normally think impossible. We did not speak Portuguese, did not speak English, did not speak Spanish. We talked about something that was sufficient to develop the synergy that led us to achieve our goals.

The most important thing was that although they normally do not work with network infrastructure and support, we had fun. Even turning the night in the Service, even if hardly any sleep for two weeks. What we took home the Campus Party was a treasure more precious than gold. No money paid for it.

"Wait a moment, please"

I could not refrain from quoting Gustavo, who came from Colombia without speaking Portuguese, with only a pocket dictionary. The first day I confess that I looked and thought "dictionary at hand? but this is not just a movie? "A week later the guy was almost speaking Portuguese fluently. I do not come with the chat that Spanish is similar to Portuguese, the guy was talking about real Portuguese! He insisted until they succeed. Noted. The funny thing was listening to him, "Wait a moment, please," said phrase every time he would search for any word in the dictionary.

Finishing

After 14:00 pm on Sunday, dismantle all the equipment and collect the fibers. Undo is much easier to do ...

At night, though we take our foreign friends for Social Gathering of São Paulo Perl Mongers pierced that night.

I thank all who worked with us and gave their sweat to the Campus Party Brazil was a success.

Some pictures of the scenes may be given in this link .

Starting in QT, Part II - Signals, Slots and Timers

February 1, 2008 · Posted in C / C + + , Qt · View Comments

In this post I followed with the game to make small tutorials for beginners on the QT. This time I will show how to create your own signals and slots and how to handle a timer.

The source code can be found at this link .

The sample program is a timer that will use the class QTimer , one of the main classes of the QT, and will display the time using a style LCD display calculator with class QLCDNumber .

QT and Timers

The most basic support timers in the QT is available from QObject class that provides methods startTimer :: QObject () and QObject :: KillTimer () . The first method returns a unique ID and the second timer ends the timer through this ID.

For this to work, however, the code snippet that uses this mechanism needs to be inside an "event loop". From the moment the timer is started it from time to time (timeout) makes an application dispate QTimerEvent , which disrupts the normal flow of the program until the event is processed.

The maximum timeout is not defined, and can create timers with timeout of years, however, the minimum time can vary from system to system. In Windows Vista the minimum timer is 10 ms while in Linux 2.6.x this is configurable (default is 4 ms). The QT will try to deliver all events, as requested, but if the system does not permit it will discard the "surplus".

Timers can also be used in threads, but you must fulfill the requirement of being inside an event loop. Threads deserve a separate article, as always ...

The class QTimer timers implements higher level, allowing some features. One is the QTimer :: singleShot () , which fires an event once.

Read the extensive documentation and repetitive, boring, but believe me, you will save a lot of QDorDeCabeca ...

More on Signals and Slots

Signals and slots are used for communication between objects, one of the fundamental parts of the QT. In this system rather than implement callbacks to handle events, we use the concept of connecting signals to slots, making programming more intuitive.

Signals and slots are class methods that are handled by the Meta-Object Compiler (moc) before the source code being compiled. They have special statements that are not part of standard C + +, so fazum moc parsing the source code and generates compilable.

When you run the moc on any class that implements signals and slots, a certain amount of source code is generated. Using the program qmake , moc the call to the program is borne by the Makefile, making it transparent to the programmer.

For a class can implement signals and slots, it needs access to the Meta-Object System . So it should inherit from class QObject and its subclasses, and need to have the macro Q_OBJECT in your area privacy statement. Completed the preparations, signals are declared in a section "signals" in sections and slots "[public | protected | private] slots".

A slot after declared, is then defined as any other common method, can be explicitly called like any other. Already the signs are a little more delicate, and are only ever defined and declared by the programmer. The reason? This message at the end of the attempt to build:

 tmp / moc_mydisplay.o: In function `MyDisplay :: signalPlay () ':
 ~ / Stopwatch / tmp / moc_mydisplay.cpp: 89: multiple definition of `:: MyDisplay signalPlay () '
 tmp / mydisplay.o: ~ / stopwatch / mydisplay.cpp: 169: first defined here
 collect2: ld returned 1 exit status
 make: ** [stopwatch] Error 1

Within the file is generated moc_mydisplay.cpp the following code:

  / / 0 SIGNAL
 signalPlay ( ) void MyDisplay :: signalPlay ()
 {
     activate ( this , & staticMetaObject , 0 , 0 ) ; QMetaObject :: activate (this, & staticMetaObject, 0, 0);
 } 

Yes, moc generates signals with the definition of so-called meta-methods of QT. Therefore, defining the body of a sign is illegal in CT and will generate a compile error for reset method. Let moc takes care of implementation of the signal for you.

Connect

It's no use just set signals and slots. You must define how they will interact. The way to do this is by connecting them through the connect () method throughout this heir of QObject . This will moc implement the signal so that a call to it results in the call (s) slot (s) connect (s) with the same parameters.

Depending on connection, a signal can even return the same value as the last slot called back. Note that this is not very safe for signals connected to several slots, therefore, nothing guarantees the order of call.

A given signal can be connected to a second signal directly. A emit () in the first signal is then equivalent to emit () in the second signal, whereas after the step of creating the MOCs, the call results in the first to the second call, which results in the call connected to other method, and so on .

Ways to connect

There are basically three ways to connect signals and slots and if not used properly can be a source of bugs terribly difficult to discover. These forms of connection are passed as extra parameters to the connect () method. They are:

Direct Connect : The slot is called immediately the signal has been issued in the thread where the signal was issued. This acts as a direct call to the slot.

Queued Connection : The signal is sent and the call to the slot goes to an internal list of the QT, and the signal returns immediately, regardless of the slot have been called or not. The loop will then evente processing this list and only later the slot is invoked on the thread where the object resides slot.

Automatic Connection : This is the default type used when you do not specify the type of connection. It is one of the "Seeds of Evil" , it presents two different behaviors: if the signal and slot resides on the same thread, works as a direct connection, but otherwise it works as queued connection.

Blocking Queued Connections : Hey!? were not just three? Well, this is one advantage to read this article: saves you documentation INCONSISTENT! This connection is similar to the queued connection, except that the signal thread is blocked until the signal to be duly executed. Note that should only be used very carefully, and signals and slots on different threads. Misuse can also cause deadlocks. You will know when you see something like this:

 user @ host: ~ / stopwatch $. / stopwatch
 Qt: Dead lock detected while activating the BlockingQueuedConnection: Sender is
 QPushButton (0x807e2d8), receiver is MyDisplay (0x8076ac0)

To solve the doubts about what is meant by "thread where an object resides" refer to the QT arespeito thread.

Always take great care with signals, slots, threads and timers. These are key features of QT, but its misuse can lead to bugs extremely difficult to locate. See all the documentation about it.

Down to the source

Our example is compose of two classes and MyDisplay StopWatch file and a main common. The main and only creates a QApplication object StopWatch. The class takes care of MyDisplay visual part of the program, consisting of a dialog with buttons and an LCD display style. The StopWatch class will create a widget to display and implement the timer. Note that this architecture is not the most elegente, more interesting to inherit from the class StopWatch MyDisplay. But that would spoil the game virtually eliminating the need to use signals and slots.

The use of signals and slots becomes clearer when we want objects to communicate with the outside. In general, the classes do not know what's outside. Passing pointers to external objects within them, it hurts the encapsulation and makes the code less generic. In our example, the more interesting to use signals and slots is myDisplay to the object (the internal StopWatch) report events from / to the object stopwatch (external Mydisplay), without this being lost in generality or encapsulation.

With the help of Qt Designer (in another article I will talk of it), I created the dialog, buttons and LCD. After simplified the code to suit our purposes. How myDisplay inherits from QDialog, and this indirectly inherits from QObject, to use signals and slots was enough to add the Q_OBJECT macro in the private section of the class declaration. After that, among other auxiliary added, the methods:

  public slots:
     long ) ; slotDisplayValue void (long);

 private slots:
     slotPlay void ();
     slotStop void ();

 signals:
     signalPlay void ();
     signalPause void ();
     signalStop void ();
     signalReset void (); 

The signs communicate to the outside events related to button clicks. Already the private slots will make a pre-processing procedure, while the public is entitled to timer ticks from the outside. Thus, the class sends information to the outside and receives information from outside, without knowing what's on the other side. The good old interface contract.

  public slots:
     slotPlay void ();
     slotPause void ();
     slotStop void ();
     slotReset void ();

 private slots:
     slotTick void ();

 signals:
     long ) ; signalTicks void (long); 

Analog and conversely the StopWatch class implements the slots that receive the signals MyDisplay class, and declares the signal that sends information to the public its slot.

It also implements a QTimer that will fire every 10 milliseconds (so that our friends can follow lerdinhos Vista!), Incrementing a counter. This counter is sent back to the display formats and displays.

The timer can be stopped, paused and restarted at any time by clicking the appropriate button.

The Finalmentes

The example itself is not much code, but it illustrates the most basic use of timers and construction of custom signals and slots. A very special attention, however, should be given to details that involve the use of these resources, they can become lethal traps.

Important Links

Signals and Slots
QTimer
Threads in QT
Online documentation of the QT