Jump to content

pcplayer99

Members
  • Content Count

    93
  • Joined

  • Last visited

Posts posted by pcplayer99


  1. This topic is interesting. I'm from China, I have heard "OrangeUI" but I have not try it. For China, EU is a very important market for some products but software because of our poor English or other EU language of our programmers. I have viewed its web page, and it is absolute created by some programmer and they have no any business  experience, and have no web page aesthetics.


  2. I have tested 10.3 and I found in old Android, UI can not updates even if it is a simple test APP, no AdMob in it.

     

    I new a project in 10.3, just a TForm with a TButton and a TLabel and a TMemo. There just has two line in Button1Click:

     

    Label1.Text := 'aaa';

    Memo1.Lines.Add('bbbb');

     

    This test APP can work fine in my mobile with Android 8.

     

    But, in mobile OPPO find 7 with Android 5, mobile XiaoMi with Android4.4, a Android PAD with Android 4.4(CPU is AllWinner A33, RAM is 1G bytes), it can install, but when I touch the Button1, nothing happened on the screen.

    In debug mode, I place a break point at the code, touch the Button1, I can see IDE stopped at the break point, after I press F9, it continues run. And I touch the Button1 again, I can see IDE stopped at the break point again, it proved that the code is running, but nothing happened on the screen.

     

    The same APP  compiled with D10.2.1, it can works fine on all device I mentioned above.

     

    --------------------

     

    Now, I installed 10.3.1 EC version, and this issue is OK.

    • Like 1

  3. Hi,

     

    These code shows how to HASH signature by SHA1, but it is not show how to combine a signature string to HASH.

     

    I have not study Yahoo, but in MS Azure, it signature string is like:

     

    GET
    x-ms-date:Wed, 30 Jan 2019 15:12:26 GMT
    x-ms-version:2015-02-21
    /devstoreaccount1/devstoreaccount1/pcplayer1
    comp:list
    restype:container
    timeout:30
     
    And MS said that between every line, there is a LF(#10 or $A) but no Return(#13 or $D) char.
    So, you must know how Yahoo's signature string create.


  4. Hi,

     

    These days I'm studying MS Azure. And I have used Delphi TAzureBlobService to access Azure, and its signature result can not accepted by Azure. To access Azure, it is by REST.

     

    I found that Azure returned some error message through HTTP, in the error message, Azure said: Server used following string to sign xxxxx xxxx。

     

    So, I use the string of the error message tell me to be a template, to create my signature string, and use the method from TAzureBlobService  to calculate the signature. It works!

     

    BTW. Azure's signature is calculate by SHA2:  THashSHA2.GetHMACAsBytes(StringToSign, Signkey, THashSHA2.TSHA2Version.SHA256);

     

    So, you may need to read Yahoo's information that its structure of signature string, and what calculation it use.


  5. I found where the problem is.

     

    I write a MappedPort program by using TIdMappedPortTCP and record any access bytes through it. This MappedPort program forward all access to my Azure emulator.

    And I setup TAzureBlobService to access this mappedPort program. So I can see the http content it send to Azure. And I got:  Authorization: SharedKey devstoreaccount1:1OhravTUJ9HaYtwSrpAZnWH+NklYbr0EBllG9zyKNLU=

     

    It is no problem here.

     

    I setup a break point in TCloudAuthentication.BuildAuthorizationString, step by step to check "StringToSign" and I got:

    [

    GET
    x-ms-date:Sat, 02 Feb 2019 03:36:19 GMT
    x-ms-version:2015-02-21
    /devstoreaccount1/pcplayer1
    comp:list
    restype:container
    timeout:30'

    ]

     

    but, the error message from Azure emulator shows:

    Server used following string to sign: 'GET

    x-ms-date:Thu, 31 Jan 2019 02:47:18 GMT
    x-ms-version:2015-02-21
    /devstoreaccount1/devstoreaccount1/pcplayer1
    comp:list
    restype:container
    timeout:30

     

    there is some different:  /devstoreaccount1/pcplayer1  and /devstoreaccount1/devstoreaccount1/pcplayer1

     

    So, I use the sinString the error message the Azure emulator tell me as template, I write code myself to create my own HTTP content and send it by TIdTcpClient,and my Azure emulator accept it! It works fine.

     

    Another problem is: TAzureBlobService can not support Azure's SAS mode, it just support shared key mode.


  6. Hello,

     

    Delphi 10.3 community edition.

     

    I have tested use TAzureBlobService to access Azure emulator in my computer. And I get error response:

     

    <?xml version="1.0" encoding="utf-8"?><Error><Code>AuthenticationFailed</Code><Message>Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
    RequestId:2e648c39-3ae5-4ff1-aef8-325878f77965
    Time:2019-01-31T03:17:34.6280300Z</Message><AuthenticationErrorDetail>The MAC signature found in the HTTP request 'VRtiV8kOIdM0mdLAaMCmw3EbMhxvyA8D+Clxie739VU=' is not the same as any computed signature. Server used following string to sign: 'GET

    x-ms-date:Thu, 31 Jan 2019 03:17:34 GMT
    /devstoreaccount1/devstoreaccount1/pcplayer1?comp=list'.</AuthenticationErrorDetail></Error>

     

    and I searched on WEB, found two posts like this error:

     

    1. https://www.delphipraxis.net/197152-tazureblobservice-geht-nicht-mit-android.html

    2. https://forums.embarcadero.com/thread.jspa?threadID=218127

     

    So, is it a bug of Delphi TAzureBlobService ?

     

    I make a MappedPort program to emulator a proxy by using TIdMappedPortTCP add a TIdLogFile to log all access to Azure.

    I use Microsoft Azure Storage Explorer to access my Azure emulator, log it:

     

    Recv 2019/1/31 9:30:50: GET /devstoreaccount1/?comp=properties&restype=service&_=1548898250197 HTTP/1.1
    x-ms-client-request-id: d7774230-24f7-11e9-8121-d92073b6b410
    user-agent: Microsoft Azure Storage Explorer, 1.6.2, win32, Azure-Storage/2.10.0 (NODE-VERSION v8.9.3; Windows_NT 10.0.17134)
    x-ms-version: 2018-03-28
    x-ms-date: Thu, 31 Jan 2019 01:30:50 GMT
    accept: application/atom+xml,application/xml
    Accept-Charset: UTF-8
    content-type: 
    content-length: 0
    authorization: SharedKey devstoreaccount1:AzOgFuwIyAjaMky5nllpbLF3ihtgyoDJCNn1EZwubEc=
    host: 192.168.8.5:801
    Connection: keep-alive


    Sent 2019/1/31 9:30:50: HTTP/1.1 200 OK
    Transfer-Encoding: chunked
    Content-Type: application/xml
    Server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
    x-ms-request-id: dbf72dc0-ceb8-43a3-8758-72bbe10fee00
    x-ms-version: 2018-03-28
    Date: Thu, 31 Jan 2019 01:30:50 GMT

    212
    <?xml version="1.0" encoding="utf-8"?><StorageServiceProperties><Logging><Version>1.0</Version><Read>false</Read><Write>false</Write><Delete>false</Delete><RetentionPolicy><Enabled>false</Enabled></RetentionPolicy></Logging><HourMetrics><Version>1.0</Version><Enabled>false</Enabled><RetentionPolicy><Enabled>false</Enabled></RetentionPolicy></HourMetrics><MinuteMetrics><Version>1.0</Version><Enabled>false</Enabled><RetentionPolicy><Enabled>false</Enabled></RetentionPolicy></MinuteMetrics><Cors /></StorageServiceProperties>

    Sent 2019/1/31 9:30:50: 0


    Recv 2019/1/31 9:30:50: GET /devstoreaccount1/pcplayer1?restype=container&comp=acl&_=1548898250786 HTTP/1.1
    x-ms-client-request-id: d7d0faf0-24f7-11e9-8121-d92073b6b410
    user-agent: Microsoft Azure Storage Explorer, 1.6.2, win32, Azure-Storage/2.10.0 (NODE-VERSION v8.9.3; Windows_NT 10.0.17134)
    x-ms-version: 2018-03-28
    x-ms-date: Thu, 31 Jan 2019 01:30:50 GMT
    accept: application/atom+xml,application/xml
    Accept-Charset: UTF-8
    content-type: 
    content-length: 0
    authorization: SharedKey devstoreaccount1:o3/xHdDlKczItY778kXx22ph9HWGwj4hJRDdzYze5u0=
    host: 192.168.8.5:801
    Connection: keep-alive


    Sent 2019/1/31 9:30:50: HTTP/1.1 200 OK
    Transfer-Encoding: chunked
    Content-Type: application/xml
    Last-Modified: Wed, 30 Jan 2019 14:41:03 GMT
    ETag: "0x8D686C0F58A53B0"
    Server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
    x-ms-request-id: e0991d7a-7682-47d9-afe5-d00e6b9b5e91
    x-ms-version: 2018-03-28
    x-ms-blob-public-access: container
    Date: Thu, 31 Jan 2019 01:30:50 GMT

    3E
    <?xml version="1.0" encoding="utf-8"?><SignedIdentifiers />

    Sent 2019/1/31 9:30:50: 0


    Recv 2019/1/31 9:30:52: HEAD /devstoreaccount1/pcplayer1?restype=container&_=1548898251862 HTTP/1.1
    x-ms-client-request-id: d8752a30-24f7-11e9-8121-d92073b6b410
    user-agent: Microsoft Azure Storage Explorer, 1.6.2, win32, Azure-Storage/2.10.0 (NODE-VERSION v8.9.3; Windows_NT 10.0.17134)
    x-ms-version: 2018-03-28
    x-ms-date: Thu, 31 Jan 2019 01:30:51 GMT
    accept: application/atom+xml,application/xml
    Accept-Charset: UTF-8
    content-type: 
    content-length: 0
    authorization: SharedKey devstoreaccount1:KXbz/5+aW2BA2+YIlLxJKT0+kG8tW/L3yghB8ju+CLI=
    host: 192.168.8.5:801
    Connection: keep-alive


    Sent 2019/1/31 9:30:52: HTTP/1.1 200 OK
    Transfer-Encoding: chunked
    Last-Modified: Wed, 30 Jan 2019 14:41:03 GMT
    ETag: "0x8D686C0F58A53B0"
    Server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
    x-ms-request-id: 46d2e105-0584-4832-8d28-090a6cb4a583
    x-ms-version: 2018-03-28
    x-ms-lease-status: unlocked
    x-ms-lease-state: available
    x-ms-blob-public-access: container
    Date: Thu, 31 Jan 2019 01:30:52 GMT


    Recv 2019/1/31 9:30:53: GET /devstoreaccount1/pcplayertest?restype=container&comp=acl&_=1548898252875 HTTP/1.1
    x-ms-client-request-id: d8752a33-24f7-11e9-8121-d92073b6b410
    user-agent: Microsoft Azure Storage Explorer, 1.6.2, win32, Azure-Storage/2.10.0 (NODE-VERSION v8.9.3; Windows_NT 10.0.17134)
    x-ms-version: 2018-03-28
    x-ms-date: Thu, 31 Jan 2019 01:30:52 GMT
    accept: application/atom+xml,application/xml
    Accept-Charset: UTF-8
    content-type: 
    content-length: 0
    authorization: SharedKey devstoreaccount1:LsU8wpcHSisV8q7E2+SJruQTGu+Z/8fZdzN4t9QtN1o=
    host: 192.168.8.5:801
    Connection: keep-alive


    Sent 2019/1/31 9:30:53: HTTP/1.1 200 OK
    Transfer-Encoding: chunked
    Content-Type: application/xml
    Last-Modified: Mon, 28 Jan 2019 13:15:01 GMT
    ETag: "0x8D685229BE2FAF0"
    Server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
    x-ms-request-id: aea17fb0-c8d9-4597-942b-18ee7ab499d1
    x-ms-version: 2018-03-28
    Date: Thu, 31 Jan 2019 01:30:53 GMT

    3E
    <?xml version="1.0" encoding="utf-8"?><SignedIdentifiers />

    Sent 2019/1/31 9:30:53: 0


    and my Delphi program that use TAzureBlobService access my emulator log is:

    Recv 2019/1/31 10:49:07: GET /devstoreaccount1/pcplayer1?restype=container&comp=list&timeout=30 HTTP/1.1
    Connection: Keep-Alive
    Authorization: SharedKey devstoreaccount1:MX5XX4cHbVB7/f/+1dkpj9pZ7O49K4CEbFUcEfv6N/o=
    User-Agent: Embarcadero URI Client/1.0
    x-ms-date: Thu, 31 Jan 2019 02:47:18 GMT
    x-ms-version: 2015-02-21
    Host: 192.168.8.5:801


    Sent 2019/1/31 10:49:07: HTTP/1.1 403 Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
    Content-Length: 712
    Content-Type: application/xml
    Server: Microsoft-HTTPAPI/2.0
    x-ms-request-id: 28db5ef4-6107-471c-b28f-4eb85cf0a808
    Date: Thu, 31 Jan 2019 02:49:07 GMT

    <?xml version="1.0" encoding="utf-8"?><Error><Code>AuthenticationFailed</Code><Message>Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
    RequestId:28db5ef4-6107-471c-b28f-4eb85cf0a808
    Time:2019-01-31T02:49:07.4405300Z</Message><AuthenticationErrorDetail>The MAC signature found in the HTTP request 'MX5XX4cHbVB7/f/+1dkpj9pZ7O49K4CEbFUcEfv6N/o=' is not the same as any computed signature. Server used following string to sign: 'GET

    x-ms-date:Thu, 31 Jan 2019 02:47:18 GMT
    x-ms-version:2015-02-21
    /devstoreaccount1/devstoreaccount1/pcplayer1
    comp:list
    restype:container
    timeout:30'.</AuthenticationErrorDetail></Error>

     

    So,  it like TAzureBlobService do a wrong calculation about the signature.

     


  7. there are some problems in UPNP with cross platform.

     

    1. UPNP is a network protocol, a device that supported UPNP is monitoring at UDP port 1900. We can implement it by using TIdUDPServer.

     

    2. But, Windows system implement UPNP device, so, system has used UDP port 1900, our code can not open UDP port 1900. On windows, we must call windows API to use UPNP.

     

    3. In other system like Android, iOS, maybe we can implement UPNP protocol by using Indy.

    • Like 1

  8. I agree with Erix A. Settings or parameters should be stored in a file, not in registry. A. in developing time maybe you will modify your settings by hand and modify registry is so trouble. B. If you release your APP, maybe user want modify settings manually not by using your APP UI, modify a file is more easy.

     

    And if you want to separate your logic code and UI, you should use object. In this object your code can settings from file or save to file, and other module in your APP like UI module needs this settings data, just access this object. So this settings module is a independent module for other modules reuse it.

     

    What kind of file for store your settings data? A ini file,  TIniFile can access it. Or you can  serialize your settings object to JSON or XML strings and save it into a file, etc. And you can store your settings into a SQLite database file.

     

    Settings should be strings that human can read, should not be binary, cause sometimes man want to modify some parameters by hand.

     

    I prefer using TStringList to read and write parameters, cause TStringList has three functions:

    1. It can work as Key=Value mode.

    2. It support SaveToFile and LoadFromFile.

     

    Your object which maintain setting parameters and your UI can interact by DataBinding mechanism of Delphi then you do not write code to synchronize UI and parameters object, and object with file.

    • Thanks 1

  9. UniGUI is a good solution. IntraWeb also a good solution.

     

    But because these two of frameworks have package server side code and front end UI code together, you lost some degree of freedom. If you want some function it has not achieved, you can hardly insert some code in it by yourself.

     

    So, in Delphi, you can use WebBroker framework,and with some front end framework such as BootStrap, jQuery, etc. It is very simple solution if you familiar with Delphi, but you must familiar with some front end framework.

     

    I'm not a expert of front end, yet I'm not familiar with BootStrap, but I have use WebBroker and BootStrap to implement a simple WEB app just like a simple WordPress, its database is FireBird.

     

    To use WebBroker and BootStrap,you can separate server side code by delphi and client side code by HTML and JavaScript, and client side codes can put into a text file out of your Delphi code, so you can update your WEB UI by no need to rebuild your delphi code.


  10.  

    I have tested five device:

     

    1. A PAD with Android 4.4;

    2. Mobile XiaoMi with Android 4.4.

    3. Mobile OPPO Find7 with Android 5.0

    4. Mobile VIVO with Android 8.0

    5. Mobile HuaWei with Android 8.0

     

    test APP by 10.2 is work fine on all above device.

    by 10.3, just can work fine in two Android 8.0 device.

     

    On device 1, 10.3 just show a black screen.

    On device 2,3,4, 10.3 can show form but can not update UI when I click the button to run code Label1.Text := 'aaaa';

     


  11. I have tested 10.3 and I found in old Android, UI can not updates even if it is a simple test APP, no AdMob in it.

     

    I new a project in 10.3, just a TForm with a TButton and a TLabel and a TMemo. There just has two line in Button1Click:

     

    Label1.Text := 'aaa';

    Memo1.Lines.Add('bbbb');

     

    This test APP can work fine in my mobile with Android 8.

     

    But, in mobile OPPO find 7 with Android 5, mobile XiaoMi with Android4.4, a Android PAD with Android 4.4(CPU is AllWinner A33, RAM is 1G bytes), it can install, but when I touch the Button1, nothing happened on the screen.

    In debug mode, I place a break point at the code, touch the Button1, I can see IDE stopped at the break point, after I press F9, it continues run. And I touch the Button1 again, I can see IDE stopped at the break point again, it proved that the code is running, but nothing happened on the screen.

     

    The same APP  compiled with D10.2.1, it can works fine on all device I mentioned above.

     

    So, Yaron, have you tested a simple APP without AdMob in your Android5 or Android4.4 device?


  12. Target: Android, in Deployment windows, if you add your file to remote path: .\assets\internal\, in delphi, you can access it at TPath.GetDocumentsPath.

     

    if you have a big number of picture, I suggest you should store it in a SQLite database. When you release you APP, release one file is better than many many files.

×