Jump to content

Tntman

Members
  • Content Count

    76
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by Tntman


  1. 3 hours ago, Alexander Elagin said:

    There is nothing difficult. You can use a serial port (if the host PC doesn't have one, a simple USB-to-COM adapter will do) as a simple communication channel - serial data exchange has been used for decades in multiple industrial applications built with Delphi. In fact, this is the area (custom hardware control / monitoring) where Delphi is used in many companies, but of course most of these applications never appear in public.

    Agree, i sent him some code samples, its just few lines of code really .. Also a lot of people that repair and diagnostic cars in my country use delphi software


  2.  

    18 hours ago, David Heffernan said:

    How are you generating the original html? 

    Answer to this question is crucial for helping him out i think ..

     

    Anyway i can recommend "webpack" for this job..

     for example in web development I am using webpack and some other tools/libraries to minify code and it is helping a lot. that said maybe owner of this topic could try to incorporate it somehow in his project..


  3. I will send you link to my website over pm since im not sure if it is allowed to post or advertise here .. Just to say my site is not finished 100% but u will find some stuff that is documented about arduino ( scripts that are commented ) , also u will find some useful stuff for writing delphi PC apps that send commands to arduinos ( library that is not mine ) when u download library there are some demo applications so u will figure out everything , its pretty easy but still if u have any questions send me PM anytime .. 

     

    For android i were using winsoft trial library because i wanted to do things fast, I will rewrite it probably 


  4. 1 hour ago, aehimself said:

    I even minified a project to a single ATMega chip for extra efficiency

     

    Minified versions are cool but i dont have space and i didnt want to use my poor soldering skills for this lol i was more oriented to writing software..

     

    1 hour ago, aehimself said:

    can I talk to this board with Delphi...?

    You mean to upload delphi code on arduino or just send commands from delphi app that is on PC or mobile ?

     

    Btw i can share anything you want, i also have other delphi arduino projects with code samples


  5. I dropped StyleBook1 on form, i opened it and i edited progress bars,buttons and all other components that my custom style needs. Now i have to update my components to use styles that I made. Is there an option to add some type of global StyleBook component so all of my forms can access it ? I have around 20 forms and i dont want to drop new StyleBook on every form...

     

    I was thinking to make some sort of invisible form ( that form will never be displayed ) where I will have my StyleBook component. After that I will include that form in every other form ( I have 20 other forms ) and try to access StyleBook that way..

     

    What are your solutions ?  


  6. 1 hour ago, limelect said:

    Android Apple the same. See your Delphi publishing to the market.

    You can compile for the market.

    When you compile for Android under configuration there is "Application store".

    On D10.2.3

    See Delphi help

     

    I was thinking that you can just post any .apk to marked ... didnt know that there are some other options for that, i will try to read more about it


  7. 1 hour ago, limelect said:

    This will work. However, I do not know what will happen on the market if it is signed and published

    Can you explain me the procedure and why u think that it could not work ? I have never published any app to market i dont even have acc there 

     

    EDIT: i am talking about android play store, not apple store


  8. 1 hour ago, limelect said:

    Some clarifications

    "I go to bin directory on my windows machine and edit that txt document inside of an .apk file and upload again"

    without any compilations?

    Edit inside of an .apk? how? you disassemble?

    Do you know where your resource is in the Apk file?

    APK is really a ZIP file.

    Your whole procedure is unclear

     

    open in winrar without unziping it so just open. Find text file open it, change data and save text file


  9. I made a lot of apps but I think that this one is most interesting for showing..

     

    I started making my own drone from scratch so in the middle of the process i decided to make app that will control my drone. 

     

    Here is the actual schema how it works:

     

    drdrorod.thumb.png.2c7b1b781b42e0be5fd26600f499d8e4.png

    This project was pretty interesting because i incorporated windows application, mobile application and also an arduino scripts and arduino programming. 

    here is picture of game, basically im moving drone and collecting coins and trying to not hit anything and die..  You can also control drone over pc controls, on the right there is logger that keep track off all commands exchanged 
    drdrdrdrdrdrddr.thumb.jpg.95eba2d6eb920b6d9617c925f18aa2fa.jpg


    Here is picture of mobile control 

    qweqweqwe.thumb.jpg.df6e6e3bb60b90b09bccddcf61993055.jpg

     

    • Like 2

  10. On 4/3/2020 at 1:50 PM, vfbb said:

    You can not change an signed iOS, MacOS or Android app, if the app is not yours. But if you have the source, the app is your, you have many options to save the resources strings, you can save in particular files for it. When we are talking about resources strings for translation, this will allow the store to make smallest packages of your app, because it will not delivery the unnecessary data to the user. For example, a French language will not be included in a user that use English language ... However, this languages files isn’t usually big, and I personally prefer to make a cross platform solution, languages in the source code. Other solution is storing it in a SQLite.

    Hmm so basically i added txt file over the IDE ( option resources and images ). I compile app and run on nox, it installed with no problem, after clicking on a button im loading content of txt file that i added in memo and everything works.

     

    After that i go to bin directory on my windows machine and edit that txt document inside of an .apk file and upload again to nox, install again and open app in nox it works , it is installed and when i click button it loads txt file with different content and everything works fine so im little bit confused now  


  11. I am not sure did you understood my question or maybe i described it poorly so i will try to explain it again..

    Here on this link you can see delphi resource hacker. http://www.angusj.com/resourcehacker/
    Tool is used to update ( edit ) resource strings in windows executables ( .exe ).

    I used this tool to edit resources strings in games ( overwriting money value for example )

    What i want to ask is it possible to make similar application in delphi fmx for windows that will be capable of updating ( editing ) resources strings in other executables for different platforms ( .apk, Linux executable, mac executables, ios executables... )

    Also my other question is where is best place and what is best way to embed/include resource strings that can be updated ( edited ) on other platforms except windows ( android, mac, ios, linux... ). 
     

     


  12. If we talk about windows platform we can embed some resource data ( for example strings ) into our exe. 

     

    For example we have app "A" and app "B". Lets say that app "A" is our main app. App "B" is secondary app ( .exe - windows compiled ) with some RCDATA strings that are embedded in it.

     

    We could load app "B" into app "A" and change resource data in app "B" from app "A" ( this can't be done if app "B" is running, app "B" needs to be closed ).

     

    If we talk about windows platform VCL or FMX we could do this with -> https://docs.microsoft.com/en-us/windows/win32/menurc/adding-deleting-and-replacing-resources

     

    My question is: What or is there any way to do this multi platform ? ( android,ios,mac,wearables,linux ... )

    I suppose that it cannot be done exactly like in windows because some stuff that I mentioned are for windows only.. So what would be the best way to achieve same thing on other platforms ( android,ios,mac,linux,wearables ... )

     

    Also imagine that we have FMX app that is compiled for windows ( we will call it "Win-app" ) and we have other app that is for android and it is built/compiled with delphi FMX ( we will call it "Andro-app" and it will have .apk extension ). Is it possible to load "Andro-app" .apk to "Win-app" and edit embedded resources in "Andro-app" from "Win-app"?  <- Is this also possible for other platforms ( Ios,Mac,linux,wearables - make "win-app" that load and edit for example resoruce strings in "ios-app", "mac-app", "linux-app" ...etc... )

     

    I don't need code, I just need someone to point me out and give me directions and I will try to learn on my own since it is so interesting topic.

     

     

    Thank you :classic_cheerleader:


  13. It does not matter. It's the same idea for mobile, desktop, watch or website... Even if we write apps only for ourselves we should use this approach. I have my own website and few apps and i still use this approach that i wrote... 

     

     


  14. 1 hour ago, Dave Nottage said:

    You cannot rewrite that java code into Delphi code, since it is creating a descendant of a Java class, which is presently not possible with Delphi. You can however create descendant in Java code that can then be consumed by Delphi.

     

    I've been meaning to do a blog post about this for quite some time now because it requires a fair amount of explanation as to how to go about it.

    At the end I though that it is not possible.. At least with my current knowledge delphi syntax and Android... Thank you for explaining it to me, I will try to google more about the stuff you mentioned in your post sounds like interesting topic to learn from


  15. 3 hours ago, Angus Robertson said:

    So how do you suggest the password is entered for a background service application on a hosted server?   Using a token from an authentication server is fine, but how do you get it?

     

    Angus

    If i understood right you have mobile application with service that is working in the background. That service should perform some request/response to a database?

    Here in this design you are missing crucial part and that is web application that will be hosted in the middle, web application code will be on remote server and nobody would see that code ( thats a plus, they basically cant crack it they can only imagine how that application is written although there are some other security concerns ). Your database credentials will be only in web application and only web application will be talking DIRECTLY to a DB. That is why u will be making a public interface that will be available to end user and that is called API ( APplication programming interface ).

     

    your API will be public and anybody could guess you api route for example ( www.mysite.com/api/customers )

    One common way of protecting routes is to restrict them, example:

     

    www.mysite.com/api/customers <- this route is PUBLIC [ GET ] route. Anyone who visit this link will get list of all customers in your database in JSON format for example.

    www.mysite.com/api/otherRoute <- this route is PUBLIC [ GET ] route but this route will have middleware in between request and response. Middleware will check if PERSON who is visiting this route is authenticated, it is authenticated it will return data. Anyone who visit this link ( if is authenticated - have valid token ) will get list of all customers in your database in JSON format for example.

     

    You can basically put any logic in middleware, so for example if user is authenticated we will check if user role is ADMIN, if is we will return list of some stuff that only ADMIN can see. You got the point...

     

    Here is brief example how it should actually work behind the scenes. User visit some api route or application itself visits it ( for example www.mysite.com/api/exampleRoute ). Webapplication is checking request, it is first checking if it is POST or GET request, it is checking also for Request parameters that are passed with request and all other stuff. If validation, middleware and all other stuff pass webapplication will connect to a DB and retrieve requested data and return to end user in JSON or some other format ( usually its json ). If validation fails webapplication will not talk to DB and it will return error response for example. 

     

    Note* Web application could be written in basically any language ( PHP, node js , delphi , python , c....etc... ) I personally use PHP, Laravel ( PHP's Framework ) node and i know little bit Java/Spring...

     

    *************

     JSON web tokens ( JWT ).. JWT's are lightweight implementation or u could use Oauth or Oauth2 implementation but those are more complicated and heavier.. For any of this implementations you have REST debugger in Rad Studio to help you and give you nice GUI interface instead of writing code on ur own.. 

     

    NOTE* If you dont know php,nodejs,python and you dont know how to write api's and stuff i mentioned in this post you could use public API's. There is a big number of publicly avialable api's , crypto apis,weather apis or even twitch api. I used twitch api for my desktop app that tracked list of online streamers and some other stuff..

     

    https://jwt.io/introduction/     <- here u can read more about JWT's i can add that JWTs are stateless so with every request you have to add them as a parameter so server can check if that token is valid,blacklisted etc... 

    NOTE* when i say stateless i mean there is no actual session on web server that is attached to particular user..

     

    So when webserver validate user credentials and return JSON web token you could store that web token anywhere. If we talk about websites ( I am sure that you can open local storage on your web browser and search for tokens from some particular web sites that you use ). 

     

    So you could ask now " What will happen if  someone steal ADMIN token from ADMIN's browser local storage and send it with request and perform operations THAT ARE ONLY RELATED TO ADMIN " ... <- This is possible scenario , but on webserver-database end you could put field in database that will check IP, request user agent and client, if those parameters dont match with previous request it means that someone have stolen token and trying to send request with ADMIN token from different device/browser etc so u could possibly limit it or destroy token or prompt  login page again...

     

    I am probably talking too much and confusing you so i will stop ... Anyway ur question was where do I suggest to save password for a background service? So u are not saving users password, you just prompt login screen so user enters his username and password and perform [ POST ] request to some of your API routes ( for example www.mysite.com/api/login ), if everything is valid you will get JSON web token from server. You save that token. Tokens could have expiration date, that expiration date is set where JSON web token is created. JSON web token that will be sent to user is created in web application.Web application and it's code is running/stored on remote server.

    So everytime when background task perform some request it will grab Token and send with request. web app validate that and give proper response. If token is expired web server will give a "expired" response to your task. So your task is going to receive response , if response is " expired " it will give notification to user to log in again so he could get new token or something like that.

     

    If there is no need for particular data to be accessed from users that are authenticated  you can just make a public route i explained that in the top of the post "www.mysite.com/api/customers <- this route is PUBLIC [ GET ] route. Anyone who visit this link will get list of all customers in your database in JSON format for example."

     

     

     

    You wrote post here saying " Encrypting a string or password is easy, harder is how you protect the key used for the encryption.  "

    In scenario that i tried to explain "key" used for encryption is on remote server, and nobody knows about it. SO that key will check against token that is sent via request.. 

     

    Also search for terms "Personal access token" it is used in almost any app

     

    • Like 1

  16. 1 hour ago, Darian Miller said:

    If hackers are in your memory space, the game is over anyway.

     

    If they are using plaintext now, the focus should be on encrypting the data at rest and ensuring it's protected in transit.  

     

     

    Some discussion about Delphi specific solutions: https://stackoverflow.com/questions/8621441/what-protection-scheme-for-my-passwords

     

    For securing strings in memory: https://medium.com/@svanas/creating-a-securestring-type-for-delphi-part-1-e7e78ed1807c

     

    The one and only way to do this is how i described .. what i told you is best practice and how it is done, there is no other way 

     

    "We use an config file to store the database connection string".  <- this is bad , security risk, it is unacceptable 

     

    "We are thinking about encrypting the connection string". <- this can be a "solution" but u will never be sure that you  are safe

    Is there any best practices to keep the connection string information safe?

     

    People can give you ideas and solutions how to encrypt string but you will still not be safe 100%..

     

    From what you told us about your application i can see that it is not that big and that u already have hosting for database. That said u can just put some php code there and make api .. U can even make api in delphi 

     

    • Thanks 1

  17. Hello, I was developing a mobile application for my school, I were using Delphi Rad Studio Rio 10.3.

    Here is brief description what application is doing: in some editboxes user adds data -> proceed to next tab 

    On second tab user is choosing video that he wants to preview, while video is playing he is clicking some buttons to mark duration of some activities on video that he loaded ...

    After that i am making a PDF report and saving to storage.

     

    I made whole application and it is working great, problem is that I used this library for slowing down video preview -> https://github.com/Zeus64/alcinoe  i had some issues with this library ( most of them were configuration issues ) but at the end I managed to resolve all of them and make my app.

     

    So why I used this library? Answer is that it had option to set speed preview of video. 

    Before I started using this library i was trying for a few days to implement this -> https://stackoverflow.com/questions/18526336/playback-video-in-slow-motion-in-android   check answer from " karanatwal.github.io "

     

    Problem was that I didnt know how to rewrite this android code into delphi FMX code :

     

    videoview = (VideoView)findViewById(R.id.videoview);
    videoview.setVideoURI("Your Video URI"); 
    videoview.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
                    @Override
                    public void onPrepared(MediaPlayer mp) {
                        //works only from api 23
                        PlaybackParams myPlayBackParams = new PlaybackParams();
                        myPlayBackParams.setSpeed(0.5f); //here set speed eg. 0.5 for slow 2 for fast mode
                        mp.setPlaybackParams(myPlayBackParams);
    
                        videoview.start();//start your video.
                    }
            });

    So now I would like to rebuild my application and exclude this " alcinoe " library cuz I use it only for setting playback speed.. 
    Can somebody help me rewriting this to a delphi code ? Thank you

     

     

    EDIT: I will later post code snippet of how i retrieve path of video and how i load it, code is not that great because it was one of my first projects but maybe it will help someone who reads this.


  18. 1 hour ago, Vandrovnik said:

    Hmm, and this API service will have to store password for the database somewhere... And his original application will have to store password for the API service somewhere, so now he has to store two passwords 🙂

    When he submit credentials ( for example email and user password) over post request to api server will validate credentials and if true server will return JSON token, that token will be stored on users phone. you can set token expiration time for example 30 min and that token will be valid only for that particular user for next 30 minutes... After retriving token you will be submitting that token for every future request and server will walidate it.. SO basically he is talking to web server, web server validate data and talks to DB. It is way more secure..  Password for DB is stored on web server and code logic for talking to DB is on web server so users dont know DB password or logic how web server communicated to DB

     

    Next security level that he could add is to ( if web app - web server  and DB are hosted on the same machine ) disable remote login, or if they are split to two different servers he can just allow his IP web server to talk and retrieve data from DB.. It is almost never good practice to talk directly to DB from almost any app ..


    Sry if i was offtopic

    • Thanks 1

  19. 7 hours ago, Serge_G said:

    Well don't be so afraid. I think you can use a TFrame (somewhere TFrame is like a style) for all that filling stuff. I think it was the Paul Toth approach. 

    I will try and see, i started yesterday developing my own design in Adobe XD so after that i will start coding :classic_cheerleader:


  20. 4 hours ago, Serge_G said:

    Hi,

    I never thought about including animation in a ListView but, why not 😉

    However my guess is TListView is not a good candidate for this sort of usage. Instead think about the ancestor, a TScrollBox.

    In my mind, this Jaques Nascimento video or videos from CodeRage2019 (Paul Thoth and Adriano Santos interventions)  

    Hello. Interesting approach using TScrollBox, i never used TScrollBox before but as I can see it is not that hard to get in touch with it..

     

    Let me elaborate more about what I would like to create and why I think that TlistView is my best choice..

     

    That animation gif that I showed u would be just one part of the application. It will represent a user list ( Part of a chat room that I will try to make with IndyTCP components ). In one field I plan to put username, image, join date and some other stuff.. SO when user joins chat room it animates like showed on picture and update list ( basically add that user ). Users can change usernames in real time, so server will push that change to other users and update their GUI.

     

    From my understandings if I try to make this with TScrollBox I should make Rectangle and other components inside it ( labels, images etc... ) and on user join I in runtime add  it to TScrollBox and display on GUI. I think that problem with this approach can occur because i would have to implement my own indexes for every field ( in TlistView for example you have OnItemClick procedure that is built in and that can figure out indexes behind the scenes for you ) also i think it will become buggy after adding like 1k rectangles with all the labels and images ( not tested that and I know that I wont have that much users just saying .. ) ... Short answer is that I am afraid to code that by myself because I am scared of making it crappy and inefficient but I guess it is the learning curve ...

     

    Links that you posted looks really nice, and I already see that I can learn a lot from them .. I thought that I watched every possible video related to delphi design on the youtube LOL but your links prove that I am wrong :classic_biggrin::classic_biggrin: I will watch them closely and try to pick best approach for my app :classic_cheerleader:

     


  21. Now look of the app looks way better if u ask me. I think that problem related to app look was because you have not designed it first in Adobe XD , Illustrator or Photoshop.

     

    Can you please tell me what and how did u used layout for components ? ScaledLayout or just simple layout ? Thank you for your time


  22. Hello members!

     

    I started learning delphi few months ago and recently i discovered that we can make really beautiful user interfaces with delphi FMX styles. 

     

    I saw on the internet this animation demo ( This is just a design ) and I wanted to implement it in delphi: https://thumbs.gfycat.com/ShamelessConfusedAmbushbug-mobile.mp4

     

    I was thinking to use ListView component in FMX for this with ItemApperance -> DynamicApperance.

    Everything was cool but i faced one problem. Problem is that I am not sure that TlistViewItem can perform animation when it is been added to the ListView.

     

    From my understandings i can only animate "Text1" and other items if i add them -> https://i.imgur.com/Y3SWIsT.jpg

    There is no option ( or I dont know how to find it ) To animate whole TListItemView when is added to a ListView.

     

    **WORKAROUND THAT I HAVE ON MY MIND**

    I was thinking to drop a ListBox and to add on it "TListBoxItem", after that i would right click it and Go on edit custom style, and try to make it look as i want.

    I tested this tutorial for editing the look of "TListBoxItem" and it is working nicely: https://www.experts-exchange.com/articles/10054/Implementing-a-ListView-in-Firemonkey.html

     

    For animation i planned to use this resources ( not tested, i dont know if it will work ) :

     

     

    So what is my question actually, well i would like to achieve similar design and effect from gif that i showed to you. I would like to use ListView with DynamicApperance. I would like to someone confirm me if that is possible and to give me some references or resource material where i could read more about it.. Also if there is someone who would like to give me a code example i would appreciate a lot.

     

    From my tests that i performed ( loop 1000 times, and add 1000 items on ListView and ListBox )  I can say that ListBox performed a lot slower so I would prefer ListView for this, also i think that using ListView here is better practice since ListView is more suitable for this situation based on this post: http://www.delphigroups.info/2/8f/544471.html

     

    At the end I just want to point out that im using FMX ONLY because i found it easier to make styles, this program is for Windows only platform. I am using Delphi Rio community ( Free version ). I would also like to add that option " Pull to refresh " that you see on that gif is not needed.

     

    Thank you for your answers and help! 🙂

     

     

×