Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 08/26/20 in all areas

  1. Lars Fosdal

    Get started writing Linux apps

    I wrote a small cookbook on getting Ubuntu up and running and setting up Rio and Sydney for compiling Linux applications.
  2. FinalBuilder is a fully featured automated build tool, which supports Delphi 3 to 10.4, along with C++Builder 4 or later. FinalBuilder makes it simple to automate your entire build process, from compiling your Delphi and C++Builder projects to compiling and uploading installers, creating ISO's. There are over 600 built in actions, with support for Git, Mercurial, Perforce, Subversion, TFS and many other version control systems. Unlike xml or batch file based systems, with FinalBuilder you can easily debug your build process, with breakpoints, step over, step into etc. Of course FinalBuilder also integrates with Continua CI - our continuous integration server product, and with other CI servers such as Jenkins. Thousands of Software Developers rely on FinalBuilder to automate the build, test and release process. If you are not using FinalBuilder to automate your builds, you are missing out. Download a fully functional 30 day trial version today.
  3. Angus Robertson

    ICS for Linux?

    PAServer is finally running after adding a second virtual network adapter for the default switch, which means PAServer now has two IP addresses 192.168.1.137 and 172.23.99.102 and I can connect to the second one. Something strange about Hyper-V on Windows 10., I've had VMs running on Windows Server for 12 years with external public access with public and LAN IPs, and never needed to add a second network adaptor. Delphi is currently transferring a lot of stuff somewhere, so not managed to build a package yet. Thanks again for pointing me in the right direction. Angus
  4. Dalija Prasnikar

    Boolean short-circuit with function calls

    Many features can be nicely added to the Pascal and fit well. https://docs.elementscompiler.com/Oxygene/Delphi/NewFeatures/ The people you talk about are not really Pascal purists, rather people that can't be bothered to learn something new. Delphi never suffered from purists... even its predecessor Turbo Pascal was always innovative and expanded features on top of standard Pascal. We would not have Pascal with objects otherwise. Probably not. Ternary operator is easier to implement than whole nullable support. But like with many other compiler features, someone needs to implement all that - that is the weakest point and the core issue, not "purists" as such.
  5. pyscripter

    Looking for SVG support in Delphi?

    In an earlier thread I presented an Interface-based access to native Windows (Direct2D) SVG support for Delphi applications. This has now been integrated into the SVGIconImageList components by @Carlo Barazzetta. Carlo is a kind of master of ImageLists (among other things). Have a look at his IconFontsImageList for instance. His SVGIconImageList component was based on the work of Martin Walter who must be a great programmer. His SVG component covered almost every SVG element and was well structured and cleanly written. There were numerous bugs and issues though, which, to a large extent, were fixed over the last few weeks and the code was refactored and optimized. Finally, @Vincent Parrett contributed a virtual version of the Image List, mirroring Delphi's VirtualImageList. So in its current form the component features: An SVGImageCollection component that inherits from Delphi's CustomImageCollection and thus is compatible with VirtualImageList A choice of SVG engines: the pascal one based on Martin's work which is using GDI+ and the native Windows one which is using Direct2D. Other SVG engines can be plugged-in with minimum effort. Excellent design support with a nice and effective SVGImageCollection editor developed by Carlo and the built-in VirtualImageList editor. Support for changing the opacity and color of the SVGs including using GrayScale. If you adopt Material Design for example and you use VCL styles, you can adjust the icon color to the style. Compatibility with older Delphi versions going back to XE6. It is free and open-source Svgs are vastly superior to bitmaps because they are typically tiny text files and scale perfectly. So, you do not need to ship with your application multiple resolutions of your images to match the DPI of the monitors. And there is a vast number of free SVGs to cover most needs. IMHO the combination of SVGImageCollection with Delphi's VirtualImageList is the best available solution (commercial ones included) for building DPI-aware Windows applications. Give it a try.
  6. Dalija Prasnikar

    Boolean short-circuit with function calls

    The only mention for nullables was in context of custom managed records that are prerequisite for implementing nullables. From that perspective we kind of have nullable support right now in 10.4. But that is far from having full compiler support for nullable types. Nullable types include way more than just defining common RTL type (we don't even have that in 10.4) and one of the things that such support also implies (assumes) is ternary operator. Additionally ternary operator has more broader usage scope than nullables themselves and thus is more interesting, worthwhile feature.
  7. Kind of a habit, I'm always using FreeAndNil. At least If Assigned(something) works properly 🙂
  8. Lars Fosdal

    RTF components or simple RTF editor?

    Why... Who knows why.
  9. Lars Fosdal

    ICS for Linux?

    The Ubuntu 18.04 that my Hyper-V Quick Create offers me, has the visual UI - so not a pure server, perhaps?
  10. Angus Robertson

    ICS for Linux?

    Thanks, will read your blog. When starting the UBUNTU 18 VM, I get an error window saying: connecting to sesman ip 127.0.0.1 port 3350 sesman connect ok sending login login successful started connecting connection problem, giving up some problem which a little searching indicates is a known problem - Issues with xRDP and Ubuntu 18.04.2 – How to fix it https://c-nergy.be/blog/?p=13390 but without xRDP you can not follow the instructions. Angus
  11. Fr0sT.Brutal

    Automated Way to Detect Interface Breaking Changes

    You can use SemVer versioning scheme to determine breaking changes and parse project/package files to determine dependency tree so you'll get a list of packages that need to be updated.
  12. FPiette

    RTF components or simple RTF editor?

    Try this: http://svn.code.sf.net/p/radstudiodemos/code/branches/RadStudio_XE6/Object Pascal/VCL/RichEdit/ For unknown reason, Embarcadero removed that demo for later Delphi versions.
  13. Sherlock

    how to run git commands from Delphi app

    Best practice has always been to just build the command line and execute that. No hassle with DLL changes, no issues with 32Bit vs. 64Bit and last but by far not least: easy testing by just copying the generated command line into a terminal and checking the output.
  14. Eli M.

    ICS for Linux?

    20.04 is not officially supported in 10.4 according to the release notes. http://docwiki.embarcadero.com/RADStudio/Sydney/en/Installation_Notes
  15. Fr0sT.Brutal

    Enums and generics

    // *************************************************************************** // Static class to convert enum value <=> enum name // *************************************************************************** TEnum<T> = class strict private class var FPTypInf: PTypeInfo; FMin, FMax: Integer; {$IFDEF CAPS_CLASSCONSTROK} class constructor Create; {$ELSE} class procedure Init; {$ENDIF} class procedure CheckRange(Item: Integer); inline; public // T => Int class function Int(Item: T): Integer; overload; inline; // Str => Int class function Int(const Name: string): Integer; overload; inline; // Int => T class function Val(Item: Integer; CheckRange: Boolean = True): T; overload; inline; // Str => T class function Val(const Name: string): T; overload; inline; // T => Str class function Str(Item: T): string; overload; inline; // Int => Str class function Str(Item: Integer): string; overload; // Search for Item in Values array and return its index as T class function Find(const Item: string; const Values: array of string): T; overload; class function Find(const Item: Char; const Values: array of Char): T; overload; class property Min: Integer read FMin; class property Max: Integer read FMax; end; {$REGION 'TEnum<T>'} {$IFDEF TYPES_GENERICS} {$IFDEF CAPS_CLASSCONSTROK} // Perform some checks and save type properties. // Executed on unit init if the class is used, raises exception if type is invalid. class constructor TEnum<T>.Create; {$ELSE} class procedure TEnum<T>.Init; {$ENDIF} begin FPTypInf := PTypeInfo(TypeInfo(T)); // type info check if FPTypInf = nil then raise Err(S_E_NoTypeInfo); // run-time type check if FPTypInf.Kind <> tkEnumeration then raise Err(S_EEnum_NotAnEnum, [FPTypInf.Name]); // get range FMin := GetTypeData(FPTypInf).MinValue; FMax := GetTypeData(FPTypInf).MaxValue; end; // Check if Item in enum range class procedure TEnum<T>.CheckRange(Item: Integer); begin if (Item < FMin) or (Item > FMax) then raise Err(S_EEnum_NotInRange, [Item, FMin, FMax, FPTypInf.Name]); end; // Integer => Enum member, the same as Integer(T) // CheckRange: controls whether checking if Item belongs Low(T)..High(T) will // be performed. Useful to return T(-1) as invalid value. class function TEnum<T>.Val(Item: Integer; CheckRange: Boolean): T; var p: Pointer; begin {$IFNDEF CAPS_CLASSCONSTROK} if FPTypInf = nil then Init; {$ENDIF} if CheckRange then Self.CheckRange(Item); p := @Result; case SizeOf(T) of 1: PUInt8(p)^ := UInt8(Item); 2: PUInt16(p)^ := UInt16(Item); else raise Err(S_EEnum_WrongSize, [SizeOf(T)]); end; end; // Enum member => Integer, the same as T(Int) class function TEnum<T>.Int(Item: T): Integer; var p: Pointer; begin p := @Item; case SizeOf(T) of 1: Result := PUInt8(p)^ ; 2: Result := PUInt16(p)^; else raise Err(S_EEnum_WrongSize, [SizeOf(T)]); end; end; // Integer => String class function TEnum<T>.Str(Item: Integer): string; begin {$IFNDEF CAPS_CLASSCONSTROK} if FPTypInf = nil then Init; {$ENDIF} CheckRange(Item); Result := GetEnumName(FPTypInf, Item); end; // T => String class function TEnum<T>.Str(Item: T): string; begin Result := Str(Int(Item)); end; // String => Integer class function TEnum<T>.Int(const Name: string): Integer; begin {$IFNDEF CAPS_CLASSCONSTROK} if FPTypInf = nil then Init; {$ENDIF} Result := GetEnumValue(FPTypInf, Name); if Result = -1 then raise Err(S_EEnum_NoValueForName, [Name, FPTypInf.Name]); end; // String => T class function TEnum<T>.Val(const Name: string): T; begin Result := Val(Int(Name)); end; // Find string representation in array of strings and return T // Similar to Val(Str) but Text and Values could be arbitrary. // Returns T(-1) if Text not found class function TEnum<T>.Find(const Item: string; const Values: array of string): T; begin Result := Val(FindStr(Item, Values), False); // Turn off range check to return -1 end; // The same but for Chars class function TEnum<T>.Find(const Item: Char; const Values: array of Char): T; begin Result := Val(FindChar(Item, Values), False); // Turn off range check to return -1 end; {$ENDIF} {$ENDREGION} // usage TEnum<TSomeEnum>.Str(seFirst) => 'seFirst' TEnum<TSomeEnum>.Val('seFirst') => seFirst TEnum<TSomeEnum>.Find('First', ['Fisrt', 'Second']) => seFirst Just note that only "naturally numbered" enums have type info (if any of elements has explicit index assignment, no type info is generated)
  16. David Heffernan

    Enums and generics

    I do this; [Names( 'Curvature', 'Bend angle' )] TPreBendSpecifiedBy = ( pbsCurvature, pbsBendAngle ); and then I can write: Assert(Enum.Name(pbsCurvature) = 'Curvature')) Of course this requires some library code behind it, but it's pretty convenient.
  17. In general, if you have a function that takes arguments, and you supply functions to get values for those arguments, then by necessity all of the parameter functions will be evaluated before the function itself is called. This is a point of contention with people who would like to see a trinary operator added to Delphi similar to what's in C/C++ (and many other languages). boolean rslt = a ? b : (c ? d : (.....) ); vs Result := func( a, b, c, d, ..... ) The trinary operator will only evaluate the parameters as they are needed, while Delphi will always evaluate ALL of the functions given as parameters to func. (rslt = a ? b : c) in c/c++ does not always produce the same result as rslt := IfThen( a, b, c ) in Delphi. In the former, 'c' is not evaluated if 'a' <> 0 (ie., true), and 'b' is not evaluated if 'a' = 0. But in the latter, a, b, and c are ALL evaluated BEFORE IfThen is called. This is particularly relevant if you want to use a construct like this to test if a reference is assigned or not: rslt := IfThen( Assigned(obj_ref), obj_ref.xyz, NIL ) will throw an exception when it attempts to evaluate the second parameter when obj_ref = NIL. That's exactly what you're trying to avoid! rslt = (Assigned(obj_ref) : obj_ref.xyz ? NIL) does what you'd expect all the time. Interestingly, we have to suffer through this mess with lengthy if...then...else tests waiting for "nullable" values to be added to the language (after 25+ years) rather than stoop so low as to implement a simple construct that solves the problem very elegantly and simply, but is regarded as too offensive to "Pascal purists" who think it's sacreligious to steal such a construct from c/c++ for ANY reason! Yes, we'll see nullable values added to Delphi long before a trinary operator.
  18. ARPACK is recommended for extracting a small number of eigen vectors from a huge problem. LAPACK has effective methods for extracting all solutions using a direct method. Neither are easy to use from Delphi. I have done so but it isn't for the faint of heart. Especially ARPACK. The famous C++ Eigen library is very capable though and easy to use. I'd suggest you wrap that in a DLL. Start in Matlab to prove that it can do the calculation sufficiently quickly for a typical matrix that you will work with. Then write a C++ program in Eigen to solve the same problems. Does that work effectively? Then, and only then, try to wrap it up to be called from Delphi.
  19. And what exactly is wrong or not understandable in a week with using {B+} and a simple one liner?
  20. Why does anybody think that all this guessing would be useful? Does anybody have much experience of success when guessing? Solving eigen problems is a very challenging numerical problem. Does anybody really believe that good solutions arise from guesswork? I am frankly embarrassed by this thread.
  21. Yeah, that one is really annoying. I used to have a class helper that added TZipFile.Delete and Remove methods but one of the Delphi versions after XE2 broke that one as the required TZipFile internal data structures are no longer accessible to class helpers.
×