Folks,
I’m in! Now is wait for the first round and play with it on the right time…
Congratz for all others that pass over the qualification.. ^^
Hugs
Step by stepFolks,
I’m in! Now is wait for the first round and play with it on the right time…
Congratz for all others that pass over the qualification.. ^^
Hugs
Camaradas,
Adicionei hoje o ParallelJobs no code.google,
Farei dele um espelho(mirror) do svn principal que é o:
http://devpartners.ath.cx:11520/svn/DevPartners/ParallelJobs/
E ainda criarei pra cada commit da library um snapshot, assim todos poderão ter o ParallelJobs, sem depender de um único servidor.
Mas e então, o que é o ParallelJobs?
O ParallelJobs é uma biblioteca que disponibiliza uma estrutura fácil para se criar processos paralelos em seu aplicativo Delphi. A forma mais conhecida de se fazer isso é utilizando extendendo a classe TThread, o que ainda torna o aplicativo dependente do gerênciamento principal de processos que a VCL dispoe. Com o ParallelJobs você podera criar os mesmos processos com apenas 1 linha de código além de poder fazer isso em qualquer lugar que precise, jogos, aplicativos matemáticos e vários outros modelos de aplicativos que não se utilize necessariamente a VCL.
Você podera acompanhar a evolução e alguns exemplos de utilização do ParallelJobs aqui, nos artigos em inglês.
Então vamos aos links do projeto:
Baixe um exemplo de utilização do ParallelJobs:
Download ele aqui:
Abraços a todos
Folks,
This is the first article about ParallelJobs and I’ll show you how to create a simple parallel process.
Lets create a simple drawing system that display a follower effect on a bitmap:
| Delphi | | copy code | | ? |
| 01 | function TfrmMain.UpdateFollower: integer; |
| 02 | const |
| 03 | FOLLOWERSIZE = 30; |
| 04 | var |
| 05 | Points: array [1..FOLLOWERSIZE] of TPoint; |
| 06 | i: Integer; |
| 07 | begin |
| 08 | while not CurrentJobTerminated do |
| 09 | begin |
| 10 | for i := 1 to FOLLOWERSIZE - 1 do |
| 11 | Points[i] := Points[i + 1]; |
| 12 | |
| 13 | with Points[FOLLOWERSIZE], Mouse do |
| 14 | begin |
| 15 | X := CursorPos.X div 3; |
| 16 | Y := CursorPos.Y div 3; |
| 17 | end; |
| 18 | |
| 19 | Bmp.Canvas.Lock; |
| 20 | try |
| 21 | Bmp.Canvas.FillRect(Bmp.Canvas.ClipRect); |
| 22 | for i := 2 to FOLLOWERSIZE do |
| 23 | begin |
| 24 | with Points[i - 1] do |
| 25 | Bmp.Canvas.MoveTo(X, Y); |
| 26 | with Points[i] do |
| 27 | Bmp.Canvas.LineTo(X, Y); |
| 28 | end; |
| 29 | finally |
| 30 | Bmp.Canvas.Unlock; |
| 31 | Invalidate; |
| 32 | end; |
| 33 | Sleep(10); |
| 34 | end; |
| 35 | |
| 36 | Result := 0; |
| 37 | end; |
This code will hold the last 30 positions(X, Y) of the mouse and when we modify something on Bmp we have to lock the canvas to don’t let it be display by WM_PAINT message on the wrong time.
Since we use the TBitmap Bmp we have to create it and setup as wish. After that its time to create the parallel job with ParallelJobs library.
The code below show how I did it:
| Delphi | | copy code | | ? |
| 01 | procedure TfrmMain.FormCreate(Sender: TObject); |
| 02 | begin |
| 03 | ControlStyle := [csOpaque]; |
| 04 | Bmp := TBitmap.Create; |
| 05 | with Bmp do |
| 06 | begin |
| 07 | Width := Screen.Width div 3; |
| 08 | Height := Screen.Height div 3; |
| 09 | |
| 10 | Canvas.Brush.Color := clBlack; |
| 11 | Canvas.Pen.Color := RGB(255, 130, 0); |
| 12 | end; |
| 13 | ParallelJob(Self, @TfrmMain.UpdateFollower); |
| 14 | end; |
ParallelJobs provide two ways to create a parallel process with any function or method you want, this code use one that you need to specify the object ( Self ) that contain the method and the method to work on a parallel process.
Now we have to create the display of the follower effect:
| Delphi | | copy code | | ? |
| 01 | procedure TfrmMain.WMPaint(var Message: TWMPaint); |
| 02 | begin |
| 03 | Inherited; |
| 04 | Bmp.Canvas.Lock; |
| 05 | try |
| 06 | Canvas.Draw(0, 0, Bmp); |
| 07 | finally |
| 08 | Bmp.Canvas.Unlock; |
| 09 | end; |
| 10 | end; |
Take a look on the Canvas.Lock, that will create a basic switcher between modification and drawing processes.
Finally, to don’t raise a exception we need to terminate the parallel process before closing the form and on it destruction we have to free the Bmp to avoid memory leak.
| Delphi | | copy code | | ? |
| 1 | procedure TfrmMain.FormDestroy(Sender: TObject); |
| 2 | begin |
| 3 | Bmp.Free; |
| 4 | end; |
| 5 | |
| 6 | procedure TfrmMain.FormClose(Sender: TObject; var Action: TCloseAction); |
| 7 | begin |
| 8 | TerminateAllParallelJobs; |
| 9 | end; |
Full source without ParallelJobs library, Download it here: pj_example1 (1.27 KB) - 65 hits
Very nice and easy, uhm?
Hugs for all
Camaradas,
Acabo de atualizar para a versão 2.6. Depois de ver a publicidade em cima da nova versão, vamos ver se realmente o produto divulgado é o que aparentou ser…
Peço a todos que qualquer problema que venha a acontecer me informar por comentário.
Adicionei também a dois dias atrás um sistema de votos, então agora quem gostou da matéria ou informação contida na página, pode votar e eu saberei que aquele assunto está sendo bem procurado e vou tentar passar mais informações sobre tal.
Abraços a todos.
Folks,
I still a little disapointed with myself, because I don’t get the needed time to play with CodeJam…
About 4 hours of a intense harding code to post the results before the qualify round ends.
3 tests of logical and basic formating output knowledges.
2 of then I have complete, the last one, gones away… the time has expired… but I can be qualified to the 1º round, I need get only 25 points to that, 10 points I already have.
Now its time to relax and wait the news…
Hugs for all
Folks,
Sometimes we need a challenge to get some deceptions and see our human condition.
If you lose its normal, only one can win, if not congratzzz you are the one.
What side you choose?
Today I received the google codejam e-mail saing that the qualification round is today, in 9hr.
I don’t feel prepared for a challenge today…
My head still looking for some usefull creations for ParallelJobs library and the work don’t let me play with it.
On the mean time I’ll see what I can do on a short time.
Camaradas,
Já que o usei o Hino Brasileiro no texto demonstrativo do Caster, vou postar um possível resultado aqui:
Hino Brasileiro:

>_ Castered! _<
Abraços
Folks,
Today I challenge myself, about 5 or 6 hours to create Caster, the clone of Wordle, but its works only for Win32 plataform with some advantages.
The challenge idea comes when I remeber this site: http://wordle.net/
A creation by Jonathan Feinberg.
I finished my challenge with this result:

Download it here: Caster (706 KB) - 147 hits
Project page: Caster: Desktop Wordle Clone
Any troubles or suggestion, post here.
Folks,
A long time ago I founded this site: Jooce.com. A really good one that provide a Virtual Desktop for everybody who wants one, for free.
Let me show what you can have using it:
With this motivation I started the projects JooceBox on DevPartners (In Brazilian Portuguese)
Download it here:
For Delphi developers you can get follow the course:
SVN: http://skpc.dyndns.org:11520/svn/DevPartners/JooceBox/
Trac: http://skpc.dyndns.org:11500/trac/DevPartners/JooceBox/
So create your account and be happy.
Camaradas,
Ontem iniciei o ParallelJobs no DevPartners.
O ParallelJobs vai ser uma library para Delphi que consiste em disponibilizar facilitadores para criação de processos paralelos nas aplicações diversas.
A library ainda está no começo, mas já tem um aplicativo teste que vai servir para exemplificar algumas maneiras de utilização e criação de processos parallelos.
Acompanhe o fórum para maiores informações:
http://devpartners.projects.pro.br/forum/?board=8.0
Vou manter ele em inglês, mas isso não impede a comunicação em português de quem quiser contribuir.
façam bom uso e colaborem se puderem,
Abraços.