Pascal

Pascal is an influential imperative and procedural programming language, largely (but not exclusively) intended to teach students structured programming and data structuring. Pasca was implemented on a wide range of architectures, from early PCs to mainframes. Pascal derivatives include OOP-based Object Pascal (used in Delphi and Lazarus/Free Pascal). Pascal is a purely procedural language and includes control statements with reserved words, but has many data structuring facilities and other abstractions like type definitions, records, pointers, enumerations, and sets.

Share tech news, updates, or what's on your mind.

Sign up to Post

Hi.

I have excel document where the name of the sheets is the date the sheet was created. But some of the sheets have a date format like this: dd/mm/yyyy and I want it like this: yyyy/mm/dd. The name of the sheets in a Listbox is added by using ADOConnection.GetTableNames(ListBox1.Items,false);

How can I convert the dateformat to the right one?
0
Hi Experts,

Exist some way to display external images in grid columns when the data source only contains links to the images ? In my data base only have the link, but I need show the image inside of the grid. I'm using delphi xe4 with firebird and IBO Objects

Could someone help me?

Thanks
Alexandre
0
I'm not sure how I can explain this, for you guys to understand with my bad english.

I have a exceldoc with 3 sheets at the moment, in time this will increase. The name of the sheets is the date of the day it was created. If you see in the attachment the name of the sheets is: 2013-04-22, 2012-09-05, 2012-06-08 in that order.

2013-04-22 = A
2012-09-05 = B
2012-06-08 = C

I want to compare B with C. I want to delete records in C, if the username exists in both B and C. When the comparing is done I want to add the rest of sheet C to sheet B. Then I will do the same with A and B.

To connect to Excel I use this:
procedure TFrmMain.ConnectToExcel;
var strConn :  widestring;
begin
  strConn:='Provider=Microsoft.ACE.OLEDB.12.0;' +
          'Data Source=' + Edit6.Text + ';' +
          'Extended Properties="Excel 12.0 xml;HDR=YES";';
  AdoConnection1.Connected:=False;
  AdoConnection1.ConnectionString:=strConn;
  ADOConnection1.CursorLocation := clUseServer;
  ADOConnection1.LoginPrompt := false;
  ADOConnection1.Mode := cmShareDenyNone;
  ADOConnection1.Provider := 'Microsoft.ACE.OLEDB.12.0';
  try
    ADOConnection1.Open;
    ADOConnection1.GetTableNames(listbox2.Items,false);
  except
    ShowMessage('Unable to connect to Excel, make sure the workbook ' + Edit6.Text + ' exist!');
    raise;
  end;
end;

Open in new window


This is what I have tried to far, but I can not figure it out:

procedure TFrmMain.FetchData;
var strComputerNavn, strUserName, 

Open in new window

0
I want to create an Interbase table at run time like
var
  MyTable : TIBTable;
begin
  MyTable := TIBTable.Create(nil);
  MyTable.TableName := 'MyTableName';
  MyTable.Database := AnExistingDatabase;
  MyTable.FieldDefs.AddFieldDef.Name := 'Field1';
  MyTable.FieldDefs.AddFieldDef.DataType := ftInteger;
  MyTable.FieldDefs.AddFieldDef.Size := 0;
  MyTable.FieldDefs.AddFieldDef.Required := False;

  AnExistingDatabase.Open;
  MyTable.CreateTable;

This generates: Unsupported Field Type.


Also Tried to use TIBSQL component

Assign to a TIBSQL components SQL property with the text below
and set the TIBSQL database property to an IBDatabase component that points to
my database

Create Table "Table2"
(
  "Field1" Varchar(20) not null,
  "Field2" Float,
  primary key ("Field1")
);

procedure TForm1.Button2Click(Sender: TObject);
begin
  IBDatabase1.Open;
  IBSQL1.ExecQuery;
end;

I get the message Transaction Not assigned
0
Hi,

I cannot find info on embarcadero sites, were there any changes in compiler comparing to XE4 ?
I mean windows vcl apps.

Code which perfectly compiled in XE4, shows the error in XE5
[dcc32 Error] clUtils.pas(411): E2003 Undeclared identifier: 'TwoDigitYearCenturyWindow'

My guess it's not the same.
Does anybody know where can I found code migration from XE4 to XE5 tips?
0
Hello,

is there anywhere I can download the Skype API for Delphi? Skype does not allow new developers.

I have a database software and would like to be able to call clients from code using skype.

Thanks,
E.
1
How to capture screen window of a process (PID)?
Ex. internet explorer tabs or Chrome tabs?
0
Is it possible to monitor if an application is operating a keyboard hook?  Can I write a program to tell when an application has tapped into and is capturing keyboard input?
0
Hi Experts,

its been a while since I have used Delphi and I feel silly for asking such a basic question but how the heck do you do a simple select case?

I have a function that returns a string and want to do something depening of the value:

IE

Select myString Case

'A': do this
'B': do that
else: do something else

end;

Thanks,
E.
0
Hi,
I`ve got a group of data like in attached file. I need to find values which are almost the same or very similar (the difference between values should be less than 100, i`ve also marked the values by -------------* string which shows where are the similar values.
In the attached example I should be able to receive 4 results:
1. 8160 - 8200
2. 24940 - 24920
3. 32920 - 33060
4. 41680 - 41760
values.txt
0
Hello, we have a Delphi Program (running under windows) that only runs correctly when the OS is set to english number format, i.e. the dot .  as decimal separator. As we are in Germany this means changing the number format every time.

I spent some time trying to convince delphi to use the dot regardless what locale is set but I could not get this working. Then I thought it might be possible to set environment variables before executing the program; I set LANG to "en" but this does not seem to influence the decimal separator. Is there another environment variable for this or another way to run a program with specific language/number settings?

Thank you for a hint,
jc
0
I would like to replace a string
"<2>Test<3><13><10>"

to

Chr(2)+"Test"+Chr(3)+Chr(13)+Chr(10)

String length = 1+4+1+1+1 = 8

How can I do this with a RegEx replace? (TRegExReplace in Delphi)
0
Hi Experts,

I have a code in delphi xe4 to parser jsons:

var
  jsonObj, jSubObj: TJSONObject;
  ja: TJSONArray;
  jp, jSubPar: TJSONPair;
  pagina: string;
  i, j: integer;
begin
  pagina := Memo1.Text;
  jsonObj := TJSONObject.ParseJSONValue(TEncoding.ASCII.GetBytes(pagina), 0)
    as TJSONObject;

  jp := TJSONPair.create;
  jp := jsonObj.Get(0);

  ja := TJSONArray.create;
  ja := (jp.JsonValue as TJSONArray);

  Form1.Memo2.Lines.Add('number of elements ' + inttostr(ja.Size));
  jSubObj := TJSONObject.create;
  jSubPar := TJSONPair.create;

  for i := 0 to ja.Size - 1 do
  begin
    jSubObj := (ja.Get(i) as TJSONObject);

    Form1.Memo2.Lines.Add('');
    Form1.Memo2.Lines.Add('Element number ' + inttostr(i) +
      ' the number of pairs is = ' + inttostr(jSubObj.Size));

    for j := 0 to jSubObj.Size - 1 do
    begin
      jSubPar := jSubObj.Get(j);
      Form1.Memo2.Lines.Add(jSubPar.JsonString.Value + ' : ' +
        jSubPar.JsonValue.Value);
    end;

  end;


I'm trying to parser values ¿¿returned by facebook api, like this:

{"data":[{"uid":100005219556303,"name":"Otavio Enrico","username":"otavio.enrico.1","sex":"male","current_location":{"city":"Mogi das Cruzes","state":"S\u00e3o Paulo","country":"Brazil","zip":"","latitude":-23.5167,"longitude":-46.1833,"id":103427389698118,"name":"Mogi das Cruzes"},"hometown_location":{"city":"Mogi das Cruzes","state":"S\u00e3o …
0
Hi all,

I been working on a Android applicaiton, all works fine when i have my phone and/or tablet plugged in.

As soon as i change the build configuration from debug to release and upload the .apk to the developer console on google play, when i download and install the app it doesnt work all i get is a black screen and the app doesnt load.

Does anyone have any ideas ???


Thank you i advance.


Trevor.
0
Hi All,

i am using delphi 2007 and try to print barcodes and A4 pages on tlp2844 zebra and hp 1020.
My problem is, when i switch the printerindex to the 1020 from the 2844, then the printed a4 page is OK, but when i switch back to the 2844, the barcode is faulty, because the page size remains the A4.

I have tried some workarounds, but can't resolve it.

need help
thank you
0
Hi Experts,
What kind of encoding is this: &#xc2; , &#xe2; , &#xc0;

And how convert it using Delphi XE4

eg:.

  &#xc2; to Â
  &#xe2; to â
  &#xc0; to À  
  &#xe0; to à
  &#xe1; á
  &#xc7; to Ç
  &#xe7; to ç
  ...
  ...
  ...

Thanks for some help
Alexandre
0
Hi Experts,

Please I need help to convert string to utf8.

eg.:

cabeça - > cabe%C3%A7a
zé -> z%C3%A9
avó -> %C3%B3

I need to store the converted value in a variable.
I tried to use utf8encode(variable) but did not work.

var
  texto:string;
begin
   texto:=utf8encode('cabeça');
   showmessage(texto);
end;

But the result was "cabeça" and not "cabe%C3%A7a" as expected.

Please, some help.
Thanks
Alexandre
0
First, let me give you some back ground. This code is only a subset of the code for the component. Secondly, I did not write this component, given the time to do so, I would rewrite it using TidHTTP instead of  IDTCPClient, because it would be more at my level. i do not have the experience for low level socket connections. Having said that, here is my problem

I have this component


 
private
    { Private declarations }
    FRawRequest : String;
    FRawResponse: String;
  ...
  protected
    { Protected declarations }
  public
    { Public declarations }
     ...
    ResponseJSON_V: TJSONValue;
    ResponseXML_v: String;
    ResponseStream: TMemoryStream;
    Constructor Create( AOwner : TComponent ); override;
    Destructor Destroy; Override;
    Procedure GenerateXML; 
    Procedure GenerateJSON;
    function EncodeUrl(aDecodedUrl: String): String;
    function DecodeUrl(aEncodedUrl: String): String;
    Function LiveGET(aRawHeader:String):String;
  published
  ...
  end;

procedure Register;


implementation

Function StreamToArray(Strm:TStream):TArray<Byte>;
Begin
 Strm.Position := 0;
 SetLength(Result,Strm.Size);
 Strm.Read(Result[0],Strm.Size);
End;


Constructor TMyConnector.Create(AOwner: TComponent);
begin
  inherited;
  FPort     := 80;
  FHost     := 'dev.xxxxxxxxxx.com';
  FSock     := TIDTCPClient.Create(Self);
  FSock.Port:= FPort;
  Fsock.Host:= Fhost;


end;


destructor TMyConnector.Destroy;
begin
  if FSock<>nil then
  begin
    if Connected 

Open in new window

0
Hi Expert,

Exist some way to put a player inside a delphi form to read streams of youtube ? I need see youtube videos in my delphi form.

Some idea
Thanks
0
Hi, Experts.  I'm new to Delphi XE4.  I have lots of years with Delphi 5, a little with Delphi 2006, but am trying to make the leap to XE4.

I have few Delphi 2006 windows service programs that run fine.  I'm trying to create a new one in XE4, based on one of my existing Delphi 2006 programs.

One change that happened somewhere between 2006 and XE4 is the _Recordset object's _Set_ActiveConnection now takes a parameter of IDispatch instead of string.

In my ignorance, I've simply changed the string parameter to IDispatch and tried typecasting.  (Don't laugh too long.)

I've read a bit of the help file on IDispatch and that gave me no better understanding.

What I'm trying to do in this program is read an encrypted ADO connection string from an INI file, and use that to make a connection to a SQL database to get a set of records that I have to process in the timer event of my service program.

The event log gives me the Microsoft equivalent to "you can't get there from here" when the service program gets to

MyRecordSet._Set_ActiveConnection(FConnectionString);  

// FConnectionString is a typecast IDispatch of a string from reading the ini file.

I'd sure appreciate some direction on how to set the connection string for an ado connection.

Thanks.
0
Hi Experts,

I need to get the pixel color of a jpg image inside of TImage. How can I do this ?

Something like this:

var
  pixel_color    : TColor;
begin
  pixel_color := Image1.Canvas.Pixels[0, 0];
end;

But this code only works to BMP image.

I am using Delphi Xe4

Thanks for some help
Alexandre
0
Hi Experts,

Is there any way to record a video from webcam using Delphi XE4 ?

Thanks
Alexandre
0
Have a little trivial problem, but on my zero level knowledge about this issue would ask experts...
I have to sent textfile to web-robot with HTTP-POST function.

Form code would be as follow:

<form ENCTYPE="multipart/form-data"
action="http://contest.sk6aw.net/contest/robot/?automatic=true"
method="POST"
<input type="text" name="contest_type">
<input type="text" name="contest_date">
<input type="text" file="logfile">
</form>

Can't found any TIdMultipartFormDataStream on my old Indy (Delphi 7).
Have tried with Synapse but have several problems to set parameters!
How to do? Thanks in advance.
0
hello my friends i am using this function in delphi

cursor2 := LoadCursorFromFile('c:\cursors\cursor2.cur');
 SetSystemCursor(cursor2, OCR_NORMAL);
 SetSystemCursor(cursor2, OCR_IBEAM);
 SetSystemCursor(cursor2, OCR_HAND);

I am need modify the normal, hand and ibeam cursors and i am using this and only modify the normal
cursor the hand cursor and ibem i am use this and continues the default cursor, please help me with a function
for i am modify this. thanks
0
Hello

I need to integrate my software with a phone service.
I received the specification to do it.
It tells this:

- The services use the concept of SOA based on REST (only GET and POST)
- The channels are established through persistent connections and sent following the model of Server Sent Events (SSE) (http://www.w3.org/TR/eventsource/).

I'm searching the web for ways to do it.
But I'm not having much sucess.

Is there any sample for consuming this kind of service?
0

Pascal

Pascal is an influential imperative and procedural programming language, largely (but not exclusively) intended to teach students structured programming and data structuring. Pasca was implemented on a wide range of architectures, from early PCs to mainframes. Pascal derivatives include OOP-based Object Pascal (used in Delphi and Lazarus/Free Pascal). Pascal is a purely procedural language and includes control statements with reserved words, but has many data structuring facilities and other abstractions like type definitions, records, pointers, enumerations, and sets.

Top Experts In
Pascal
<
Monthly
>

No Top Experts for this time period. Answer questions to earn the title!