sábado, 11 de junho de 2011

Alterando a porta do Apache de 80 para 81 no WAMP

Abaixo os passos para alterar a porta padrão do Apache no WAMP de 80 para 81 (fonte):


Open the httpd.conf file for the Apache server. On my machine, it’s located here C:\wamp\bin\apache\apache2.2.8\conf\httpd.conf
Do a search for "Listen 80"and replace it with "Listen 81".
Save and close the file.

Open the wampmanager.tpl file. On my machine, it’s located here: C:\wamp\wampmanager.tpl
Do a search for "http://localhost/" and replace it with "http://localhost:81/" (There are three total).
Do a search for "${w_testPort80}" and replace it with "${w_testPort81}".
Save and close the file.

Open the testPort.php file. On my machine, it’s located here: C:\wamp\scripts\testPort.php
Do a search for "80" and replace it with "81" (There are three total).
Save and close the file.

Open the english.lang file. On my machine, it’s located here: C:\wamp\lang\english.lang
Do a search for “$w_testPort80 = ‘Test Port 80";” and replace it with “$w_testPort81 = "Test Port 81";.
Save and close the file.

Right click on the WampServer icon and click on “Exit”.
Restart your WampServer.

quarta-feira, 30 de janeiro de 2008

Outlook Express

To set up your Outlook Express client to work with Gmail:

  1. Enable IMAP in your Gmail account. Don't forget to click Save Changes when you're done.
  2. Open Outlook Express.
  3. Click the Tools menu, and select Accounts...
  4. Click Add, and then click Mail...
  5. Enter your name in the Display name: field, and click Next.
  6. Enter your full Gmail email address (username@gmail.com) in the Email address: field, and click Next.
  7. For My incoming mail server is a ______ server, please select IMAP in the drop-down menu.
  8. Enter 'imap.gmail.com' in the Incoming mail (POP3, IMAP or HTTP) server: field. Enter 'smtp.gmail.com' in the Outgoing mail (SMTP) server: field.
  9. Click Next.
  10. Enter your Gmail username (including '@gmail.com') in the Account name: field. Enter your Gmail password in the Password: field, and click Next.



  11. Click Finish.
  12. Highlight imap.gmail.com under Account, and click Properties.
  13. Click the Advanced tab.
  14. Under Outgoing Mail (SMTP), check the box next to This server requires a secure connection (SSL).
  15. Enter '465' in the Outgoing mail (SMTP): field.
  16. Under Incoming mail (IMAP), check the box next to This server requires a secure connection (SSL). The port will change to '993'.



  17. Click the Servers tab, and check the box next to My server requires authentication.


  18. Click OK.

terça-feira, 8 de janeiro de 2008

Highlighting Delphi's DBGrid Row On Mouse over

Delphi's TDBGrid displays and manipulates records from a dataset in a tabular grid.

Contrary to what most novice developers think, the DBGrid component allows various customizations. changing the color of a specific cell or a column or even a row is not complicated at all.
What most are not aware of, is that you can even implement the OnMouseHover (hot tracking)change the display (color, font, etc.) of the DBGRid's (data) row underneath the mouse - *not* the currently selected row - thus making it look like today's web driven interfaces.
behavior to
I'm sure you've seen this behavior many times - many tables on the Web change the background color of their rows as mouse hovers over them.

Coloring DBGrid's Row On Mouse Hover

To follow the source code provided later on, create a new application. On the form ("Form1") drop a DBGrid ("DBGrid1"). Use any type of TDataset descentand and connect to some database data to make sure the dbgrid has some data to show.

Note: All he code goes inside the Form1's unit source!!

For a start, prepare the protected hack for the DBGrid component. In the interface section, just add the following line:


type
___THackDBGrid = class(TDBGrid) ;

Next, add a private integer property "MouseOverRow" - you'll use it to track the index position of the row the mouse is over.

private fMouseOverRow: integer;
procedure SetMouseOverRow(const Value: integer) ;
property MouseOverRow : integer read fMouseOverRow write
SetMouseOverRow;
To be able to track the row the mouse is over you need to handle the OnMouseMove DBGrid1's event.
//DBGrid1 OnMouseMove
procedure TForm1.DBGrid1MouseMove(Sender: TObject;Shift: TShiftState;X, Y: Integer) ;
var
___ gc: TGridCoord;
begin
___gc := DBGrid1.MouseCoord(x, y) ;
___MouseOverRow := gc.Y;
end
The MouseOverRow property's setter calls the Refresh method that will in turn fire the DrawColumnCell event.
procedure TForm1.SetMouseOverRow(const Value: integer) ;
begin
___if fMouseOverRow <> Value then
___begin
______fMouseOverRow := Value;
______DBGrid1.Repaint;
___end;
end;
As expected the tricky part goes inside the OnDrawColumnCell event handling procedure.
//DBGrdi1 OnDrawColumnCell
procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject;const Rect: TRect;DataCol: Integer;Column: TColumn;State: TGridDrawState) ;
begin
___if NOT ((gdFocused in State) or (gdSelected in State)) AND (MouseOverRow = 1 + THackDBGrid(DBGrid1).DataLink.ActiveRecord) then
___begin
______with DBGrid1.Canvas do
______begin
_________Brush.Color := clSilver;
_________Font.Color := clNavy;
______end;
___end;

___DBGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State) ;
end;

What we want is to change the drawing color of the row the mouse is over.

Therefore:

If MouseOverRow matches the ActiveRecord value of the protected DataLink property and the cell being drawn does not have the focus and is not selected: change the Canvas's coloring to actually "draw" the row highlighted.

The tricky part here was the protected DataLink property and the ActiveRecord value. The DataLink property helps the data-aware grid manage its link to the data source and respond to data events. The ActiveRecord specifies the index of the current record within the internal record buffer maintained by the dataset for the Owner of the TDataLink object.

You might think that ActiveRecord points to the currently selected record for the data displayed in the grid, but it is not.

Note: you might ask yourself: "how does he know this". Here's the answer: I read Delphi Help files and browse the VCL source code

While Delphi draws data the DBGrid displays it changes the ActiveRecord to match the row being drawn.

And this is the trick: match the currently drawn row woth the one the mouse is over. That's it. Beauty!

sábado, 4 de agosto de 2007

Delphi - Manipulando BDE Alias (Manipulating BDE Aliases)

Manipulando Alias da BDE direto do código.

http://delphi.about.com/od/dbbde/a/bdealiases.htm


Alternativa 2 - Lendo parâmetros de arquivo de configuração .ini


procedure TFPrincipal.SQLConnection1BeforeConnect(Sender: TObject);
var ConfigIni: TIniFile;
begin
//Seta as propriedades da conexão em tempo de execução pegando os dados do arquivo config.ini
ConfigIni := TIniFile.Create(ExtractFilePath(ParamStr(0)) + 'Config.ini');
SQLConnection1.Params.Values['Database']:= ConfigIni.ReadString('CONFIG', 'DATABASE', '');
SQLConnection1.Params.Values['User_Name']:= ConfigIni.ReadString('CONFIG', 'USERNAME', '');
SQLConnection1.Params.Values['Password']:= ConfigIni.ReadString('CONFIG', 'PASSWORD', '');
SQLConnection1.Params.Values['ServerCharSet']:= 'DOS860';
ConfigIni.Free;
end;

sexta-feira, 3 de agosto de 2007

Sql Sintaxe (syntax)

Referência rápida a sintaxe das clausulas SQL. Acesse o link no fim do post para informações mais detalhadas.

Select Statement
SELECT "column_name" FROM "table_name"

Where
SELECT "column_name"
FROM "table_name"
WHERE "condition"

Between
SELECT "column_name"
FROM "table_name"
WHERE "column_name" BETWEEN 'value1' AND 'value2'

Like
SELECT "column_name"
FROM "table_name"
WHERE "column_name" LIKE '%PEDACO_DA_PALAVRA%'

Order By
SELECT "column_name"
FROM "table_name"
[WHERE "condition"]
ORDER BY "column_name" [ASC, DESC]

Group By
SELECT "column_name1", SUM("column_name2")
FROM "table_name"
GROUP BY "column_name1"

Insert Into Statement
INSERT INTO "table_name" ("column1", "column2", ...)
VALUES ("value1", "value2", ...)

Update Statement
UPDATE "table_name"
SET "column_1" = [new value]
WHERE {condition}

Delete From Statement
DELETE FROM "table_name"
WHERE {condition}


Fonte: http://www.1keydata.com/sql/sql-syntax.html