I did not find rest client solution for delphi 2007. I end up using indy for this. I use LkJson to handle json. class function TSampleApp.Hello(AModel: TModel): Integer; var idHttp: TIdHTTP; url, sjsonresponse, sjsonrequest: string; strRequest: TStrings; jsonObj: TlkJSONobject; begin Result := -1; url := 'http://localhost:49272/api/test/hello'; idHttp := TIdHTTP.Create; try...
r,delphi,delphi-xe5,linear-interpolation
Linear interpolation of 1D-data is very simple: Find such index in X-array, that X[i] <= Xb < X[i+1] (binary search for case of random access, linear search for case of step-by step Xb changing) Calculate Yb = Y[i] + (Y[i+1] - Y[i]) * (Xb - X[i]) / (X[i+1] - X[i])...
Two ways roll this back: 1) delete the RADStudioRepository.xml file that resides in \AppData\Roaming\Embarcadero\BDS\12.0. Delphi recreates a default file when restarted 2) edit the RADStudioRepository.xml file to remove the offending entries....
delphi,redirect,indy,delphi-xe5,indy10
Client behavior for handling the HTTP 302 reply code is ambiguous, and often treated erroneously by various clients. This is well documented in various RFCs, including 2068 and 2616. The 303 reply code was created to resolve the ambiguity, but many clients still do not support 303 yet, and many...
delphi,conditional-statements,delphi-xe5,conditional-compilation,defined
According to the Delphi documentation: http://docwiki.embarcadero.com/RADStudio/XE6/en/Conditional_compilation_%28Delphi%29 The conditional directives {$IFDEF}, {$IFNDEF}, {$IF}, {$ELSEIF}, {$ELSE}, {$ENDIF}, and {$IFEND} allow you to compile or suppress code based on the status of a conditional symbol. The {$IFDEF} and {$IFNDEF} only allow you to work with defines previously set by {$DEFINE ...}. However the...
delphi,layout,firemonkey,delphi-xe5
It is correct to call Grid.ControlCollection.Clear to delete the items in the collection. From Help: Clear empties the Items array and destroys each TCollectionItem. Note the "destroys", which means it takes ownership and resposnibility of managing the lifetime of the image. You say: an access violation occurs when one of...
delphi,timer,countdown,delphi-xe5
You did not say how (in which format) the time is to be entered in the TEdit, so here are three alternative time entry possibilities. The output is anyway formatted as H:M:S. I modified the code from yesterday to use TryStrToInt / TryStrToTime to catch errors. Also, a Seconds counter...
arrays,delphi,generics,delphi-xe5,dynamic-arrays
As already answered, TArray<XXX> is exactly like any other custom type defined as array of XXX. In fact, TArray<XXX> is a custom type defined as array of XXX. That said, a custom type defined as array of XXX is not equivalent to array of XXX in the context of a...
Delphi IDE is far from perfect when it comes to editing/compiling packages but you should solve the problem on your side - configure your packages better and Delphi will compile them correctly. I can only give you general advices addressing the info given: If you need a common include file...
delphi,google-chrome,delphi-xe5
Chrome allows you to pass a position and size on the command line with --window-position and --window-size I believe. Check out this page for details.
delphi,delphi-xe5,fastreport,vcl-styles
Effectively both issues it seems VCL Styles bugs. 1) Q: The toolbar gets a white border around it. A: The TToolBarStyleHook Style hook in not handling the BorderWidth property. so you must create a new style hook and override the PaintNC to overcome this issue. type TToolBarStyleHookEx = class(TToolBarStyleHook) protected...
delphi,delphi-xe5,delphi-ide,object-inspector
You have appeared to have reverse engineered the meaning of the asterisk. Since I guess you have no source for the design time component code you'll need to rely on such reverse engineering, or any documentation that you can find. In the comments you wonder how the component could cause...
delphi,listbox,firemonkey,delphi-xe5
To adjust form's height or width to accommodate some content you should use ClientWidth and ClientHeight properties of the form rather that Width and Height ClientWidth and ClientHeight hold dimension of form without border, caption and menu area....
java,delphi,pascal,delphi-xe5,modbus
As you said, a Delphi Word is an unsigned 16 bit type. The Java char likewise is an unsigned 16 bit type. However, you mention Word in the question, but it doesn't appear in the code. Well, you use Word in ReadHoldRegisters but nowhere in Add_CRC16 is the Word type...
You're not using TCharHelper; you're using the old System.Character IsDigit function instead. The way to use TCharHelper.IsDigit is: if c.IsDigit then ... ...
web-services,delphi,wsdl,delphi-7,delphi-xe5
I have use THTTPRIO.OnBeforeExecute for change SOAPResponse.Then delete unnecessary attribute and type in XML source and packing again and assign it to SOAPResponse and send it. In this method the problem was solved....
You are never releasing TORDEN variable, hence the memory leak, and error you get when you do try to release it is caused by following lines: for LValue in d do if (LValue as TJSONOBJECT).GetValue('ss').Value = '0' then dlnew.AddElement(LValue); LValue is owned by d and will be released when d...
Disclaimer: I am not a lawyer. Assumption: You want to use foreign code in your application that is licensed as GPLv2 only. The only legal way to write software against such code is to make your own source code available as GPLv2 (or a compatible license) as well. You can...
I created a simple application with a list view, set it into report mode, added some items, and added this OnShow event: procedure TForm1.FormShow(Sender: TObject); begin ListView1.Items[1].Selected := True; end; The specified item was indeed selected. The conclusion that I draw from this is that the Selected property can be...
I'm not sure if it's possible. Even if it were, it doesn't sound like a reliable solution. FireDAC would need to have some explicit option to define a working directory for its design time part. Otherwise it would be tied to the IDE's working directory. Instead I would make a...
You cannot save it, that is theme that is not drawn with help of VCL Styles, but by Windows itself.
delphi,informix,delphi-xe5,firedac
I made it work out using following query in my stored proc: SELECT DBINFO('sqlca.sqlerrd1') FROM SYSTABLES WHERE tabname = '<tablename>' and return the same value in Stored Proc....
Try this method it works for me procedure TData.InsertItem(someObject: TSomeObjectClass); var qry: TFDQuery; begin qry := CreateQry( 'insert into SomeObject(id, description, something)'+ ' values (:id, :description, :something);', false); qry.Params.ParamByName('id').AsInteger := someObject.id; qry.Params.ParamByName('description').asstring := someObject.description; qry.Params.ParamByName('something').asstring := someObject.something; qry.Prepare; qry.execsql; qry.Free; end; I've put and object in the parameter but you...
android,delphi,gmail,firemonkey,delphi-xe5
Found it: procedure TfrmSendMail.CreateEmail(const Recipient, Subject, Content, Attachment, Attachment2: string); var Intent: JIntent; Uri: Jnet_Uri; AttachmentFile: JFile; begin Intent := TJIntent.Create; Intent.setAction(TJIntent.JavaClass.ACTION_SEND_MULTIPLE); Intent.setFlags(TJIntent.JavaClass.FLAG_ACTIVITY_NEW_TASK); Intent.putExtra(TJIntent.JavaClass.EXTRA_EMAIL, StringToJString(Recipient)); Intent.putExtra(TJIntent.JavaClass.EXTRA_SUBJECT, StringToJString(Subject)); Intent.putExtra(TJIntent.JavaClass.EXTRA_TEXT,...
Look here: http://blogs.embarcadero.com/sarinadupont/2013/10/17/463/ Is an example for mobile, but you use in desktop too....
Apart from time travel which is already mentioned in the comments I think there is no other way to recover your code. But you can avoid this in the future by installing DDevExtensions. This extension creates backups of your files after every successful compile. Or you can check Autosave in...
delphi,rest,utf-8,gzip,delphi-xe5
Remy Lebeau's input in his answer to this question as well as his comment to the answer in the question Automatically Decode GZIP In TRESTResponse? put me on the right track. Like he said, setting AcceptEncoding doesn't suffice, because the TIdHTTP that performs the actual request doesn't have a decompressor...
The supported way to fake input is not to use SendMessage and PostMessage. Instead call SendInput which places input events into the message queue of the foreground window. This is how the .net SendKeys method is implemented. In the comments you say that you used keybd_event. This is not advisable....
delphi,grid,delphi-xe,firemonkey,delphi-xe5
The style here is so different from a standard TListBoxItem style that is probably makes sense to start from scratch, in which case the issues with accessing the default styles become immaterial. Add a TStyleBook to your form. Set the StyleBook property of the form to point to it. Double...
multithreading,delphi,delphi-xe5
The problem is that TThread.Synchronize() is broken in FireMonkey. See this QC report: Report #123579: TThread.Synchronize() and TThread.Queue() do not work correctly in FireMonkey This has only just recently been discovered, but it has been broken since FireMonkey was first introduced and nobody apparently noticed until now. Until Embarcadero fixes...
android,database,multithreading,delphi,delphi-xe5
Problem The problem is that the TImageLoader.LoadImage loads the data from the net asynchronously. Because of that the data is not yet available at the time when you're loading the data. Simple solution In order to stop TImageLoader from doing that you can add an extra method to it and...
delphi,delphi-xe5,dynamic-arrays,tfilestream
Is the file large ? Can it fit into RAM all at once ? You basically have two simple options to create a DynArray out of the file, but they are only recommended for small to middle files. 1: http://www.freepascal.org/docs-html/rtl/classes/tbytesstream.html var BS: TBytesStream; b: byte; L, i: integer; begin BS...
System.Math unit contains Infinity constant to represent IEEE754 Inf pseudovalue(1.0/0.0). There are also a lot of MaxDouble, MaxExtended etc constants in this unit (look at Variables section here). This short test works as needed, so I suspect your component may have some kind of range checking or have property editor...
delphi,delphi-xe5,anonymous-methods
You're seeing undefined behavior. The article you cite mentions that the method reference needs to remain alive for the lifetime of the method pointer, but your code breaks that rule. The object associated with the method reference may get destroyed, so the dbGrid variable that held the captured value no...
As @J... suggested the problem was that (somehow) the dynamic arrays were falling out of scope when sending the request. To solve the problem we are assigning to each dynamic array property of the request a copy of the same dynamic array after creating the request but before sending it...
delphi,delphi-xe5,virtualtreeview
I found this Link and changed the awnser to fit my code. Data.Symbol[1] //Simply points to a char. So I changed it to 'char' Read: Stream.Read(Len, SizeOf(Len)); SetLength(Data.Column0, Len); Stream.Read(PChar(Data.Column0)^, Len * SizeOf(Char)); //Copy/Paste this code for all Columns Write: Len := Length(Data.Column0); Stream.Write(Len, SizeOf(Len)); Stream.Write(PChar(Data.Column0)^, Length(Data.Column0) * SizeOf(Char)); //Copy/Paste...
The IDE Insight window was removed in XE5. Instead, there's an edit box top right of the screen (Ctrl+. gives it the focus) that you type into and get a dropdown list of commands to pick from in response. This is documented in What's New in Delphi and C++Builder XE5....
From the comments, you have Dropbox, and the Restore functionality is available, but using it would cost you a week's worth of work. If I was in that situation, here's what I would do: Copy the current file to somewhere else (My Documents, for example). Use Dropbox Restore to get...
delphi,firemonkey,delphi-xe5,firemonkey-fm3
When you create the TPopupTest in your form you have to set the creator's owner to your Form, as well as the Parent. Changing the Unit to something like this will make it appear but it's not exactly as you picture it, you will have to refine it a bit....
As stated on the top of the question there is a generic answer for this question. There is a need of the style windowborderstyle be present and all these descendant stuff. However the Firemonley Styles MetropolisUI that comes with Delphi XE2 - XE5 do not have that style defined. If...
android,delphi,delphi-xe5,file-location
I finally found out how to solve this. By using TPath.GetSharedDocumentsPath I could see the file saved from the app on the pc if the device NOT was connected as a drive when saving (mentioned on this page). E.i. When using the app, the pc can't be using the sdcard...
delphi,time,format,delphi-xe5,stopwatch
See http://docwiki.embarcadero.com/Libraries/en/System.SysUtils.Format labelSW.Text := Format('%2.2u:%2.2u:%2.2u:%3.3u',[Hour,Min,Sec,MSec]); The precision specifier makes left padding with zeroes. Using the RTL TStopwatch advanced record in System.Diagnostics, it gets a little easier: uses System.SysUtils, System.Diagnostics; var sw: TStopwatch; ... sw := TStopwatch.StartNew; // Start measuring time ... procedure TForm1.TimerSWTimer(Sender: TObject); begin LabelSW.Text := FormatDateTime('hh:nn:ss:zzz',sw.ElapsedMilliseconds/MSecsPerDay);...
windows,delphi,installation,components,delphi-xe5
It's likely that you are trying to load the 64 bit version of the package. This should not be loaded at design time. The instructions for building the Cindy library include building both the 32 bit packages and 64 bit packages. Make sure that you build both but only the...
Post is automatically called when the user navigates to another record. The only time you need to call Post is if the currently selected record has pending changes at the time you close the form. But even then, you don't have to call Post explicitly: there's a helper function CheckBrowseMode...
android,delphi,scroll,delphi-xe5
You need to place a control such as a TLayout as the immediate child of the TScrollBox. Set it's Position at (0,0) and Height/Width as necessary for your controls. This size is what is used by the scroll box for it's scroll bars. Then place your actual controls onto the...
As a last resource I have decided to open the MetropolisUI.Style on notepad and take a look on what is inside. I have found that "editstyle" that is the default for TEdit has the following structure: object TLayout StyleName = 'editstyle' Height = 50.000000000000000000 Width = 50.000000000000000000 FixedHeight = 32...
delphi,vcl,delphi-xe5,teechart
You can exploit unused AXLabel argument like this: for DevIndex := 0 to DeviceCount - 1 do begin Device := FDevices[DevIndex]; BubbleSeries.AddBubble(Device.CalculateXVal,Device.CalculateYVal, Device.CalculateRadius, IntToStr(DevIndex)); end; // to avoid labels' text ox X-Axis: Chart1.BottomAxis.LabelStyle := talValue; //in Clicked: DeviceIndex := StrToInt(BubbleSeries.Labels[Index]); ...