Ir para conteúdo
Fórum Script Brasil

Anderson.OL

Membros
  • Total de itens

    3
  • Registro em

  • Última visita

Sobre Anderson.OL

Perfil

  • Gender
    Male

Anderson.OL's Achievements

0

Reputação

  1. Pois bem, abandonei TCollection e TCollectionItem, criei uma classe com Array de ClientDataSets com escopo public como abaixo: unit MultiClientDataSet; interface uses System.SysUtils, System.Classes, Fmx.Types, DataSnap.DBClient; type TMultiClientDataSet = class(TComponent) private FList: TList; function GetClientDataSet(Index: Integer): TClientDataSet; procedure SetClientDataSet(Index: Integer; const Value: TClientDataSet); { Private declarations } protected { Protected declarations } public { Public declarations } constructor Create(AOwner: TComponent); override; function Count: Integer; function AddClientDataSet(ClientDataSet: TClientDataSet): TClientDataSet; overload; function AddClientDataSet: TClientDataSet; overload; procedure RemoveAction(ClientDataSet: TClientDataSet); property ClientDataSets[Index: Integer] : TClientDataSet read GetClientDataSet write SetClientDataSet; published { Published declarations } end; procedure Register; implementation procedure Register; begin RegisterComponents('RCA Samples', [TMultiClientDataSet]); end; { TMultiClientDataSet } function TMultiClientDataSet.AddClientDataSet(ClientDataSet: TClientDataSet): TClientDataSet; begin FList.Add(ClientDataSet); Result := ClientDataSet; end; function TMultiClientDataSet.AddClientDataSet: TClientDataSet; var FClientDataSet: TClientDataSet; begin FClientDataSet := TClientDataSet.Create(Self); FClientDataSet.Name := 'ClientDataSet' + IntToStr(Count+1); Result := AddClientDataSet(FClientDataSet) end; function TMultiClientDataSet.Count: Integer; begin Result := FList.Count; end; constructor TMultiClientDataSet.Create(AOwner: TComponent); begin inherited; FList := TList.Create; end; function TMultiClientDataSet.GetClientDataSet(Index: Integer): TClientDataSet; begin Result := TClientDataSet(FList[Index]); end; procedure TMultiClientDataSet.RemoveAction(ClientDataSet: TClientDataSet); begin if FList.Remove(ClientDataSet) >= 0 then begin ClientDataSet.Destroy; end; end; procedure TMultiClientDataSet.SetClientDataSet(Index: Integer; const Value: TClientDataSet); begin TClientDataSet(FList[Index]).Assign(Value); end; end. Criei um editor de componente como mostra o código abaixo: unit MultiClientDataSetEditor; interface uses System.Classes, DesignEditors, DesignIntf, FMX.Dialogs, System.SysUtils; type TMultiClientDataSetEditor = class(TComponentEditor) private procedure ShowEditor; public function GetVerbCount : integer; override; function GetVerb (Index : integer): string; override; procedure ExecuteVerb (Index : integer); override; procedure Edit; override; end; procedure Register; implementation uses MultiClientDataSet, UnitFrmMultiClientDataSetEditor; procedure Register; begin { Declare DesignIntf e StdCtrls no uses } RegisterComponentEditor(TMultiClientDataSet,TMultiClientDataSetEditor); end; { TMultiClientDataSetEditor } procedure TMultiClientDataSetEditor.Edit; begin inherited; ShowMessage('Component ' + Component.Name); end; procedure TMultiClientDataSetEditor.ExecuteVerb(Index: integer); begin inherited; case Index of 0 : ShowEditor; 1 : ShowMessage('Editor de Actions'); 2 : TMultiClientDataSet(Component).AddClientDataSet; end; end; function TMultiClientDataSetEditor.GetVerb(Index: integer): string; begin case Index of 0 : Result := 'Editor'; 1 : Result := 'Count: ' + IntToStr(TMultiClientDataSet(Component).Count ); 2 : Result := 'Adicionar um ClientDataSet'; end; end; function TMultiClientDataSetEditor.GetVerbCount: integer; begin Result := 3; end; procedure TMultiClientDataSetEditor.ShowEditor; var Frm: TFrmMultiClientDataSetEditor; begin Frm := TFrmMultiClientDataSetEditor.Create(NIL); try Frm.Component := Component; Frm.ShowModal; finally Frm.Free; end; end; end. Com esse editor em mãos, após incluir o componente no Form, posso adicionar ClientDataSets através do Menu Popup. Ou através do form de edição do componente O problema é que não consigo persistir isso, pois o componente inserido não fica no código do Form. Eu reparei que se eu modificar o Create do ClienteDataSet para FClientDataSet := TClientDataSet.Create(Self.Owner); Daí o ClientDataSet aparece código do Form, mas não fica legal. Como faz ?
  2. Anderson.OL

    API Facebook

    Boa noite a todos A API do facebook nos permite pegar todas as atualizações de nossos amigos através, vide documentação no link: http://developers.facebook.com/docs/reference/api/ Um exemplo do retorno pode ser visto na página abaixo: https://graph.facebook.com/me/home?access_t...WDLCU9hNK4AZDZD Que no final, para cada update, gera um item como ilustrado abaixo: object(stdClass)#6 (17) { ["id"]=> string(31) "100001290681462_311958168826089" ["from"]=> object(stdClass)#7 (2) { ["name"]=> string(12) "Isis Santana" ["id"]=> string(15) "100001290681462" } ["message"]=> string(31) "kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk" ["link"]=> string(105) "http://www.facebook.com/photo.php?fbid=293594800683784&set=a.268572769852654.66103.268570933186171&type=1" ["name"]=> string(11) "Wall Photos" ["caption"]=> string(26) "agora a p**** ficou seria!" ["description"]=> string(50) "Gostou? Compartilhe ... Não gostou? aperte f13 :(" ["properties"]=> array(1) { [0]=> object(stdClass)#8 (3) { ["name"]=> string(2) "By" ["text"]=> string(10) "Troll Book" ["href"]=> string(30) "http://www.facebook.com/oTroll" } } ["icon"]=> string(59) "http://static.ak.fbcdn.net/rsrc.php/v1/yD/r/aS8ecmYRys0.gif" ["actions"]=> array(2) { [0]=> object(stdClass)#9 (2) { ["name"]=> string(7) "Comment" ["link"]=> string(61) "http://www.facebook.com/100001290681462/posts/311958168826089" } [1]=> object(stdClass)#10 (2) { ["name"]=> string(4) "Like" ["link"]=> string(61) "http://www.facebook.com/100001290681462/posts/311958168826089" } } ["type"]=> string(5) "photo" ["object_id"]=> string(15) "293594800683784" ["application"]=> object(stdClass)#11 (2) { ["name"]=> string(6) "Photos" ["id"]=> string(10) "2305272732" } ["created_time"]=> string(24) "2011-12-16T01:15:03+0000" ["updated_time"]=> string(24) "2011-12-16T01:16:21+0000" ["likes"]=> object(stdClass)#12 (2) { ["data"]=> array(1) { [0]=> object(stdClass)#13 (2) { ["name"]=> string(14) "Laura Marzoque" ["id"]=> string(15) "100002264726696" } } ["count"]=> int(1) } ["comments"]=> object(stdClass)#14 (2) { ["data"]=> array(1) { [0]=> object(stdClass)#15 (4) { ["id"]=> string(39) "100001290681462_311958168826089_4238950" ["from"]=> object(stdClass)#16 (2) { ["name"]=> string(12) "Isis Santana" ["id"]=> string(15) "100001290681462" } ["message"]=> string(60) "Até o pereirão tem um relacionamento sério... heuheuheuhe" ["created_time"]=> string(24) "2011-12-16T01:16:21+0000" } } ["count"]=> int(1) } } Se você analisou o item acima com um pouco de cuidado, é possível perceber que o update se refere ao envio de uma foto, sendo que ele não traz o link para a foto, traz somente o link para a pagina com a foto que é o seguinte: http://www.facebook.com/photo.php?fbid=293...6171&type=1 Agora vem a dúvida, como pegar a URL para ir diretamente para a foto, e não para esta página?
  3. alguém sabe o motivo do erro abaixo? E como soluciona-lo? mysql> show slave status \G *************************** 1. row *************************** Slave_IO_State: Waiting for master to send event Master_Host: 192.168.10.121 Master_User: repuser Master_Port: 3306 Connect_Retry: 60 Master_Log_File: mysql-bin.000001 Read_Master_Log_Pos: 105222 Relay_Log_File: lab-02-relay-bin.000002 Relay_Log_Pos: 45402 Relay_Master_Log_File: mysql-bin.000001 Slave_IO_Running: Yes Slave_SQL_Running: No Replicate_Do_DB: Replicate_Ignore_DB: Replicate_Do_Table: Replicate_Ignore_Table: Replicate_Wild_Do_Table: Replicate_Wild_Ignore_Table: Last_Errno: 1062 Last_Error: Error 'Duplicate entry '1531' for key 'PRIMARY'' on query. Default database: 'farma'. Query: 'REPLACE RECEBER SET CODFILIAL = '002', CLIENTE = '00247', PRODUTO = '005729', NRORDEM = '195923', DTCOMPR A = '2010-12-03', QUANTIDADE = 1, preço = 14.65, VENDEDOR = '001', RETPRO = ' ', COMISSAO = 0.00, TIPO = '005', CONVENIO = ' ', PROMO = 'N', PG = ' ', ENCERRA = '0000-00-00', NRCAIXA = '02 ', DESCONTO = 0.00, JURO = 0.00, CUSTO = 11.02, HORAEMINF = '14:37:26', OPERADOR = 'JHEFERSON ', TIPOREC = 0, CARTAO = ' ', IDRESCONTA = 0, FECPARCIAL = ' ', CRTCREDITO = ' ', PAGACOMISS = ' ', SUBSIDIO = ' ', DESCO = 0.00, LABOR AT = '0026', NRPREREC = 0, CONTEXP = 6809, NR_ITEM = 1, ACRESCIMO = 0.00, ACTION = 0, PBM = ' '' Skip_Counter: 0 Exec_Master_Log_Pos: 66388 Relay_Log_Space: 79358 Until_Condition: None Until_Log_File: Until_Log_Pos: 0 Master_SSL_Allowed: No Master_SSL_CA_File: Master_SSL_CA_Path: Master_SSL_Cert: Master_SSL_Cipher: Master_SSL_Key: Seconds_Behind_Master: NULL Master_SSL_Verify_Server_Cert: No Last_IO_Errno: 0 Last_IO_Error: Last_SQL_Errno: 1062 Last_SQL_Error: Error 'Duplicate entry '1531' for key 'PRIMARY'' on query. Default database: 'farma'. Query: 'REPLACE RECEBER SET CODFILIAL = '002', CLIENTE = '00247', PRODUTO = '005729', NRORDEM = '195923', DTCOMPR A = '2010-12-03', QUANTIDADE = 1, preço = 14.65, VENDEDOR = '001', RETPRO = ' ', COMISSAO = 0.00, TIPO = '005', CONVENIO = ' ', PROMO = 'N', PG = ' ', ENCERRA = '0000-00-00', NRCAIXA = '02 ', DESCONTO = 0.00, JURO = 0.00, CUSTO = 11.02, HORAEMINF = '14:37:26', OPERADOR = 'JHEFERSON ', TIPOREC = 0, CARTAO = ' ', IDRESCONTA = 0, FECPARCIAL = ' ', CRTCREDITO = ' ', PAGACOMISS = ' ', SUBSIDIO = ' ', DESCO = 0.00, LABOR AT = '0026', NRPREREC = 0, CONTEXP = 6809, NR_ITEM = 1, ACRESCIMO = 0.00, ACTION = 0, PBM = ' '' 1 row in set (0.00 sec) mysql> mysql> mysql> mysql> REPLACE RECEBER SET CODFILIAL = '002', CLIENTE = '00247', PRODUTO = '005729', NRORDEM = '195923', DTCOMPRA = '2010-12-03', QUANTIDADE = 1, preço = 14.65, VENDEDOR = '001', RETPRO = ' ', COMISSAO = 0.00, TIPO = '005', CONVENIO = ' ', PROMO = 'N', PG = ' ', ENCERRA = '0000-00-00', NRCAIXA = '02 ', DESCONTO = 0.00, JURO = 0.00, CUSTO = 11.02, HORAEMINF = '14:37:26', OPERADOR = 'JHEFERSON ', TIPOREC = 0, CARTAO = ' ', IDRESCONTA = 0, FECPARCIAL = ' ', CRTCREDITO = ' ', PAGACOMISS = ' ', SUBSIDIO = ' ', DESCO = 0.00, LABORAT = '0026', NRPREREC = 0, CONTEXP = 6809, NR_ITEM = 1, ACRESCIMO = 0.00, ACTION = 0, PBM = ' '; Query OK, 2 rows affected (0.05 sec) mysql>
×
×
  • Criar Novo...