Delphi

Error 406 Not Acceptable with idHTTP on Android

一世执手 提交于 2020-01-11 09:56:08
问题 I'm trying to post a insert on a MySQL database using idHTTP and a PHP script. This is the PHP script to insert in the database: $mysqli = new mysqli($servidor, $usuario, $senha, $banco); // Caso algo tenha dado errado, exibe uma mensagem de erro if (mysqli_connect_errno()) trigger_error(mysqli_connect_error()); $iduser = quoted_printable_decode($_POST['iduser']); $nome = quoted_printable_decode($_POST['nome']); $data = quoted_printable_decode($_POST['data']); $hora = quoted_printable_decode(

How to play non-PCM file or convert it to PCM on the fly ?

Deadly 提交于 2020-01-11 09:32:24
问题 The following code works with some wav files, but with others I get, "InvalidOperationException was unhandled. Message=Sound API only supports playing PCM wave files." var webClient = new WebClient(); webClient.DownloadFile(url, fileName); var fileSound = new SoundPlayer(fileName); fileSound.PlaySync(); Is there a way to programmatically check if a wav file is "bad" (not a PCM wave file) and then convert it as necessary? What is odd is that the code works in the legacy Delphi app - all of the

How to play non-PCM file or convert it to PCM on the fly ?

早过忘川 提交于 2020-01-11 09:32:14
问题 The following code works with some wav files, but with others I get, "InvalidOperationException was unhandled. Message=Sound API only supports playing PCM wave files." var webClient = new WebClient(); webClient.DownloadFile(url, fileName); var fileSound = new SoundPlayer(fileName); fileSound.PlaySync(); Is there a way to programmatically check if a wav file is "bad" (not a PCM wave file) and then convert it as necessary? What is odd is that the code works in the legacy Delphi app - all of the

Syntax Error with Query

时间秒杀一切 提交于 2020-01-11 09:21:31
问题 I would like to use an Insert Into query in Delphi XE2 to insert a user's information into a MS Access Database. The problem is I keep getting the same error: Syntax error in INSERT INTO statement I have done some research but there is no definitive answer. my source code is: opendb('QuizDB.mdb'); DB.Close; DB.SQL.Add('INSERT INTO tblUsers'); DB.SQL.Add('(FirstName,Surname,Username,Password,Grade)'); DB.SQL.Add('Values (:Firstname, :Surname, :Username, :Password, :Grade)'); Db.Parameters

Array Property, TList, TStringList, or TCollection, etc (Delphi Win32)

大憨熊 提交于 2020-01-11 09:08:24
问题 I am developing various components, and regularly run into the need to have a property that has a "one-to-many" relationship, component-to-property-member. The components are often visual components, but not always, and sometimes need to be registered with the IDE (i.e. use the Property Inspector), but not always. I find myself unsure of which route to take when setting up these properties -- using an array property, a TList, a TStringList, a TCollection, or something else altogether (perhaps

How to implement reference counted objects in Delphi

亡梦爱人 提交于 2020-01-11 07:33:09
问题 I have a graph like structure. I don't know exactly when to destroy the objects in traditional Delphi manner, instead I would like to implement something like reference counted objects. I know that I can use something like object.GetReference and object.Release instead of Free, and use a private variable for reference counting, but is there any better way? Thanks 回答1: If you have problems determining the correct way (place, order and so on) of destroying standard objects in a Delphi program,

How to implement reference counted objects in Delphi

一曲冷凌霜 提交于 2020-01-11 07:33:05
问题 I have a graph like structure. I don't know exactly when to destroy the objects in traditional Delphi manner, instead I would like to implement something like reference counted objects. I know that I can use something like object.GetReference and object.Release instead of Free, and use a private variable for reference counting, but is there any better way? Thanks 回答1: If you have problems determining the correct way (place, order and so on) of destroying standard objects in a Delphi program,

TmemoryStream Server Out Of Memory On receiving stream

百般思念 提交于 2020-01-11 07:26:10
问题 All I'm trying to do is send a stream with TSockets, but I'm having an "out of memory" error. I managed to send files, just not images. In the server Form's OnCreate event, I'm creating the stream. For the client, in the Form's OnCreate I'm creating the stream, also a bmp. I've tried to see if it's not sending, but it's sending something, only I can't tell what. On the server side, I've tested sending commands to the client, and I know they send, also I've tested with booleans, but still get

Getting External Exception C0000006 in D2006 app - how can I force delphi to load the whole executable?

 ̄綄美尐妖づ 提交于 2020-01-11 06:45:13
问题 I get this occasionally when exiting my app - my app is running the EXE over a network. I understand it's a page fault when part of the EXE is loaded on demand. I have also observed it in the OnDrawCell method of a TDrawGrid, so I'm mystified how that might have caused a page load. Also, the exception kept happening. So my questions: Can Error C0000006 result from other causes? I have made fairly major changes to the way the app manages memory, though nothing out of the ordinary, and I'm

Delphi TFloatField.DisplayFormat for numeric fields less than 1.0

大城市里の小女人 提交于 2020-01-11 06:13:29
问题 This is my procedure. procedure format_integer_field(Atable: TDataSet); var i: integer; begin if Atable.Active then if Atable.FieldCount > 0 then with Atable do begin for i:= 0 to FieldCount-1 do if (Fields[i] is TIntegerField) then begin (Fields[i] as TIntegerField).DisplayFormat := '###,###'; (Fields[i] as TIntegerField).EditFormat := '#'; end else if (Fields[i] is TFloatField) then begin (Fields[i] as TFloatField).DisplayFormat := '###,###.##'; (Fields[i] as TFloatField).EditFormat := '#.#