Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 07/30/21 in Posts

  1. Uwe Raabe

    Prevent from closing when....

    The VCL already provides such a flag for you: TApplication.ModalLevel
  2. darnocian

    Parsing Text search expression

    I felt like playing with this idea for Delphi - as like writing parsers. 😉 Years ago I did something similar for a document management system in a different language. I've written a small demo illustrating 2 ways of parsing https://github.com/sempare/sempare-delphi-fts-expression I did this for fun and in a few hours, so it is still very raw. It contains a hand rolled lexer and parser, but hopefully can give you some ideas how to do this too. In the first (Sempare.FullTextSearch.SimpleExpression.Test.pas) you can see some scenarios: procedure TSimpleExprTest.TestSimpleExpr; begin assert.AreEqual('name = ''conrad''', tparser.ParseStr('name', '"conrad"')); end; procedure TSimpleExprTest.TestWildCard2Expr; begin assert.AreEqual('(name like ''conrad%'') or (name like ''%pete'')', tparser.ParseStr('name', '"conrad%" "%pete"')); end; procedure TSimpleExprTest.TestWildCardExpr; begin assert.AreEqual('name like ''conrad%''', tparser.ParseStr('name', '"conrad%"')); end; procedure TSimpleExprTest.TestNotExpr; begin assert.AreEqual('not (name = ''conrad'')', tparser.ParseStr('name', 'not "conrad"')); end; procedure TSimpleExprTest.TestOrExpr; begin assert.AreEqual('(name = ''abc'') or (name = ''def'')', tparser.ParseStr('name', '"abc" or "def"')); end; procedure TSimpleExprTest.TestPrecidentExpr; begin assert.AreEqual('(name = ''abc'') and (not ((name = ''321'') or (name = ''def'')))', tparser.ParseStr('name', '''abc'' and not ''321'' or ''def''')); end; The second (Sempare.FullTextSearch.Expression.Test.pas) is a bit more general. It illustrates parsing, but implementation at present is fairly basic as just a pretty printer: procedure TExprTest.TestNotExpr; begin assert.Areequal('not (name != ''conrad'')', tparser.ParseStr('not (name!="conrad")')); end; procedure TExprTest.TestOrExpr; begin assert.Areequal('(name = ''abc'') or (text = ''def'')', tparser.ParseStr('name = ''abc'' or text = ''def''')); end; procedure TExprTest.TestPrecidentExpr; begin assert.Areequal('((name = ''abc'') and (value = ''321'')) or (text = ''def'')', // tparser.ParseStr('name = ''abc'' and value = ''321'' or text = ''def''')); end; procedure TExprTest.TestStartsWithExpr; begin assert.Areequal('name like ''abc%''', tparser.ParseStr('name starts with "abc"')); end; above you can see that the parsing identifies the precedence and places brackets appropriately. Also it changed 'starts with' to 'like'... NOTE: there are 2 different parsers implemented for the above scenarios (but both named TParser - just depends which unit is being referenced) Hope you find this useful.
  3. I’ve been exploring this for my Delphi app which needs to support WidgetKit (iOS 13-style) Home Screen widgets. Getting the widget built and working with my app was easy enough but I’m struggling to force it to update when data changes as the WidgetKit API is swift only. I’ve tried creating a native Obj-C static library which contains the bridging headers to call the swift code, and tried a swift static library with the @objc tags to expose the correct headers but Delphi just won’t see the exposed classes. If I pull the libraries above into native ObjC apps they both work fine but Delphi can’t seem to see the classes exposed, even though they link into the app using the fake loader method. I feel like I’m so tantalisingly close to getting this working so I’ll keep digging and post here if I get it working.
  4. Thank you all for the help and comments. I went with VMWare Workstation PRO and I am quite satisfied. The system is very responsive, all custom hardware that we are developing works trough USB and network. I am using Veracrypt for encrypted containers where I keep the source code (in case my PC gets stolen) and it work flawlessly. My reasons for virtualization: Privacy. I plan to switch to Linux by the end of the year. I don't want Windows to be my main OS any longer. I plan to use hardware with Intel ME, Webcam, Audio, WLAN/Bluetooth switchable. There are at ton of reasons, but that is another discussion. Tedious setup. I have hundreds of my own libraries and packages. I have over 20 commercial 3rd party packages (tools) and they are all interconnected. This means that it takes a lot of time to setup system that truly works. I also need to keep older versions of RAD Studio Enterprise for debugging/compiling older products, where customers did not upgrade to newer software. With VMWare I will be able to switch between versions fast. Portability/backups, I want to switch my development environment to another machine fast in case of main PC gets broken or stolen. I do backups almost on daily basis. Testing. I want to test the software with clean Windows with our tools and databases preinstalled. But nothing else. Windows Sandbox is not useful in my case. Low spec machine simulation testing, etc. I still have testing computers that are running native Windows OS for some development and testing. OFC the performance and speed of native development is important, that is why I will not switch my Unreal Engine development to virtualization, that would be disastrous. But I can setup my full Unreal Engine environment + Visual Studio in 5 hours and it also works natively on Linux. Kind regards
  5. A.M. Hoornweg

    VMWare Workstation PRO vs MS Hyper-V

    Some advantages of using virtualization: Backing up a vm is as easy as copying a file. If you break something in a vm, it doesn't affect the host machine. If you decide to replace your host machine with a new one, you're up and running again within an hour. I've configured my VM to use separate virtual disk files for C: and D: and I keep my projects on D:. Whenever I update Delphi, I archive the virtual C: drive first. This makes it dead easy to fire up an older Delphi version whenever I need it.
×